ScummVM API documentation
qdengine.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 QDENGINE_H
23#define QDENGINE_H
24
25#include "common/error.h"
26#include "common/random.h"
27#include "common/serializer.h"
28#include "engines/engine.h"
29#include "graphics/pixelformat.h"
30
31#include "qdengine/qd_fwd.h"
32#include "qdengine/parser/qdscr_parser.h"
33#include "qdengine/qdcore/qd_screen_text.h"
34
36
37namespace Graphics {
38class Screen;
39}
40
41namespace QDEngine {
42
43struct QDEngineGameDescription;
44class grDispatcher;
45class qdGameDispatcher;
46
47enum QDEngineDebugChannels {
48 kDebugGraphics = 1,
49 kDebugInput,
50 kDebugLoad,
51 kDebugLog,
52 kDebugSave,
53 kDebugSound,
54 kDebugTemp,
55 kDebugQuant,
56 kDebugMinigames,
57 kDebugMovement,
58 kDebugText,
59 kDebug16BppMode,
60};
61
62enum {
63 GF_BROKEN_VIDEOS = 1
64};
65
66class QDEngineEngine : public Engine {
67private:
68 const ADGameDescription *_gameDescription;
69 Common::RandomSource _randomSource;
70
71 grDispatcher *_grD = nullptr;
72 qdGameDispatcher *_gameD = nullptr;
73
74protected:
75 // Engine APIs
76 Common::Error run() override;
77
78public:
79 Graphics::Screen *_screen = nullptr;
80 Graphics::PixelFormat _pixelformat;
81 int _tagMap[QDSCR_MAX_KEYWORD_ID];
82
83 int _screenW;
84 int _screenH;
85
86 bool _forceFullRedraw = false;
87
88public:
89 QDEngineEngine(OSystem *syst, const ADGameDescription *gameDesc);
90 ~QDEngineEngine() override;
91
92 uint32 getFeatures() const;
93 Common::Language getLanguage() const;
94
99 Common::String getTargetName() const { return _targetName; }
100
101 const char *getExeName() const;
102
106 uint32 getRandomNumber(uint maxNum) {
107 return _randomSource.getRandomNumber(maxNum);
108 }
109
110 void setSeed(uint32 seed) {
111 _randomSource.setSeed(seed);
112 }
113
114 bool hasFeature(EngineFeature f) const override {
115 return
119 };
120
121 bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override {
122 return true;
123 }
124 bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override {
125 return true;
126 }
127
128 Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override;
130
131 void syncSoundSettings() override;
132
133 int engineMain();
134
135 const Vect2i &screen_offset() {
136 return _screen_offset;
137 }
138 void set_screen_offset(const Vect2i &offset) {
139 _screen_offset = offset;
140 }
141
142public:
143 int _thumbSizeX = 0, _thumbSizeY = 0;
144 bool _debugDraw = false;
145 bool _debugDrawGrid = false;
146 bool _debugDrawPath = false;
147 int _gameVersion = 0;
148
149 Vect2i _screen_offset = Vect2i(0, 0);
150 grScreenRegion _fps_region = grScreenRegion_EMPTY;
151 grScreenRegion _fps_region_last = grScreenRegion_EMPTY;
152 Std::vector<qdGameObject *> _visible_objects;
153
154 // Default text format
155 qdScreenTextFormat _default_format;
156 // Global format
157 qdScreenTextFormat _global_text_format;
158 // Global format for dialog topics
159 qdScreenTextFormat _global_topic_format;
160
161private:
162 void init_graphics();
163};
164
165extern QDEngineEngine *g_engine;
166#define SHOULD_QUIT ::QDEngine::g_engine->shouldQuit()
167
168} // namespace QDEngine
169
170byte *transCyrillic(const Common::String &str);
171
172#endif // QDENGINE_H
Definition: error.h:81
Definition: random.h:44
void setSeed(uint32 seed)
uint getRandomNumber(uint max)
Definition: stream.h:745
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: screen.h:47
Definition: system.h:166
Definition: qdengine.h:66
Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave=false) override
Common::String getGameId() const
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: qdengine.h:124
Common::Error run() override
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: qdengine.h:121
Common::Error loadGameStream(Common::SeekableReadStream *stream) override
void syncSoundSettings() override
bool hasFeature(EngineFeature f) const override
Definition: qdengine.h:114
uint32 getRandomNumber(uint maxNum)
Definition: qdengine.h:106
Definition: xmath.h:268
Definition: gr_dispatcher.h:85
Definition: qd_game_dispatcher.h:43
Definition: vector.h:39
Language
Definition: language.h:45
Definition: formatinfo.h:28
Базовый класс для игровых ресурсов.
Definition: console.h:28
Definition: advancedDetector.h:164
Definition: pixelformat.h:138
Definition: atari-screen.h:58