ScummVM API documentation
ultima_early.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 ULTIMA_SHARED_EARLY_ULTIMA_EARLY_H
23#define ULTIMA_SHARED_EARLY_ULTIMA_EARLY_H
24
25#include "common/scummsys.h"
26#include "common/array.h"
27#include "common/endian.h"
28#include "common/hash-str.h"
29#include "common/serializer.h"
30#include "common/random.h"
31#include "common/savefile.h"
32#include "common/util.h"
33#include "graphics/surface.h"
34#include "engines/engine.h"
35#include "ultima/detection.h"
36
37#include "ultima/shared/engine/events.h"
38
39namespace Ultima {
40
41struct UltimaGameDescription;
42
43namespace Shared {
44
46 uint8 _version;
47 uint8 _gameId;
48 uint8 _language;
49 uint8 _videoMode;
50 Common::String _saveName;
51 Graphics::Surface *_thumbnail;
52 int _year, _month, _day;
53 int _hour, _minute;
54 int _totalFrames;
55};
56
57class Events;
58class Game;
59class GameBase;
60class MouseCursor;
61class Resources;
62
63namespace Gfx {
64class Screen;
65}
66
67class UltimaEarlyEngine : public Engine, public EventsCallback {
68private:
72 virtual bool initialize();
73
77 virtual void deinitialize() {}
78
79private:
80 Common::RandomSource _randomSource;
81protected:
82 const UltimaGameDescription *_gameDescription;
83public:
84 GameBase *_game;
85 MouseCursor *_mouseCursor;
86 Gfx::Screen *_screen;
87 EventsManager *_events;
88public:
89 UltimaEarlyEngine(OSystem *syst, const UltimaGameDescription *gameDesc);
90 ~UltimaEarlyEngine() override;
91
95 Common::Error run() override;
96
100 bool hasFeature(EngineFeature f) const override;
101
105 void playGame();
106
110 uint getRandomNumber(uint maxVal) { return _randomSource.getRandomNumber(maxVal); }
111
115 uint getRandomNumber(uint min, uint max) {
116 return min + _randomSource.getRandomNumber(max - min);
117 }
118
122 Graphics::Screen *getScreen() const override;
123
128 bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
129
134 bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
135
140
144 Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
145
149 GameId getGameId() const;
150
155 bool isEnhanced() const;
156
157 /*
158 * Creates a new hierarchy for the game, that contains all the logic for playing that particular game.
159 */
160 Game *createGame() const;
161};
162
163} // End of namespace Shared
164
165extern Shared::UltimaEarlyEngine *g_vm;
166
167} // End of namespace Ultima
168
169#endif
Definition: error.h:81
Definition: random.h:44
uint getRandomNumber(uint max)
Definition: stream.h:745
Definition: str.h:59
Definition: ustr.h:57
Definition: stream.h:77
Definition: engine.h:149
EngineFeature
Definition: engine.h:282
Definition: screen.h:47
Definition: system.h:166
Definition: events.h:124
Definition: events.h:139
Definition: game_base.h:53
Definition: game.h:42
Definition: screen.h:58
Definition: mouse_cursor.h:60
Definition: resources.h:128
Definition: ultima_early.h:67
Graphics::Screen * getScreen() const override
bool hasFeature(EngineFeature f) const override
uint getRandomNumber(uint maxVal)
Definition: ultima_early.h:110
Common::Error loadGameStream(Common::SeekableReadStream *stream) override
Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave=false) override
uint getRandomNumber(uint min, uint max)
Definition: ultima_early.h:115
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Common::Error run() override
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: surface.h:67
Definition: atari-screen.h:58
Definition: ultima_early.h:45
Definition: detection.h:65