1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef SKY_COMPACT_H
24 #define SKY_COMPACT_H
25 
26 #include "sky/sky.h"
27 #include "sky/struc.h"
28 #include "sky/skydefs.h"
29 
30 namespace Common {
31 class File;
32 }
33 
34 enum CptIds {
35 	CPT_JOEY = 1,
36 	CPT_FOSTER = 3,
37 	CPT_TEXT_1 = 0x17,
38 	CPT_TEXT_11 = 0x21,
39 	CPT_MENU_BAR = 0x2E,
40 	CPT_REICH_DOOR_20 = 0x30AB,
41 	CPT_MOVE_LIST = 0xBD,
42 	CPT_TALK_TABLE_LIST = 0xBC
43 };
44 
45 enum CptTypeIds {
46 	CPT_NULL = 0,
47 	COMPACT,
48 	TURNTAB,
49 	ANIMSEQ,
50 	MISCBIN,
51 	GETTOTAB,
52 	ROUTEBUF,
53 	MAINLIST,
54 	NUM_CPT_TYPES
55 };
56 
57 namespace Sky {
58 
59 class SkyCompact {
60 public:
61 	SkyCompact();
62 	~SkyCompact();
63 	Compact *fetchCpt(uint16 cptId);
64 	Compact *fetchCptInfo(uint16 cptId, uint16 *elems = NULL, uint16 *type = NULL, char *name = NULL);
65 	static uint16 getSub(Compact *cpt, uint16 mode);
66 	static void setSub(Compact *cpt, uint16 mode, uint16 value);
67 	static MegaSet *getMegaSet(Compact *cpt);
68 	uint16 *getGrafixPtr(Compact *cpt);
69 	uint16 *getTurnTable(Compact *cpt, uint16 dir);
70 	void *getCompactElem(Compact *cpt, uint16 off);
71 	bool cptIsId(Compact *cpt, uint16 id);
72 	uint8	*createResetData(uint16 gameVersion);
73 	uint16	_numSaveIds;
74 	uint16	*_saveIds;
75 	// - debugging functions
76 	uint16 findCptId(void *cpt);
77 	uint16 findCptId(const char *cptName);
78 	uint16 giveNumDataLists();
79 	uint16 giveDataListLen(uint16 listNum);
80 	const char *nameForType(uint16 type);
81 private:
82 	void checkAndFixOfficerBluntError();
83 
84 	uint16  _numDataLists;
85 	uint16  *_dataListLen;
86 	uint16  *_rawBuf;
87 	char	*_asciiBuf;
88 	Compact ***_compacts;
89 	char    ***_cptNames;
90 	uint16	**_cptSizes;
91 	uint16  **_cptTypes;
92 	Common::File	*_cptFile;
93 	uint32	_resetDataPos;
94 	static const char *const _typeNames[NUM_CPT_TYPES];
95 };
96 
97 } // End of namespace Sky
98 
99 #endif
100