ScummVM API documentation
scene_view.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  * Additional copyright for this file:
8  * Copyright (C) 1995 Presto Studios, Inc.
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14 
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19 
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  *
23  */
24 
25 #ifndef BURIED_SCENE_VIEW_H
26 #define BURIED_SCENE_VIEW_H
27 
28 #include "buried/aidata.h"
29 #include "buried/animdata.h"
30 #include "buried/global_flags.h"
31 #include "buried/sprtdata.h"
32 #include "buried/window.h"
33 
34 #include "common/array.h"
35 
36 namespace Graphics {
37 struct Surface;
38 }
39 
40 namespace Buried {
41 
42 class AVIFrames;
43 class SceneBase;
44 class VideoWindow;
45 
46 enum Direction {
47  kDirectionUp = 0,
48  kDirectionLeft = 1,
49  kDirectionRight = 2,
50  kDirectionDown = 3,
51  kDirectionForward = 4
52 };
53 
54 class SceneViewWindow : public Window {
55 public:
56  SceneViewWindow(BuriedEngine *vm, Window *parent);
57  ~SceneViewWindow();
58 
59  bool _paused;
60  bool _disableArthur;
61 
62  bool startNewGame(bool walkthrough = false);
63  bool startNewGameIntro(bool walkthrough = false);
64  bool startNewGame(const Location &startingLocation);
65  bool showDeathScene(int deathSceneIndex);
66  bool showCompletionScene();
67 
68  bool getSceneStaticData(const Location &location, LocationStaticData &sceneStaticData);
69  GlobalFlags &getGlobalFlags() { return _globalFlags; }
70  bool getCurrentSceneLocation(Location &curLocation);
71 
72  bool jumpToScene(const Location &newLocation);
73  bool jumpToSceneRestore(const Location &newLocation);
74  bool moveInDirection(Direction direction);
75  bool moveToDestination(const DestinationScene &destinationData);
76  bool timeSuitJump(int destination);
77 
78  bool playTransition(const DestinationScene &destinationData, int navFrame);
79  bool videoTransition(const Location &location, DestinationScene destinationData, int navFrame);
80  bool walkTransition(const Location &location, const DestinationScene &destinationData, int navFrame);
81  bool pushTransition(Graphics::Surface *curBackground, Graphics::Surface *newBackground, int direction, uint stripSize, int totalTime);
82  bool pushNewTransition(Graphics::Surface *newBackground, int direction, int stripSize, int totalTime);
83  bool slideInTransition(Graphics::Surface *newBackground, int direction, int stripSize, int totalTime);
84  bool slideOutTransition(Graphics::Surface *newBackground, int direction, int stripSize, int totalTime);
85 
86  bool changeStillFrameMovie(const Common::Path &fileName = Common::Path());
87  bool changeCycleFrameMovie(const Common::Path &fileName = Common::Path());
88 
89  Graphics::Surface *getStillFrameCopy(int frameIndex);
90  const Graphics::Surface *getStillFrame(int frameIndex);
91  Graphics::Surface *getCycleFrameCopy(int frameIndex);
92  const Graphics::Surface *getCycleFrame(int frameIndex);
93  bool enableCycleFrameCache(bool enable);
94  bool flushCycleFrameCache();
95  bool enableCycling(bool enable);
96  bool forceEnableCycling(bool enable);
97  bool getCyclingStatus() const { return _cycleEnabled; }
98  bool isCyclingEnabled() const { return _cycleEnabled || _forceCycleEnabled; }
99  bool closeCycleFrameMovie();
100 
101  bool addNumberToGlobalFlagTable(byte numberToAdd);
102  byte getNumberFromGlobalFlagTable(int tableIndex);
103  bool isNumberInGlobalFlagTable(byte numberToCheck);
104 
105  bool playSynchronousAnimation(int animationID);
106  bool playSynchronousAnimationExtern(int animationID);
107  bool playPlacedSynchronousAnimation(int animationID, int left, int top);
108  bool playClippedSynchronousAnimation(int animationID, int left, int top, int right, int bottom);
109 
110  bool startAsynchronousAnimation(int animationID, bool loopAnimation);
111  bool startAsynchronousAnimation(int fileNameID, int startPosition, int playStartPosition, int frameCount, bool loopAnimation);
112  bool startAsynchronousAnimationExtern(int fileNameID, int startPosition, int playStartPosition, int frameCount, bool loopAnimation);
113  bool stopAsynchronousAnimation();
114  bool isAsynchronousAnimationStillPlaying();
115  int getAsynchronousAnimationCurrentPosition();
116  bool asynchronousAnimationTimerCallback();
117  bool startPlacedAsynchronousAnimation(int left, int top, int width, int height, int animationID, bool loopAnimation);
118  bool startPlacedAsynchronousAnimation(int left, int top, int width, int height, int fileNameID, int startPosition, int playStartPosition, int frameCount, bool loopAnimation);
119  bool startPlacedAsynchronousAnimationExtern(int left, int top, int width, int height, int fileNameID, int startPosition, int playStartPosition, int frameCount, bool loopAnimation);
120 
121  bool retrieveAICommentEntry(const Location &commentLocation, int commentType, const Common::Array<AIComment> &commentDatabase, int &lastFoundEntry, AIComment &currentCommentData);
122  bool checkAICommentDependencies(const Location &commentLocation, const AIComment &commentData);
123  bool playAICommentFromData(const AIComment &commentData);
124  bool playAIComment(int commentType);
125  bool playAIComment(const Location &commentLocation, int commentType);
126  bool checkForAIComment(int commentType);
127  bool checkForAIComment(const Location &commentLocation, int commentType);
128 
129  bool infoWindowDisplayed(bool flag);
130  bool bioChipWindowDisplayed(bool flag);
131  bool burnedLetterWindowDisplayed(bool flag);
132  bool isAuxWindowDisplayed();
133 
134  void onPaint();
135  void onTimer(uint timer);
136  bool onSetCursor(uint message);
137  void onEnable(bool enable);
138 
139  void onLButtonDown(const Common::Point &point, uint flags);
140  void onLButtonUp(const Common::Point &point, uint flags);
141  void onMouseMove(const Common::Point &point, uint flags);
142 
143  void onKeyUp(const Common::KeyState &key, uint flags);
144 
145  bool isScenePresent() { return _currentScene != 0; }
146  int draggingItem(int itemID, const Common::Point &pointLocation, int itemFlags);
147  int droppedItem(int itemID, const Common::Point &pointLocation, int itemFlags);
148 
149  bool updatePrebufferWithSprite(Sprite &spriteData);
150  bool changeSpriteStatus(bool status);
151  bool resetCursor();
152 
153  bool displayLiveText(const Common::String &text = "", bool notifyUser = true);
154  bool displayTranslationText(const Common::String &text);
155 
156  bool resetNavigationArrows();
157 
158  bool startEnvironmentAmbient(int oldTimeZone = -1, int oldEnvironment = -1, int timeZone = -1, int environment = -1, bool fade = true);
159  bool checkCustomAICommentDependencies(const Location &commentLocation, const AIComment &commentData);
160 
161  const SceneBase *getCurrentScene() const { return _currentScene; }
162 
163  Common::Array<AIComment> getAICommentDatabase(int timeZone, int environment);
164 
165 private:
166  Graphics::Surface *_preBuffer;
167  SceneBase *_currentScene;
168  Common::Array<LocationStaticData> _currentNavigationDatabase;
169  GlobalFlags _globalFlags;
170  VideoWindow *_walkMovie;
171 
172  Common::Path _walkMovieFileName;
173 
174  AVIFrames *_stillFrames;
175  AVIFrames *_cycleFrames;
176  Common::Point _curMousePos;
177  int _curCursor;
178  Sprite _currentSprite;
179  int _currentAmbient;
180  bool _useScenePaint;
181  bool _useSprite;
182  bool _cycleEnabled, _forceCycleEnabled;
183  uint _timer;
184 
185  bool _infoWindowDisplayed;
186  bool _bioChipWindowDisplayed;
187  bool _burnedLetterDisplayed;
188 
189  VideoWindow *_asyncMovie;
190  Common::Path _asyncMovieFileName;
191  int _asyncMovieStartFrame;
192  int _asyncMovieFrameCount;
193  bool _loopAsyncMovie;
194 
195  Common::Path _lastAICommentFileName;
196 
197  // Special sound handling for the demo
198  uint _demoSoundTimer;
199  int _demoSoundEffectHandle;
200  void startDemoAmbientSound();
201 
202  void handleCyclingChange();
203 
204  bool initializeTimeZoneAndEnvironment(Window *viewWindow, int timeZone, int environment);
205  SceneBase *constructSceneObject(Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation);
206 
207  Common::Array<AnimEvent> getAnimationDatabase(int timeZone, int environment);
208 
209  bool moveToDestination(const DestinationScene &destinationData, int navFrame);
210 
211  // AI Lab
212  bool initializeAILabTimeZoneAndEnvironment(Window *viewWindow, int environment);
213  bool startAILabAmbient(int oldTimeZone, int oldEnvironment, int environment, bool fade);
214  SceneBase *constructAILabSceneObject(Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation);
215  bool checkCustomSpaceStationAICommentDependencies(const Location &commentLocation, const AIComment &commentData);
216 
217  // Castle
218  bool initializeCastleTimeZoneAndEnvironment(Window *viewWindow, int environment);
219  bool startCastleAmbient(int oldTimeZone, int oldEnvironment, int environment, bool fade);
220  SceneBase *constructCastleSceneObject(Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation);
221  bool checkCustomCastleAICommentDependencies(const Location &commentLocation, const AIComment &commentData);
222 
223  // Da Vinci's Studio
224  bool initializeDaVinciTimeZoneAndEnvironment(Window *viewWindow, int environment);
225  bool startDaVinciAmbient(int oldTimeZone, int oldEnvironment, int environment, bool fade);
226  SceneBase *constructDaVinciSceneObject(Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation);
227  bool checkCustomDaVinciAICommentDependencies(const Location &commentLocation, const AIComment &commentData);
228 
229  // Future Apartment
230  bool startFutureApartmentAmbient(int oldTimeZone, int oldEnvironment, int environment, bool fade);
231  SceneBase *constructFutureApartmentSceneObject(Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation);
232 
233  // Mayan
234  bool initializeMayanTimeZoneAndEnvironment(Window *viewWindow, int environment);
235  bool startMayanAmbient(int oldTimeZone, int oldEnvironment, int environment, bool fade);
236  SceneBase *constructMayanSceneObject(Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation);
237  bool checkCustomMayanAICommentDependencies(const Location &commentLocation, const AIComment &commentData);
238 
239  // Agent 3's Lair
240  bool initializeAgent3LairTimeZoneAndEnvironment(Window *viewWindow, int environment);
241  bool startAgent3LairAmbient(int oldTimeZone, int oldEnvironment, int environment, bool fade);
242  SceneBase *constructAgent3LairSceneObject(Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation);
243 
244  // Alien
245  bool initializeAlienTimeZoneAndEnvironment(Window *viewWindow, int environment);
246  bool startAlienAmbient(int oldTimeZone, int oldEnvironment, int environment, bool fade);
247  SceneBase *constructAlienSceneObject(Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation);
248 
249  byte *aiFlag(uint16 offset);
250  byte getAIFlag(uint16 offset);
251  void setAIFlag(uint16 offset, byte value);
252 };
253 
254 } // End of namespace Buried
255 
256 #endif
Definition: window.h:37
Definition: str.h:59
Definition: surface.h:67
Definition: avi_frames.h:42
Definition: array.h:52
Definition: global_flags.h:35
Definition: path.h:52
Definition: navdata.h:72
Definition: aidata.h:54
Definition: buried.h:67
Definition: navdata.h:59
Definition: agent_evaluation.h:31
Definition: video_window.h:37
Definition: formatinfo.h:28
Definition: sprtdata.h:36
Definition: rect.h:45
Definition: navdata.h:32
Definition: keyboard.h:294
Definition: scene_view.h:54
Definition: scene_base.h:76