ScummVM API documentation
toltecs.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 TOLTECS_TOLTECS_H
23#define TOLTECS_TOLTECS_H
24
25#include "common/scummsys.h"
26#include "common/endian.h"
27#include "common/events.h"
28#include "common/file.h"
29#include "common/keyboard.h"
30#include "common/random.h"
31#include "common/textconsole.h"
32
33#include "engines/engine.h"
34
35#include "graphics/surface.h"
36
37#include "gui/debugger.h"
38
39#include "toltecs/console.h"
40
41namespace Toltecs {
42
43struct ToltecsGameDescription;
44
45class AnimationPlayer;
46class ArchiveReader;
47class Input;
48class MenuSystem;
49class MoviePlayer;
50class Music;
51class Palette;
52class ResourceCache;
53class ScriptInterpreter;
54class Screen;
55class SegmentMap;
56class Sound;
57
58enum SysString {
59 kStrLoadingPleaseWait,
60 kStrWhatCanIDoForYou,
61 kStrLoad,
62 kStrSave,
63 kStrTextOn,
64 kStrTextOff,
65 kStrVoicesOn,
66 kStrVoicesOff,
67 kStrVolume,
68 kStrPlay,
69 kStrQuit,
70 kStrLoadGame,
71 kStrSaveGame,
72 kStrAdjustVolume,
73 kStrMaster,
74 kStrVoices,
75 kStrMusic,
76 kStrSoundFx,
77 kStrBackground,
78 kStrCancel,
79 kStrDone,
80 kStrAreYouSure,
81 kStrYes,
82 kStrNo,
83 kSysStrCount
84};
85
86enum TOLTECSAction {
87 kActionNone,
88 kActionSkipDialog,
89 kActionOpenSaveMenu,
90 kActionOpenLoadMenu,
91 kActionSkipMovie,
92 kActionMenuOpen,
93 kActionSkipRide,
94};
95
96enum MenuID {
97 kMenuIdNone,
98 kMenuIdMain,
99 kMenuIdSave,
100 kMenuIdLoad,
101 kMenuIdVolumes
102};
103
104class ToltecsEngine : public ::Engine {
105
106
107protected:
108 Common::Error run() override;
109// void shutdown();
110
111public:
112 ToltecsEngine(OSystem *syst, const ToltecsGameDescription *gameDesc);
113 ~ToltecsEngine() override;
114
115 bool hasFeature(EngineFeature f) const override;
116
118 const ToltecsGameDescription *_gameDescription;
119 uint32 getFeatures() const;
120 Common::Language getLanguage() const;
121 const Common::String& getTargetName() const { return _targetName; }
122 void syncSoundSettings() override;
123
124 void setupSysStrings();
125 void requestSavegame(int slotNum, Common::String &description);
126 void requestLoadgame(int slotNum);
127
128 void loadScene(uint resIndex);
129
130 void updateScreen();
131 void drawScreen();
132 void updateInput();
133
134 void setGuiHeight(int16 guiHeight);
135
136 void setCamera(int16 x, int16 y);
137 bool getCameraChanged();
138 void scrollCameraUp(int16 delta);
139 void scrollCameraDown(int16 delta);
140 void scrollCameraLeft(int16 delta);
141 void scrollCameraRight(int16 delta);
142 void updateCamera();
143
144 void showMenu(MenuID menuId);
145
146 void talk(int16 slotIndex, int16 slotOffset);
147
148 void walk(byte *walkData);
149
150 int16 findRectAtPoint(byte *rectData, int16 x, int16 y, int16 index, int16 itemSize,
151 byte *rectDataEnd);
152
153 int _cfgVoicesVolume, _cfgMusicVolume, _cfgSoundFXVolume;
154 bool _cfgText, _cfgVoices;
155public:
156
157 AnimationPlayer *_anim;
158 ArchiveReader *_arc;
159 Input *_input;
160 MenuSystem *_menuSystem;
161 MoviePlayer *_moviePlayer;
162 Music *_music;
163 Palette *_palette;
164 ResourceCache *_res;
165 ScriptInterpreter *_script;
166 Screen *_screen;
167 SegmentMap *_segmap;
168 Sound *_sound;
169
170 Common::String _sysStrings[kSysStrCount];
171
172 int _saveLoadRequested;
173 int _saveLoadSlot;
174 Common::String _saveLoadDescription;
175
176 uint _sceneResIndex;
177 int16 _sceneWidth, _sceneHeight;
178
179 int _counter01, _counter02;
180 bool _movieSceneFlag;
181 byte _flag01;
182
183 int16 _cameraX, _cameraY;
184 int16 _newCameraX, _newCameraY;
185 int16 _cameraHeight;
186 int16 _guiHeight;
187
188 bool _doSpeech, _doText;
189
190 int16 _walkSpeedY, _walkSpeedX;
191
193 int16 _mouseX, _mouseY;
194 int16 _mouseDblClickTicks;
195 bool _mouseWaitForRelease;
196 byte _mouseButton;
197 int16 _mouseDisabled;
198 bool _leftButtonDown, _rightButtonDown;
199
200 const char *getSysString(int index) const { return _sysStrings[index].c_str(); }
201
202 /* Save/load */
203
204 enum kReadSaveHeaderError {
205 kRSHENoError = 0,
206 kRSHEInvalidType = 1,
207 kRSHEInvalidVersion = 2,
208 kRSHEIoError = 3
209 };
210
211 struct SaveHeader {
212 Common::String description;
213 uint32 version;
214 byte gameID;
215 uint32 flags;
216 uint32 saveDate;
217 uint32 saveTime;
218 uint32 playTime;
219 Graphics::Surface *thumbnail;
220 };
221
222 bool _isSaveAllowed;
223
224 bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override { return _isSaveAllowed; }
225 bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override { return _isSaveAllowed; }
226 Common::Error loadGameState(int slot) override;
227 Common::Error saveGameState(int slot, const Common::String &description, bool isAutosave = false) override;
228 void savegame(const char *filename, const char *description);
229 void loadgame(const char *filename);
230
231 const char *getSavegameFilename(int num);
232 static Common::String getSavegameFilename(const Common::String &target, int num);
233
234 WARN_UNUSED_RESULT static kReadSaveHeaderError readSaveHeader(Common::SeekableReadStream *in, SaveHeader &header, bool skipThumbnail = true);
235
236};
237
238} // End of namespace Toltecs
239
240#endif /* TOLTECS_TOLTECS_H */
Definition: error.h:81
Definition: random.h:44
Definition: stream.h:745
Definition: str.h:59
Definition: ustr.h:57
Definition: engine.h:149
const Common::String _targetName
Definition: engine.h:186
EngineFeature
Definition: engine.h:282
Definition: system.h:166
Definition: atari-screen.h:42
Definition: animation.h:30
Definition: resource.h:37
Definition: menu.h:72
Definition: movie.h:33
Definition: music.h:52
Definition: palette.h:35
Definition: resource.h:63
Definition: screen.h:150
Definition: script.h:39
Definition: segmap.h:46
Definition: sound.h:50
Definition: toltecs.h:104
Common::Error loadGameState(int slot) override
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: toltecs.h:225
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: toltecs.h:224
Common::Error run() override
void syncSoundSettings() override
Common::Error saveGameState(int slot, const Common::String &description, bool isAutosave=false) override
bool hasFeature(EngineFeature f) const override
uint32 CustomEventType
Definition: events.h:212
Language
Definition: language.h:45
bool skipThumbnail(Common::SeekableReadStream &in)
Definition: surface.h:67
Definition: atari-screen.h:58
Definition: toltecs.h:211
Definition: detection.h:27