ScummVM API documentation
cryomni3d.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 CRYOMNI3D_CRYOMNI3D_H
23#define CRYOMNI3D_CRYOMNI3D_H
24
25#include "audio/mixer.h"
26
27#include "common/array.h"
28#include "common/keyboard.h"
29#include "common/queue.h"
30#include "common/rect.h"
31#include "common/scummsys.h"
32
33#include "engines/engine.h"
34
35#include "graphics/cursorman.h"
36
37#include "cryomni3d/font_manager.h"
38#include "cryomni3d/objects.h"
39#include "cryomni3d/sprites.h"
40#include "cryomni3d/detection.h"
41
42class OSystem;
43
44namespace Common {
45struct Point;
46class SeekableReadStream;
47}
48
49namespace Image {
50class ImageDecoder;
51}
52
62namespace CryOmni3D {
63
65
66// Engine Debug Flags
67enum {
68 kDebugFile = 1,
69 kDebugVariable,
70 kDebugSaveLoad,
71};
72
73enum DragStatus {
74 kDragStatus_NoDrag = 0,
75 kDragStatus_Pressed,
76 kDragStatus_Finished,
77 kDragStatus_Dragging
78};
79
80class CryOmni3DEngine : public ::Engine {
81protected:
82 Common::Error run() override;
83
84public:
85 CryOmni3DEngine(OSystem *syst, const CryOmni3DGameDescription *gamedesc);
86 ~CryOmni3DEngine() override;
87
88 // Detection related functions
89 const CryOmni3DGameDescription *_gameDescription;
90 const char *getGameId() const;
91 uint32 getFeatures() const;
92 uint16 getVersion() const;
93 Common::Platform getPlatform() const;
94 uint8 getGameType() const;
95 Common::Language getLanguage() const;
96
97 bool hasFeature(EngineFeature f) const override;
98 bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override { return _canLoadSave; }
99 bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override { return _canLoadSave; }
100
101 void setCanLoadSave(bool canLoadSave) { _canLoadSave = canLoadSave; }
102 static const uint kSaveDescriptionLen = 20;
103private:
104 void pauseEngineIntern(bool) override;
105
106public:
107 Image::ImageDecoder *loadHLZ(const Common::Path &filepath);
108
109 void fillSurface(byte color);
110 /* We use CursorMan because it avoids problems with cursors in GMM */
111 void setCursor(const Graphics::Cursor &cursor) const;
112 void setCursor(uint cursorId) const;
113 bool showMouse(bool visible) { return CursorMan.showMouse(visible); }
114 typedef void (CryOmni3DEngine::*HNMCallback)(uint frameNum);
115 void playHNM(const Common::Path &filepath,
117 HNMCallback beforeDraw = nullptr, HNMCallback afterDraw = nullptr);
118 bool displayHLZ(const Common::Path &filepath, uint32 timeout = uint(-1));
119
120 bool pollEvents();
121 Common::Point getMousePos();
122 void setMousePos(const Common::Point &point);
123 uint getCurrentMouseButton() { return _lastMouseButton; }
124 Common::KeyState getNextKey();
125 bool checkKeysPressed();
126 bool checkKeysPressed(uint numKeys, ...);
127 void clearKeys() { _keysPressed.clear(); }
128 void waitMouseRelease();
129 void setAutoRepeatClick(uint millis);
130 DragStatus getDragStatus() { return _dragStatus; }
131
132 virtual bool displayToolbar(const Graphics::Surface *original) = 0;
133 virtual bool hasPlaceDocumentation() = 0;
134 virtual bool displayPlaceDocumentation() = 0;
135 virtual uint displayOptions() = 0;
136 virtual bool shouldAbort() { return g_engine->shouldQuit(); }
137
138 virtual void makeTranslucent(Graphics::Surface &dst, const Graphics::Surface &src) const = 0;
139 virtual void setupPalette(const byte *colors, uint start, uint num) = 0;
140
141protected:
142 DATSeekableStream *getStaticData(uint32 gameId, uint16 version) const;
143
144 void copySubPalette(byte *dst, const byte *src, uint start, uint num);
145 void setPalette(const byte *colors, uint start, uint num);
146 void lockPalette(uint startRW, uint endRW) { _lockPaletteStartRW = startRW; _lockPaletteEndRW = endRW; }
147 void unlockPalette() { _lockPaletteStartRW = 0; _lockPaletteEndRW = 255; }
148 void fadeOutPalette();
149 void fadeInPalette(const byte *colors);
150 void setBlackPalette();
151
152 void setHNMClipping(const Common::Rect &clip) { _hnmClipping = clip; _hnmHasClip = true; }
153 void unsetHNMClipping() { _hnmHasClip = false; }
154
155protected:
156 bool _canLoadSave;
157
158 FontManager _fontManager;
159 Sprites _sprites;
160 Objects _objects;
161 Inventory _inventory;
162
164
165 DragStatus _dragStatus;
166 Common::Point _dragStart;
167 uint _lastMouseButton;
168 uint _autoRepeatNextEvent;
169
170private:
171 uint _lockPaletteStartRW;
172 uint _lockPaletteEndRW;
173
174 Common::Rect _hnmClipping;
175 bool _hnmHasClip;
176};
177
179protected:
180 Common::Error run() override;
181
182public:
183 CryOmni3DEngine_HNMPlayer(OSystem *syst, const CryOmni3DGameDescription *gamedesc) : CryOmni3DEngine(syst, gamedesc) {}
184 ~CryOmni3DEngine_HNMPlayer() override {}
185
186 bool displayToolbar(const Graphics::Surface *original) override { return false; }
187 bool hasPlaceDocumentation() override { return false; }
188 bool displayPlaceDocumentation() override { return false; }
189 uint displayOptions() override { return 0; }
190 void makeTranslucent(Graphics::Surface &dst, const Graphics::Surface &src) const override {}
191 void setupPalette(const byte *colors, uint start, uint num) override {}
192};
193
194} // End of namespace CryOmni3D
195
196#endif
SoundType
Definition: mixer.h:73
@ kPlainSoundType
Definition: mixer.h:74
Definition: error.h:81
Definition: path.h:52
Definition: ustr.h:57
Definition: cryomni3d.h:178
Common::Error run() override
Definition: cryomni3d.h:80
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: cryomni3d.h:98
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: cryomni3d.h:99
bool hasFeature(EngineFeature f) const override
Common::Error run() override
Definition: datstream.h:33
Definition: engine.h:149
static bool shouldQuit()
EngineFeature
Definition: engine.h:282
Definition: cursor.h:42
Definition: image_decoder.h:53
Definition: system.h:166
Language
Definition: language.h:45
Platform
Definition: platform.h:93
Engine * g_engine
Definition: algorithm.h:29
Definition: cryomni3d.h:62
Definition: keyboard.h:294
Definition: rect.h:144
Definition: rect.h:536
Definition: detection.h:48
Definition: surface.h:67
Definition: display_client.h:58