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