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/nebular/core/action.h"
32 #include "mads/nebular/core/assets.h"
33 #include "mads/nebular/core/events.h"
34 #include "mads/nebular/core/game_data.h"
35 #include "mads/nebular/core/hotspots.h"
36 #include "mads/nebular/core/messages.h"
37 #include "mads/nebular/core/rails.h"
38 #include "mads/nebular/core/user_interface.h"
39 
40 namespace MADS {
41 namespace Nebular {
42 
43 class MADSEngine;
44 class Scene;
45 class SpriteSlot;
46 
47 #define MADS_INTERFACE_HEIGHT 44
48 #define MADS_SCENE_HEIGHT 156
49 
50 #define DEPTH_BANDS_SIZE 15
51 
52 #define SPRITE_SLOTS_MAX_SIZE 50
53 #define TEXT_DISPLAY_MAX_SIZE 40
54 #define DIRTY_AREAS_SIZE (SPRITE_SLOTS_MAX_SIZE + TEXT_DISPLAY_MAX_SIZE)
55 
56 enum {
57  SCENEFLAG_DITHER = 0x01, // Dither to 16 colors
58  SCENEFLAG_LOAD_SHADOW = 0x10, // Load hard shadows
59  SCENEFLAG_TRANSLATE = 0x10000 // Translate palette of loaded background
60 };
61 
62 class VerbInit {
63 public:
64  int _id;
65  VerbType _verbType;
66  PrepType _prepType;
67 
68  VerbInit() {
69  }
70  VerbInit(int id, VerbType verbType, PrepType prepType)
71  : _id(id), _verbType(verbType), _prepType(prepType) {
72  }
73 };
74 
75 class SceneLogic {
76 protected:
77  RexNebularEngine *_vm;
78  Scene *_scene;
79 public:
84 
88  virtual ~SceneLogic() {
89  }
90 
94  virtual void setup() = 0;
95 
99  virtual void enter() = 0;
100 
104  virtual void step() {
105  }
106 
110  virtual void preActions() {
111  }
112 
116  virtual void actions() = 0;
117 
121  virtual void postActions() {
122  }
123 
127  virtual void unhandledAction() {
128  }
129 
133  virtual void synchronize(Common::Serializer &s) {
134  }
135 };
136 
137 struct ARTHeader {
138  int _width;
139  int _height;
140  Common::Array<RGB6> _palette;
141  Common::Array<PaletteCycle> _paletteCycles;
142 
143  void load(Common::SeekableReadStream *f, bool isV2);
144 };
145 
149 class SceneInfo {
150  class SpriteInfo {
151  public:
152  int _spriteSetIndex;
153  Common::Point _position;
154  int _frameNumber;
155  int _depth;
156  int _scale;
157 
158  void load(Common::SeekableReadStream *f);
159  };
160 protected:
161  RexNebularEngine *_vm;
162 
167 public:
168  int _sceneId;
169  int _artFileNum;
170  int _depthStyle;
171  int _width;
172  int _height;
173 
174  int _yBandsEnd;
175  int _yBandsStart;
176  int _maxScale;
177  int _minScale;
178  int _depthList[DEPTH_BANDS_SIZE];
179  int _field4A; // Useless field ?
180 
181  int _usageIndex;
182  Common::Array<PaletteCycle> _paletteCycles;
183  WalkNodeList _nodes;
184 public:
188  virtual ~SceneInfo() {
189  }
190 
194  static SceneInfo *init(RexNebularEngine *vm);
195 
199  void load(int sceneId, int variant, const Common::String &resName, int flags,
200  DepthSurface &depthSurface, BaseSurface &bgSurface);
201 
205  void loadPalette(int sceneId, int artFileNum, const Common::String &resName, int flags, BaseSurface &bgSurface);
206 
210  void loadMadsV1Background(int sceneId, const Common::String &resName, int flags, BaseSurface &bgSurface);
211 
215  void loadMadsV2Background(int sceneId, const Common::String &resName, int flags, BaseSurface &bgSurface);
216 
222  virtual void loadCodes(BaseSurface &depthSurface, int variant) = 0;
223 
229  virtual void loadCodes(BaseSurface &depthSurface, Common::SeekableReadStream *stream) = 0;
230 };
231 
232 } // namespace Nebular
233 } // namespace MADS
234 
235 #endif
virtual ~SceneLogic()
Definition: scene_data.h:88
Definition: str.h:59
Definition: nebular.h:51
Definition: array.h:52
virtual void postActions()
Definition: scene_data.h:121
Definition: msurface.h:203
virtual ~SceneInfo()
Definition: scene_data.h:188
Definition: stream.h:745
Definition: scene_data.h:75
Definition: serializer.h:80
virtual void step()
Definition: scene_data.h:104
virtual void unhandledAction()
Definition: scene_data.h:127
virtual void synchronize(Common::Serializer &s)
Definition: scene_data.h:133
Definition: msurface.h:56
Definition: scene_data.h:62
Definition: scene.h:47
Definition: rect.h:144
virtual void preActions()
Definition: scene_data.h:110
Definition: mps_installer.h:31
Definition: scene_data.h:149
Definition: scene_data.h:137