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
33namespace Sherlock {
34
35#define MAX_ZONES 40
36#define INFO_LINE 140
37
38class SherlockEngine;
39
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[Graphics::PALETTE_SIZE]; // Palette
55
56
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
77class Exit: public Common::Rect {
78public:
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
93struct SceneEntry {
94 Common::Point _startPosition;
95 int _startDir;
96 int _allow;
97
102 void load3DO(Common::SeekableReadStream &s);
103};
104
106 Common::String _name;
107 int _priority;
108
113 void load3DO(Common::SeekableReadStream &s);
114};
115
116class ObjectArray : public Common::Array<Object> {
117public:
121 int indexOf(const Object &obj) const;
122};
123
124class ScaleZone: public Common::Rect {
125public:
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
129 void load(Common::SeekableReadStream &s);
130};
131
132class WalkArray : public Common::Array < Common::Point > {
133public:
134 int _pointsCount;
135 int _fileOffset;
136
137 WalkArray() : _pointsCount(0), _fileOffset(-1) {}
138
142 void load(Common::SeekableReadStream &s, bool isRoseTattoo);
143};
144
145class Scene {
146private:
150 void loadSceneSounds();
151
156 void checkSceneStatus();
157
163 void checkInventory();
164
169 void transitionToScene();
170
175 void saveSceneStatus();
176protected:
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
209public:
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;
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;
237public:
238 static Scene *init(SherlockEngine *vm);
239 virtual ~Scene();
240
245
251 void checkSceneFlags(bool mode);
252
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);
295public:
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
Definition: array.h:52
Definition: path.h:52
Definition: stream.h:745
Definition: serializer.h:80
Definition: str.h:59
Definition: scene.h:77
void load(Common::SeekableReadStream &s, bool isRoseTattoo)
Definition: scene.h:116
int indexOf(const Object &obj) const
Definition: objects.h:363
Definition: objects.h:120
Definition: scene.h:124
Definition: scene.h:145
virtual int startCAnim(int cAnimNum, int playRate=1)=0
int toggleObject(const Common::String &name)
virtual void updateBackground()
virtual void doBgAnim()=0
int whichZone(const Common::Point &pt)
virtual void freeScene()
void checkSceneFlags(bool mode)
virtual int findBgShape(const Common::Point &pt)=0
virtual void synchronize(Serializer &s)
virtual void drawAllShapes()=0
virtual void checkBgShapes()
virtual bool loadScene(const Common::Path &filename)
Exit * checkForExit(const Common::Rect &r)
int checkForZones(const Common::Point &pt, int zoneType)
virtual int closestZone(const Common::Point &pt)=0
virtual void paletteLoaded()
Definition: scene.h:206
Definition: sherlock.h:206
Definition: scene.h:132
void load(Common::SeekableReadStream &s, bool isRoseTattoo)
Definition: rect.h:144
Definition: rect.h:536
Definition: scene.h:40
void load(Common::SeekableReadStream &s, bool isRoseTattoo)
Definition: scene.h:65
void load(Common::SeekableReadStream &s)
Definition: scene.h:93
void load(Common::SeekableReadStream &s)
Definition: scene.h:105
void load(Common::SeekableReadStream &s)