ScummVM API documentation
gamedata.h
Go to the documentation of this file.
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 MUTATIONOFJB_GAMEDATA_H
23 #define MUTATIONOFJB_GAMEDATA_H
24 
25 #include "mutationofjb/inventory.h"
26 
27 #include "common/serializer.h"
28 #include "common/scummsys.h"
29 
30 namespace Common {
31 class ReadStream;
32 }
33 
34 namespace MutationOfJB {
35 
36 enum {
37  MAX_ENTITY_NAME_LENGTH = 0x14
38 };
39 
51 struct Door : public Common::Serializable {
60  char _name[MAX_ENTITY_NAME_LENGTH + 1];
65  uint8 _destSceneId;
67  uint16 _destX;
69  uint16 _destY;
71  uint16 _x;
73  uint8 _y;
75  uint16 _width;
77  uint8 _height;
79  uint16 _walkToX;
81  uint8 _walkToY;
87  uint8 _SP;
88 
93  bool isActive();
94 
101  bool loadInitialState(Common::ReadStream &stream);
102 
108  void saveLoadWithSerializer(Common::Serializer &sz) override;
109 
115  bool allowsImplicitSceneChange() const;
116 };
117 
131 struct Object : public Common::Serializable {
133  uint8 _active;
143  uint8 _firstFrame;
154  uint8 _numFrames;
167  uint8 _jumpChance;
175  uint16 _x;
177  uint8 _y;
179  uint16 _width;
181  uint8 _height;
183  uint16 _WX;
192  uint8 _SP;
193 
200  bool loadInitialState(Common::ReadStream &stream);
201 
207  void saveLoadWithSerializer(Common::Serializer &sz) override;
208 };
209 
213 struct Static : public Common::Serializable {
215  uint8 _active;
230  char _name[MAX_ENTITY_NAME_LENGTH + 1];
232  uint16 _x;
234  uint8 _y;
236  uint16 _width;
238  uint8 _height;
240  uint16 _walkToX;
242  uint8 _walkToY;
245 
252  bool loadInitialState(Common::ReadStream &stream);
253 
259  void saveLoadWithSerializer(Common::Serializer &sz) override;
260 
267  bool isCombinable() const;
268 
275  bool allowsImplicitPickup() const;
276 };
277 
282 struct Bitmap : public Common::Serializable {
284  uint8 _roomFrame;
286  uint8 _isVisible;
288  uint16 _x1;
290  uint8 _y1;
292  uint16 _x2;
294  uint8 _y2;
295 
302  bool loadInitialState(Common::ReadStream &stream);
303 
309  void saveLoadWithSerializer(Common::Serializer &sz) override;
310 };
311 
322 
323  uint8 getContext() const {
324  return (_encodedData >> 7) & 0x1;
325  }
326  uint8 getConvItemIndex() const {
327  return (_encodedData >> 4) & 0x7;
328  }
329  uint8 getConvGroupIndex() const {
330  return _encodedData & 0xF;
331  }
332 
333  ExhaustedConvItem() : _encodedData(0) {}
334  ExhaustedConvItem(uint8 context, uint8 convItemIndex, uint8 convGroupIndex) :
335  _encodedData(((context & 0x1) << 7) | ((convItemIndex & 0x7) << 4) | (convGroupIndex & 0xF)) {}
336 };
337 
339  Door *getDoor(uint8 objectId);
340  Object *getObject(uint8 objectId, bool ignoreNo = false);
341  Static *getStatic(uint8 staticId, bool ignoreNo = false);
342  Bitmap *getBitmap(uint8 bitmapId);
343 
344  uint8 getNoDoors(bool ignoreNo = false) const;
345  uint8 getNoObjects(bool ignoreNo = false) const;
346  uint8 getNoStatics(bool ignoreNo = false) const;
347  uint8 getNoBitmaps() const;
348 
358  Door *findDoor(int16 x, int16 y, bool activeOnly = true, int *index = nullptr);
368  Static *findStatic(int16 x, int16 y, bool activeOnly = true, int *index = nullptr);
369  Bitmap *findBitmap(int16 x, int16 y, int *index = nullptr);
370 
371  void addExhaustedConvItem(uint8 context, uint8 convItemIndex, uint8 convGroupIndex);
372  bool isConvItemExhausted(uint8 context, uint8 convItemIndex, uint8 convGroupIndex) const;
373 
375  uint8 _startup;
380  uint8 _unknown001;
381  uint8 _unknown002;
382  uint8 _unknown003;
383  uint8 _delay;
385  uint8 _noDoors;
386  Door _doors[5];
388  uint8 _noObjects;
389  Object _objects[9];
391  uint8 _noStatics;
392  Static _statics[15];
394  Bitmap _bitmaps[10];
396  uint16 _obstacleY1;
401  uint8 _palRotLast;
404 
410  ExhaustedConvItem _exhaustedConvItems[79];
411 
418  bool loadInitialState(Common::ReadStream &stream);
419 
425  void saveLoadWithSerializer(Common::Serializer &sz) override;
426 };
427 
429  struct Item {
430  uint8 _question;
431  uint8 _response;
432  uint8 _nextGroupIndex;
433  };
434 
436 
437  Common::Array<ItemGroup> _itemGroups;
438  uint8 _context;
439  uint8 _objectId;
440  uint8 _color;
441 };
442 
444 public:
445  GameData();
446  Scene *getScene(uint8 sceneId);
447  Scene *getCurrentScene();
448  Inventory &getInventory();
449 
456  bool loadInitialState(Common::ReadStream &stream);
457 
463  void saveLoadWithSerializer(Common::Serializer &sz) override;
464 
465  uint8 _currentScene; // Persistent.
466  uint8 _lastScene;
467  bool _partB; // Persistent.
468  Inventory _inventory; // Persistent.
469  Common::String _currentAPK; // Persistent.
470  ConversationInfo _conversationInfo;
472  uint8 _color;
473 private:
474  Scene _scenes[45]; // Persistent.
475 };
476 
477 enum Colors {
478  WHITE = 0xC6,
479  DARKGRAY = 0xC2,
480  LIGHTGRAY = 0xC4,
481  GREEN = 0xC8,
482  ORANGE = 0xCA,
483  DARKBLUE = 0xD6,
484  LIGHTBLUE = 0xDA,
485  BROWN = 0xDC
486 };
487 
488 }
489 
490 #endif
uint16 _destY
Definition: gamedata.h:69
Definition: inventory.h:40
uint8 _noObjects
Definition: gamedata.h:388
Definition: str.h:59
uint8 _roomFrame
Definition: gamedata.h:284
uint8 _y1
Definition: gamedata.h:290
uint8 _delay
Definition: gamedata.h:383
uint16 _destX
Definition: gamedata.h:67
uint8 _palRotLast
Definition: gamedata.h:401
uint8 _unknown001
Definition: gamedata.h:380
Definition: gamedata.h:338
uint16 _x1
Definition: gamedata.h:288
uint8 _firstFrame
Definition: gamedata.h:143
Definition: gamedata.h:429
uint8 _walkToFrame
Definition: gamedata.h:244
uint8 _destSceneId
Definition: gamedata.h:65
Definition: gamedata.h:51
uint16 _x
Definition: gamedata.h:175
uint8 _y
Definition: gamedata.h:73
Definition: serializer.h:79
uint16 _x
Definition: gamedata.h:71
uint16 _width
Definition: gamedata.h:179
uint8 _exhaustedConvItemNext
Definition: gamedata.h:409
uint16 _walkToX
Definition: gamedata.h:240
uint16 _x2
Definition: gamedata.h:292
uint8 _isVisible
Definition: gamedata.h:286
uint8 _startup
Definition: gamedata.h:375
uint8 _numFrames
Definition: gamedata.h:154
uint8 _height
Definition: gamedata.h:181
uint8 _height
Definition: gamedata.h:238
uint16 _walkToX
Definition: gamedata.h:79
uint8 _SP
Definition: gamedata.h:87
uint8 _y
Definition: gamedata.h:234
Definition: gamedata.h:213
uint8 _encodedData
Definition: gamedata.h:321
Definition: animationdecoder.h:36
uint8 _jumpChance
Definition: gamedata.h:167
uint8 _SP
Definition: gamedata.h:192
uint8 _noDoors
Definition: gamedata.h:385
Definition: algorithm.h:29
uint8 _active
Definition: gamedata.h:215
uint8 _y
Definition: gamedata.h:177
uint16 _width
Definition: gamedata.h:236
uint8 _y2
Definition: gamedata.h:294
Definition: gamedata.h:443
Definition: gamedata.h:282
uint16 _WX
Definition: gamedata.h:183
Definition: serializer.h:308
uint8 _walkToY
Definition: gamedata.h:242
uint8 _randomFrame
Definition: gamedata.h:152
uint8 _active
Definition: gamedata.h:133
uint16 _obstacleY1
Definition: gamedata.h:396
uint16 _x
Definition: gamedata.h:232
uint8 _noStatics
Definition: gamedata.h:391
uint8 _palRotDelay
Definition: gamedata.h:403
uint8 _height
Definition: gamedata.h:77
uint8 _walkToY
Definition: gamedata.h:81
Definition: gamedata.h:428
uint16 _width
Definition: gamedata.h:75
Definition: stream.h:385
Definition: gamedata.h:131
uint8 _color
Definition: gamedata.h:472
uint8 _roomFrameMSB
Definition: gamedata.h:190
uint8 _roomFrameLSB
Definition: gamedata.h:161
Definition: gamedata.h:315
uint8 _currentFrame
Definition: gamedata.h:173
uint8 _palRotFirst
Definition: gamedata.h:399