ScummVM API documentation
riven.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 MOHAWK_RIVEN_H
23#define MOHAWK_RIVEN_H
24
25#include "mohawk/installer_archive.h"
26#include "mohawk/mohawk.h"
27
28#include "common/hashmap.h"
29#include "common/hash-str.h"
30#include "common/random.h"
31#include "common/rect.h"
32
33#include "graphics/surface.h"
34
35namespace Common {
36class Keymap;
37}
38
39namespace GUI {
40class GuiObject;
41class OptionsContainerWidget;
42}
43
44namespace Mohawk {
45
46struct MohawkGameDescription;
47class MohawkArchive;
48class RivenGraphics;
49class RivenConsole;
50struct RivenLanguage;
51class RivenSaveLoad;
52class RivenOptionsWidget;
53class RivenStack;
54class RivenCard;
55class RivenHotspot;
56class RivenScriptManager;
57class RivenSoundManager;
58class RivenInventory;
59class RivenVideoManager;
60
61// Riven Stack Types
62enum {
63 kStackUnknown = 0, // Default value for ReturnStackID
64 kStackOspit = 1, // 233rd Age (Gehn's Office)
65 kStackPspit = 2, // Prison Island
66 kStackRspit = 3, // Temple Island
67 kStackTspit = 4, // Rebel Age (Tay)
68 kStackBspit = 5, // Book-Making Island
69 kStackGspit = 6, // Garden Island
70 kStackJspit = 7, // Jungle Island
71 kStackAspit = 8, // Main Menu, Books, Setup
72
73 kStackFirst = kStackOspit,
74 kStackLast = kStackAspit
75};
76
77// Engine Debug Flags
78enum {
79 kRivenDebugScript = 1,
80 kRivenDebugPatches,
81};
82
83struct ZipMode {
84 Common::String name;
85 uint16 id;
86 bool operator== (const ZipMode& z) const;
87};
88
90
92protected:
93 Common::Error run() override;
94
95public:
96 MohawkEngine_Riven(OSystem *syst, const MohawkGameDescription *gamedesc);
97 ~MohawkEngine_Riven() override;
98
99 RivenVideoManager *_video;
100 RivenSoundManager *_sound;
101 RivenGraphics *_gfx;
103 RivenScriptManager *_scriptMan;
104 RivenInventory *_inventory;
105
106 // Display debug rectangles around the hotspots
107 bool _showHotspots;
108
109 bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
110 bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
111 Common::Error loadGameState(int slot) override;
112 Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
113 Common::String getSaveStateName(int slot) const override {
114 return Common::String::format("riven-%03d.rvn", slot);
115 }
116
117 static const RivenLanguage *getLanguageDesc(Common::Language language);
118 Common::Language getLanguage() const override;
119
120 bool hasFeature(EngineFeature f) const override;
121
122 void applyGameSettings() override;
123 static Common::Array<Common::Keymap *> initKeymaps(const char *target);
124
125 bool isInteractive() const;
126 void doFrame();
127 void processInput();
128
129private:
130 // Datafiles
131 MohawkArchive *_extrasFile; // We need a separate handle for the extra data
132 const char **listExpectedDatafiles() const;
133 void loadLanguageDatafile(char prefix, uint16 stackId);
134 bool checkDatafiles();
135
136 RivenSaveLoad *_saveLoad;
137 InstallerArchive _installerArchive;
138
139 // Stack/Card-related functions and variables
140 RivenCard *_card;
141 RivenStack *_stack;
142
143 int _menuSavedCard;
144 int _menuSavedStack;
146
147 bool _gameEnded;
148 uint32 _lastSaveTime;
149 Common::Language _currentLanguage;
150
151 // Variables
152 void initVars();
153
154 void pauseEngineIntern(bool) override;
155
156public:
157 // Stack/card/script funtions
158 RivenStack *constructStackById(uint16 id);
159 void changeToCard(uint16 dest);
160 void changeToStack(uint16 stackId);
161 void reloadCurrentCard();
162 RivenCard *getCard() const { return _card; }
163 RivenStack *getStack() const { return _stack; }
164
165 // Hotspot functions/variables
166 Common::Array<ZipMode> _zipModeData;
167 void addZipVisitedCard(uint16 cardId, uint16 cardNameId);
168 bool isZipVisitedCard(const Common::String &hotspotName) const;
169
170 // Variables
171 RivenVariableMap _vars;
172 uint32 &getStackVar(uint32 index);
173
174 // Miscellaneous
175 Common::Array<uint16> getResourceIDList(uint32 type) const;
176 Common::SeekableReadStream *getExtrasResource(uint32 tag, uint16 id);
177 bool _activatedPLST;
178 bool _activatedSLST;
179 void delay(uint32 ms);
180 void runOptionsDialog();
181
182 // Save / Load
184
188 bool hasGameEnded() const;
189
194
195 // Main menu handling
196 void goToMainMenu();
197 void resumeFromMainMenu();
198 bool isInMainMenu() const;
199 bool isGameStarted() const;
200 void startNewGame();
201};
202
203} // End of namespace Mohawk
204
205#endif
Definition: array.h:52
Definition: error.h:81
Definition: random.h:44
Definition: stream.h:745
Definition: str.h:59
static String format(MSVC_PRINTF const char *fmt,...) GCC_PRINTF(1
Definition: ustr.h:57
EngineFeature
Definition: engine.h:282
Definition: installer_archive.h:35
Definition: resource.h:171
Definition: riven.h:91
Common::Error run() override
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave=false) override
bool canSaveAutosaveCurrently() override
Common::Error loadGameState(int slot) override
bool hasFeature(EngineFeature f) const override
void applyGameSettings() override
Common::String getSaveStateName(int slot) const override
Definition: riven.h:113
Definition: mohawk.h:54
Definition: riven_card.h:44
Definition: riven_graphics.h:61
Definition: riven_inventory.h:36
Definition: riven_saveload.h:59
Definition: riven_scripts.h:164
Definition: riven_sound.h:65
Definition: riven_stack.h:89
Definition: riven_video.h:130
Definition: system.h:166
Language
Definition: language.h:45
Definition: algorithm.h:29
Definition: bitmap.h:32
Definition: detection.h:65
Definition: riven_metaengine.h:30
Definition: riven.h:83