ScummVM API documentation
fool.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 FOOL_H
23#define FOOL_H
24
25#include "common/scummsys.h"
26#include "common/system.h"
27#include "common/error.h"
28#include "common/fs.h"
29#include "common/random.h"
30#include "common/serializer.h"
31#include "common/util.h"
32#include "engines/engine.h"
33#include "graphics/macgui/macwindowmanager.h"
34
35#include "fool/detection.h"
36
37#define SCREEN_WIDTH 0x200
38#define SCREEN_HEIGHT 0x156
39#define MENU_HEIGHT 0x14
40#define SCREEN_PAGE_SIZE (SCREEN_WIDTH*SCREEN_HEIGHT/8) // 0x5580
41
42namespace Fool {
43
44struct FoolGameDescription;
45
46enum FoolVersion {
47 kFool11 = 1,
48 kFool20 = 2,
49 kFool201 = 4,
50 kFool30 = 8,
51 kFoolDemo10 = 16,
52};
53
54class FoolEngine : public Engine {
55private:
56 const FOOLGameDescription *_gameDescription;
57 Common::RandomSource _randomSource;
58protected:
59 // Engine APIs
60 Common::Error run() override;
61
62public:
64 Graphics::MacWindowManager *_wm = nullptr;
65
66 FoolEngine(OSystem *syst, const FOOLGameDescription *gameDesc);
67 ~FoolEngine() override;
68
69 uint32 getFeatures() const;
70
75
79 uint32 getRandomNumber(uint maxNum) {
80 return _randomSource.getRandomNumber(maxNum);
81 }
82
83 bool hasFeature(EngineFeature f) const override {
84 return
88 };
89
90 bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override {
91 return true;
92 }
93 bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override {
94 return true;
95 }
96
97 const Common::String getTarget() {
98 return _targetName;
99 }
100
106
107 Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override {
108 Common::Serializer s(nullptr, stream);
109 return syncGame(s);
110 }
112 Common::Serializer s(stream, nullptr);
113 return syncGame(s);
114 }
115};
116
117extern FoolEngine *g_engine;
118#define SHOULD_QUIT ::Fool::g_engine->shouldQuit()
119
120} // End of namespace Fool
121
122#endif // FOOL_H
Definition: error.h:81
Definition: random.h:44
uint getRandomNumber(uint max)
Definition: stream.h:745
Definition: serializer.h:80
Definition: str.h:59
Definition: ustr.h:57
Definition: stream.h:77
Definition: engine.h:149
const Common::String _targetName
Definition: engine.h:186
EngineFeature
Definition: engine.h:282
@ kSupportsReturnToLauncher
Definition: engine.h:296
@ kSupportsSavingDuringRuntime
Definition: engine.h:314
@ kSupportsLoadingDuringRuntime
Definition: engine.h:305
Definition: fool.h:54
uint32 getRandomNumber(uint maxNum)
Definition: fool.h:79
Common::Error loadGameStream(Common::SeekableReadStream *stream) override
Definition: fool.h:111
Common::String getGameId() const
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: fool.h:90
Common::Error run() override
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: fool.h:93
Common::Error syncGame(Common::Serializer &s)
Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave=false) override
Definition: fool.h:107
bool hasFeature(EngineFeature f) const override
Definition: fool.h:83
Definition: macwindowmanager.h:149
Definition: managed_surface.h:51
Definition: system.h:166
Engine * g_engine
Definition: detection.h:29