30#include "engines/engine.h"
31#include "engines/savestate.h"
33#include "common/random.h"
34#include "common/savefile.h"
35#include "common/str.h"
36#include "common/memstream.h"
38#include "advancedDetector.h"
40#include "dm/console.h"
41#include "dm/detection.h"
62 kActionToggleInventoryChampion0,
63 kActionToggleInventoryChampion1,
64 kActionToggleInventoryChampion2,
65 kActionToggleInventoryChampion3,
86 kDMThingTypeParty = -1,
88 kDMThingTypeTeleporter = 1,
89 kDMstringTypeText = 2,
90 kDMThingTypeSensor = 3,
91 kDMThingTypeGroup = 4,
92 kDMThingTypeWeapon = 5,
93 kDMThingTypeArmour = 6,
94 kDMThingTypeScroll = 7,
95 kDMThingTypePotion = 8,
96 kDMThingTypeContainer = 9,
97 kDMThingTypeJunk = 10,
98 kDMThingTypeProjectile = 14,
99 kDMThingTypeExplosion = 15,
100 kDMThingTypeTotal = 16
105 kDMCellNorthWest = 0,
106 kDMCellNorthEast = 1,
107 kDMCellSouthEast = 2,
112 kDMModeLoadSavedGame = 0,
113 kDMModeLoadDungeon = 1,
114 kDMModeWaitingOnEntrance = 99,
115 kDMModeEntranceDrawCredits = 202
119 kDMLoadgameFailure = -1,
120 kDMLoadgameSuccess = 1
124 kDMMapIndexNone = -1,
125 kDMMapIndexEntrance = 255
128#define kDMMaskDecodeEvenIfInvisible 0x8000
129#define kDMMaskMergeCycles 0x8000
131#define kDMSlotBoxInventoryFirstSlot 8
132#define kDMSlotBoxInventoryActionHand 9
133#define kDMSlotBoxChestFirstSlot 38
139 Thing() : _data(0xFFFF) {}
140 explicit Thing(uint16 d) { set(d); }
146 byte getCell()
const {
return _data >> 14; }
147 ThingType getType()
const {
return (ThingType)((_data >> 10) & 0xF); }
148 uint16 getIndex()
const {
return _data & 0x3FF; }
150 void setCell(uint16 cell) { _data = (_data & ~(0x3 << 14)) | ((cell & 0x3) << 14); }
151 void setType(uint16 type) { _data = (_data & ~(0xF << 10)) | ((type & 0xF) << 10); }
152 void setIndex(uint16 index) { _data = (_data & ~0x3FF) | (index & 0x3FF); }
154 uint16 getTypeAndIndex() {
return _data & 0x3FFF; }
155 uint16 toUint16()
const {
return _data; }
156 bool operator==(
const Thing &rhs)
const {
return _data == rhs._data; }
157 bool operator!=(
const Thing &rhs)
const {
return _data != rhs._data; }
160#define setFlag(val, mask) ((val) |= (mask))
161#define getFlag(val, mask) ((val) & (mask))
162#define clearFlag(val, mask) ((val) &= (~(mask)))
166#define CALL_MEMBER_FN(object, ptrToMember) ((object).*(ptrToMember))
172 void processNewPartyMap(uint16 mapIndex);
173 void initializeGame();
174 void initMemoryManager();
176 void initConstants();
182 void fuseSequenceUpdate();
183 void processEntrance();
184 void openEntranceDoors();
199 void delay(uint16 verticalBlank);
200 uint16 getScaledProduct(uint16 val, uint16 scale, uint16 vale2);
201 uint16 getRandomNumber(uint32 max) {
return _rnd->
getRandomNumber(max - 1); }
202 int16 ordinalToIndex(int16 val);
203 int16 indexToOrdinal(int16 val);
206 LoadgameResult loadgame(int16 slot);
207 void endGame(
bool doNotDrawCreditsOnly);
209 void entranceDrawCredits();
214 Direction turnDirRight(int16 dir);
215 Direction turnDirLeft(int16 dir);
216 Direction returnOppositeDir(int16 dir);
217 bool isOrientedWestEast(int16 dir);
218 uint16 normalizeModulo4(int16 dir);
220 int32 filterTime(int32 mapTime);
221 int32 setMapAndTime(uint32 map, uint32 time);
222 uint16 getMap(int32 mapTime);
223 Thing thingWithNewCell(
Thing thing, int16 cell);
224 int16 getDistance(int16 mapx1, int16 mapy1, int16 mapx2, int16 mapy2);
225 int32 setMap(int32 &mapTime, uint32 map);
230 byte *_interfaceCredits;
233 byte *_savedScreenForOpenEntranceDoors;
235 bool _canLoadFromGMM;
237 byte *_entranceDoorAnimSteps[10];
256 bool _engineShouldQuit;
257 int _loadSaveSlotAtRuntime;
260 bool _restartGameRequest;
262 bool _stopWaitingForPlayerInput;
263 bool _gameTimeTicking;
264 bool _restartGameAllowed;
266 bool _stopPressingEye;
268 bool _stopPressingMouth;
269 bool _highlightBoxInversionRequested;
270 int16 _projectileDisableMovementTicks;
271 int16 _lastProjectileDisabledMovementDirection;
273 int16 _newPartyMapIndex;
274 bool _setMousePointerToObjectInMainLoop;
275 int16 _disabledMovementTicks;
277 int8 _dirIntoStepCountEast[4];
278 int8 _dirIntoStepCountNorth[4];
280 char _stringBuildBuffer[128];
281 int16 _waitForInputMaxVerticalBlankCount;
284 Thing _thingEndOfList;
285 Thing _thingFirstExplosion;
286 Thing _thingExplFireBall;
287 Thing _thingExplSlime;
288 Thing _thingExplLightningBolt;
289 Thing _thingExplHarmNonMaterial;
290 Thing _thingExplOpenDoor;
291 Thing _thingExplPoisonBolt;
292 Thing _thingExplPoisonCloud;
293 Thing _thingExplSmoke;
294 Thing _thingExplFluxcage;
295 Thing _thingExplRebirthStep1;
296 Thing _thingExplRebirthStep2;
Definition: memstream.h:194
uint getRandomNumber(uint max)
Definition: champion.h:491
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Common::Error loadGameState(int slot) override
bool hasFeature(EngineFeature f) const override
Common::String getSaveStateName(int slot) const override
Common::Error run() override
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: dungeonman.h:609
Definition: eventman.h:199
Definition: inventory.h:53
Definition: movesens.h:45
Definition: objectman.h:48
Definition: projexpl.h:43
Definition: timeline.h:151
EngineFeature
Definition: engine.h:282
Language
Definition: language.h:45
Common::Platform platform
Definition: advancedDetector.h:199
Definition: detection.h:70