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
36namespace Graphics {
37struct Surface;
38}
39
40namespace Buried {
41
42class AVIFrames;
43class SceneBase;
44class VideoWindow;
45
46enum Direction {
47 kDirectionUp = 0,
48 kDirectionLeft = 1,
49 kDirectionRight = 2,
50 kDirectionDown = 3,
51 kDirectionForward = 4
52};
53
54class SceneViewWindow : public Window {
55public:
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 onActionEnd(const Common::CustomEventType &action, uint flags);
144 void onKeyUp(const Common::KeyState &key, uint flags);
145
146 bool isScenePresent() { return _currentScene != 0; }
147 int draggingItem(int itemID, const Common::Point &pointLocation, int itemFlags);
148 int droppedItem(int itemID, const Common::Point &pointLocation, int itemFlags);
149
150 bool updatePrebufferWithSprite(Sprite &spriteData);
151 bool changeSpriteStatus(bool status);
152 bool resetCursor();
153
154 bool displayLiveText(const Common::String &text = "", bool notifyUser = true);
155 bool displayTranslationText(const Common::String &text);
156
157 bool resetNavigationArrows();
158
159 bool startEnvironmentAmbient(int oldTimeZone = -1, int oldEnvironment = -1, int timeZone = -1, int environment = -1, bool fade = true);
160 bool checkCustomAICommentDependencies(const Location &commentLocation, const AIComment &commentData);
161
162 const SceneBase *getCurrentScene() const { return _currentScene; }
163
164 Common::Array<AIComment> getAICommentDatabase(int timeZone, int environment);
165
166private:
167 Graphics::Surface *_preBuffer;
168 SceneBase *_currentScene;
169 Common::Array<LocationStaticData> _currentNavigationDatabase;
170 GlobalFlags _globalFlags;
171 VideoWindow *_walkMovie;
172
173 Common::Path _walkMovieFileName;
174
175 AVIFrames *_stillFrames;
176 AVIFrames *_cycleFrames;
177 Common::Point _curMousePos;
178 int _curCursor;
179 Sprite _currentSprite;
180 int _currentAmbient;
181 bool _useScenePaint;
182 bool _useSprite;
183 bool _cycleEnabled, _forceCycleEnabled;
184 uint _timer;
185
186 bool _infoWindowDisplayed;
187 bool _bioChipWindowDisplayed;
188 bool _burnedLetterDisplayed;
189
190 VideoWindow *_asyncMovie;
191 Common::Path _asyncMovieFileName;
192 int _asyncMovieStartFrame;
193 int _asyncMovieFrameCount;
194 bool _loopAsyncMovie;
195
196 Common::Path _lastAICommentFileName;
197
198 // Special sound handling for the demo
199 uint _demoSoundTimer;
200 int _demoSoundEffectHandle;
201 void startDemoAmbientSound();
202
203 void handleCyclingChange();
204
205 bool initializeTimeZoneAndEnvironment(Window *viewWindow, int timeZone, int environment);
206 SceneBase *constructSceneObject(Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation);
207
208 Common::Array<AnimEvent> getAnimationDatabase(int timeZone, int environment);
209
210 bool moveToDestination(const DestinationScene &destinationData, int navFrame);
211
212 // AI Lab
213 bool initializeAILabTimeZoneAndEnvironment(Window *viewWindow, int environment);
214 bool startAILabAmbient(int oldTimeZone, int oldEnvironment, int environment, bool fade);
215 SceneBase *constructAILabSceneObject(Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation);
216 bool checkCustomSpaceStationAICommentDependencies(const Location &commentLocation, const AIComment &commentData);
217
218 // Castle
219 bool initializeCastleTimeZoneAndEnvironment(Window *viewWindow, int environment);
220 bool startCastleAmbient(int oldTimeZone, int oldEnvironment, int environment, bool fade);
221 SceneBase *constructCastleSceneObject(Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation);
222 bool checkCustomCastleAICommentDependencies(const Location &commentLocation, const AIComment &commentData);
223
224 // Da Vinci's Studio
225 bool initializeDaVinciTimeZoneAndEnvironment(Window *viewWindow, int environment);
226 bool startDaVinciAmbient(int oldTimeZone, int oldEnvironment, int environment, bool fade);
227 SceneBase *constructDaVinciSceneObject(Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation);
228 bool checkCustomDaVinciAICommentDependencies(const Location &commentLocation, const AIComment &commentData);
229
230 // Future Apartment
231 bool startFutureApartmentAmbient(int oldTimeZone, int oldEnvironment, int environment, bool fade);
232 SceneBase *constructFutureApartmentSceneObject(Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation);
233
234 // Mayan
235 bool initializeMayanTimeZoneAndEnvironment(Window *viewWindow, int environment);
236 bool startMayanAmbient(int oldTimeZone, int oldEnvironment, int environment, bool fade);
237 SceneBase *constructMayanSceneObject(Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation);
238 bool checkCustomMayanAICommentDependencies(const Location &commentLocation, const AIComment &commentData);
239
240 // Agent 3's Lair
241 bool initializeAgent3LairTimeZoneAndEnvironment(Window *viewWindow, int environment);
242 bool startAgent3LairAmbient(int oldTimeZone, int oldEnvironment, int environment, bool fade);
243 SceneBase *constructAgent3LairSceneObject(Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation);
244
245 // Alien
246 bool initializeAlienTimeZoneAndEnvironment(Window *viewWindow, int environment);
247 bool startAlienAmbient(int oldTimeZone, int oldEnvironment, int environment, bool fade);
248 SceneBase *constructAlienSceneObject(Window *viewWindow, const LocationStaticData &sceneStaticData, const Location &priorLocation);
249
250 byte *aiFlag(uint16 offset);
251 byte getAIFlag(uint16 offset);
252 void setAIFlag(uint16 offset, byte value);
253};
254
255} // End of namespace Buried
256
257#endif
Definition: avi_frames.h:42
Definition: buried.h:96
Definition: scene_base.h:76
Definition: scene_view.h:54
Definition: video_window.h:37
Definition: window.h:38
Definition: array.h:52
Definition: path.h:52
Definition: str.h:59
uint32 CustomEventType
Definition: events.h:212
Definition: formatinfo.h:28
Definition: aidata.h:54
Definition: navdata.h:59
Definition: global_flags.h:35
Definition: navdata.h:32
Definition: navdata.h:72
Definition: sprtdata.h:36
Definition: keyboard.h:294
Definition: rect.h:144
Definition: surface.h:67