ScummVM API documentation
myst.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_MYST_H
23#define MOHAWK_MYST_H
24
25#include "mohawk/console.h"
26#include "mohawk/mohawk.h"
27#include "mohawk/myst_actions.h"
28#include "mohawk/resource_cache.h"
29#include "mohawk/video.h"
30
31#include "audio/mixer.h"
32
33#include "common/events.h"
34#include "common/random.h"
35
36namespace Mohawk {
37
38class MohawkEngine_Myst;
39class VideoManager;
40class MystGraphics;
41class MystScriptParser;
42class MystConsole;
43class MystGameState;
44struct MystLanguage;
45class MystOptionsWidget;
46class MystSound;
47class MystArea;
48class MystAreaImageSwitch;
49class MystAreaHover;
50class MystCard;
51
52// Engine Debug Flags
53enum {
54 kDebugVariable = 1,
55 kDebugSaveLoad,
56 kDebugView,
57 kDebugHint,
58 kDebugResource,
59 kDebugINIT,
60 kDebugEXIT,
61 kDebugScript,
62 kDebugHelp,
63 kDebugCache,
64};
65
66// Myst Stacks
67enum MystStack {
68 kChannelwoodStack = 0, // Channelwood Age
69 kCreditsStack, // Credits
70 kDemoStack, // Demo Main Menu
71 kDniStack, // D'ni
72 kIntroStack, // Intro
73 kMakingOfStack, // Making Of Myst
74 kMechanicalStack, // Mechanical Age
75 kMystStack, // Myst Island
76 kSeleniticStack, // Selenitic Age
77 kDemoSlidesStack, // Demo Slideshow
78 kDemoPreviewStack, // Demo Myst Library Preview
79 kStoneshipStack, // Stoneship Age
80 kMenuStack // Main menu
81};
82
83// Transitions
84enum TransitionType {
85 kTransitionLeftToRight = 0,
86 kTransitionRightToLeft = 1,
87 kTransitionSlideToLeft = 2,
88 kTransitionSlideToRight = 3,
89 kTransitionDissolve = 4,
90 kTransitionTopToBottom = 5,
91 kTransitionBottomToTop = 6,
92 kTransitionSlideToTop = 7,
93 kTransitionSlideToBottom= 8,
94 kTransitionPartToRight = 9,
95 kTransitionPartToLeft = 10,
96 kTransitionCopy = 11,
97 kNoTransition = 999
98};
99
101 uint16 var;
103};
104
106 struct SoundItem {
107 int16 action;
108 uint16 volume;
109 };
110
111 int16 sound;
112 uint16 soundVolume;
113 uint16 soundVar;
114 Common::Array<SoundItem> soundList;
115};
116
117// View Sound Action Type
118enum {
119 kMystSoundActionConditional = -4,
120 kMystSoundActionContinue = -1,
121 kMystSoundActionChangeVolume = -2,
122 kMystSoundActionStop = -3
123 // Other positive values are PlayNewSound of that id
124};
125
126typedef Common::SharedPtr<MystCard> MystCardPtr;
127typedef Common::SharedPtr<MystScriptParser> MystScriptParserPtr;
128
130protected:
131 Common::Error run() override;
132
133public:
134 MohawkEngine_Myst(OSystem *syst, const MohawkGameDescription *gamedesc);
135 ~MohawkEngine_Myst() override;
136
137 Common::SeekableReadStream *getResource(uint32 tag, uint16 id) override;
138 Common::Array<uint16> getResourceIDList(uint32 type) const;
139 void cachePreload(uint32 tag, uint16 id);
140
141 void changeToStack(MystStack stackId, uint16 card, uint16 linkSrcSound, uint16 linkDstSound);
142 void changeToCard(uint16 card, TransitionType transition);
143 MystCard *getCard() { return _card.get(); };
144 MystCardPtr getCardPtr() { return _card; };
145 void setMainCursor(uint16 cursor);
146 uint16 getMainCursor() { return _mainCursor; }
147 void refreshCursor();
148 bool wait(uint32 duration, bool skippable = false);
149 bool addCdRomDelay;
150
152 void doFrame();
153
154 MystSoundBlock readSoundBlock(Common::ReadStream *stream) const;
155 void applySoundBlock(const MystSoundBlock &block);
156
157 bool _showResourceRects;
158
159 VideoManager *_video;
160 MystSound *_sound;
161 MystGraphics *_gfx;
162 MystGameState *_gameState;
163 MystScriptParserPtr _stack;
165
166 MystArea *loadResource(Common::SeekableReadStream *rlstStream, MystArea *parent);
167 void redrawResource(MystAreaImageSwitch *resource, bool update = true);
168
169 void setCacheState(bool state) { _cache.enabled = state; }
170 bool getCacheState() { return _cache.enabled; }
171
172 VideoEntryPtr playMovie(const Common::String &name, MystStack stack);
173 VideoEntryPtr playMovieFullscreen(const Common::String &name, MystStack stack);
174 VideoEntryPtr findVideo(const Common::String &name, MystStack stack);
175 void playMovieBlocking(const Common::String &name, MystStack stack, uint16 x, uint16 y);
176 void playFlybyMovie(MystStack stack);
177 void playSkippableMovie(const VideoEntryPtr &video, bool looping);
178 void waitUntilMovieEnds(const VideoEntryPtr &video);
179 Common::Path selectLocalizedMovieFilename(const Common::Path &movieName);
180
181 void playSoundBlocking(uint16 id);
182
189 bool isInteractive() const;
190 bool isGameStarted() const;
191 bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
192 bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
193 Common::Error loadGameState(int slot) override;
194 Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
195 Common::String getSaveStateName(int slot) const override {
196 return Common::String::format("myst-%03d.mys", slot);
197 }
198
199 bool hasFeature(EngineFeature f) const override;
200
201 void applyGameSettings() override;
202 static Common::Array<Common::Keymap *> initKeymaps(const char *target);
203
204 void resumeFromMainMenu();
205
206 void runOptionsDialog();
207 void runCredits();
208
209 bool canDoAction(MystEventAction action);
210 void doAction(MystEventAction action);
211 void scheduleAction(MystEventAction action);
212
213 static const MystLanguage *getLanguageDesc(Common::Language language);
214 Common::Language getLanguage() const override;
215
216private:
217 ResourceCache _cache;
218
219 MystScriptParserPtr _prevStack;
220
221 MystCardPtr _card;
222 MystCardPtr _prevCard;
223
224 bool hasGameSaveSupport() const;
225 void pauseEngineIntern(bool pause) override;
226
227 void goToMainMenu();
228
229 void dropPage();
230
231 Common::Path wrapMovieFilename(const Common::String &movieName, uint16 stack);
232
233 void loadStackArchives(MystStack stackId);
234 void loadArchive(const char *archiveName, const char *language, bool mandatory);
235
236 // Input
237 bool _mouseClicked;
238 bool _mouseMoved;
239 bool _escapePressed;
240 bool _waitingOnBlockingOperation;
241
242 uint16 _currentCursor;
243 uint16 _mainCursor; // Also defines the current page being held (white, blue, red, or none)
244
245 Common::Language _currentLanguage;
246 MystEventAction _scheduledAction;
247};
248
249} // End of namespace Mohawk
250
251#endif
Definition: error.h:81
Definition: path.h:52
Definition: random.h:44
Definition: stream.h:385
Definition: stream.h:745
PointerType get() const
Definition: ptr.h:229
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: myst.h:129
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave=false) override
void applyGameSettings() override
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Common::String getSaveStateName(int slot) const override
Definition: myst.h:195
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Common::Error run() override
bool hasFeature(EngineFeature f) const override
Common::Error loadGameState(int slot) override
Definition: mohawk.h:54
Definition: myst_areas.h:59
Definition: myst_areas.h:154
Definition: myst_card.h:39
Definition: myst_state.h:100
Definition: myst_graphics.h:41
Definition: myst_sound.h:39
Definition: resource_cache.h:30
Definition: video.h:244
Definition: system.h:166
Language
Definition: language.h:45
Definition: bitmap.h:32
Definition: detection.h:65
Definition: myst.h:100
Definition: myst_metaengine.h:30
Definition: myst.h:106
Definition: myst.h:105