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 CRUISE_VARS_H
24 #define CRUISE_VARS_H
25 
26 #include "common/file.h"
27 
28 namespace Cruise {
29 
30 #define NBCOLORS 256
31 #define NBSCREENS 8
32 
33 struct menuElementSubStruct {
34 	struct menuElementSubStruct *pNext;
35 	int16 ovlIdx;
36 	int16 header;
37 };
38 
39 struct menuElementStruct {
40 	struct menuElementStruct *next;
41 	const char *string;
42 	int x;
43 	int y;
44 	int varA;
45 	bool selected;
46 	unsigned char color;
47 	gfxEntryStruct *gfx;
48 	menuElementSubStruct *ptrSub;
49 };
50 
51 typedef int32(*opcodeTypeFunction)();
52 typedef int16(*opcodeFunction)();
53 
54 extern uint8 *_systemFNT;
55 extern int16 fontFileIndex;
56 
57 extern uint8 itemColor;
58 extern uint8 selectColor;
59 extern uint8 titleColor;
60 extern uint8 subColor;
61 
62 extern int16 scroll;
63 extern int16 switchPal;
64 extern char cmdLine[90];
65 
66 extern int16 masterScreen;
67 extern int16 doFade;
68 extern int16 fadeFlag;
69 
70 struct preloadStruct {
71 	char name[15];
72 	int32 size;
73 	int32 sourceSize;
74 	uint8 *ptr;
75 	int16 nofree;
76 	int16 protect;
77 	int16 ovl;
78 };
79 
80 struct filesData2Struct {
81 	int16 field_0;
82 	int16 field_2;
83 };
84 
85 struct dataFileName {
86 	char name[13];
87 };
88 
89 struct setHeaderEntry {
90 	int32 offset;		// offset ptr
91 	int16 width;
92 	int16 height;
93 	int16 type;		// resource type, ie. sprites 0,1,4,5 and 8
94 	int16 transparency;
95 	int16 hotspotY;
96 	int16 hotspotX;
97 };
98 
99 struct volumeDataStruct {
100 	char ident[10];
101 	dataFileName *ptr;
102 	int16 diskNumber;
103 	int32 size;
104 };
105 
106 struct fileEntry {
107 	char name[14];
108 	int32 offset;
109 	int32 size;
110 	int32 extSize;
111 	int32 unk3;		// unused
112 };
113 
114 struct dataFileEntrySub {
115 	uint8 *ptr;
116 	int16 index;		// sprite index
117 	char name[13];
118 	int16 transparency;	// sprite transparency
119 	uint8 *ptrMask;
120 	uint8 resourceType;	// sprite and image type 2,4,8 , fnt = 7, spl = 6
121 	int16 compression;
122 };
123 
124 struct dataFileEntry {
125 	uint16 widthInColumn;
126 	uint16 width;
127 	uint16 resType;
128 	uint16 height;
129 	dataFileEntrySub subData;
130 };
131 
132 struct SoundEntry {
133 	int16 frameNum;
134 	uint16 frequency;
135 	int16 volume;
136 };
137 
138 /*
139 struct systemStringsStruct {
140 	int8 param;
141 	char string[12];
142 	char bootScriptName[8];
143 };
144 */
145 extern preloadStruct preloadData[64];
146 
147 extern volumeDataStruct volumeData[20];
148 
149 extern int32 volumeDataLoaded;
150 
151 extern int16 numOfDisks;
152 
153 extern char lastOverlay[38];
154 extern char nextOverlay[38];
155 
156 extern int16 currentActiveMenu;
157 extern int16 autoMsg;
158 extern menuElementSubStruct* linkedRelation;
159 extern bool userWait;
160 extern int16 autoTrack;
161 
162 extern int16 currentDiskNumber;
163 
164 extern int16 volumeNumEntry;
165 extern fileEntry *volumePtrToFileDescriptor;
166 
167 extern uint32 volumeFileDescriptorSize;
168 extern int16 volumeSizeOfEntry;
169 extern int16 volumeNumberOfEntry;
170 
171 extern int16 displayOn;
172 
173 extern int16 protectionCode;
174 
175 #define NUM_FILE_ENTRIES 257
176 
177 extern int16 globalVars[2000];
178 extern dataFileEntry filesDatabase[NUM_FILE_ENTRIES];
179 
180 extern int16 bootOverlayNumber;
181 
182 extern SoundEntry soundList[4];
183 
184 extern opcodeTypeFunction opcodeTypeTable[64];
185 
186 extern int16 positionInStack;
187 extern actorStruct actorHead;
188 
189 extern int16 stateID;
190 extern int16 xdial;
191 
192 extern uint8 *currentData3DataPtr;
193 extern uint8 *scriptDataPtrTable[7];
194 
195 extern int16 currentScriptOpcodeType;
196 
197 extern int16 saveOpcodeVar;
198 
199 extern int16 narratorOvl;
200 extern int16 narratorIdx;
201 
202 extern int16 songLoaded;
203 extern int16 songPlayed;
204 extern int16 songLoop;
205 extern int16 activeMouse;
206 extern int16 userEnabled;
207 extern int16 var5;
208 extern int16 dialogueEnabled;
209 extern int16 dialogueOvl;
210 extern int16 dialogueObj;
211 extern int16 userDelay;
212 extern int16 sysKey;
213 extern int16 sysX;
214 extern int16 sysY;
215 extern int16 automoveInc;
216 extern int16 automoveMax;
217 extern int16 isMessage;
218 extern int16 automaticMode;
219 extern int16 aniX;
220 extern int16 aniY;
221 extern bool animationStart;
222 
223 extern int16 autoOvl;
224 extern int16 var39;
225 extern int16 playerMenuEnabled;
226 extern int16 var39;
227 extern int16 var41;
228 extern int16 var42;
229 extern int16 var45;
230 extern int16 var46;
231 extern int16 var47;
232 extern int16 var48;
233 extern int16 flagCt;
234 
235 extern uint8 newPal[NBCOLORS*3];
236 extern uint8 workpal[NBCOLORS*3];
237 extern uint8 palScreen[NBSCREENS][NBCOLORS*3];
238 
239 //extern systemStringsStruct systemStrings;
240 
241 extern char currentCtpName[40];
242 
243 extern int16 saveVar1;
244 extern uint8 saveVar2[97];	// recheck size
245 
246 extern int16 numberOfWalkboxes;	// saveVar3
247 extern int16 walkboxColor[15];	// saveVar4     // Type: 0x00 - non walkable, 0x01 - walkable, 0x02 - exit zone
248 extern int16 walkboxState[15];	// saveVar5 // walkbox can change its type: 0x00 - not changeable, 0x01 - changeable
249 // Assumption: To change the type: walkboxColor[i] -= walkboxChane[i] and vice versa
250 extern uint8 lastAni[16];
251 
252 extern int32 loadFileVar1;
253 
254 extern int16 loadCtFromSave;
255 extern int16 ctp_routeCoordCount;	// ctpVar2  // number of path-finding coordinates
256 extern int16 ctp_routeCoords[20][2];	// ctpVar3      // path-finding coordinates array
257 
258 /* ctp_routeCoords:
259 
260 	correct size would be: ctp_routes[routeCoordCount * 4]
261 	coordinate information with x (2 bytes) and y (2 bytes)
262 */
263 
264 extern int16 ctp_routes[20][10];	// path-finding line information
265 
266 /* ctp_routes:
267 
268    correct size would be: ctp_routes[routeCoordCount * 20 * 2]
269    array is seperate in 20 * 2 bytes slices.
270    first 2 bytes of the slice indicate how many coordinates/lines are following (lineCount)
271    after that there are lineCount * 2 bytes following with indexes pointing on the routeCoords table
272    the root x,y for the lines is the coordinate in the routeCoords array, which fits to the current slice
273    for the 20 * i slice the root x,y is routeCoords[i], routeCoords[i+2]
274    the unused rest of the slice if filled up with 0xFF
275 */
276 extern int16 ctp_walkboxTable[15][40];	// ctpVar5      // walkboxes coordinates and lines
277 extern int16 walkboxColorIndex[16];
278 extern int16 walkboxZoom[15];	// ctpVar7  // scaling information for walkboxes
279 extern int16 distanceTable[20][10];
280 
281 extern int16 flagSpeed;
282 extern int16 speedGame;
283 extern int16 oldSpeedGame;
284 
285 extern uint8 globalScreen[320 * 200];
286 
287 //extern OSystem *osystem;
288 
289 } // End of namespace Cruise
290 
291 #endif
292