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 MADS_SCENE_H
23 #define MADS_SCENE_H
24 
25 #include "common/scummsys.h"
26 #include "common/array.h"
27 #include "common/rect.h"
28 #include "mads/assets.h"
29 #include "mads/screen.h"
30 #include "mads/hotspots.h"
31 #include "mads/messages.h"
32 #include "mads/msurface.h"
33 #include "mads/scene_data.h"
34 #include "mads/animation.h"
35 #include "mads/rails.h"
36 #include "mads/sequence.h"
37 #include "mads/sprites.h"
38 #include "mads/user_interface.h"
39 
40 namespace MADS {
41 
42 enum { RETURNING_FROM_DIALOG = -2, RETURNING_FROM_LOADING = -1 };
43 
44 class Scene {
45 private:
49  int activeVocabIndexOf(int vocabId);
50 
54  void loadVocabStrings();
55 
59  void doFrame();
60 
61  void doPreactions();
62 
63  void doAction();
64 
68  void doSceneStep();
69 
73  void checkKeyboard();
74 
78  void updateCursor();
79 protected:
80  MADSEngine *_vm;
81 public:
82  SceneLogic *_sceneLogic;
83  MSurface _sceneSurface;
84  int _priorSceneId;
85  int _nextSceneId;
86  int _currentSceneId;
87  Common::Array<VerbInit> _verbList;
88  TextDisplayList _textDisplay;
89  SpriteSlots _spriteSlots;
90  SpriteSets _sprites;
91  DynamicHotspots _dynamicHotspots;
92  Common::Array<int> _activeVocabs;
93  SequenceList _sequences;
94  KernelMessages _kernelMessages;
95  Rails _rails;
96  Common::String _talkFont;
97  int _textSpacing;
98  Hotspots _hotspots;
99  DirtyAreas _dirtyAreas;
100  int _variant;
101  SceneInfo *_sceneInfo;
102  MSurface _backgroundSurface;
103  DepthSurface _depthSurface;
104  UserInterface _userInterface;
105  bool _cyclingActive;
106  int _cyclingThreshold;
107  int _cyclingDelay;
108  int _totalCycleColors;
109  Common::Array<uint32> _cycleTicks;
110  Common::Array<PaletteCycle> _paletteCycles;
111  Common::StringArray _vocabStrings;
112  Animation *_animationData;
113  Animation *_animation[10];
114  bool _freeAnimationFlag;
115  int _depthStyle;
116  int _bandsRange;
117  int _scaleRange;
118  int _interfaceY;
119  int _spritesCount;
120  MADSAction _action;
121  bool _roomChanged;
122  bool _reloadSceneFlag;
123  Common::Point _posAdjust;
124  uint32 _frameStartTime;
125  ScreenMode _mode;
126  bool _lookFlag;
127  Common::Point _customDest;
129  Common::Array<PaletteUsage::UsageEntry> _scenePaletteUsage;
133  Scene(MADSEngine *vm);
134 
138  ~Scene();
139 
140  void restrictScene();
141 
145  void clearVocab();
146 
150  void addActiveVocab(int vocabId);
151 
155  uint32 getVocabStringsCount() const;
156 
160  void clearSequenceList();
161 
165  void clearMessageList();
166 
170  void loadSceneLogic();
171 
178  void loadScene(int sceneId, const Common::Path &prefix, bool palFlag);
179 
183  void loadHotspots();
184 
188  void loadVocab();
189 
190  bool getDepthHighBits(const Common::Point &pt);
191 
195  void loop();
196 
200  void drawElements(ScreenTransition transitionType, bool surfaceFlag);
201 
202  /*
203  * Initializes the data for palette animation within the scene
204  */
205  void initPaletteAnimation(Common::Array<PaletteCycle> &palCycles, bool animFlag);
206 
210  void animatePalette();
211 
215  int loadAnimation(const Common::Path &resName, int trigger = 0);
216 
220  Common::String getVocab(int vocabId) { return _vocabStrings[vocabId - 1]; }
221 
225  void freeCurrentScene();
226 
230  void changeVariant(int variant);
231 
232  void resetScene();
233 
238  void removeSprites();
239 
243  void freeAnimation();
244 
248  void freeAnimation(int idx);
249 
254 
255  void setAnimFrame(int id, int val);
256  int getAnimFrame(int id);
257 
258  void setDynamicAnim(int id, int anim_id, int segment);
259  void setCamera(Common::Point pos);
260  void drawToBackground(int spriteId, int frameId, Common::Point pos, int depth, int scale);
261  void deleteSequence(int idx);
262  void loadSpeech(int idx);
263  void playSpeech(int idx);
264  void sceneScale(int yFront, int maxScale, int yBack, int minScale);
265  void animations_tick();
266 
267  int _speechReady;
268 };
269 
270 } // End of namespace MADS
271 
272 #endif /* MADS_SCENE_H */
Definition: screen.h:97
Definition: str.h:59
void loadScene(int sceneId, const Common::Path &prefix, bool palFlag)
Definition: action.h:103
Definition: array.h:52
void addActiveVocab(int vocabId)
void changeVariant(int variant)
int loadAnimation(const Common::Path &resName, int trigger=0)
Definition: path.h:52
uint32 getVocabStringsCount() const
Definition: rails.h:56
Definition: hotspots.h:120
Definition: serializer.h:79
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
void loadHotspots()
void synchronize(Common::Serializer &s)
void loadVocab()
void freeCurrentScene()
void freeAnimation()
Definition: msurface.h:184
Definition: rect.h:45
Definition: scene_data.h:141
Definition: scene.h:44
Definition: hotspots.h:71
Definition: mads.h:87
Definition: scene_data.h:73
void animatePalette()
Definition: sprites.h:149
Definition: sequence.h:89
void clearSequenceList()
Definition: user_interface.h:132
Definition: action.h:28
void removeSprites()
Scene(MADSEngine *vm)
void clearVocab()
Definition: messages.h:150
Common::String getVocab(int vocabId)
Definition: scene.h:220
void drawElements(ScreenTransition transitionType, bool surfaceFlag)
Definition: msurface.h:172
Definition: animation.h:140
Definition: sprites.h:200
void loadSceneLogic()
Definition: messages.h:87
void clearMessageList()