aboutsummaryrefslogtreecommitdiff
path: root/engines/hopkins/globals.h
blob: 9c730bb1dac7fe0d9759a27d04ce0151bb33e7c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

#ifndef HOPKINS_GLOBALS_H
#define HOPKINS_GLOBALS_H

#include "common/scummsys.h"
#include "common/str.h"
#include "common/events.h"

namespace Hopkins {

struct ZonePItem {
	int _destX;
	int _destY;
	int _spriteIndex;
	int field6;
	int field7;
	int field8;
	int field9;
	int fieldA;
	int fieldB;
	int fieldC;
	int fieldD;
	int fieldE;
	int fieldF;
	bool _enabledFl;
	int field12;
};

struct BqeAnimItem {
	byte *_data;
	bool _enabledFl;
};

struct BankItem {
	byte *_data;
	bool _loadedFl;
	Common::String _filename;
	int _fileHeader;
	int _objDataIdx;
};

struct ListeItem {
	bool _visibleFl;
	int _posX;
	int _posY;
	int _width;
	int _height;
};

struct BobItem {
	int field0;
	byte *_spriteData;
	int _xp;
	int _yp;
	int _frameIndex;
	int _animDataIdx;
	int field12;
	int field14;
	bool _disabledAnimationFl;
	byte *_animData;
	bool field1C;
	int field1E;
	int field20;
	int field22;
	int _offsetY; // Unused variable?
	bool field34; // Set to true in B_CACHE_OFF()
	int _zoomFactor;
	bool _flipFl;
	bool _isSpriteFl;
	bool _activeFl;
	int _oldX;
	int _oldY;
	int _oldWidth;
	int _oldHeight;
	int _oldX2;
	int _zooInmFactor;
	int _zoomOutFactor;
};

struct LockAnimItem {
	bool _enableFl;
	int _posX;
};

struct VBobItem {
	byte *_spriteData;
	int field4;
	int _xp;
	int _yp;
	int _frameIndex;
	byte *_surface;
	int _oldX;
	int _oldY;
	int _oldFrameIndex;
	byte *_oldSpriteData;
};

struct ObjetWItem {
	byte field0;
	byte _idx;
	byte field2;
	byte field3;
	byte field4;
	byte field5;
	byte field6;
	byte field7;
};

/**
 * Mode for SortItem records
 */
enum SortMode { SORT_NONE = 0, SORT_BOB = 1, SORT_SPRITE = 2, SORT_CACHE = 3 };

/**
 * Structure to represent a pending display of either a Bob, Sprite, or Cache Item.
 */
struct SortItem {
	SortMode _sortMode;
	int _index;
	int _priority;
};

struct CacheItem {
	int _x;
	int _spriteIndex;
	int _y;
	int _width;
	int _height;
	int _useCount;
	byte *_spriteData;
	bool field10;
	int field14;
};

struct HopkinsItem {
	int field0;
	int field2;
};

struct CharacterLocation {
	Common::Point _pos;
	int _startSpriteIndex;
	int _location;
	int _zoomFactor;
};

enum SauvegardeOffset {
	svField1 = 1
	, svField2 = 2
	, svField3 = 3
	, svField4 = 4
	, svField5 = 5
	, svField6 = 6
	, svField8 = 8
	, svField9 = 9
	, svField10 = 10
	, svField13 = 13
	, svField80 = 80
	, svField94 = 94
	, svField95 = 95
	, svField113 = 113
	, svField117 = 117
	, svField121 = 121
	, svField122 = 122
	, svField123 = 123
	, svField132 = 132
	, svField133 = 133
	, svField135 = 135
	, svField166 = 166
	, svField167 = 167
	, svField170 = 170
	, svField171 = 171
	, svField172 = 172
	, svField173 = 173
	, svField176 = 176
	, svField177 = 177
	, svField180 = 180
	, svField181 = 181
	, svField182 = 182
	, svField183 = 183
	, svField184 = 184
	, svField185 = 185
	, svField186 = 186
	, svField187 = 187
	, svField188 = 188
	, svField189 = 189
	, svField190 = 190
	, svField191 = 191
	, svField192 = 192
	, svField193 = 193
	, svField194 = 194
	, svField220 = 220
	, svField225 = 225
	, svField228 = 228
	, svField231 = 231
	, svField253 = 253
	, svField261 = 261
	, svField270 = 270
	, svField300 = 300
	, svField311 = 311
	, svField312 = 312
	, svField318 = 318
	, svField320 = 320
	, svField330 = 330
	, svField333 = 333
	, svField338 = 338
	, svField339 = 339
	, svField340 = 340
	, svField341 = 341
	, svField349 = 349
	, svField352 = 352
	, svField353 = 353
	, svField354 = 354
	, svField355 = 355
	, svField356 = 356
	, svField357 = 357
	, svField399 = 399
	, svField401 = 401
};

enum PlayerCharacter { CHARACTER_HOPKINS = 0, CHARACTER_HOPKINS_CLONE = 1, CHARACTER_SAMANTHA = 2 };

// TODO: Sauvegrade1 fields should really be mapped into data array
struct Sauvegarde {
	byte _data[2050];
	CharacterLocation _cloneHopkins;
	CharacterLocation _realHopkins;
	CharacterLocation _samantha;
	int16 _inventory[35];	// Originally at offset 1300 of data array
	int16 _mapCarPosX;
	int16 _mapCarPosY;
};

struct CreditItem {
	bool _actvFl;
	int _colour;
	int _linePosY;
	int _lineSize;
	byte _line[50];
};

enum Language { LANG_EN = 0, LANG_FR = 1, LANG_SP = 2};

class HopkinsEngine;

/**
 * Engine Globals
 */
class Globals {
private:
	HopkinsEngine *_vm;

	byte *_inventoryObject;

	void INIT_ANIM();
	void INIT_VBOB();
	void B_CACHE_OFF(int idx);

public:
	bool _disableInventFl;
	bool _cityMapEnabledFl;
	bool _linuxEndDemoFl;
	bool _censorshipFl;
	bool _introSpeechOffFl;
	bool _cacheFl;
	bool _forceHideText;
	int _exitId;
	int _oceanDirection;
	int _oldDirection, _oldDirectionSpriteIdx;
	int _actionDirection;
	int _lastDirection;
	int _oldFrameIndex;
	int _hotspotTextColor;
	int _inventory[36];
	int _objectWidth, _objectHeight;
	int _screenId;
	int _prevScreenId;
	int _boxWidth;
	int _characterMaxPosY;
	int _baseMapColor;
	int _spriteSize[500];
	int _sortedDisplayCount;
	int _oldMouseZoneId;
	int _oldMouseX, _oldMouseY;
	uint _speed;
	byte *_answerBuffer;
	Sauvegarde *_saveData;
	Language _language;
	HopkinsItem Hopkins[70];
	BobItem _bob[36];
	SortItem _sortedDisplay[51];

	CreditItem _creditsItem[200];
	int _creditsLineNumb;
	int _creditsStep;
	int _creditsPosY;
	int Credit_bx;
	int Credit_bx1;
	int Credit_by;
	int Credit_by1;

	int _menuSpeed;
	int _menuSoundOff;
	int _menuTextOff;
	int _menuVoiceOff;
	int _menuMusicOff;
	int _menuDisplayType;
	int _menuScrollSpeed;

	byte *_optionDialogSpr;
	bool _optionDialogFl;
	uint32 _catalogPos;
	uint32 _catalogSize;
	LockAnimItem _lockedAnims[30];
	int _oldRouteFromX;
	int _oldRouteFromY;
	int _oldRouteDestX;
	int _oldRouteDestY;
	int _oldZoneNum;

	byte *TETE;
	byte *ICONE;
	bool NOMARCHE;
	int iRegul;
	byte *BUF_ZONE;
	int nbrligne; // Useless variable?
	BqeAnimItem Bqe_Anim[35];
	byte *SPRITE_ECRAN;
	byte *PERSO;
	int PERSO_TYPE;
	int BOBZONE[105];
	bool BOBZONE_FLAG[105];
	bool NOT_VERIF;
	ZonePItem ZONEP[106];
	ObjetWItem ObjetW[300];
	int NUM_FICHIER_OBJ;
	byte *ADR_FICHIER_OBJ;
	ListeItem Liste[6];
	ListeItem Liste2[35];
	BankItem Bank[8];
	byte *CACHE_BANQUE[6];
	CacheItem Cache[25];
	VBobItem VBob[30];
	int Compteur;
	int compteur_71;
	Common::String FICH_ZONE;
	bool GOACTION;
	int j_104;
	int GESTE_FLAG;
	byte *GESTE;
	Common::String FICH_TEXTE;

	Globals();
	~Globals();
	void setParent(HopkinsEngine *vm);
	byte *allocMemory(int count);
	byte *freeMemory(byte *p);
	void setConfig();
	void loadObjects();
	void clearAll();
	void loadCharacterData();
	void resetCache();
	void loadCache(const Common::String &file);

	void CLEAR_VBOB();
	void CACHE_ON();
	void CACHE_OFF(int v1 = 0);
	void CACHE_SUB(int idx);
	void CACHE_ADD(int idx);
};

// Global null pointer
extern byte *g_PTRNUL;

} // End of namespace Hopkins

#endif /* HOPKINS_GLOBALS_H */