ScummVM API documentation
sky.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 SKY_SKY_H
23#define SKY_SKY_H
24
25
26#include "common/array.h"
27#include "common/error.h"
28#include "common/keyboard.h"
29#include "engines/engine.h"
30#include "graphics/big5.h"
31#include "sky/ibasstext.h"
32
41namespace Sky {
42
43
44#define TOTAL_SCREENS 100
45#define TOTAL_HINT_ANSWERS 164
46
47struct SystemVars {
48 uint32 systemFlags;
49 uint32 gameVersion;
50 uint32 mouseFlag;
51 uint16 language;
52 uint32 currentPalette;
53 uint16 gameSpeed;
54 uint16 currentMusic;
55 bool pastIntro;
56 bool paused;
57 bool textDirRTL;
58 bool _seenScreen[TOTAL_SCREENS];
59 bool _answerSeen[TOTAL_HINT_ANSWERS];
60};
61
62class Sound;
63class Disk;
64class Text;
65class Logic;
66class Mouse;
67class Screen;
68class Control;
69class MusicBase;
70class Debugger;
71class SkyCompact;
72
73enum SkyAction {
74 kSkyActionNone,
75 kSkyActionToggleFastMode,
76 kSkyActionToggleReallyFastMode,
77 kSkyActionOpenControlPanel,
78 kSkyActionConfirm,
79 kSkyActionSkip,
80 kSkyActionSkipLine,
81 kSkyActionPause
82};
83
84class SkyEngine : public Engine {
85protected:
86 SkyAction _action;
87 Common::KeyState _keyPressed;
88
89 Sound *_skySound;
90 Disk *_skyDisk;
91 Text *_skyText;
92 Logic *_skyLogic;
93 Mouse *_skyMouse;
94 Screen *_skyScreen;
95 Control *_skyControl;
96 SkyCompact *_skyCompact;
97 Debugger *_debugger;
98
99 MusicBase *_skyMusic;
100
101public:
102 SkyEngine(OSystem *syst);
103 ~SkyEngine() override;
104
105 void syncSoundSettings() override;
106
107 static bool isDemo();
108 static bool isCDVersion();
109 static bool isIbass();
110
111 Common::Error loadGameState(int slot) override;
112 Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
113 bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
114 bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
115 Common::String getSaveStateName(int slot) const override {
116 return Common::String::format("SKY-VM.%03d", slot);
117 }
118
119 static void *fetchItem(uint32 num);
120 static void *_itemList[300];
121 static SystemVars *_systemVars;
122 static const char *shortcutsKeymapId;
123 uint32 _chineseTraditionalOffsets[8];
124 char *_chineseTraditionalBlock;
125 Graphics::Big5Font *_big5Font;
126
127 bool canSaveGameStateCurrently();
128 static int giveCurrentScreen();
129
130 static uint32 giveScriptVar(uint32 s);
131 void setSeenScreen(int screen);
132 static bool hasSeenScreen(int screen);
133 static void setHintAnswerSeen(int answer);
134 static bool isHintAnswerSeen(int answer);
135
136 uint16 _curScreen;
137
138 static Common::String lookUpAscii(int line);
139 static Common::String giveButton(const Common::String &button);
140
141protected:
142 // Engine APIs
143 Common::Error init();
144 bool loadChineseTraditional();
145 Common::Error go();
146 Common::Error run() override {
147 Common::Error err;
148 err = init();
149 if (err.getCode() != Common::kNoError)
150 return err;
151 return go();
152 }
153
154 bool hasFeature(EngineFeature f) const override;
155
156 byte _fastMode;
157
158 void delay(int32 amount);
159 void handleKey();
160
161 void initItemList();
162
163 void initVirgin();
164 void loadFixedItems();
165};
166
167} // End of namespace Sky
168
169#endif
Definition: error.h:81
ErrorCode getCode() const
Definition: error.h:112
Definition: str.h:59
static String format(MSVC_PRINTF const char *fmt,...) GCC_PRINTF(1
Definition: ustr.h:57
Definition: engine.h:149
EngineFeature
Definition: engine.h:282
Definition: big5.h:32
Definition: system.h:166
Definition: control.h:192
Definition: debug.h:36
Definition: disk.h:59
Definition: logic.h:136
Definition: mouse.h:88
Definition: musicbase.h:55
Definition: screen.h:80
Definition: compact.h:58
Definition: sky.h:84
Common::Error run() override
Definition: sky.h:146
void syncSoundSettings() override
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Common::String getSaveStateName(int slot) const override
Definition: sky.h:115
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave=false) override
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Common::Error loadGameState(int slot) override
bool hasFeature(EngineFeature f) const override
Definition: sound.h:47
Definition: text.h:49
@ kNoError
No error occurred.
Definition: error.h:48
Definition: autoroute.h:28
Definition: keyboard.h:294
Definition: sky.h:47