ScummVM API documentation
globals.h
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 modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (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, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef HOPKINS_GLOBALS_H
23 #define HOPKINS_GLOBALS_H
24 
25 #include "common/scummsys.h"
26 #include "common/str.h"
27 #include "common/util.h"
28 #include "common/events.h"
29 
30 namespace Hopkins {
31 
32 struct HopkinsItem {
33  int _speedX;
34  int _speedY;
35 };
36 
38  Common::Point _pos;
39  int _startSpriteIndex;
40  int _location;
41  int _zoomFactor;
42 
43  void reset() {
44  _pos.x = 0;
45  _pos.y = 0;
46  _startSpriteIndex = 0;
47  _location = 0;
48  _zoomFactor = 0;
49  }
50 
51  CharacterLocation() { reset(); }
52 };
53 
54 enum SauvegardeOffset {
55  svLastMouseCursor = 1
56  , svLastZoneNum = 2
57  , svLastObjectIndex = 3
58  , svDialogField4 = 4
59  , svLastScreenId = 5
60  , svLastPrevScreenId = 6
61  , svLastInventoryItem = 8
62  , svLastInvMouseCursor = 9
63  , svLastSavegameSlot = 10
64  , svFreedHostageFl = 80
65  , svField94 = 94
66  , svField95 = 95
67  , svForestAvailableFl = 113
68  , svHutBurningFl = 117
69  , svHopkinsCloneFl = 121
70  , svAlternateSpriteFl = 122
71  , svHeavenGuardGoneFl = 123
72  , svField132 = 132
73  , svField133 = 133
74  , svGameWonFl = 135
75  , svCinemaCurtainCond1 = 166
76  , svCinemaCurtainCond2 = 167
77  , svBankAttackAnimPlayedFl = 170
78  , svCopCall1PlayedFl = 171
79  , svCopCall2PlayedFl = 172
80  , svField173 = 173
81  , svField176 = 176
82  , svPoolDogGoneFl = 177
83  , svCinemaDogGoneFl = 181
84  , svField183 = 183
85  , svField184 = 184
86  , svField186 = 186
87  , svField188 = 188
88  , svField200 = 200
89  , svField214 = 214
90  , svBombBoxOpenedFl = 220
91  , svBombDisarmedFl = 225
92  , svField228 = 228
93  , svField231 = 231
94  , svField253 = 253
95  , svField261 = 261
96  , svField270 = 270
97  , svField300 = 300
98  , svBaseElevatorCond1 = 311
99  , svBaseFireFl = 312
100  , svSecondElevatorAvailableFl = 318
101  , svField320 = 320
102  , svEscapeLeftJailFl = 330
103  , svField333 = 333
104  , svField338 = 338
105  , svField339 = 339
106  , svField340 = 340
107  , svField341 = 341
108  , svField352 = 352
109  , svField353 = 353
110  , svField354 = 354
111  , svField355 = 355
112  , svField356 = 356
113  , svField357 = 357
114  , svField399 = 399
115  , svField401 = 401
116 };
117 
118 // As Script engine directly access savegame fields,
119 // refactoring it in separated fields properly named is impossible
120 struct Savegame {
121  byte _data[2050];
122  CharacterLocation _cloneHopkins;
123  CharacterLocation _realHopkins;
124  CharacterLocation _samantha;
125  int16 _inventory[35]; // Originally at offset 1300 of data array
126  int16 _mapCarPosX;
127  int16 _mapCarPosY;
128 
129  void reset() {
130  for (uint16 i = 0; i < ARRAYSIZE(_data); i++) {
131  _data[i] = 0;
132  }
133  _cloneHopkins.reset();
134  _realHopkins.reset();
135  _samantha.reset();
136  for (uint16 i = 0; i < ARRAYSIZE(_inventory); i++) {
137  _inventory[i] = 0;
138  }
139  _mapCarPosX = 0;
140  _mapCarPosY = 0;
141  }
142 
143  Savegame() { reset(); }
144 };
145 
146 struct CreditItem {
147  bool _actvFl;
148  int _color;
149  int _linePosY;
150  int _lineSize;
151  byte _line[50];
152 };
153 
154 enum Language { LANG_EN = 0, LANG_FR = 1, LANG_SP = 2};
155 
156 enum PlayerCharacter { CHARACTER_HOPKINS = 0, CHARACTER_HOPKINS_CLONE = 1, CHARACTER_SAMANTHA = 2 };
157 
158 enum Directions {
159  DIR_NONE = -1,
160  DIR_UP = 1,
161  DIR_UP_RIGHT = 2,
162  DIR_RIGHT = 3,
163  DIR_DOWN_RIGHT = 4,
164  DIR_DOWN = 5,
165  DIR_DOWN_LEFT = 6,
166  DIR_LEFT = 7,
167  DIR_UP_LEFT = 8
168 };
169 
170 enum EventMode {
171  EVENTMODE_DEFAULT = 0,
172  EVENTMODE_IGNORE = 1,
173  EVENTMODE_CREDITS = 3,
174  EVENTMODE_ALT = 4
175 };
176 
177 class HopkinsEngine;
178 
182 class Globals {
183 private:
184  HopkinsEngine *_vm;
185 
186 public:
187  bool _disableInventFl;
188  bool _cityMapEnabledFl;
189  bool _linuxEndDemoFl;
190  bool _censorshipFl;
191  bool _introSpeechOffFl;
192  int _exitId;
193  Directions _oceanDirection;
194  int _actionDirection;
195  int _inventory[36];
196  int _screenId;
197  int _prevScreenId;
198  int _characterMaxPosY;
199  int _baseMapColor;
200  int _spriteSize[500];
201  PlayerCharacter _characterType;
202  uint _speed;
203  byte *_answerBuffer;
204  Savegame *_saveData;
205  Language _language;
206  HopkinsItem _hopkinsItem[70];
207 
208  CreditItem _creditsItem[200];
209  int _creditsLineNumb;
210  int _creditsStep;
211  int _creditsPosY;
212  int _creditsStartX;
213  int _creditsEndX;
214  int _creditsStartY;
215  int _creditsEndY;
216 
217  int _menuSpeed;
218  int _menuSoundOff;
219  int _menuTextOff;
220  int _menuVoiceOff;
221  int _menuMusicOff;
222  int _menuDisplayType;
223  int _menuScrollSpeed;
224 
225  byte *_optionDialogSpr;
226  bool _optionDialogFl;
227 
228  bool _actionMoveTo;
229  bool _freezeCharacterFl;
230  bool _checkDistanceFl;
231  byte *_characterSpriteBuf;
232  Common::Path _zoneFilename;
233  Common::Path _textFilename;
234  byte *_levelSpriteBuf;
235 
236  EventMode _eventMode;
237 
238  Globals(HopkinsEngine *vm);
239  ~Globals();
240  byte *allocMemory(int count);
241  byte *freeMemory(byte *p);
242  void setConfig();
243  void clearAll();
244  void loadCharacterData();
245 
246  int _curRoomNum;
247 };
248 
249 } // End of namespace Hopkins
250 
251 #endif /* HOPKINS_GLOBALS_H */
#define ARRAYSIZE(x)
Definition: util.h:91
Definition: globals.h:120
Definition: globals.h:37
Definition: globals.h:32
Definition: path.h:52
Definition: globals.h:182
Definition: rect.h:45
Definition: anim.h:30
int16 x
Definition: rect.h:46
int16 y
Definition: rect.h:47
Definition: hopkins.h:86
Definition: globals.h:146