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/nebular/core/assets.h"
29 #include "mads/nebular/core/screen.h"
30 #include "mads/nebular/core/hotspots.h"
31 #include "mads/nebular/core/messages.h"
32 #include "mads/nebular/core/msurface.h"
33 #include "mads/nebular/core/scene_data.h"
34 #include "mads/nebular/core/animation.h"
35 #include "mads/nebular/core/rails.h"
36 #include "mads/nebular/core/sequence.h"
37 #include "mads/nebular/core/sprites.h"
38 #include "mads/nebular/core/user_interface.h"
39 
40 namespace MADS {
41 namespace Nebular {
42 
43 enum {
44  RETURNING_FROM_DIALOG = -2, RETURNING_FROM_LOADING = -1
45 };
46 
47 class Scene {
48 private:
52  int activeVocabIndexOf(int vocabId);
53 
57  void loadVocabStrings();
58 
62  void doFrame();
63 
64  void doPreactions();
65 
66  void doAction();
67 
71  void doSceneStep();
72 
76  void checkKeyboard();
77 
81  void updateCursor();
82 protected:
83  RexNebularEngine *_vm;
84 public:
85  SceneLogic *_sceneLogic;
86  MSurface _sceneSurface;
87  int _priorSceneId;
88  int _nextSceneId;
89  int _currentSceneId;
90  Common::Array<VerbInit> _verbList;
91  TextDisplayList _textDisplay;
92  SpriteSlots _spriteSlots;
93  SpriteSets _sprites;
94  DynamicHotspots _dynamicHotspots;
95  Common::Array<int> _activeVocabs;
96  SequenceList _sequences;
97  KernelMessages _kernelMessages;
98  Rails _rails;
99  Common::String _talkFont;
100  int _textSpacing;
101  Hotspots _hotspots;
102  DirtyAreas _dirtyAreas;
103  int _variant;
104  SceneInfo *_sceneInfo;
105  MSurface _backgroundSurface;
106  DepthSurface _depthSurface;
107  UserInterface _userInterface;
108  bool _cyclingActive;
109  int _cyclingThreshold;
110  int _cyclingDelay;
111  int _totalCycleColors;
112  Common::Array<uint32> _cycleTicks;
113  Common::Array<PaletteCycle> _paletteCycles;
114  Common::StringArray _vocabStrings;
115  Animation *_animationData;
116  Animation *_animation[10];
117  bool _freeAnimationFlag;
118  int _depthStyle;
119  int _bandsRange;
120  int _scaleRange;
121  int _interfaceY;
122  int _spritesCount;
123  MADSAction _action;
124  bool _roomChanged;
125  bool _reloadSceneFlag;
126  Common::Point _posAdjust;
127  uint32 _frameStartTime;
128  ScreenMode _mode;
129  bool _lookFlag;
130  Common::Point _customDest;
132  Common::Array<PaletteUsage::UsageEntry> _scenePaletteUsage;
136  Scene(RexNebularEngine *vm);
137 
141  ~Scene();
142 
143  void restrictScene();
144 
148  void clearVocab();
149 
153  void addActiveVocab(int vocabId);
154 
158  uint32 getVocabStringsCount() const;
159 
163  void clearSequenceList();
164 
168  void clearMessageList();
169 
173  void loadSceneLogic();
174 
181  void loadScene(int sceneId, const Common::Path &prefix, bool palFlag);
182 
186  void loadHotspots();
187 
191  void loadVocab();
192 
193  bool getDepthHighBits(const Common::Point &pt);
194 
198  void loop();
199 
203  void drawElements(ScreenTransition transitionType, bool surfaceFlag);
204 
205  /*
206  * Initializes the data for palette animation within the scene
207  */
208  void initPaletteAnimation(Common::Array<PaletteCycle> &palCycles, bool animFlag);
209 
213  void animatePalette();
214 
218  int loadAnimation(const Common::Path &resName, int trigger = 0);
219 
223  Common::String getVocab(int vocabId) {
224  return _vocabStrings[vocabId - 1];
225  }
226 
230  void freeCurrentScene();
231 
235  void changeVariant(int variant);
236 
237  void resetScene();
238 
243  void removeSprites();
244 
248  void freeAnimation();
249 
253  void freeAnimation(int idx);
254 
259 
260  void setAnimFrame(int id, int val);
261  int getAnimFrame(int id);
262 
263  void setDynamicAnim(int id, int anim_id, int segment);
264  void setCamera(Common::Point pos);
265  void drawToBackground(int spriteId, int frameId, Common::Point pos, int depth, int scale);
266  void deleteSequence(int idx);
267  void loadSpeech(int idx);
268  void playSpeech(int idx);
269  void sceneScale(int yFront, int maxScale, int yBack, int minScale);
270  void animations_tick();
271 
272  int _speechReady;
273 };
274 
275 } // namespace Nebular
276 } // namespace MADS
277 
278 #endif
Common::String getVocab(int vocabId)
Definition: scene.h:223
void synchronize(Common::Serializer &s)
void loadScene(int sceneId, const Common::Path &prefix, bool palFlag)
Definition: str.h:59
Definition: nebular.h:51
Definition: action.h:106
Definition: array.h:52
int loadAnimation(const Common::Path &resName, int trigger=0)
Definition: msurface.h:203
Definition: hotspots.h:125
Definition: sprites.h:201
Definition: path.h:52
Definition: scene_data.h:75
Definition: screen.h:99
Definition: sprites.h:150
Definition: serializer.h:80
void addActiveVocab(int vocabId)
uint32 getVocabStringsCount() const
Definition: animation.h:141
void changeVariant(int variant)
void drawElements(ScreenTransition transitionType, bool surfaceFlag)
Definition: user_interface.h:136
Scene(RexNebularEngine *vm)
Definition: scene.h:47
Definition: messages.h:153
Definition: rect.h:144
Definition: rails.h:57
Definition: sound_manager.h:38
Definition: scene_data.h:149
Definition: hotspots.h:72
Definition: msurface.h:188
Definition: messages.h:90
Definition: sequence.h:92