ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

myst3.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the AUTHORS
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef MYST3_ENGINE_H
00024 #define MYST3_ENGINE_H
00025 
00026 #include "engines/engine.h"
00027 
00028 #include "common/array.h"
00029 #include "common/ptr.h"
00030 #include "common/system.h"
00031 #include "common/random.h"
00032 
00033 #include "engines/myst3/archive.h"
00034 
00035 namespace Graphics {
00036 struct Surface;
00037 }
00038 
00039 namespace Common {
00040 struct Event;
00041 }
00042 
00043 namespace Myst3 {
00044 
00045 // Engine Debug Flags
00046 enum {
00047     kDebugVariable = (1 << 0),
00048     kDebugSaveLoad = (1 << 1),
00049     kDebugNode     = (1 << 2),
00050     kDebugScript   = (1 << 3)
00051 };
00052 
00053 enum TransitionType {
00054     kTransitionFade = 1,
00055     kTransitionNone,
00056     kTransitionZip,
00057     kTransitionLeftToRight,
00058     kTransitionRightToLeft
00059 };
00060 
00061 class Archive;
00062 class Console;
00063 class Drawable;
00064 class GameState;
00065 class HotSpot;
00066 class Cursor;
00067 class Inventory;
00068 class Database;
00069 class Scene;
00070 class Script;
00071 class SpotItemFace;
00072 class SunSpot;
00073 class Renderer;
00074 class Menu;
00075 class Node;
00076 class Sound;
00077 class Ambient;
00078 class ScriptedMovie;
00079 class ShakeEffect;
00080 class RotationEffect;
00081 class Transition;
00082 class FrameLimiter;
00083 struct NodeData;
00084 struct Myst3GameDescription;
00085 
00086 typedef Common::SharedPtr<NodeData> NodePtr;
00087 
00088 class Myst3Engine : public Engine {
00089 
00090 protected:
00091     // Engine APIs
00092     virtual Common::Error run() override;
00093     virtual void syncSoundSettings() override;
00094     virtual void pauseEngineIntern(bool pause) override;
00095 
00096 public:
00097     GameState *_state;
00098     Scene *_scene;
00099     Cursor *_cursor;
00100     Inventory *_inventory;
00101     Renderer *_gfx;
00102     Menu *_menu;
00103     Database *_db;
00104     Sound *_sound;
00105     Ambient *_ambient;
00106     
00107     Common::RandomSource *_rnd;
00108 
00109     // Used by the projectors on J'nanin, see puzzle #14
00110     Graphics::Surface *_projectorBackground;
00111 
00112     Myst3Engine(OSystem *syst, const Myst3GameDescription *version);
00113     virtual ~Myst3Engine();
00114 
00115     bool hasFeature(EngineFeature f) const override;
00116     Common::Platform getPlatform() const;
00117     Common::Language getGameLanguage() const;
00118     uint32 getGameLocalizationType() const;
00119     bool isTextLanguageEnglish() const;
00120     bool isWideScreenModEnabled() const;
00121 
00122     bool canSaveGameStateCurrently() override;
00123     bool canLoadGameStateCurrently() override;
00124     Common::Error loadGameState(int slot) override;
00125     Common::Error loadGameState(Common::String fileName, TransitionType transition);
00126     Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
00127     Common::Error saveGameState(const Common::String &desc, const Graphics::Surface *thumbnail, bool isAutosave);
00128 
00129     ResourceDescription getFileDescription(const Common::String &room, uint32 index, uint16 face,
00130                                                 Archive::ResourceType type);
00131     ResourceDescriptionArray listFilesMatching(const Common::String &room, uint32 index, uint16 face,
00132                                             Archive::ResourceType type);
00133 
00134     Graphics::Surface *loadTexture(uint16 id);
00135     static Graphics::Surface *decodeJpeg(const ResourceDescription *jpegDesc);
00136 
00137     void goToNode(uint16 nodeID, TransitionType transition);
00138     void loadNode(uint16 nodeID, uint32 roomID = 0, uint32 ageID = 0);
00139     void unloadNode();
00140     void loadNodeCubeFaces(uint16 nodeID);
00141     void loadNodeFrame(uint16 nodeID);
00142     void loadNodeMenu(uint16 nodeID);
00143 
00144     void setupTransition();
00145     void drawTransition(TransitionType transitionType);
00146 
00147     void dragItem(uint16 statusVar, uint16 movie, uint16 frame, uint16 hoverFrame, uint16 itemVar);
00148     void dragSymbol(uint16 var, uint16 id);
00149     int16 openDialog(uint16 id);
00150 
00151     void runNodeInitScripts();
00152     void runNodeBackgroundScripts();
00153     void runScriptsFromNode(uint16 nodeID, uint32 roomID = 0, uint32 ageID = 0);
00154     void runBackgroundSoundScriptsFromNode(uint16 nodeID, uint32 roomID = 0, uint32 ageID = 0);
00155     void runAmbientScripts(uint32 node);
00156 
00157     void loadMovie(uint16 id, uint16 condition, bool resetCond, bool loop);
00158     void playMovieGoToNode(uint16 movie, uint16 node);
00159     void playMovieFullFrame(uint16 movie);
00160     void playSimpleMovie(uint16 id, bool fullframe = false, bool refreshAmbientSounds = false);
00161     void removeMovie(uint16 id);
00162     void setMovieLooping(uint16 id, bool loop);
00163 
00164     void addSpotItem(uint16 id, int16 condition, bool fade);
00165     SpotItemFace *addMenuSpotItem(uint16 id, int16 condition, const Common::Rect &rect);
00166     void loadNodeSubtitles(uint32 id);
00167 
00168     void addSunSpot(uint16 pitch, uint16 heading, uint16 intensity,
00169             uint16 color, uint16 var, bool varControlledIntensity, uint16 radius);
00170     SunSpot computeSunspotsIntensity(float pitch, float heading);
00171 
00172     void setMenuAction(uint16 action) { _menuAction = action; }
00173 
00174     void animateDirectionChange(float pitch, float heading, uint16 scriptTicks);
00175     void getMovieLookAt(uint16 id, bool start, float &pitch, float &heading);
00176 
00177     void drawFrame(bool noSwap = false);
00178 
00179     void processInput(bool interactive);
00180     void processEventForKeyboardState(const Common::Event &event);
00181     void processEventForGamepad(const Common::Event &event);
00182     void updateInputState();
00183 
00184     bool inputValidatePressed();
00185     bool inputEscapePressed();
00186     bool inputSpacePressed();
00187     bool inputTilePressed();
00188 
00189     void settingsInitDefaults();
00190     void settingsLoadToVars();
00191     void settingsApplyFromVars();
00192 
00193 private:
00194     OSystem *_system;
00195     const Myst3GameDescription *_gameDescription;
00196 
00197     Node *_node;
00198 
00199     Common::Array<Archive *> _archivesCommon;
00200     Archive *_archiveNode;
00201 
00202     Script *_scriptEngine;
00203 
00204     Common::Array<ScriptedMovie *> _movies;
00205     Common::Array<SunSpot *> _sunspots;
00206     Common::Array<Drawable *> _drawables;
00207 
00208     uint16 _menuAction;
00209 
00210     // Used by Amateria's magnetic rings
00211     ShakeEffect *_shakeEffect;
00212     // Used by Voltaic's spinning gears
00213     RotationEffect *_rotationEffect;
00214 
00215     FrameLimiter *_frameLimiter;
00216     Transition *_transition;
00217 
00218     bool _inputSpacePressed;
00219     bool _inputEnterPressed;
00220     bool _inputEscapePressed;
00221     bool _inputEscapePressedNotConsumed;
00222     bool _inputTildePressed;
00223 
00224     bool _interactive;
00225 
00226     uint32 _backgroundSoundScriptLastRoomId;
00227     uint32 _backgroundSoundScriptLastAgeId;
00228 
00235     bool _inventoryManualHide;
00236 
00237     HotSpot *getHoveredHotspot(NodePtr nodeData, uint16 var = 0);
00238     void updateCursor();
00239 
00240     bool checkDatafiles();
00241 
00242     bool addArchive(const Common::String &file, bool mandatory);
00243     void openArchives();
00244     void closeArchives();
00245 
00246     bool isInventoryVisible();
00247 
00248     void interactWithHoveredElement();
00249 
00250     friend class Console;
00251 };
00252 
00253 } // end of namespace Myst3
00254 
00255 #endif


Generated on Sat Sep 12 2020 05:01:23 for ResidualVM by doxygen 1.7.1
curved edge   curved edge