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 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (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, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef ULTIMA_SHARED_EARLY_ULTIMA_EARLY_H 24 #define ULTIMA_SHARED_EARLY_ULTIMA_EARLY_H 25 26 #include "common/scummsys.h" 27 #include "common/array.h" 28 #include "common/endian.h" 29 #include "common/hash-str.h" 30 #include "common/serializer.h" 31 #include "common/random.h" 32 #include "common/savefile.h" 33 #include "common/util.h" 34 #include "graphics/surface.h" 35 #include "engines/engine.h" 36 #include "ultima/detection.h" 37 38 #include "ultima/shared/engine/ultima.h" 39 40 namespace Ultima { 41 42 struct UltimaGameDescription; 43 44 namespace Shared { 45 46 struct UltimaSavegameHeader { 47 uint8 _version; 48 uint8 _gameId; 49 uint8 _language; 50 uint8 _videoMode; 51 Common::String _saveName; 52 Graphics::Surface *_thumbnail; 53 int _year, _month, _day; 54 int _hour, _minute; 55 int _totalFrames; 56 }; 57 58 class Debugger; 59 class Events; 60 class Game; 61 class GameBase; 62 class MouseCursor; 63 class Resources; 64 65 namespace Gfx { 66 class Screen; 67 } 68 69 class UltimaEarlyEngine : public UltimaEngine { 70 private: 71 /** 72 * Initialize the engine 73 */ 74 bool initialize() override; 75 76 /** 77 * Deinitialize the engine 78 */ 79 80 void deinitialize() override; 81 82 /** 83 * Returns the data archive folder and version that's required 84 */ 85 bool isDataRequired(Common::String &folder, int &majorVersion, int &minorVersion) override; 86 public: 87 GameBase *_game; 88 MouseCursor *_mouseCursor; 89 Gfx::Screen *_screen; 90 public: 91 UltimaEarlyEngine(OSystem *syst, const UltimaGameDescription *gameDesc); 92 ~UltimaEarlyEngine() override; 93 94 /** 95 * Main method for running the game 96 */ 97 Common::Error run() override; 98 99 /** 100 * Play the game 101 */ 102 void playGame(); 103 104 /** 105 * Get the screen 106 */ 107 Graphics::Screen *getScreen() const override; 108 /** 109 * Indicates whether a game state can be loaded. 110 * @param isAutosave Flags whether it's an autosave check 111 */ 112 bool canLoadGameStateCurrently(bool isAutosave) override; 113 114 /** 115 * Indicates whether a game state can be saved. 116 * @param isAutosave Flags whether it's an autosave check 117 */ 118 bool canSaveGameStateCurrently(bool isAutosave) override; 119 120 /** 121 * Load a savegame 122 */ 123 Common::Error loadGameStream(Common::SeekableReadStream *stream) override; 124 125 /** 126 * Save a game state. 127 */ 128 Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override; 129 130 /* 131 * Creates a new hierarchy for the game, that contains all the logic for playing that particular game. 132 */ 133 Game *createGame() const; 134 }; 135 136 } // End of namespace Shared 137 138 extern Shared::UltimaEarlyEngine *g_vm; 139 140 } // End of namespace Ultima 141 142 #endif 143