ScummVM API documentation
scene.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 SHERLOCK_SCENE_H
23 #define SHERLOCK_SCENE_H
24 
25 #include "common/scummsys.h"
26 #include "common/array.h"
27 #include "common/rect.h"
28 #include "common/serializer.h"
29 #include "sherlock/objects.h"
30 #include "sherlock/resources.h"
31 #include "sherlock/screen.h"
32 
33 namespace Sherlock {
34 
35 #define MAX_ZONES 40
36 #define INFO_LINE 140
37 
38 class SherlockEngine;
39 
40 struct BgFileHeader {
41  int _numStructs;
42  int _numImages;
43  int _numcAnimations;
44  int _descSize;
45  int _seqSize;
46 
47  // Serrated Scalpel
48  int _fill;
49 
50  // Rose Tattoo
51  int _scrollSize;
52  int _bytesWritten; // Size of the main body of the RRM
53  int _fadeStyle; // Fade style
54  byte _palette[PALETTE_SIZE]; // Palette
55 
56 
57  BgFileHeader();
58 
62  void load(Common::SeekableReadStream &s, bool isRoseTattoo);
63 };
64 
66  int _filesize; // How long images are
67  int _maxFrames; // How many unique frames in object
68  Common::String _filename; // Filename of object
69 
74  void load3DO(Common::SeekableReadStream &s);
75 };
76 
77 class Exit: public Common::Rect {
78 public:
79  int _scene;
80  int _allow;
81  PositionFacing _newPosition;
82 
83  Common::String _dest;
84  int _image; // Arrow image to use
85 
89  void load(Common::SeekableReadStream &s, bool isRoseTattoo);
90  void load3DO(Common::SeekableReadStream &s);
91 };
92 
93 struct SceneEntry {
94  Common::Point _startPosition;
95  int _startDir;
96  int _allow;
97 
102  void load3DO(Common::SeekableReadStream &s);
103 };
104 
105 struct SceneSound {
106  Common::String _name;
107  int _priority;
108 
113  void load3DO(Common::SeekableReadStream &s);
114 };
115 
116 class ObjectArray : public Common::Array<Object> {
117 public:
121  int indexOf(const Object &obj) const;
122 };
123 
124 class ScaleZone: public Common::Rect {
125 public:
126  int _topNumber; // Numerator of scale size at the top of the zone
127  int _bottomNumber; // Numerator of scale size at the bottom of the zone
128 
130 };
131 
132 class WalkArray : public Common::Array < Common::Point > {
133 public:
134  int _pointsCount;
135  int _fileOffset;
136 
137  WalkArray() : _pointsCount(0), _fileOffset(-1) {}
138 
142  void load(Common::SeekableReadStream &s, bool isRoseTattoo);
143 };
144 
145 class Scene {
146 private:
150  void loadSceneSounds();
151 
156  void checkSceneStatus();
157 
163  void checkInventory();
164 
169  void transitionToScene();
170 
175  void saveSceneStatus();
176 protected:
177  SherlockEngine *_vm;
178  Common::Path _roomFilename;
179 
189  virtual bool loadScene(const Common::Path &filename);
190 
196  virtual void checkBgShapes();
197 
201  virtual void drawAllShapes() = 0;
202 
206  virtual void paletteLoaded() {}
207 
208  Scene(SherlockEngine *vm);
209 public:
210  int _currentScene;
211  int _goToScene;
212  bool **_sceneStats;
213  bool _walkedInScene;
214  int _version;
215  bool _compressed;
216  int _invGraphicItems;
217  Common::String _comments;
218  Common::Array<char> _descText;
220  ObjectArray _bgShapes;
221  Common::Array<CAnim> _cAnim;
222  Common::Array<byte> _sequenceBuffer;
224  int _walkDirectory[MAX_ZONES][MAX_ZONES];
225  Common::Array<WalkArray> _walkPoints;
226  Common::Array<Exit> _exits;
227  SceneEntry _entrance;
229  Common::Array<Object *> _canimShapes;
230  Common::Array<ScaleZone> _scaleZones;
231  Common::StringArray _objSoundList;
232  bool _restoreFlag;
233  int _animating;
234  bool _doBgAnimDone;
235  int _tempFadeStyle;
236  int _cAnimFramePause;
237 public:
238  static Scene *init(SherlockEngine *vm);
239  virtual ~Scene();
240 
244  void selectScene();
245 
251  void checkSceneFlags(bool mode);
252 
256  Exit *checkForExit(const Common::Rect &r);
257 
262  int toggleObject(const Common::String &name);
263 
268  int checkForZones(const Common::Point &pt, int zoneType);
269 
273  int whichZone(const Common::Point &pt);
274 
278  virtual void freeScene();
279 
283  virtual int closestZone(const Common::Point &pt) = 0;
284 
289  virtual int findBgShape(const Common::Point &pt) = 0;
290 
294  virtual void synchronize(Serializer &s);
295 public:
299  virtual void doBgAnim() = 0;
300 
305  virtual void updateBackground();
306 
315  virtual int startCAnim(int cAnimNum, int playRate = 1) = 0;
316 };
317 
318 } // End of namespace Sherlock
319 
320 #endif
virtual void paletteLoaded()
Definition: scene.h:206
Definition: objects.h:120
Definition: str.h:59
Definition: scene.h:132
Definition: scene.h:40
Definition: array.h:52
Definition: animation.h:29
Definition: rect.h:144
Definition: path.h:52
Definition: scene.h:145
Definition: stream.h:745
Definition: serializer.h:79
void load(Common::SeekableReadStream &s, bool isRoseTattoo)
Definition: sherlock.h:76
Definition: rect.h:45
Definition: scene.h:65
Definition: objects.h:363
Definition: scene.h:77
Definition: scene.h:105
Definition: scene.h:124
Definition: scene.h:93
Definition: scene.h:116