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