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