ScummVM API documentation
data.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 ASYLUM_RESOURCES_DATA_H
23 #define ASYLUM_RESOURCES_DATA_H
24 
25 #include "common/rect.h"
26 #include "common/serializer.h"
27 
28 #include "engines/asylum/shared.h"
29 
30 namespace Asylum {
31 
33 // Flags
34 enum GlobalFlag {
35  kFlag1,
36  kFlag2,
37  kFlag3,
38  kFlagRedraw,
39  kFlagSkipDrawScene,
40  kFlagSceneRectChanged,
41  kFlagScene1,
42  kFlagSkipScriptProcessing,
43  kFlagIsEncounterRunning,
44  kFlagEncounterDisablePlayerOnExit,
45  kFlagActorUpdateEnabledCheck,
46  kFlagActorUpdateStatus15Check
47 };
48 
49 class SharedData;
50 
51 class CrowsData {
52 public:
53  CrowsData(SharedData *sharedData) : /* _sharedData(sharedData), */_data() { memset(_data, 0, sizeof(_data)); }
54  int32 &operator [](uint32 index);
55 private:
56  int32 _data[84];
57  //SharedData *_sharedData;
58 };
59 
131 public:
132  SharedData();
133  virtual ~SharedData() {};
134 
135  // Public variables
136  int32 cdNumber;
137  uint32 movieIndex;
138  uint32 sceneCounter;
139  Common::Point vector1;
140  Common::Point vector2;
141  bool actorEnableForStatus7;
142  ActorDirection globalDirection;
143  CrowsData crowsData;
144 
145  // Used by Actor::enableActorsChapter2 (and maybe others)
146  void resetChapter2Data();
147  void reset(); // called during game reset
148 
149  // Flags
150  bool getFlag(GlobalFlag flag) const;
151  void setFlag(GlobalFlag flag, bool state);
152 
153  // Serializer
154  void saveLoadAmbientSoundData(Common::Serializer &s);
155  void saveLoadWithSerializer(Common::Serializer &s);
156 
158  // Accessors
160 
161  // Ambient sound data
162  uint32 getAmbientTick(uint32 index) const;
163  void setAmbientTick(uint32 index, uint32 val);
164  uint32 getAmbientFlag(uint32 index) const;
165  void setAmbientFlag(uint32 index, uint32 val);
166  void resetAmbientFlags();
167 
171  ActorIndex getPlayerIndex() { return _playerIndex; }
172 
178  void setPlayerIndex(ActorIndex index) { _playerIndex = index; }
179 
180  // Coordinates
181  Common::Point getGlobalPoint() { return _globalPoint; }
182  void setGlobalPoint(const Common::Point &point) { _globalPoint = point; }
183  Common::Point getSceneCoords() { return _sceneCoords; }
184  void setSceneCoords(const Common::Point &point) { _sceneCoords = point; }
185  int16 getSceneOffset() { return _sceneOffset; }
186  void setSceneOffset(int16 sceneOffset) { _sceneOffset = sceneOffset; }
187  int16 getSceneOffsetAdd() { return _sceneOffsetAdd; }
188  void setSceneOffsetAdd(int16 sceneOffsetAdd) { _sceneOffsetAdd = sceneOffsetAdd; }
189 
190  // Saved scene data
191  void saveCursorResources(ResourceId *resources, uint32 size);
192  void loadCursorResources(ResourceId *resources, uint32 size) const;
193  void saveSceneFonts(ResourceId font1, ResourceId font2, ResourceId font3);
194  void loadSceneFonts(ResourceId *font1, ResourceId *font2, ResourceId *font3) const;
195  void saveSmallCursor(int32 smallCurUp, int32 smallCurDown);
196  void loadSmallCursor(int32 *smallCurUp, int32 *smallCurDown) const;
197  void saveEncounterFrameBackground(ResourceId encounterFrameBg) { _encounterFrameBg = encounterFrameBg; }
198  void loadEncounterFrameBackground(ResourceId *encounterFrameBg) { *encounterFrameBg = _encounterFrameBg; }
199 
200  // Matte data
201  int32 getMatteVar1() const { return _matteVar1; }
202  void setMatteVar1(int32 val) { _matteVar1 = val; }
203  uint32 getMatteVar2() const { return _matteVar2; }
204  void setMatteVar2(uint32 val) { _matteVar2 = val; }
205  int16 getMatteBarHeight() const { return _matteBarHeight; }
206  void setMatteBarHeight(int16 val) { _matteBarHeight = val; }
207  bool getMatteInitialized() const { return _matteInitialized; }
208  void setMatteInitialized(bool val) { _matteInitialized = val; }
209  bool getMattePlaySound() const { return _mattePlaySound; }
210  void setMattePlaySound(bool val) { _mattePlaySound = val; }
211 
212  // Chapter 2 data
213  void setChapter2Counter(uint32 index, int32 val);
214  int32 getChapter2Counter(uint32 index) const;
215  int32 getChapter2FrameIndexOffset() const { return _chapter2FrameIndexOffset; }
216  void setChapter2FrameIndexOffset(int32 val) { _chapter2FrameIndexOffset = val; }
217  ActorIndex getChapter2ActorIndex() const { return _chapter2ActorIndex; }
218  void setChapter2ActorIndex(ActorIndex val) { _chapter2ActorIndex = val; }
219 
220  // Misc
221  int32 getActorUpdateStatusEnabledCounter() { return _actorUpdateStatusEnabledCounter; }
222  void setActorUpdateStatusEnabledCounter(int32 val) { _actorUpdateStatusEnabledCounter = val; }
223 
224  // Screen updates
225  int32 getEventUpdate() { return _eventUpdate; }
226  void setEventUpdate(int32 val) { _eventUpdate = val; }
227  uint32 getNextScreenUpdate() { return _nextScreenUpdate; }
228  void setNextScreenUpdate(uint32 nextScreenUpdate) { _nextScreenUpdate = nextScreenUpdate; }
229 
230 private:
231  uint32 _ambientFlags[15];
232  uint32 _ambientTicks[15];
233  Common::Point _globalPoint; // global point
234  bool _flagSkipScriptProcessing;
235  bool _flagIsEncounterRunning;
236  int32 _playerIndex;
237  Common::Point _sceneCoords;
238  int16 _sceneOffset;
239  int16 _sceneOffsetAdd;
240  ResourceId _cursorResources[13];
241  ResourceId _sceneFonts[3];
242  uint32 _chapter2Data1[5];
243  int32 _smallCurUp;
244  int32 _smallCurDown;
245  ResourceId _encounterFrameBg;
246  bool _flagSkipDrawScene;
247  int32 _matteVar1;
248  bool _flagActorUpdateEnabledCheck;
249  bool _matteInitialized;
250  bool _mattePlaySound;
251  int32 _currentScreenUpdatesCount;
252  uint32 _chapter2Data2[9];
253  int32 _chapter2Counters[8];
254  int32 _chapter2Data3[23];
255  int32 _chapter2FrameIndexOffset;
256  ActorIndex _chapter2ActorIndex;
257  int32 _eventUpdate;
258  uint32 _chapter2Data4[18];
259  int32 _actorUpdateStatusEnabledCounter;
260  uint32 _chapter2Data5[9];
261  bool _flagEncounterDisablePlayerOnExit;
262  bool _flag1;
263  uint32 _nextScreenUpdate;
264  //byte _moviesViewed[196];
265  bool _flagActorUpdateStatus15Check;
266 
267  // Non-saved data
268  bool _flag2;
269  bool _flag3;
270  bool _flagScene1;
271  bool _flagRedraw;
272 
273  int16 _matteBarHeight;
274  uint32 _matteVar2;
275 
276  friend class CrowsData;
277 };
278 
279 } // End of namespace Asylum
280 
281 #endif // ASYLUM_RESOURCES_DATA_H
Definition: data.h:130
Definition: asylum.h:53
ActorIndex getPlayerIndex()
Definition: data.h:171
Definition: serializer.h:79
Definition: data.h:51
Definition: rect.h:45
Definition: serializer.h:308
void setPlayerIndex(ActorIndex index)
Definition: data.h:178