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 SUPERNOVA_SUPERNOVA_H 24 #define SUPERNOVA_SUPERNOVA_H 25 26 #include "common/array.h" 27 #include "common/events.h" 28 #include "common/random.h" 29 #include "common/scummsys.h" 30 #include "engines/engine.h" 31 #include "common/file.h" 32 33 #include "supernova/console.h" 34 #include "supernova/graphics.h" 35 #include "supernova/msn_def.h" 36 #include "supernova/room.h" 37 #include "supernova/sound.h" 38 #include "supernova/imageid.h" 39 #include "supernova/game-manager.h" 40 41 namespace Common { 42 class MemoryReadWriteStream; 43 } 44 45 namespace Supernova { 46 47 #define SAVEGAME_HEADER MKTAG('M','S','N','1') 48 #define SAVEGAME_HEADER2 MKTAG('M','S','N','2') 49 #define SAVEGAME_VERSION 10 50 51 #define SUPERNOVA_DAT "supernova.dat" 52 #define SUPERNOVA_DAT_VERSION 4 53 54 class GuiElement; 55 class ResourceManager; 56 class Sound; 57 class console; 58 class GameManager; 59 class GameManager1; 60 class Screen; 61 62 class SupernovaEngine : public Engine { 63 public: 64 explicit SupernovaEngine(OSystem *syst); 65 ~SupernovaEngine() override; 66 67 Common::Error run() override; 68 Common::Error loadGameState(int slot) override; 69 bool canLoadGameStateCurrently() override; 70 Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override; 71 bool canSaveGameStateCurrently() override; 72 bool hasFeature(EngineFeature f) const override; 73 void pauseEngineIntern(bool pause) override; 74 75 GameManager *_gm; 76 Sound *_sound; 77 ResourceManager *_resMan; 78 Screen *_screen; 79 bool _allowLoadGame; 80 bool _allowSaveGame; 81 Common::StringArray _gameStrings; 82 Common::String _nullString; 83 int _sleepAuoSaveVersion; 84 Common::MemoryReadWriteStream* _sleepAutoSave; 85 86 uint _delay; 87 int _textSpeed; 88 char _MSPart; 89 bool _improved; 90 91 Common::Error loadGameStrings(); 92 void init(); 93 virtual Common::String getSaveStateName(int slot) const override; 94 bool loadGame(int slot); 95 bool saveGame(int slot, const Common::String &description); 96 bool serialize(Common::WriteStream *out); 97 bool deserialize(Common::ReadStream *in, int version); 98 bool quitGameDialog(); 99 void errorTempSave(bool saving); 100 void setTextSpeed(); 101 const Common::String &getGameString(int idx) const; 102 void setGameString(int idx, const Common::String &string); 103 void showHelpScreen1(); 104 void showHelpScreen2(); 105 Common::SeekableReadStream *getBlockFromDatFile(Common::String name); 106 Common::Error showTextReader(const char *extension); 107 108 // forwarding calls 109 void playSound(AudioId sample); 110 void playSound(MusicId index); 111 void paletteFadeIn(); 112 void paletteFadeOut(int minBrightness = 0); 113 void paletteBrightness(); 114 void renderImage(int section); 115 void renderImage(ImageId id, bool removeImage = false); 116 bool setCurrentImage(int filenumber); 117 void saveScreen(int x, int y, int width, int height); 118 void saveScreen(const GuiElement &guiElement); 119 void restoreScreen(); 120 void renderRoom(Room &room); 121 void renderMessage(const char *text, MessagePosition position = kMessageNormal); 122 void renderMessage(const Common::String &text, MessagePosition position = kMessageNormal); 123 void renderMessage(int stringId, MessagePosition position = kMessageNormal, 124 Common::String var1 = "", Common::String var2 = ""); 125 void renderMessage(int stringId, int x, int y); 126 void removeMessage(); 127 void renderText(const uint16 character); 128 void renderText(const char *text); 129 void renderText(const Common::String &text); 130 void renderText(int stringId); 131 void renderText(const uint16 character, int x, int y, byte color); 132 void renderText(const char *text, int x, int y, byte color); 133 void renderText(const Common::String &text, int x, int y, byte color); 134 void renderText(int stringId, int x, int y, byte color); 135 void renderText(const GuiElement &guiElement); 136 void renderBox(int x, int y, int width, int height, byte color); 137 void renderBox(const GuiElement &guiElement); 138 void setColor63(byte value); 139 void stopSound(); 140 }; 141 142 } 143 144 #endif 145