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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef SKY_SKY_H
24 #define SKY_SKY_H
25 
26 
27 #include "common/error.h"
28 #include "common/keyboard.h"
29 #include "engines/engine.h"
30 
31 /**
32  * This is the namespace of the Sky engine.
33  *
34  * Status of this engine: ???
35  *
36  * Games using this engine:
37  * - Beneath a Steel Sky
38  */
39 namespace Sky {
40 
41 struct SystemVars {
42 	uint32 systemFlags;
43 	uint32 gameVersion;
44 	uint32 mouseFlag;
45 	uint16 language;
46 	uint32 currentPalette;
47 	uint16 gameSpeed;
48 	uint16 currentMusic;
49 	bool pastIntro;
50 	bool paused;
51 };
52 
53 class Sound;
54 class Disk;
55 class Text;
56 class Logic;
57 class Mouse;
58 class Screen;
59 class Control;
60 class MusicBase;
61 class Debugger;
62 class SkyCompact;
63 
64 class SkyEngine : public Engine {
65 protected:
66 	Common::KeyState _keyPressed;
67 
68 	Sound *_skySound;
69 	Disk *_skyDisk;
70 	Text *_skyText;
71 	Logic *_skyLogic;
72 	Mouse *_skyMouse;
73 	Screen *_skyScreen;
74 	Control *_skyControl;
75 	SkyCompact *_skyCompact;
76 	Debugger *_debugger;
77 
78 	MusicBase *_skyMusic;
79 
80 public:
81 	SkyEngine(OSystem *syst);
82 	virtual ~SkyEngine();
83 
84 	virtual void syncSoundSettings();
85 
86 	static bool isDemo();
87 	static bool isCDVersion();
88 
89 	Common::Error loadGameState(int slot);
90 	Common::Error saveGameState(int slot, const Common::String &desc);
91 	bool canLoadGameStateCurrently();
92 	bool canSaveGameStateCurrently();
93 
94 	static void *fetchItem(uint32 num);
95 	static void *_itemList[300];
96 
97 	static SystemVars _systemVars;
98 
99 protected:
100 	// Engine APIs
101 	Common::Error init();
102 	Common::Error go();
run()103 	virtual Common::Error run() {
104 		Common::Error err;
105 		err = init();
106 		if (err.getCode() != Common::kNoError)
107 			return err;
108 		return go();
109 	}
110 	virtual GUI::Debugger *getDebugger();
111 	virtual bool hasFeature(EngineFeature f) const;
112 
113 	byte _fastMode;
114 
115 	void delay(int32 amount);
116 	void handleKey();
117 
118 	uint32 _lastSaveTime;
119 
120 	void initItemList();
121 
122 	void initVirgin();
123 	void loadFixedItems();
124 };
125 
126 } // End of namespace Sky
127 
128 #endif
129