ScummVM API documentation
scene_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 MADS_SCENE_DATA_H
23 #define MADS_SCENE_DATA_H
24 
25 #include "common/scummsys.h"
26 #include "common/array.h"
27 #include "common/serializer.h"
28 #include "common/str.h"
29 #include "common/str-array.h"
30 #include "common/rect.h"
31 #include "mads/action.h"
32 #include "mads/assets.h"
33 #include "mads/events.h"
34 #include "mads/game_data.h"
35 #include "mads/hotspots.h"
36 #include "mads/messages.h"
37 #include "mads/rails.h"
38 #include "mads/user_interface.h"
39 
40 namespace MADS {
41 
42 class MADSEngine;
43 class Scene;
44 class SpriteSlot;
45 
46 #define MADS_INTERFACE_HEIGHT 44
47 #define MADS_SCENE_HEIGHT 156
48 
49 #define DEPTH_BANDS_SIZE 15
50 
51 #define SPRITE_SLOTS_MAX_SIZE 50
52 #define TEXT_DISPLAY_MAX_SIZE 40
53 #define DIRTY_AREAS_SIZE (SPRITE_SLOTS_MAX_SIZE + TEXT_DISPLAY_MAX_SIZE)
54 
55 enum {
56  SCENEFLAG_DITHER = 0x01, // Dither to 16 colors
57  SCENEFLAG_LOAD_SHADOW = 0x10, // Load hard shadows
58  SCENEFLAG_TRANSLATE = 0x10000 // Translate palette of loaded background
59 };
60 
61 class VerbInit {
62 public:
63  int _id;
64  VerbType _verbType;
65  PrepType _prepType;
66 
67  VerbInit() {}
68  VerbInit(int id, VerbType verbType, PrepType prepType)
69  : _id(id), _verbType(verbType), _prepType(prepType) {
70  }
71 };
72 
73 class SceneLogic {
74 protected:
75  MADSEngine *_vm;
76  Scene *_scene;
77 public:
82 
86  virtual ~SceneLogic() {}
87 
91  virtual void setup() = 0;
92 
96  virtual void enter() = 0;
97 
101  virtual void step() {}
102 
106  virtual void preActions() {}
107 
111  virtual void actions() = 0;
112 
116  virtual void postActions() {}
117 
121  virtual void unhandledAction() {}
122 
126  virtual void synchronize(Common::Serializer &s) {}
127 };
128 
129 struct ARTHeader {
130  int _width;
131  int _height;
132  Common::Array<RGB6> _palette;
133  Common::Array<PaletteCycle> _paletteCycles;
134 
135  void load(Common::SeekableReadStream *f, bool isV2);
136 };
137 
141 class SceneInfo {
142  class SpriteInfo {
143  public:
144  int _spriteSetIndex;
145  Common::Point _position;
146  int _frameNumber;
147  int _depth;
148  int _scale;
149 
150  void load(Common::SeekableReadStream *f);
151  };
152 protected:
153  MADSEngine *_vm;
154 
158  SceneInfo(MADSEngine *vm);
159 public:
160  int _sceneId;
161  int _artFileNum;
162  int _depthStyle;
163  int _width;
164  int _height;
165 
166  int _yBandsEnd;
167  int _yBandsStart;
168  int _maxScale;
169  int _minScale;
170  int _depthList[DEPTH_BANDS_SIZE];
171  int _field4A; // Useless field ?
172 
173  int _usageIndex;
174  Common::Array<PaletteCycle> _paletteCycles;
175  WalkNodeList _nodes;
176 public:
180  virtual ~SceneInfo() {}
181 
185  static SceneInfo *init(MADSEngine *vm);
186 
190  void load(int sceneId, int variant, const Common::String &resName, int flags,
191  DepthSurface &depthSurface, BaseSurface &bgSurface);
192 
196  void loadPalette(int sceneId, int artFileNum, const Common::String &resName, int flags, BaseSurface &bgSurface);
197 
201  void loadMadsV1Background(int sceneId, const Common::String &resName, int flags, BaseSurface &bgSurface);
202 
206  void loadMadsV2Background(int sceneId, const Common::String &resName, int flags, BaseSurface &bgSurface);
207 
213  virtual void loadCodes(BaseSurface &depthSurface, int variant) = 0;
214 
220  virtual void loadCodes(BaseSurface &depthSurface, Common::SeekableReadStream *stream) = 0;
221 };
222 
223 } // End of namespace MADS
224 
225 #endif /* MADS_SCENE_DATA_H */
virtual ~SceneLogic()
Definition: scene_data.h:86
Definition: msurface.h:55
Definition: scene_data.h:61
Definition: str.h:59
virtual void synchronize(Common::Serializer &s)
Definition: scene_data.h:126
Definition: array.h:52
virtual void preActions()
Definition: scene_data.h:106
Definition: stream.h:745
Definition: serializer.h:79
virtual void postActions()
Definition: scene_data.h:116
Definition: msurface.h:184
Definition: rect.h:45
Definition: scene_data.h:129
Definition: scene_data.h:141
Definition: scene.h:44
Definition: mads.h:87
Definition: scene_data.h:73
virtual ~SceneInfo()
Definition: scene_data.h:180
Definition: action.h:28
virtual void unhandledAction()
Definition: scene_data.h:121
virtual void step()
Definition: scene_data.h:101