ScummVM API documentation
supernova.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  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (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, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef SUPERNOVA_SUPERNOVA_H
23 #define SUPERNOVA_SUPERNOVA_H
24 
25 #include "common/array.h"
26 #include "common/events.h"
27 #include "common/random.h"
28 #include "common/scummsys.h"
29 #include "engines/engine.h"
30 #include "common/file.h"
31 
32 #include "supernova/console.h"
33 #include "supernova/graphics.h"
34 #include "supernova/msn_def.h"
35 #include "supernova/room.h"
36 #include "supernova/sound.h"
37 #include "supernova/imageid.h"
38 #include "supernova/game-manager.h"
39 
40 namespace Common {
41  class MemoryReadWriteStream;
42 }
43 
44 namespace Supernova {
45 
46 #define SAVEGAME_HEADER MKTAG('M','S','N','1')
47 #define SAVEGAME_HEADER2 MKTAG('M','S','N','2')
48 #define SAVEGAME_VERSION 10
49 
50 #define SUPERNOVA_DAT "supernova.dat"
51 #define SUPERNOVA_DAT_VERSION 4
52 
53 class GuiElement;
54 class ResourceManager;
55 class Sound;
56 class console;
57 class GameManager;
58 class GameManager1;
59 class Screen;
60 
61 class SupernovaEngine : public Engine {
62 public:
63  explicit SupernovaEngine(OSystem *syst);
64  ~SupernovaEngine() override;
65 
66  Common::Error run() override;
67  Common::Error loadGameState(int slot) override;
68  bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
69  Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
70  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
71  bool hasFeature(EngineFeature f) const override;
72  void pauseEngineIntern(bool pause) override;
73 
74  GameManager *_gm;
75  Sound *_sound;
76  ResourceManager *_resMan;
77  Screen *_screen;
78  bool _allowLoadGame;
79  bool _allowSaveGame;
80  Common::StringArray _gameStrings;
81  Common::String _nullString;
82  int _sleepAuoSaveVersion;
83  Common::MemoryReadWriteStream* _sleepAutoSave;
84 
85  uint _delay;
86  int _textSpeed;
87  char _MSPart;
88  bool _improved;
89 
90  Common::Error loadGameStrings();
91  void init();
92  Common::String getSaveStateName(int slot) const override;
93  bool loadGame(int slot);
94  bool saveGame(int slot, const Common::String &description);
95  bool serialize(Common::WriteStream *out);
96  bool deserialize(Common::ReadStream *in, int version);
97  bool quitGameDialog();
98  void errorTempSave(bool saving);
99  void setTextSpeed();
100  const Common::String &getGameString(int idx) const;
101  void setGameString(int idx, const Common::String &string);
102  void showHelpScreen1();
103  void showHelpScreen2();
104  Common::SeekableReadStream *getBlockFromDatFile(Common::String name);
105  Common::Error showTextReader(const char *extension);
106 
107  // forwarding calls
108  void playSound(AudioId sample);
109  void playSound(MusicId index);
110  void paletteFadeIn();
111  void paletteFadeOut(int minBrightness = 0);
112  void paletteBrightness();
113  void renderImage(int section);
114  void renderImage(ImageId id, bool removeImage = false);
115  bool setCurrentImage(int filenumber);
116  void saveScreen(int x, int y, int width, int height);
117  void saveScreen(const GuiElement &guiElement);
118  void restoreScreen();
119  void renderRoom(Room &room);
120  void renderMessage(const char *text, MessagePosition position = kMessageNormal);
121  void renderMessage(const Common::String &text, MessagePosition position = kMessageNormal);
122  void renderMessage(int stringId, MessagePosition position = kMessageNormal,
123  Common::String var1 = "", Common::String var2 = "");
124  void renderMessage(int stringId, int x, int y);
125  void removeMessage();
126  void renderText(const uint16 character);
127  void renderText(const char *text);
128  void renderText(const Common::String &text);
129  void renderText(int stringId);
130  void renderText(const uint16 character, int x, int y, byte color);
131  void renderText(const char *text, int x, int y, byte color);
132  void renderText(const Common::String &text, int x, int y, byte color);
133  void renderText(int stringId, int x, int y, byte color);
134  void renderText(const GuiElement &guiElement);
135  void renderBox(int x, int y, int width, int height, byte color);
136  void renderBox(const GuiElement &guiElement);
137  void setColor63(byte value);
138  void stopSound();
139 };
140 
141 enum SUPERNOVAAction {
142  kActionNone,
143  kActionPause,
144  kActionQuit,
145  kActionSkip,
146  kActionSkipLine,
147  kActionHelp,
148  kActionInstr,
149  kActionInfo,
150  kActionSpeed,
151  kActionGo,
152  kActionLook,
153  kActionTake,
154  kActionOpen,
155  kActionClose,
156  kActionPush,
157  kActionPull,
158  kActionUse,
159  kActionTalk,
160  kActionGive,
161  kActionUp,
162  kActionDown,
163  kActionPgUp,
164  kActionPgDown,
165  kActionExit,
166  kActionOfficeManager,
167  kActionPhone,
168  kActionProText,
169  kActionCalculata,
170 };
171 
172 }
173 
174 #endif
Definition: supernova.h:61
Definition: game-manager.h:101
Definition: str.h:59
EngineFeature
Definition: engine.h:260
Definition: stream.h:77
Definition: error.h:81
Definition: console.h:27
Definition: resman.h:41
Definition: room.h:39
Definition: game-manager.h:63
Definition: sound.h:85
Definition: atari-screen.h:58
Definition: stream.h:745
Definition: ustr.h:57
Definition: algorithm.h:29
Definition: memstream.h:283
Definition: screen.h:124
Definition: stream.h:385
Definition: system.h:163
Definition: engine.h:146