diff options
author | Strangerke | 2017-01-31 18:15:31 +0100 |
---|---|---|
committer | Strangerke | 2017-01-31 18:15:31 +0100 |
commit | f4472d2f0a6f54b7a7b5dacceb069ad983d5e0fd (patch) | |
tree | e6cb3d5e303a32440cc1f6a4395c368c46f03f4f /engines/dm | |
parent | 2a74a975a38fa7113b92d98d48ddc03c76437f3c (diff) | |
download | scummvm-rg350-f4472d2f0a6f54b7a7b5dacceb069ad983d5e0fd.tar.gz scummvm-rg350-f4472d2f0a6f54b7a7b5dacceb069ad983d5e0fd.tar.bz2 scummvm-rg350-f4472d2f0a6f54b7a7b5dacceb069ad983d5e0fd.zip |
DM: Fix GCC warnings
Diffstat (limited to 'engines/dm')
-rw-r--r-- | engines/dm/champion.cpp | 68 | ||||
-rw-r--r-- | engines/dm/champion.h | 10 | ||||
-rw-r--r-- | engines/dm/console.cpp | 4 | ||||
-rw-r--r-- | engines/dm/dm.cpp | 31 | ||||
-rw-r--r-- | engines/dm/dm.h | 31 | ||||
-rw-r--r-- | engines/dm/dungeonman.cpp | 90 | ||||
-rw-r--r-- | engines/dm/eventman.cpp | 18 | ||||
-rw-r--r-- | engines/dm/gfx.cpp | 16 | ||||
-rw-r--r-- | engines/dm/group.cpp | 72 | ||||
-rw-r--r-- | engines/dm/inventory.cpp | 28 | ||||
-rw-r--r-- | engines/dm/loadsave.cpp | 2 | ||||
-rw-r--r-- | engines/dm/menus.cpp | 44 | ||||
-rw-r--r-- | engines/dm/movesens.cpp | 74 | ||||
-rw-r--r-- | engines/dm/objectman.cpp | 2 | ||||
-rw-r--r-- | engines/dm/projexpl.cpp | 70 | ||||
-rw-r--r-- | engines/dm/timeline.cpp | 48 |
16 files changed, 307 insertions, 301 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index 616ea637b4..4536ff7de2 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -43,7 +43,7 @@ namespace DM { void Champion::resetToZero() { for (int16 i = 0; i < 30; ++i) - _slots[i] = Thing::_none; + _slots[i] = _vm->_thingNone; for (int16 i = 0; i < 20; ++i) _skills[i].resetToZero(); _attributes = _wounds = 0; @@ -161,7 +161,9 @@ void ChampionMan::initConstants() { } ChampionMan::ChampionMan(DMEngine *vm) : _vm(vm) { + _champions = new Champion[4]; for (uint16 i = 0; i < 4; ++i) { + _champions[i].setVm(_vm); _championPendingDamage[i] = 0; _championPendingWounds[i] = 0; _champions[i].resetToZero(); @@ -182,6 +184,10 @@ ChampionMan::ChampionMan(DMEngine *vm) : _vm(vm) { initConstants(); } +ChampionMan::~ChampionMan() { + delete[] _champions; +} + bool ChampionMan::isLeaderHandObjectThrown(int16 side) { if (_leaderIndex == kDMChampionNone) return false; @@ -213,7 +219,7 @@ bool ChampionMan::isObjectThrown(uint16 champIndex, int16 slotIndex, int16 side) curChampion->setSlot((ChampionSlot)slotIndex, actionHandThing); } else { curThing = getObjectRemovedFromSlot(champIndex, slotIndex); - if (curThing == Thing::_none) + if (curThing == _vm->_thingNone) return false; } @@ -525,7 +531,7 @@ void ChampionMan::drawChangedObjectIcons() { } void ChampionMan::addObjectInSlot(ChampionIndex champIndex, Thing thing, ChampionSlot slotIndex) { - if (thing == Thing::_none) + if (thing == _vm->_thingNone) return; InventoryMan &invMan = *_vm->_inventoryMan; @@ -606,8 +612,8 @@ Thing ChampionMan::getObjectRemovedFromLeaderHand() { _leaderEmptyHanded = true; Thing leaderHandObject = _leaderHandObject; - if (leaderHandObject != Thing::_none) { - _leaderHandObject = Thing::_none; + if (leaderHandObject != _vm->_thingNone) { + _leaderHandObject = _vm->_thingNone; _leaderHandObjectIconIndex = kDMIconIndiceNone; eventMan.showMouse(); _vm->_objectMan->clearLeaderObjectName(); @@ -672,14 +678,14 @@ Thing ChampionMan::getObjectRemovedFromSlot(uint16 champIndex, uint16 slotIndex) if (slotIndex >= kDMSlotChest1) { curThing = inventory._chestSlots[slotIndex - kDMSlotChest1]; - inventory._chestSlots[slotIndex - kDMSlotChest1] = Thing::_none; + inventory._chestSlots[slotIndex - kDMSlotChest1] = _vm->_thingNone; } else { curThing = curChampion->_slots[slotIndex]; - curChampion->_slots[slotIndex] = Thing::_none; + curChampion->_slots[slotIndex] = _vm->_thingNone; } - if (curThing == Thing::_none) - return Thing::_none; + if (curThing == _vm->_thingNone) + return _vm->_thingNone; bool isInventoryChampion = (_vm->indexToOrdinal(champIndex) == inventory._inventoryChampionOrdinal); int16 curIconIndex = _vm->_objectMan->getIconIndex(curThing); @@ -1217,7 +1223,7 @@ void ChampionMan::addScentStrength(int16 mapX, int16 mapY, int32 cycleCount) { } void ChampionMan::putObjectInLeaderHand(Thing thing, bool setMousePointer) { - if (thing == Thing::_none) + if (thing == _vm->_thingNone) return; EventManager &evtMan = *_vm->_eventMan; @@ -1346,23 +1352,23 @@ void ChampionMan::clickOnSlotBox(uint16 slotBoxIndex) { else slotThing = _champions[champIndex]._slots[slotIndex]; - if ((slotThing == Thing::_none) && (leaderHandObject == Thing::_none)) + if ((slotThing == _vm->_thingNone) && (leaderHandObject == _vm->_thingNone)) return; - if ((leaderHandObject != Thing::_none) && (!(dungeon._objectInfos[dungeon.getObjectInfoIndex(leaderHandObject)]._allowedSlots & _slotMasks[slotIndex]))) + if ((leaderHandObject != _vm->_thingNone) && (!(dungeon._objectInfos[dungeon.getObjectInfoIndex(leaderHandObject)]._allowedSlots & _slotMasks[slotIndex]))) return; EventManager &evtMan = *_vm->_eventMan; evtMan.showMouse(); - if (leaderHandObject != Thing::_none) + if (leaderHandObject != _vm->_thingNone) getObjectRemovedFromLeaderHand(); - if (slotThing != Thing::_none) { + if (slotThing != _vm->_thingNone) { getObjectRemovedFromSlot(champIndex, slotIndex); putObjectInLeaderHand(slotThing, false); } - if (leaderHandObject != Thing::_none) + if (leaderHandObject != _vm->_thingNone) addObjectInSlot((ChampionIndex)champIndex, leaderHandObject, (ChampionSlot)slotIndex); drawChampionState((ChampionIndex)champIndex); @@ -1509,7 +1515,7 @@ void ChampionMan::championKill(uint16 champIndex) { dropAllObjects(champIndex); Thing unusedThing = dungeon.getUnusedThing(kDMMaskChampionBones | kDMThingTypeJunk); uint16 curCell = 0; - if (unusedThing != Thing::_none) { + if (unusedThing != _vm->_thingNone) { Junk *L0966_ps_Junk = (Junk *)dungeon.getThingData(unusedThing); L0966_ps_Junk->setType(kDMJunkTypeBones); L0966_ps_Junk->setDoNotDiscard(true); @@ -1592,7 +1598,7 @@ void ChampionMan::dropAllObjects(uint16 champIndex) { DungeonMan &dungeon = *_vm->_dungeonMan; for (uint16 slotIndex = kDMSlotReadyHand; slotIndex < kDMSlotChest1; slotIndex++) { Thing curThing = getObjectRemovedFromSlot(champIndex, slotDropOrder[slotIndex]); - if (curThing != Thing::_none) + if (curThing != _vm->_thingNone) _vm->_moveSens->getMoveResult(_vm->thingWithNewCell(curThing, curCell), kDMMapXNotOnASquare, 0, dungeon._partyMapX, dungeon._partyMapY); } } @@ -1875,7 +1881,7 @@ void ChampionMan::resetDataToStartGame() { Thing handThing = _leaderHandObject; EventManager &evtMan = *_vm->_eventMan; - if (handThing == Thing::_none) { + if (handThing == _vm->_thingNone) { _leaderEmptyHanded = true; _leaderHandObjectIconIndex = kDMIconIndiceNone; evtMan.setMousePointer(); @@ -1903,7 +1909,7 @@ void ChampionMan::resetDataToStartGame() { return; } - _leaderHandObject = Thing::_none; + _leaderHandObject = _vm->_thingNone; _leaderHandObjectIconIndex = kDMIconIndiceNone; _leaderEmptyHanded = true; } @@ -1938,7 +1944,7 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) { championPtr->_food = 1500 + _vm->getRandomNumber(256); championPtr->_water = 1500 + _vm->getRandomNumber(256); for (int16 slotIdx = kDMSlotReadyHand; slotIdx < kDMSlotChest1; slotIdx++) - championPtr->_slots[slotIdx] = Thing::_none; + championPtr->_slots[slotIdx] = _vm->_thingNone; Thing curThing = dungeon.getSquareFirstThing(dungeon._partyMapX, dungeon._partyMapY); while (curThing.getType() != kDMstringTypeText) @@ -2012,7 +2018,7 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) { curMapX += _vm->_dirIntoStepCountEast[dungeon._partyDir], curMapY += _vm->_dirIntoStepCountNorth[dungeon._partyDir]; curThing = dungeon.getSquareFirstThing(curMapX, curMapY); int16 slotIdx = kDMSlotBackpackLine1_1; - while (curThing != Thing::_endOfList) { + while (curThing != _vm->_thingEndOfList) { ThingType thingType = curThing.getType(); if ((thingType > kDMThingTypeSensor) && (curThing.getCell() == championObjectsCell)) { int16 objectAllowedSlots = dungeon._objectInfos[dungeon.getObjectInfoIndex(curThing)]._allowedSlots; @@ -2030,7 +2036,7 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) { if (skipCheck) break; - if ((objectAllowedSlots & _slotMasks[kDMSlotNeck]) && (championPtr->_slots[kDMSlotNeck] == Thing::_none)) + if ((objectAllowedSlots & _slotMasks[kDMSlotNeck]) && (championPtr->_slots[kDMSlotNeck] == _vm->_thingNone)) curSlotIndex = kDMSlotNeck; else curSlotIndex = slotIdx++; @@ -2038,27 +2044,27 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) { break; } case kDMThingTypeWeapon: - if (championPtr->_slots[kDMSlotActionHand] == Thing::_none) + if (championPtr->_slots[kDMSlotActionHand] == _vm->_thingNone) curSlotIndex = kDMSlotActionHand; - else if ((objectAllowedSlots & _slotMasks[kDMSlotNeck]) && (championPtr->_slots[kDMSlotNeck] == Thing::_none)) + else if ((objectAllowedSlots & _slotMasks[kDMSlotNeck]) && (championPtr->_slots[kDMSlotNeck] == _vm->_thingNone)) curSlotIndex = kDMSlotNeck; else curSlotIndex = slotIdx++; break; case kDMThingTypeScroll: case kDMThingTypePotion: - if (championPtr->_slots[kDMSlotPouch1] == Thing::_none) + if (championPtr->_slots[kDMSlotPouch1] == _vm->_thingNone) curSlotIndex = kDMSlotPouch1; - else if (championPtr->_slots[kDMSlotPouch_2] == Thing::_none) + else if (championPtr->_slots[kDMSlotPouch_2] == _vm->_thingNone) curSlotIndex = kDMSlotPouch_2; - else if ((objectAllowedSlots & _slotMasks[kDMSlotNeck]) && (championPtr->_slots[kDMSlotNeck] == Thing::_none)) + else if ((objectAllowedSlots & _slotMasks[kDMSlotNeck]) && (championPtr->_slots[kDMSlotNeck] == _vm->_thingNone)) curSlotIndex = kDMSlotNeck; else curSlotIndex = slotIdx++; break; case kDMThingTypeContainer: case kDMThingTypeJunk: - if ((objectAllowedSlots & _slotMasks[kDMSlotNeck]) && (championPtr->_slots[kDMSlotNeck] == Thing::_none)) + if ((objectAllowedSlots & _slotMasks[kDMSlotNeck]) && (championPtr->_slots[kDMSlotNeck] == _vm->_thingNone)) curSlotIndex = kDMSlotNeck; else curSlotIndex = slotIdx++; @@ -2068,8 +2074,8 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) { break; } - while (championPtr->_slots[curSlotIndex] != Thing::_none) { - if ((objectAllowedSlots & _slotMasks[kDMSlotNeck]) && (championPtr->_slots[kDMSlotNeck] == Thing::_none)) + while (championPtr->_slots[curSlotIndex] != _vm->_thingNone) { + if ((objectAllowedSlots & _slotMasks[kDMSlotNeck]) && (championPtr->_slots[kDMSlotNeck] == _vm->_thingNone)) curSlotIndex = kDMSlotNeck; else curSlotIndex = slotIdx++; @@ -2395,7 +2401,7 @@ void ChampionMan::drawSlot(uint16 champIndex, int16 slotIndex) { evtMan.hideMouse(); int16 iconIndex; - if (thing == Thing::_none) { + if (thing == _vm->_thingNone) { if (slotIndex <= kDMSlotFeet) { iconIndex = kDMIconIndiceReadyHand + (slotIndex << 1); if (champ->getWoundsFlag((ChampionWound)(1 << slotIndex))) { diff --git a/engines/dm/champion.h b/engines/dm/champion.h index ffcd7abc42..60c45a8825 100644 --- a/engines/dm/champion.h +++ b/engines/dm/champion.h @@ -397,6 +397,9 @@ public: }; // @ SKILL class Champion { +private: + DMEngine *_vm; + public: uint16 _attributes; uint16 _wounds; @@ -428,6 +431,9 @@ public: int16 _shieldDefense; byte _portrait[928]; // 32 x 29 pixel portrait + Champion() {} + void setVm(DMEngine *vm) { _vm = vm; } + Thing &getSlot(ChampionSlot slot) { return _slots[slot]; } void setSlot(ChampionSlot slot, Thing val) { _slots[slot] = val; } @@ -487,7 +493,7 @@ class ChampionMan { public: - Champion _champions[4]; // @ K0071_as_Champions + Champion *_champions; // @ K0071_as_Champions uint16 _partyChampionCount; // @ G0305_ui_PartyChampionCount bool _partyDead; // @ G0303_B_PartyDead Thing _leaderHandObject; // @ G0414_T_LeaderHandObject @@ -502,6 +508,8 @@ public: bool _mousePointerHiddenToDrawChangedObjIconOnScreen; // @ G0420_B_MousePointerHiddenToDrawChangedObjectIconOnScreen explicit ChampionMan(DMEngine *vm); + ~ChampionMan(); + ChampionIndex getIndexInCell(int16 cell); // @ F0285_CHAMPION_GetIndexInCell bool isLeaderHandObjectThrown(int16 side); // @ F0329_CHAMPION_IsLeaderHandObjectThrown bool isObjectThrown(uint16 champIndex, int16 slotIndex, int16 side); // @ F0328_CHAMPION_IsObjectThrown diff --git a/engines/dm/console.cpp b/engines/dm/console.cpp index 978fadb750..c27d143ddd 100644 --- a/engines/dm/console.cpp +++ b/engines/dm/console.cpp @@ -150,7 +150,7 @@ bool Console::Cmd_pos(int argc, const char** argv) { if (haventWarned.check()) debugPrintf("Setting position directly can cause glitches and crashes.\n"); debugPrintf("Position set to (%d, %d)\n", x, y); - _vm->_moveSens->getMoveResult(Thing::_party, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, + _vm->_moveSens->getMoveResult(_vm->_thingParty, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, x - currMap._offsetMapX, y - currMap._offsetMapY); } else goto argumentError; @@ -184,7 +184,7 @@ bool Console::Cmd_map(int argc, const char** argv) { debugPrintf("Setting map directly can cause glitches and crashes.\n"); debugPrintf("Map set to %d\n", index); - _vm->_moveSens->getMoveResult(Thing::_party, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMMapXNotOnASquare, 0); + _vm->_moveSens->getMoveResult(_vm->_thingParty, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMMapXNotOnASquare, 0); _vm->_newPartyMapIndex = _vm->_dungeonMan->getLocationAfterLevelChange( _vm->_dungeonMan->_partyMapIndex, index - _vm->_dungeonMan->_partyMapIndex, &_vm->_dungeonMan->_partyMapX, &_vm->_dungeonMan->_partyMapY); diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index 25d741f376..8fdb1c8d88 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -120,7 +120,14 @@ int16 DMEngine::getDistance(int16 mapx1, int16 mapy1, int16 mapx2, int16 mapy2) return ABS(mapx1 - mapx2) + ABS(mapy1 - mapy2); } -DMEngine::DMEngine(OSystem *syst, const DMADGameDescription *desc) : Engine(syst), _console(nullptr), _gameVersion(desc) { +DMEngine::DMEngine(OSystem *syst, const DMADGameDescription *desc) : + Engine(syst), _console(nullptr), _gameVersion(desc), + _thingNone(0), _thingEndOfList(0xFFFE), _thingFirstExplosion(0xFF80), + _thingExplFireBall(0xFF80), _thingExplSlime(0xFF81), _thingExplLightningBolt(0xFF82), + _thingExplHarmNonMaterial(0xFF83), _thingExplOpenDoor(0xFF84), _thingExplPoisonBolt(0xFF86), + _thingExplPoisonCloud(0xFF87), _thingExplSmoke(0xFFA8), _thingExplFluxcage(0xFFB2), + _thingExplRebirthStep1(0xFFE4), _thingExplRebirthStep2(0xFFE5), _thingParty(0xFFFF) + { // register random source _rnd = new Common::RandomSource("dm"); @@ -280,7 +287,7 @@ void DMEngine::initializeGame() { startGame(); if (_gameMode != kDMModeLoadSavedGame) - _moveSens->getMoveResult(Thing::_party, kDMMapXNotOnASquare, 0, _dungeonMan->_partyMapX, _dungeonMan->_partyMapY); + _moveSens->getMoveResult(_thingParty, kDMMapXNotOnASquare, 0, _dungeonMan->_partyMapX, _dungeonMan->_partyMapY); _eventMan->showMouse(); _eventMan->discardAllInput(); } @@ -413,7 +420,7 @@ void DMEngine::gameloop() { if (_newPartyMapIndex != kDMMapIndexNone) { processNewPartyMap(_newPartyMapIndex); - _moveSens->getMoveResult(Thing::_party, kDMMapXNotOnASquare, 0, _dungeonMan->_partyMapX, _dungeonMan->_partyMapY); + _moveSens->getMoveResult(_thingParty, kDMMapXNotOnASquare, 0, _dungeonMan->_partyMapX, _dungeonMan->_partyMapY); _newPartyMapIndex = kDMMapIndexNone; _eventMan->discardAllInput(); } @@ -928,12 +935,12 @@ void DMEngine::fuseSequence() { for (;;) { Thing curThing = _dungeonMan->getSquareFirstObject(fluxCageMapX, fluxcageMapY); - while (curThing != Thing::_endOfList) { + while (curThing != _thingEndOfList) { if (curThing.getType() == kDMThingTypeExplosion) { Explosion *curExplosion = (Explosion*)_dungeonMan->getThingData(curThing); if (curExplosion->getType() == kDMExplosionTypeFluxcage) { _dungeonMan->unlinkThingFromList(curThing, Thing(0), fluxCageMapX, fluxcageMapY); - curExplosion->setNextThing(Thing::_none); + curExplosion->setNextThing(_thingNone); continue; } } @@ -948,14 +955,14 @@ void DMEngine::fuseSequence() { } fuseSequenceUpdate(); for (int16 attackId = 55; attackId <= 255; attackId += 40) { - _projexpl->createExplosion(Thing::_explFireBall, attackId, lordChaosMapX, lordChaosMapY, kDMCreatureTypeSingleCenteredCreature); + _projexpl->createExplosion(_thingExplFireBall, attackId, lordChaosMapX, lordChaosMapY, kDMCreatureTypeSingleCenteredCreature); fuseSequenceUpdate(); } _sound->requestPlay(kDMSoundIndexBuzz, lordChaosMapX, lordChaosMapY, kDMSoundModePlayIfPrioritized); lordGroup->_type = kDMCreatureTypeLordOrder; fuseSequenceUpdate(); for (int16 attackId = 55; attackId <= 255; attackId += 40) { - _projexpl->createExplosion(Thing::_explHarmNonMaterial, attackId, lordChaosMapX, lordChaosMapY, kDMCreatureTypeSingleCenteredCreature); + _projexpl->createExplosion(_thingExplHarmNonMaterial, attackId, lordChaosMapX, lordChaosMapY, kDMCreatureTypeSingleCenteredCreature); fuseSequenceUpdate(); } for (int16 cycleCount = 3; cycleCount > 0; cycleCount--) { @@ -966,8 +973,8 @@ void DMEngine::fuseSequence() { fuseSequenceUpdate(); } } - _projexpl->createExplosion(Thing::_explFireBall, 255, lordChaosMapX, lordChaosMapY, kDMCreatureTypeSingleCenteredCreature); - _projexpl->createExplosion(Thing::_explHarmNonMaterial, 255, lordChaosMapX, lordChaosMapY, kDMCreatureTypeSingleCenteredCreature); + _projexpl->createExplosion(_thingExplFireBall, 255, lordChaosMapX, lordChaosMapY, kDMCreatureTypeSingleCenteredCreature); + _projexpl->createExplosion(_thingExplHarmNonMaterial, 255, lordChaosMapX, lordChaosMapY, kDMCreatureTypeSingleCenteredCreature); fuseSequenceUpdate(); lordGroup->_type = kDMCreatureTypeGreyLord; fuseSequenceUpdate(); @@ -976,7 +983,7 @@ void DMEngine::fuseSequence() { for (int16 curMapX = 0; curMapX < _dungeonMan->_currMapWidth; curMapX++) { for (int curMapY = 0; curMapY < _dungeonMan->_currMapHeight; curMapY++) { Thing curThing = _groupMan->groupGetThing(curMapX, curMapY); - if ((curThing != Thing::_endOfList) && ((curMapX != lordChaosMapX) || (curMapY != lordChaosMapY))) { + if ((curThing != _thingEndOfList) && ((curMapX != lordChaosMapX) || (curMapY != lordChaosMapY))) { _groupMan->groupDelete(curMapX, curMapY); } } @@ -986,7 +993,7 @@ void DMEngine::fuseSequence() { Thing curThing = _dungeonMan->getSquareFirstThing(0, 0); int16 textStringThingCount = 0; Thing textStringThings[8]; - while (curThing != Thing::_endOfList) { + while (curThing != _thingEndOfList) { if (curThing.getType() == kDMstringTypeText) textStringThings[textStringThingCount++] = curThing; @@ -1011,7 +1018,7 @@ void DMEngine::fuseSequence() { } for (int16 attackId = 55; attackId <= 255; attackId += 40) { - _projexpl->createExplosion(Thing::_explHarmNonMaterial, attackId, lordChaosMapX, lordChaosMapY, kDMCreatureTypeSingleCenteredCreature); + _projexpl->createExplosion(_thingExplHarmNonMaterial, attackId, lordChaosMapX, lordChaosMapY, kDMCreatureTypeSingleCenteredCreature); fuseSequenceUpdate(); } diff --git a/engines/dm/dm.h b/engines/dm/dm.h index 9056a744fb..16307778ba 100644 --- a/engines/dm/dm.h +++ b/engines/dm/dm.h @@ -167,21 +167,6 @@ struct DMADGameDescription { class Thing { public: uint16 _data; - static const Thing _none; // @ C0xFFFF_THING_NONE - static const Thing _endOfList; // @ C0xFFFE_THING_ENDOFLIST - static const Thing _firstExplosion; // @ C0xFF80_THING_FIRST_EXPLOSION - static const Thing _explFireBall; // @ C0xFF80_THING_EXPLOSION_FIREBALL - static const Thing _explSlime; // @ C0xFF81_THING_EXPLOSION_SLIME - static const Thing _explLightningBolt; // @ C0xFF82_THING_EXPLOSION_LIGHTNING_BOLT - static const Thing _explHarmNonMaterial; // @ C0xFF83_THING_EXPLOSION_HARM_NON_MATERIAL - static const Thing _explOpenDoor; // @ C0xFF84_THING_EXPLOSION_OPEN_DOOR - static const Thing _explPoisonBolt; // @ C0xFF86_THING_EXPLOSION_POISON_BOLT - static const Thing _explPoisonCloud; // @ C0xFF87_THING_EXPLOSION_POISON_CLOUD - static const Thing _explSmoke; // @ C0xFFA8_THING_EXPLOSION_SMOKE - static const Thing _explFluxcage; // @ C0xFFB2_THING_EXPLOSION_FLUXCAGE - static const Thing _explRebirthStep1; // @ C0xFFE4_THING_EXPLOSION_REBIRTH_STEP1 - static const Thing _explRebirthStep2; // @ C0xFFE5_THING_EXPLOSION_REBIRTH_STEP2 - static const Thing _party; // @ C0xFFFF_THING_PARTY Thing() : _data(0) {} Thing(const Thing &other) { set(other._data); } @@ -329,6 +314,22 @@ public: int32 _gameTime; // @ G0313_ul_GameTime char _stringBuildBuffer[128]; // @ G0353_ac_StringBuildBuffer int16 _waitForInputMaxVerticalBlankCount; // @ G0318_i_WaitForInputMaximumVerticalBlankCount + + Thing _thingNone; // @ C0xFFFF_THING_NONE + Thing _thingEndOfList; // @ C0xFFFE_THING_ENDOFLIST + Thing _thingFirstExplosion; // @ C0xFF80_THING_FIRST_EXPLOSION + Thing _thingExplFireBall; // @ C0xFF80_THING_EXPLOSION_FIREBALL + Thing _thingExplSlime; // @ C0xFF81_THING_EXPLOSION_SLIME + Thing _thingExplLightningBolt; // @ C0xFF82_THING_EXPLOSION_LIGHTNING_BOLT + Thing _thingExplHarmNonMaterial; // @ C0xFF83_THING_EXPLOSION_HARM_NON_MATERIAL + Thing _thingExplOpenDoor; // @ C0xFF84_THING_EXPLOSION_OPEN_DOOR + Thing _thingExplPoisonBolt; // @ C0xFF86_THING_EXPLOSION_POISON_BOLT + Thing _thingExplPoisonCloud; // @ C0xFF87_THING_EXPLOSION_POISON_CLOUD + Thing _thingExplSmoke; // @ C0xFFA8_THING_EXPLOSION_SMOKE + Thing _thingExplFluxcage; // @ C0xFFB2_THING_EXPLOSION_FLUXCAGE + Thing _thingExplRebirthStep1; // @ C0xFFE4_THING_EXPLOSION_REBIRTH_STEP1 + Thing _thingExplRebirthStep2; // @ C0xFFE5_THING_EXPLOSION_REBIRTH_STEP2 + Thing _thingParty; // @ C0xFFFF_THING_PARTY }; bool readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader *header); diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp index 618c61a307..2d0d65f2a4 100644 --- a/engines/dm/dungeonman.cpp +++ b/engines/dm/dungeonman.cpp @@ -543,22 +543,6 @@ void DungeonMan::decompressDungeonFile() { f.close(); } -const Thing Thing::_none(0); // @ C0xFFFF_THING_NONE -const Thing Thing::_endOfList(0xFFFE); // @ C0xFFFE_THING_ENDOFLIST -const Thing Thing::_firstExplosion(0xFF80); // @ C0xFF80_THING_FIRST_EXPLOSION -const Thing Thing::_explFireBall(0xFF80); // @ C0xFF80_THING_EXPLOSION_FIREBALL -const Thing Thing::_explSlime(0xFF81); // @ C0xFF81_THING_EXPLOSION_SLIME -const Thing Thing::_explLightningBolt(0xFF82); // @ C0xFF82_THING_EXPLOSION_LIGHTNING_BOLT -const Thing Thing::_explHarmNonMaterial(0xFF83); // @ C0xFF83_THING_EXPLOSION_HARM_NON_MATERIAL -const Thing Thing::_explOpenDoor(0xFF84); // @ C0xFF84_THING_EXPLOSION_OPEN_DOOR -const Thing Thing::_explPoisonBolt(0xFF86); // @ C0xFF86_THING_EXPLOSION_POISON_BOLT -const Thing Thing::_explPoisonCloud(0xFF87); // @ C0xFF87_THING_EXPLOSION_POISON_CLOUD -const Thing Thing::_explSmoke(0xFFA8); // @ C0xFFA8_THING_EXPLOSION_SMOKE -const Thing Thing::_explFluxcage(0xFFB2); // @ C0xFFB2_THING_EXPLOSION_FLUXCAGE -const Thing Thing::_explRebirthStep1(0xFFE4); // @ C0xFFE4_THING_EXPLOSION_REBIRTH_STEP1 -const Thing Thing::_explRebirthStep2(0xFFE5); // @ C0xFFE5_THING_EXPLOSION_REBIRTH_STEP2 -const Thing Thing::_party(0xFFFF); // @ C0xFFFF_THING_PARTY - void DungeonMan::loadDungeonFile(Common::InSaveFile *file) { static const byte additionalThingCounts[16] = { // @ G0236_auc_Graphic559_AdditionalThingCounts{ 0, /* Door */ @@ -685,7 +669,7 @@ void DungeonMan::loadDungeonFile(Common::InSaveFile *file) { if (_vm->_gameMode != kDMModeLoadSavedGame) { for (uint16 i = 0; i < 300; ++i) - _squareFirstThings[actualSquareFirstThingCount + i] = Thing::_none; + _squareFirstThings[actualSquareFirstThingCount + i] = _vm->_thingNone; } // load text data @@ -739,7 +723,7 @@ void DungeonMan::loadDungeonFile(Common::InSaveFile *file) { timeline._eventMaxCount += _dungeonFileHeader._thingCounts[thingType]; for (uint16 i = 0; i < additionalThingCounts[thingType]; ++i) - (_thingData[thingType] + (thingCount + i) * thingStoreWordCount)[0] = Thing::_none.toUint16(); + (_thingData[thingType] + (thingCount + i) * thingStoreWordCount)[0] = _vm->_thingNone.toUint16(); } } @@ -864,7 +848,7 @@ int16 DungeonMan::getSquareFirstThingIndex(int16 mapX, int16 mapY) { Thing DungeonMan::getSquareFirstThing(int16 mapX, int16 mapY) { int16 index = getSquareFirstThingIndex(mapX, mapY); if (index == -1) - return Thing::_endOfList; + return _vm->_thingEndOfList; return _squareFirstThings[index]; } @@ -918,7 +902,7 @@ void DungeonMan::setSquareAspect(uint16 *aspectArray, Direction dir, int16 mapX, squareIsFakeWall = false; T0172010_ClosedFakeWall: setSquareAspectOrnOrdinals(aspectArray, leftRandomWallOrnamentAllowed, frontRandomWallOrnamentAllowed, rightRandomWallOrnamentAllowed, dir, mapX, mapY, squareIsFakeWall); - while ((curThing != Thing::_endOfList) && (curThing.getType() <= kDMThingTypeSensor)) { + while ((curThing != _vm->_thingEndOfList) && (curThing.getType() <= kDMThingTypeSensor)) { ThingType curThingType = curThing.getType(); int16 AL0310_i_SideIndex = _vm->normalizeModulo4(curThing.getCell() - dir); if (AL0310_i_SideIndex) { /* Invisible on the back wall if 0 */ @@ -938,7 +922,7 @@ T0172010_ClosedFakeWall: curThing = getNextThing(curThing); } if (squareIsFakeWall && (_partyMapX != mapX) && (_partyMapY != mapY)) { - aspectArray[kDMSquareAspectFirstGroupOrObject] = Thing::_endOfList.toUint16(); + aspectArray[kDMSquareAspectFirstGroupOrObject] = _vm->_thingEndOfList.toUint16(); return; } break; @@ -971,7 +955,7 @@ T0172010_ClosedFakeWall: AL0307_uc_FootprintsAllowed = true; } - while ((curThing != Thing::_endOfList) && (curThing.getType() <= kDMThingTypeSensor)) { + while ((curThing != _vm->_thingEndOfList) && (curThing.getType() <= kDMThingTypeSensor)) { if (curThing.getType() == kDMThingTypeSensor) { Sensor *curSensor = (Sensor *)getThingData(curThing); aspectArray[kDMSquareAspectFloorOrn] = curSensor->getAttrOrnOrdinal(); @@ -988,7 +972,7 @@ T0172010_ClosedFakeWall: aspectArray[kDMSquareAspectElement] = (bool((getFlag(AL0307_uc_Square, kDMSquareMaskStairsNorthSouth) >> 3)) == _vm->isOrientedWestEast(dir)) ? kDMElementTypeStairsSide : kDMElementTypeStairsFront; aspectArray[kDMSquareAspectStairsUp] = getFlag(AL0307_uc_Square, kDMSquareMaskStairsUp); AL0307_uc_FootprintsAllowed = false; - while ((curThing != Thing::_endOfList) && (curThing.getType() <= kDMThingTypeSensor)) + while ((curThing != _vm->_thingEndOfList) && (curThing.getType() <= kDMThingTypeSensor)) curThing = getNextThing(curThing); break; case kDMElementTypeDoor: @@ -1001,7 +985,7 @@ T0172010_ClosedFakeWall: } AL0307_uc_FootprintsAllowed = true; - while ((curThing != Thing::_endOfList) && (curThing.getType() <= kDMThingTypeSensor)) + while ((curThing != _vm->_thingEndOfList) && (curThing.getType() <= kDMThingTypeSensor)) curThing = getNextThing(curThing); AL0307_uc_ScentOrdinal = championMan.getScentOrdinal(mapX, mapY); @@ -1219,7 +1203,7 @@ Thing DungeonMan::getUnusedThing(uint16 thingType) { Thing curThing; for (;;) { /*_Infinite loop_*/ - if (*thingPtr == Thing::_none) { /* If thing data is unused */ + if (*thingPtr == _vm->_thingNone) { /* If thing data is unused */ curThing = Thing((thingType << 10) | (thingCount - thingIdx)); break; } @@ -1227,8 +1211,8 @@ Thing DungeonMan::getUnusedThing(uint16 thingType) { thingPtr += thingDataByteCount; /* Proceed to the next thing data */ } else { curThing = getDiscardThing(thingType); - if (curThing == Thing::_none) - return Thing::_none; + if (curThing == _vm->_thingNone) + return _vm->_thingNone; thingPtr = (Thing *)getThingData(curThing); break; @@ -1236,7 +1220,7 @@ Thing DungeonMan::getUnusedThing(uint16 thingType) { } memset(thingPtr, 0, thingDataByteCount * 2); - *thingPtr = Thing::_endOfList; + *thingPtr = _vm->_thingEndOfList; return curThing; } @@ -1266,11 +1250,11 @@ uint16 DungeonMan::getObjectWeight(Thing thing) { 2, 0, 8 }; - if (thing == Thing::_none) + if (thing == _vm->_thingNone) return 0; // Initialization is not present in original - // Set to 0 by default as it's the default value used for Thing::_none + // Set to 0 by default as it's the default value used for _vm->_none uint16 weight = 0; Junk *junk = (Junk *)getThingData(thing); @@ -1290,7 +1274,7 @@ uint16 DungeonMan::getObjectWeight(Thing thing) { case kDMThingTypeContainer: weight = 50; thing = ((Container *)junk)->getSlot(); - while (thing != Thing::_endOfList) { + while (thing != _vm->_thingEndOfList) { weight += getObjectWeight(thing); thing = getNextThing(thing); } @@ -1332,11 +1316,11 @@ int16 DungeonMan::getObjectInfoIndex(Thing thing) { } void DungeonMan::linkThingToList(Thing thingToLink, Thing thingInList, int16 mapX, int16 mapY) { - if (thingToLink == Thing::_endOfList) + if (thingToLink == _vm->_thingEndOfList) return; Thing *thingPtr = (Thing *)getThingData(thingToLink); - *thingPtr = Thing::_endOfList; + *thingPtr = _vm->_thingEndOfList; /* If mapX >= 0 then the thing is linked to the list of things on the specified square else it is linked at the end of the specified thing list */ if (mapX >= 0) { byte *currSquare = &_currMapData[mapX][mapY]; @@ -1366,7 +1350,7 @@ void DungeonMan::linkThingToList(Thing thingToLink, Thing thingInList, int16 map } } Thing nextThing = getNextThing(thingInList); - while (nextThing != Thing::_endOfList) + while (nextThing != _vm->_thingEndOfList) nextThing = getNextThing(thingInList = nextThing); thingPtr = (Thing *)getThingData(thingInList); @@ -1381,13 +1365,13 @@ WeaponInfo *DungeonMan::getWeaponInfo(Thing thing) { int16 DungeonMan::getProjectileAspect(Thing thing) { ThingType thingType = thing.getType(); if (thingType == kDMThingTypeExplosion) { - if (thing == Thing::_explFireBall) + if (thing == _vm->_thingExplFireBall) return -_vm->indexToOrdinal(k10_ProjectileAspectExplosionFireBall); - if (thing == Thing::_explSlime) + if (thing == _vm->_thingExplSlime) return -_vm->indexToOrdinal(k12_ProjectileAspectExplosionSlime); - if (thing == Thing::_explLightningBolt) + if (thing == _vm->_thingExplLightningBolt) return -_vm->indexToOrdinal(k3_ProjectileAspectExplosionLightningBolt); - if ((thing == Thing::_explPoisonBolt) || (thing == Thing::_explPoisonCloud)) + if ((thing == _vm->_thingExplPoisonBolt) || (thing == _vm->_thingExplPoisonCloud)) return -_vm->indexToOrdinal(k13_ProjectileAspectExplosionPoisonBoltCloud); return -_vm->indexToOrdinal(k11_ProjectileAspectExplosionDefault); @@ -1426,7 +1410,7 @@ int16 DungeonMan::getLocationAfterLevelChange(int16 mapIndex, int16 levelDelta, Thing DungeonMan::getSquareFirstObject(int16 mapX, int16 mapY) { Thing thing = getSquareFirstThing(mapX, mapY); - while ((thing != Thing::_endOfList) && (thing.getType() < kDMThingTypeGroup)) + while ((thing != _vm->_thingEndOfList) && (thing.getType() < kDMThingTypeGroup)) thing = getNextThing(thing); return thing; @@ -1445,7 +1429,7 @@ Thing DungeonMan::getDiscardThing(uint16 thingType) { static unsigned char lastDiscardedThingMapIndex[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; if (thingType == kDMThingTypeExplosion) - return Thing::_none; + return _vm->_thingNone; GroupMan &groupMan = *_vm->_groupMan; ProjExpl &projExpl = *_vm->_projexpl; @@ -1525,13 +1509,13 @@ Thing DungeonMan::getDiscardThing(uint16 thingType) { lastDiscardedThingMapIndex[thingType] = mapIndex; return Thing(squareThing.getTypeAndIndex()); } - } while ((squareThing = getNextThing(squareThing)) != Thing::_endOfList); + } while ((squareThing = getNextThing(squareThing)) != _vm->_thingEndOfList); } } } if ((mapIndex == _partyMapIndex) || (_dungeonFileHeader._mapCount <= 1)) { lastDiscardedThingMapIndex[thingType] = mapIndex; - return Thing::_none; + return _vm->_thingNone; } do { @@ -1575,7 +1559,7 @@ bool DungeonMan::isCreatureAllowedOnMap(Thing thing, uint16 mapIndex) { } void DungeonMan::unlinkThingFromList(Thing thingToUnlink, Thing thingInList, int16 mapX, int16 mapY) { - if (thingToUnlink == Thing::_endOfList) + if (thingToUnlink == _vm->_thingEndOfList) return; uint16 tmp = thingToUnlink.toUint16(); @@ -1587,24 +1571,24 @@ void DungeonMan::unlinkThingFromList(Thing thingToUnlink, Thing thingInList, int thingPtr = (Thing *)getThingData(thingToUnlink); uint16 firstThingIndex = getSquareFirstThingIndex(mapX, mapY); Thing *currThing = &_squareFirstThings[firstThingIndex]; /* BUG0_01 Coding error without consequence. The engine does not check that there are things at the specified square coordinates. f160_getSquareFirstThingIndex would return -1 for an empty square. No consequence as the function is never called with the coordinates of an empty square (except in the case of BUG0_59) */ - if ((*thingPtr == Thing::_endOfList) && (((Thing *)currThing)->getTypeAndIndex() == thingToUnlink.toUint16())) { /* If the thing to unlink is the last thing on the square */ + if ((*thingPtr == _vm->_thingEndOfList) && (((Thing *)currThing)->getTypeAndIndex() == thingToUnlink.toUint16())) { /* If the thing to unlink is the last thing on the square */ clearFlag(_currMapData[mapX][mapY], kDMSquareMaskThingListPresent); uint16 squareFirstThingIdx = _dungeonFileHeader._squareFirstThingCount - 1; for (uint16 i = 0; i < squareFirstThingIdx - firstThingIndex; ++i) currThing[i] = currThing[i + 1]; - _squareFirstThings[squareFirstThingIdx] = Thing::_none; + _squareFirstThings[squareFirstThingIdx] = _vm->_thingNone; uint16 *cumulativeFirstThingCount = _currMapColCumulativeSquareFirstThingCount + mapX + 1; uint16 currColumn = _dungeonColumCount - (_dungeonMapsFirstColumnIndex[_currMapIndex] + mapX) - 1; while (currColumn--) { /* For each column starting from and after the column containing the square where the thing is unlinked */ (*cumulativeFirstThingCount++)--; /* Decrement the cumulative first thing count */ } - *thingPtr = Thing::_endOfList; + *thingPtr = _vm->_thingEndOfList; return; } if (((Thing *)currThing)->getTypeAndIndex() == thingToUnlink.toUint16()) { *currThing = *thingPtr; - *thingPtr = Thing::_endOfList; + *thingPtr = _vm->_thingEndOfList; return; } thingInList = *currThing; @@ -1612,9 +1596,9 @@ void DungeonMan::unlinkThingFromList(Thing thingToUnlink, Thing thingInList, int Thing currThing = getNextThing(thingInList); while (currThing.getTypeAndIndex() != thingToUnlink.toUint16()) { - if ((currThing == Thing::_endOfList) || (currThing == Thing::_none)) { + if ((currThing == _vm->_thingEndOfList) || (currThing == _vm->_thingNone)) { if (thingPtr) - *thingPtr = Thing::_endOfList; + *thingPtr = _vm->_thingEndOfList; return; } currThing = getNextThing(thingInList = currThing); @@ -1622,7 +1606,7 @@ void DungeonMan::unlinkThingFromList(Thing thingToUnlink, Thing thingInList, int thingPtr = (Thing *)getThingData(thingInList); *thingPtr = getNextThing(currThing); thingPtr = (Thing *)getThingData(thingToUnlink); - *thingPtr = Thing::_endOfList; + *thingPtr = _vm->_thingEndOfList; } int16 DungeonMan::getStairsExitDirection(int16 mapX, int16 mapY) { @@ -1678,12 +1662,12 @@ Thing DungeonMan::getObjForProjectileLaucherOrObjGen(uint16 iconIndex) { junkType = kDMWeaponTorch; break; default: - return Thing::_none; + return _vm->_thingNone; } Thing unusedThing = getUnusedThing(thingType); - if (unusedThing == Thing::_none) - return Thing::_none; + if (unusedThing == _vm->_thingNone) + return _vm->_thingNone; Junk *junkPtr = (Junk *)getThingData(unusedThing); junkPtr->setType(junkType); /* Also works for WEAPON in cases other than Boulder */ diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp index 43f9bd8efc..622a7d5e1f 100644 --- a/engines/dm/eventman.cpp +++ b/engines/dm/eventman.cpp @@ -948,9 +948,9 @@ void EventManager::commandTurnParty(CommandType cmdType) { return; } - _vm->_moveSens->processThingAdditionOrRemoval(_vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, Thing::_party, true, false); + _vm->_moveSens->processThingAdditionOrRemoval(_vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, _vm->_thingParty, true, false); _vm->_championMan->setPartyDirection(_vm->normalizeModulo4(_vm->_dungeonMan->_partyDir + ((cmdType == kDMCommandTurnRight) ? 1 : 3))); - _vm->_moveSens->processThingAdditionOrRemoval(_vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, Thing::_party, true, true); + _vm->_moveSens->processThingAdditionOrRemoval(_vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, _vm->_thingParty, true, true); } void EventManager::commandMoveParty(CommandType cmdType) { @@ -1005,7 +1005,7 @@ void EventManager::commandMoveParty(CommandType cmdType) { isMovementBlocked = true; break; case kDMElementTypeStairs: { - _vm->_moveSens->getMoveResult(Thing::_party, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMMapXNotOnASquare, 0); + _vm->_moveSens->getMoveResult(_vm->_thingParty, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMMapXNotOnASquare, 0); _vm->_dungeonMan->_partyMapX = partyMapX; _vm->_dungeonMan->_partyMapY = partyMapY; byte stairState = curSquare.toByte(); @@ -1038,7 +1038,7 @@ void EventManager::commandMoveParty(CommandType cmdType) { if (damage) _vm->_sound->requestPlay(kDMSoundIndexPartyDamaged, partyMapX, partyMapY, kDMSoundModePlayImmediately); } else { - isMovementBlocked = (_vm->_groupMan->groupGetThing(partyMapX, partyMapY) != Thing::_endOfList); + isMovementBlocked = (_vm->_groupMan->groupGetThing(partyMapX, partyMapY) != _vm->_thingEndOfList); if (isMovementBlocked) _vm->_groupMan->processEvents29to41(partyMapX, partyMapY, kDMEventTypeCreateReactionPartyIsAdjacent, 0); } @@ -1052,9 +1052,9 @@ void EventManager::commandMoveParty(CommandType cmdType) { } if (isStairsSquare) - _vm->_moveSens->getMoveResult(Thing::_party, kDMMapXNotOnASquare, 0, partyMapX, partyMapY); + _vm->_moveSens->getMoveResult(_vm->_thingParty, kDMMapXNotOnASquare, 0, partyMapX, partyMapY); else - _vm->_moveSens->getMoveResult(Thing::_party, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, partyMapX, partyMapY); + _vm->_moveSens->getMoveResult(_vm->_thingParty, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, partyMapX, partyMapY); uint16 disabledMovtTicks = 1; championsPtr = _vm->_championMan->_champions; @@ -1282,7 +1282,7 @@ void EventManager::commandProcessCommands160To162ClickInResurrectReincarnatePane for (uint16 slotIndex = kDMSlotReadyHand; slotIndex < kDMSlotChest1; slotIndex++) { Thing thing = champ->getSlot((ChampionSlot)slotIndex); - if (thing != Thing::_none) { + if (thing != _vm->_thingNone) { _vm->_dungeonMan->unlinkThingFromList(thing, Thing(0), mapX, mapY); } } @@ -1371,7 +1371,7 @@ void EventManager::processType80_clickInDungeonView_grabLeaderHandObject(uint16 if (viewCell >= kDMViewCellBackRight) { mapX += _vm->_dirIntoStepCountEast[_vm->_dungeonMan->_partyDir], mapY += _vm->_dirIntoStepCountNorth[_vm->_dungeonMan->_partyDir]; Thing groupThing = _vm->_groupMan->groupGetThing(mapX, mapY); - if ((groupThing != Thing::_endOfList) && + if ((groupThing != _vm->_thingEndOfList) && !_vm->_moveSens->isLevitating(groupThing) && _vm->_groupMan->getCreatureOrdinalInCell((Group*)_vm->_dungeonMan->getThingData(groupThing), _vm->normalizeModulo4(viewCell + _vm->_dungeonMan->_partyDir))) { return; /* It is not possible to grab an object on floor if there is a non levitating creature on its cell */ @@ -1454,7 +1454,7 @@ void EventManager::discardAllInput() { } void EventManager::commandTakeStairs(bool stairsGoDown) { - _vm->_moveSens->getMoveResult(Thing::_party, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMMapXNotOnASquare, 0); + _vm->_moveSens->getMoveResult(_vm->_thingParty, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, kDMMapXNotOnASquare, 0); _vm->_newPartyMapIndex = _vm->_dungeonMan->getLocationAfterLevelChange(_vm->_dungeonMan->_partyMapIndex, stairsGoDown ? -1 : 1, &_vm->_dungeonMan->_partyMapX, &_vm->_dungeonMan->_partyMapY); _vm->_dungeonMan->setCurrentMap(_vm->_newPartyMapIndex); _vm->_championMan->setPartyDirection(_vm->_dungeonMan->getStairsExitDirection(_vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY)); diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index ccab619b50..caf6dc45c9 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -116,7 +116,7 @@ DisplayMan::DisplayMan(DMEngine *dmEngine) : _vm(dmEngine) { for (int i = 0; i < 18; i++) _currMapDoorOrnIndices[i] = 0; - _inscriptionThing = Thing::_none; + _inscriptionThing = _vm->_thingNone; _useByteBoxCoordinates = false; _bitmapCeiling = nullptr; @@ -3177,14 +3177,14 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir {276, 60} /* D0R */ }; - if (thingParam == Thing::_endOfList) + if (thingParam == _vm->_thingEndOfList) return; DungeonMan &dungeon = *_vm->_dungeonMan; int16 orderedViewCellOrdinals = cellOrder; Group *group = nullptr; - Thing groupThing = Thing::_none; + Thing groupThing = _vm->_thingNone; bool squareHasExplosion = drawCreaturesCompleted = false; bool squareHasProjectile = false; cellCounter = 0; @@ -3351,14 +3351,14 @@ T0115015_DrawProjectileAsObject: if (drawProjectileAsObject) goto T0115171_BackFromT0115015_DrawProjectileAsObject; } - } while ((thingParam = dungeon.getNextThing(thingParam)) != Thing::_endOfList); + } while ((thingParam = dungeon.getNextThing(thingParam)) != _vm->_thingEndOfList); if (AL_2_viewCell == kDMViewCellAlcove) break; /* End of processing when drawing objects in an alcove */ if (viewSquareIndex < kDMViewSquareD3C) break; /* End of processing if square is too far away at D4 */ /* Draw creatures */ drawingLastBackRowCell = ((AL_2_viewCell <= kDMViewCellFrontRight) || (cellCounter == 1)) && (!remainingViewCellOrdinalsToProcess || ((remainingViewCellOrdinalsToProcess & 0x0000000F) >= 3)); /* If (draw cell on the back row or second cell being processed) and (no more cells to draw or next cell to draw is a cell on the front row) */ - if ((groupThing == Thing::_none) || drawCreaturesCompleted) + if ((groupThing == _vm->_thingNone) || drawCreaturesCompleted) goto T0115129_DrawProjectiles; /* Skip code to draw creatures */ ActiveGroup *activeGroup; @@ -3733,7 +3733,7 @@ T0115129_DrawProjectiles: } } T0115171_BackFromT0115015_DrawProjectileAsObject:; - } while ((thingParam = dungeon.getNextThing(thingParam)) != Thing::_endOfList); + } while ((thingParam = dungeon.getNextThing(thingParam)) != _vm->_thingEndOfList); } while (remainingViewCellOrdinalsToProcess); /* Draw explosions */ @@ -3765,7 +3765,7 @@ T0115171_BackFromT0115015_DrawProjectileAsObject:; AL_4_explosionAspectIndex = kDMExplosionAspectSmoke; } else { if (AL_4_explosionType == kDMExplosionTypeRebirthStep1) { - objectAspect = (ObjectAspect *)&_projectileAspect[_vm->ordinalToIndex(-dungeon.getProjectileAspect(Thing::_explLightningBolt))]; + objectAspect = (ObjectAspect *)&_projectileAspect[_vm->ordinalToIndex(-dungeon.getProjectileAspect(_vm->_thingExplLightningBolt))]; bitmapRedBanana = getNativeBitmapOrGraphic(((ProjectileAspect *)objectAspect)->_firstNativeBitmapRelativeIndex + (kDMGraphicIdxFirstProjectile + 1)); explosionCoordinates = rebirthStep1ExplosionCoordinates[AL_1_viewSquareExplosionIndex - 3]; byteWidth = getScaledDimension((((ProjectileAspect *)objectAspect)->_byteWidth), explosionCoordinates[2]); @@ -3869,7 +3869,7 @@ T0115200_DrawExplosion: blitToBitmap(bitmapRedBanana, _bitmapViewport, boxByteGreen, AL_4_xPos, 0, byteWidth, k112_byteWidthViewport, kDMColorFlesh, heightRedEagle, k136_heightViewport); } } - } while ((thingParam = dungeon.getNextThing(thingParam))!= Thing::_endOfList); + } while ((thingParam = dungeon.getNextThing(thingParam))!= _vm->_thingEndOfList); if ((fluxcageExplosion != 0) && (doorFrontViewDrawingPass != 1) && !_doNotDrawFluxcagesDuringEndgame) { /* Fluxcage is an explosion displayed as a field (like teleporters), above all other graphics */ AL_1_viewSquareExplosionIndex -= 3; /* Convert square index for explosions back to square index */ diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp index a72342da3d..8656d9fa2f 100644 --- a/engines/dm/group.cpp +++ b/engines/dm/group.cpp @@ -155,7 +155,7 @@ void GroupMan::dropGroupPossessions(int16 mapX, int16 mapY, Thing groupThing, So } Thing currentThing = group->_slot; - if ((currentThing) != Thing::_endOfList) { + if ((currentThing) != _vm->_thingEndOfList) { bool weaponDropped = false; Thing nextThing; do { @@ -165,7 +165,7 @@ void GroupMan::dropGroupPossessions(int16 mapX, int16 mapY, Thing groupThing, So weaponDropped = true; } _vm->_moveSens->getMoveResult(currentThing, kDMMapXNotOnASquare, 0, mapX, mapY); - } while ((currentThing = nextThing) != Thing::_endOfList); + } while ((currentThing = nextThing) != _vm->_thingEndOfList); if (soundMode != kDMSoundModeDoNotPlaySound) _vm->_sound->requestPlay(weaponDropped ? kDMSoundIndexMetallicThud : kDMSoundIndexWoodenThudAttackTrolinAntmanStoneGolem, mapX, mapY, soundMode); @@ -289,7 +289,7 @@ void GroupMan::dropCreatureFixedPossessions(CreatureType creatureType, int16 map } Thing nextUnusedThing = dungeon.getUnusedThing(currThingType); - if ((nextUnusedThing) == Thing::_none) + if ((nextUnusedThing) == _vm->_thingNone) continue; Weapon *currWeapon = (Weapon *)dungeon.getThingData(nextUnusedThing); @@ -390,7 +390,7 @@ Thing GroupMan::groupGetThing(int16 mapX, int16 mapY) { DungeonMan &dungeon = *_vm->_dungeonMan; Thing curThing = dungeon.getSquareFirstThing(mapX, mapY); - while ((curThing != Thing::_endOfList) && (curThing.getType() != kDMThingTypeGroup)) + while ((curThing != _vm->_thingEndOfList) && (curThing.getType() != kDMThingTypeGroup)) curThing = dungeon.getNextThing(curThing); return curThing; @@ -489,7 +489,7 @@ int16 GroupMan::groupGetDamageCreatureOutcome(Group *group, uint16 creatureIndex else attack = 255; - _vm->_projexpl->createExplosion(Thing::_explSmoke, attack, mapX, mapY, cell); /* BUG0_66 Smoke is placed on the source map instead of the destination map when a creature dies by falling through a pit. The game has a special case to correctly drop the creature possessions on the destination map but there is no such special case for the smoke. Note that the death must be caused by the damage of the fall (there is no smoke if the creature is removed because its type is not allowed on the destination map). However this bug has no visible consequence because of BUG0_26: the smoke explosion falls in the pit right after being placed in the dungeon and before being drawn on screen so it is only visible on the destination square */ + _vm->_projexpl->createExplosion(_vm->_thingExplSmoke, attack, mapX, mapY, cell); /* BUG0_66 Smoke is placed on the source map instead of the destination map when a creature dies by falling through a pit. The game has a special case to correctly drop the creature possessions on the destination map but there is no such special case for the smoke. Note that the death must be caused by the damage of the fall (there is no smoke if the creature is removed because its type is not allowed on the destination map). However this bug has no visible consequence because of BUG0_26: the smoke explosion falls in the pit right after being placed in the dungeon and before being drawn on screen so it is only visible on the destination square */ return retVal; } @@ -501,7 +501,7 @@ int16 GroupMan::groupGetDamageCreatureOutcome(Group *group, uint16 creatureIndex void GroupMan::groupDelete(int16 mapX, int16 mapY) { Thing groupThing = groupGetThing(mapX, mapY); - if (groupThing == Thing::_endOfList) + if (groupThing == _vm->_thingEndOfList) return; DungeonMan &dungeon = *_vm->_dungeonMan; @@ -510,7 +510,7 @@ void GroupMan::groupDelete(int16 mapX, int16 mapY) { for (uint16 i = 0; i < 4; ++i) group->_health[i] = 0; _vm->_moveSens->getMoveResult(groupThing, mapX, mapY, kDMMapXNotOnASquare, 0); - group->_nextThing = Thing::_none; + group->_nextThing = _vm->_thingNone; if (dungeon._currMapIndex == dungeon._partyMapIndex) { _activeGroups[group->getActiveGroupIndex()]._groupThingIndex = -1; _currActiveGroupCount--; @@ -608,7 +608,7 @@ void GroupMan::processEvents29to41(int16 eventMapX, int16 eventMapY, TimelineEve Thing groupThing = groupGetThing(eventMapX, eventMapY); /* If there is no creature at the location specified in the event then the event is ignored */ - if (groupThing == Thing::_endOfList) + if (groupThing == _vm->_thingEndOfList) return; ChampionMan &championMan = *_vm->_championMan; @@ -1089,7 +1089,7 @@ T0209136: bool GroupMan::isMovementPossible(CreatureInfo *creatureInfo, int16 mapX, int16 mapY, uint16 dir, bool allowMovementOverImaginaryPitsAndFakeWalls) { _groupMovementTestedDirections[dir] = true; - _groupMovementBlockedByGroupThing = Thing::_endOfList; + _groupMovementBlockedByGroupThing = _vm->_thingEndOfList; _groupMovementBlockedByDoor = false; _groupMovementBlockedByParty = false; if (creatureInfo->_movementTicks == kDMMovementTicksImmobile) @@ -1114,7 +1114,7 @@ bool GroupMan::isMovementPossible(CreatureInfo *creatureInfo, int16 mapX, int16 if (getFlag(creatureInfo->_attributes, kDMCreatureMaskArchenemy)) { Thing curThing = dungeon.getSquareFirstThing(mapX, mapY); - while (curThing != Thing::_endOfList) { + while (curThing != _vm->_thingEndOfList) { if ((curThing).getType() == kDMThingTypeExplosion) { Teleporter *curTeleporter = (Teleporter *)dungeon.getThingData(curThing); if (((Explosion *)curTeleporter)->setType(kDMExplosionTypeFluxcage)) { @@ -1148,7 +1148,7 @@ bool GroupMan::isMovementPossible(CreatureInfo *creatureInfo, int16 mapX, int16 } _groupMovementBlockedByGroupThing = groupGetThing(mapX, mapY); - return (_groupMovementBlockedByGroupThing == Thing::_endOfList); + return (_groupMovementBlockedByGroupThing == _vm->_thingEndOfList); } int16 GroupMan::getDistanceBetweenSquares(int16 srcMapX, int16 srcMapY, int16 destMapX, int16 destMapY) { @@ -1475,47 +1475,47 @@ bool GroupMan::isCreatureAttacking(Group *group, int16 mapX, int16 mapY, uint16 targetCell += primaryDirectionToParty; targetCell &= 0x0003; if ((creatureInfo->getAttackRange() > 1) && ((_currGroupDistanceToParty > 1) || _vm->getRandomNumber(2))) { - Thing projectileThing = Thing::_none; + Thing projectileThing = _vm->_thingNone; switch (creatureType) { case kDMCreatureTypeVexirk: case kDMCreatureTypeLordChaos: if (_vm->getRandomNumber(2)) { - projectileThing = Thing::_explFireBall; + projectileThing = _vm->_thingExplFireBall; } else { switch (_vm->getRandomNumber(4)) { case 0: - projectileThing = Thing::_explHarmNonMaterial; + projectileThing = _vm->_thingExplHarmNonMaterial; break; case 1: - projectileThing = Thing::_explLightningBolt; + projectileThing = _vm->_thingExplLightningBolt; break; case 2: - projectileThing = Thing::_explPoisonCloud; + projectileThing = _vm->_thingExplPoisonCloud; break; case 3: - projectileThing = Thing::_explOpenDoor; + projectileThing = _vm->_thingExplOpenDoor; } } break; case kDMCreatureTypeSwampSlime: - projectileThing = Thing::_explSlime; + projectileThing = _vm->_thingExplSlime; break; case kDMCreatureTypeWizardEye: if (_vm->getRandomNumber(8)) { - projectileThing = Thing::_explLightningBolt; + projectileThing = _vm->_thingExplLightningBolt; } else { - projectileThing = Thing::_explOpenDoor; + projectileThing = _vm->_thingExplOpenDoor; } break; case kDMCreatureTypeMaterializerZytaz: if (_vm->getRandomNumber(2)) { - projectileThing = Thing::_explPoisonCloud; + projectileThing = _vm->_thingExplPoisonCloud; break; } case kDMCreatureTypeDemon: case kDMCreatureTypeRedDragon: - projectileThing = Thing::_explFireBall; + projectileThing = _vm->_thingExplFireBall; break; default: break; @@ -1594,14 +1594,14 @@ void GroupMan::stealFromChampion(Group *group, uint16 championIndex) { stealFromSlotIndex += _vm->getRandomNumber(17); /* Select a random slot in the backpack */ Thing slotThing = champion->_slots[stealFromSlotIndex]; - if ((slotThing != Thing::_none)) { + if ((slotThing != _vm->_thingNone)) { objectStolen = true; slotThing = championMan.getObjectRemovedFromSlot(championIndex, stealFromSlotIndex); - if (group->_slot == Thing::_endOfList) { + if (group->_slot == _vm->_thingEndOfList) { group->_slot = slotThing; /* BUG0_12 An object is cloned and appears at two different locations in the dungeon and/or inventory. The game may crash when interacting with this object. If a Giggler with no possessions steals an object that was previously in a chest and was not the last object in the chest then the objects that followed it are cloned. In the chest, the object is part of a linked list of objects that is not reset when the object is removed from the chest and placed in the inventory (but not in the dungeon), nor when it is stolen and added as the first Giggler possession. If the Giggler already has a possession before stealing the object then this does not create a cloned object. - The following statement is missing: L0394_T_Thing->Next = Thing::_endOfList; - This creates cloned things if L0394_T_Thing->Next is not Thing::_endOfList which is the case when the object comes from a chest in which it was not the last object */ + The following statement is missing: L0394_T_Thing->Next = _vm->_endOfList; + This creates cloned things if L0394_T_Thing->Next is not _vm->_endOfList which is the case when the object comes from a chest in which it was not the last object */ } else { _vm->_dungeonMan->linkThingToList(slotThing, group->_slot, kDMMapXNotOnASquare, 0); } @@ -1782,7 +1782,7 @@ void GroupMan::addAllActiveGroups() { break; } curThing = dungeon.getNextThing(curThing); - } while (curThing != Thing::_endOfList); + } while (curThing != _vm->_thingEndOfList); } } } @@ -1793,11 +1793,11 @@ Thing GroupMan::groupGetGenerated(CreatureType creatureType, int16 healthMultipl Thing groupThing = dungeon.getUnusedThing(kDMThingTypeGroup); if (((_currActiveGroupCount >= (_maxActiveGroupCount - 5)) && (dungeon._currMapIndex == dungeon._partyMapIndex)) - || (groupThing == Thing::_none)) { - return Thing::_none; + || (groupThing == _vm->_thingNone)) { + return _vm->_thingNone; } Group *group = (Group *)dungeon.getThingData(groupThing); - group->_slot = Thing::_endOfList; + group->_slot = _vm->_thingEndOfList; group->setDoNotDiscard(false); group->setDir(dir); group->setCount(creatureCount); @@ -1828,7 +1828,7 @@ Thing GroupMan::groupGetGenerated(CreatureType creatureType, int16 healthMultipl impact (in which case the thing data was marked as unused) or the party is on the destination square and an event is created to move the creature into the dungeon later (in which case the thing is referenced in the event) */ - return Thing::_none; + return _vm->_thingNone; } _vm->_sound->requestPlay(kDMSoundIndexBuzz, mapX, mapY, kDMSoundModePlayIfPrioritized); return groupThing; @@ -1846,7 +1846,7 @@ bool GroupMan::isSquareACorridorTeleporterPitOrDoor(int16 mapX, int16 mapY) { int16 GroupMan::getMeleeTargetCreatureOrdinal(int16 groupX, int16 groupY, int16 partyX, int16 partyY, uint16 champCell) { Thing groupThing = groupGetThing(groupX, groupY); - if (groupThing == Thing::_endOfList) + if (groupThing == _vm->_thingEndOfList) return 0; Group *group = (Group *)_vm->_dungeonMan->getThingData(groupThing); @@ -1955,7 +1955,7 @@ void GroupMan::fluxCageAction(int16 mapX, int16 mapY) { return; Thing unusedThing = dungeon.getUnusedThing(kDMThingTypeExplosion); - if (unusedThing == Thing::_none) + if (unusedThing == _vm->_thingNone) return; dungeon.linkThingToList(unusedThing, Thing(0), mapX, mapY); @@ -1995,7 +1995,7 @@ void GroupMan::fluxCageAction(int16 mapX, int16 mapY) { uint16 GroupMan::isLordChaosOnSquare(int16 mapX, int16 mapY) { Thing thing = groupGetThing(mapX, mapY); - if (thing == Thing::_endOfList) + if (thing == _vm->_thingEndOfList) return 0; Group *group = (Group *)_vm->_dungeonMan->getThingData(thing); @@ -2013,7 +2013,7 @@ bool GroupMan::isFluxcageOnSquare(int16 mapX, int16 mapY) { return false; Thing thing = dungeon.getSquareFirstThing(mapX, mapY); - while (thing != Thing::_endOfList) { + while (thing != _vm->_thingEndOfList) { if ((thing.getType() == kDMThingTypeExplosion) && (((Explosion *)dungeon._thingData[kDMThingTypeExplosion])[thing.getIndex()].getType() == kDMExplosionTypeFluxcage)) return true; @@ -2028,7 +2028,7 @@ void GroupMan::fuseAction(uint16 mapX, uint16 mapY) { if ((mapX >= dungeon._currMapWidth) || (mapY >= dungeon._currMapHeight)) return; - _vm->_projexpl->createExplosion(Thing::_explHarmNonMaterial, 255, mapX, mapY, kDMCreatureTypeSingleCenteredCreature); /* BUG0_17 The game crashes after the Fuse action is performed while looking at a wall on a map boundary. An explosion thing is created on the square in front of the party but there is no check to ensure the square coordinates are in the map bounds. This corrupts a memory location and leads to a game crash */ + _vm->_projexpl->createExplosion(_vm->_thingExplHarmNonMaterial, 255, mapX, mapY, kDMCreatureTypeSingleCenteredCreature); /* BUG0_17 The game crashes after the Fuse action is performed while looking at a wall on a map boundary. An explosion thing is created on the square in front of the party but there is no check to ensure the square coordinates are in the map bounds. This corrupts a memory location and leads to a game crash */ Thing lordChaosThing = Thing(isLordChaosOnSquare(mapX, mapY)); if (lordChaosThing.toUint16()) { bool isFluxcages[4]; diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp index 7ee28f3bea..b05adc6120 100644 --- a/engines/dm/inventory.cpp +++ b/engines/dm/inventory.cpp @@ -74,7 +74,7 @@ InventoryMan::InventoryMan(DMEngine *vm) : _vm(vm) { _panelContent = kDMPanelContentFoodWaterPoisoned; for (uint16 i = 0; i < 8; ++i) _chestSlots[i] = Thing(0); - _openChest = Thing::_none; + _openChest = _vm->_thingNone; _objDescTextXpos = 0; _objDescTextYpos = 0; @@ -266,11 +266,11 @@ void InventoryMan::drawPanel() { _panelContent = kDMPanelContentScroll; break; default: - thing = Thing::_none; + thing = _vm->_thingNone; break; } - if (thing == Thing::_none) + if (thing == _vm->_thingNone) drawPanelFoodWaterPoisoned(); else drawPanelObject(thing, false); @@ -280,20 +280,20 @@ void InventoryMan::closeChest() { DungeonMan &dunMan = *_vm->_dungeonMan; bool processFirstChestSlot = true; - if (_openChest == Thing::_none) + if (_openChest == _vm->_thingNone) return; Container *container = (Container *)dunMan.getThingData(_openChest); - _openChest = Thing::_none; - container->getSlot() = Thing::_endOfList; + _openChest = _vm->_thingNone; + container->getSlot() = _vm->_thingEndOfList; Thing prevThing; for (int16 chestSlotIndex = 0; chestSlotIndex < 8; ++chestSlotIndex) { Thing thing = _chestSlots[chestSlotIndex]; - if (thing != Thing::_none) { - _chestSlots[chestSlotIndex] = Thing::_none; // CHANGE8_09_FIX + if (thing != _vm->_thingNone) { + _chestSlots[chestSlotIndex] = _vm->_thingNone; // CHANGE8_09_FIX if (processFirstChestSlot) { processFirstChestSlot = false; - *dunMan.getThingData(thing) = Thing::_endOfList.toUint16(); + *dunMan.getThingData(thing) = _vm->_thingEndOfList.toUint16(); container->getSlot() = prevThing = thing; } else { dunMan.linkThingToList(thing, prevThing, kDMMapXNotOnASquare, 0); @@ -368,7 +368,7 @@ void InventoryMan::openAndDrawChest(Thing thingToOpen, Container *chest, bool is if (_openChest == thingToOpen) return; - if (_openChest != Thing::_none) + if (_openChest != _vm->_thingNone) closeChest(); // CHANGE8_09_FIX _openChest = thingToOpen; @@ -380,7 +380,7 @@ void InventoryMan::openAndDrawChest(Thing thingToOpen, Container *chest, bool is int16 chestSlotIndex = 0; Thing thing = chest->getSlot(); int16 thingCount = 0; - while (thing != Thing::_endOfList) { + while (thing != _vm->_thingEndOfList) { if (++thingCount > 8) break; // CHANGE8_08_FIX, make sure that no more than the first 8 objects in a chest are drawn @@ -390,7 +390,7 @@ void InventoryMan::openAndDrawChest(Thing thingToOpen, Container *chest, bool is } while (chestSlotIndex < 8) { objMan.drawIconInSlotBox(chestSlotIndex + kDMSlotBoxChestFirstSlot, kDMIconIndiceNone); - _chestSlots[chestSlotIndex++] = Thing::_none; + _chestSlots[chestSlotIndex++] = _vm->_thingNone; } } @@ -872,7 +872,7 @@ void InventoryMan::drawStopPressingEye() { drawPanel(); _vm->_displayMan->drawViewport(k0_viewportNotDungeonView); Thing leaderHandObject = _vm->_championMan->_leaderHandObject; - if (leaderHandObject != Thing::_none) + if (leaderHandObject != _vm->_thingNone) _vm->_objectMan->drawLeaderObjectName(leaderHandObject); _vm->_eventMan->showMouse(); @@ -940,7 +940,7 @@ void InventoryMan::clickOnMouth() { } else if (handThingType == kDMThingTypePotion) removeObjectFromLeaderHand = false; else { - junkData->setNextThing(Thing::_none); + junkData->setNextThing(_vm->_thingNone); removeObjectFromLeaderHand = true; } _vm->_eventMan->showMouse(); diff --git a/engines/dm/loadsave.cpp b/engines/dm/loadsave.cpp index 8bc3770226..3d8f76c33f 100644 --- a/engines/dm/loadsave.cpp +++ b/engines/dm/loadsave.cpp @@ -63,7 +63,7 @@ LoadgameResult DMEngine::loadgame(int16 slot) { //L1366_B_FadePalette = !F0428_DIALOG_RequireGameDiskInDrive_NoDialogDrawn(C0_DO_NOT_FORCE_DIALOG_DM_CSB, true); _restartGameAllowed = false; _championMan->_partyChampionCount = 0; - _championMan->_leaderHandObject = Thing::_none; + _championMan->_leaderHandObject = _thingNone; } else { fileName = getSavefileName(slot); saveFileManager = _system->getSavefileManager(); diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp index ce5e6d2054..348bdfdb2d 100644 --- a/engines/dm/menus.cpp +++ b/engines/dm/menus.cpp @@ -206,7 +206,7 @@ void MenuMan::drawActionIcon(ChampionIndex championIndex) { byte *bitmapIcon = dm._tmpBitmap; Thing thing = champion.getSlot(kDMSlotActionHand); IconIndice iconIndex; - if (thing == Thing::_none) { + if (thing == _vm->_thingNone) { iconIndex = kDMIconIndiceActionEmptyHand; } else if (dungeon._objectInfos[dungeon.getObjectInfoIndex(thing)]._actionSetIndex) { iconIndex = _vm->_objectMan->getIconIndex(thing); @@ -590,7 +590,7 @@ int16 MenuMan::getChampionSpellCastResult(uint16 champIndex) { if (curSpell->getType() == kDMSpellTypeProjectileOpenDoor) skillLevel <<= 1; - championMan.isProjectileSpellCast(champIndex, Thing(curSpell->getType() + Thing::_firstExplosion.toUint16()), CLIP(21, (powerSymbolOrdinal + 2) * (4 + (skillLevel << 1)), 255), 0); + championMan.isProjectileSpellCast(champIndex, Thing(curSpell->getType() + _vm->_thingFirstExplosion.toUint16()), CLIP(21, (powerSymbolOrdinal + 2) * (4 + (skillLevel << 1)), 255), 0); break; case kDMSpellKindOther: { TimelineEvent newEvent; @@ -666,15 +666,15 @@ int16 MenuMan::getChampionSpellCastResult(uint16 champIndex) { break; case kDMSpellTypeOtherZokathra: { Thing unusedObject = dungeon.getUnusedThing(kDMThingTypeJunk); - if (unusedObject == Thing::_none) + if (unusedObject == _vm->_thingNone) break; Junk *junkData = (Junk *)dungeon.getThingData(unusedObject); junkData->setType(kDMJunkTypeZokathra); ChampionSlot slotIndex; - if (curChampion->_slots[kDMSlotReadyHand] == Thing::_none) + if (curChampion->_slots[kDMSlotReadyHand] == _vm->_thingNone) slotIndex = kDMSlotReadyHand; - else if (curChampion->_slots[kDMSlotActionHand] == Thing::_none) + else if (curChampion->_slots[kDMSlotActionHand] == _vm->_thingNone) slotIndex = kDMSlotActionHand; else slotIndex = kDMSlotLeaderHand; @@ -819,7 +819,7 @@ Potion *MenuMan::getEmptyFlaskInHand(Champion *champ, Thing *potionThing) { DungeonMan &dungeon = *_vm->_dungeonMan; for (int16 slotIndex = kDMSlotHead; --slotIndex >= kDMSlotReadyHand; ) { Thing curThing = champ->_slots[slotIndex]; - if ((curThing != Thing::_none) && (_vm->_objectMan->getIconIndex(curThing) == kDMIconIndicePotionEmptyFlask)) { + if ((curThing != _vm->_thingNone) && (_vm->_objectMan->getIconIndex(curThing) == kDMIconIndicePotionEmptyFlask)) { *potionThing = curThing; return (Potion *)dungeon.getThingData(curThing); } @@ -1100,27 +1100,27 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) { bool setDirectionFl = false; int16 kineticEnergy = 0; - Thing explosionThing = Thing::_none; + Thing explosionThing = _vm->_thingNone; bool actionPerformed = true; switch (actionIndex) { case kDMActionLightning: kineticEnergy = 180; - explosionThing = Thing::_explLightningBolt; + explosionThing = _vm->_thingExplLightningBolt; setDirectionFl = true; break; case kDMActionDispel: kineticEnergy = 150; - explosionThing = Thing::_explHarmNonMaterial; + explosionThing = _vm->_thingExplHarmNonMaterial; setDirectionFl = true; break; case kDMActionFireball: kineticEnergy = 150; - explosionThing = Thing::_explFireBall; + explosionThing = _vm->_thingExplFireBall; setDirectionFl = true; break; case kDMActionSpit: kineticEnergy = 250; - explosionThing = Thing::_explFireBall; + explosionThing = _vm->_thingExplFireBall; setDirectionFl = true; break; case kDMActionBash: @@ -1240,16 +1240,16 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) { kineticEnergy = _vm->getRandomNumber(128) + 100; switch (_vm->getRandomNumber(6)) { case 0: - explosionThing = Thing::_explPoisonBolt; + explosionThing = _vm->_thingExplPoisonBolt; break; case 1: - explosionThing = Thing::_explPoisonCloud; + explosionThing = _vm->_thingExplPoisonCloud; break; case 2: - explosionThing = Thing::_explHarmNonMaterial; + explosionThing = _vm->_thingExplHarmNonMaterial; break; default: - explosionThing = Thing::_explFireBall; + explosionThing = _vm->_thingExplFireBall; break; } setDirectionFl = true; @@ -1311,12 +1311,12 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) { nextMapX += _vm->_dirIntoStepCountEast[dungeon._partyDir]; nextMapY += _vm->_dirIntoStepCountNorth[dungeon._partyDir]; /* CHANGE6_00_FIX The presence of a group over the pit is checked so that you cannot climb down a pit with the rope if there is a group levitating over it */ - if ((dungeon.getSquare(nextMapX, nextMapY).getType() == kDMElementTypePit) && (_vm->_groupMan->groupGetThing(nextMapX, nextMapY) == Thing::_endOfList)) { + if ((dungeon.getSquare(nextMapX, nextMapY).getType() == kDMElementTypePit) && (_vm->_groupMan->groupGetThing(nextMapX, nextMapY) == _vm->_thingEndOfList)) { /* BUG0_77 The party moves forward when using the rope in front of a closed pit. The engine does not check whether the pit is open before moving the party over the pit. This is not consistent with the behavior when using the rope in front of a corridor where nothing happens */ _vm->_moveSens->_useRopeToClimbDownPit = true; - _vm->_moveSens->getMoveResult(Thing::_party, dungeon._partyMapX, dungeon._partyMapY, nextMapX, nextMapY); + _vm->_moveSens->getMoveResult(_vm->_thingParty, dungeon._partyMapX, dungeon._partyMapY, nextMapX, nextMapY); _vm->_moveSens->_useRopeToClimbDownPit = false; } else { actionDisabledTicks = 0; @@ -1327,11 +1327,11 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) { if (weaponInHand->getType() == (int)kDMJunkTypeMagicalBoxBlue) { freezeTicks = 30; championMan.getObjectRemovedFromSlot(champIndex, kDMSlotActionHand); - weaponInHand->setNextThing(Thing::_none); + weaponInHand->setNextThing(_vm->_thingNone); } else if (weaponInHand->getType() == (int)kDMJunkTypeMagicalBoxGreen) { freezeTicks = 125; championMan.getObjectRemovedFromSlot(champIndex, kDMSlotActionHand); - weaponInHand->setNextThing(Thing::_none); + weaponInHand->setNextThing(_vm->_thingNone); } else { freezeTicks = 70; decrementCharges(curChampion); @@ -1510,7 +1510,7 @@ bool MenuMan::isMeleeActionPerformed(int16 champIndex, Champion *champ, int16 ac DungeonMan &dungeon = *_vm->_dungeonMan; _vm->_sound->requestPlay(kDMSoundIndexAttackSkelettonAnimatedArmorDethKnight, dungeon._partyMapX, dungeon._partyMapY, kDMSoundModePlayIfPrioritized); - if (_actionTargetGroupThing == Thing::_endOfList) + if (_actionTargetGroupThing == _vm->_thingEndOfList) return false; uint16 championCell = champ->_cell; @@ -1546,7 +1546,7 @@ bool MenuMan::isMeleeActionPerformed(int16 champIndex, Champion *champ, int16 ac bool MenuMan::isGroupFrightenedByAction(int16 champIndex, uint16 actionIndex, int16 mapX, int16 mapY) { bool retVal = false; - if (_actionTargetGroupThing == Thing::_endOfList) + if (_actionTargetGroupThing == _vm->_thingEndOfList) return retVal; ChampionMan &championMan = *_vm->_championMan; @@ -1688,7 +1688,7 @@ void MenuMan::processCommands116To119_setActingChampion(uint16 champIndex) { uint16 actionSetIndex; Thing slotActionThing = curChampion->_slots[kDMSlotActionHand]; - if (slotActionThing == Thing::_none) + if (slotActionThing == _vm->_thingNone) actionSetIndex = 2; /* Actions Punch, Kick and War Cry */ else { actionSetIndex = dungeon._objectInfos[dungeon.getObjectInfoIndex(slotActionThing)]._actionSetIndex; diff --git a/engines/dm/movesens.cpp b/engines/dm/movesens.cpp index 7c7dc19606..cb9f93ab2b 100644 --- a/engines/dm/movesens.cpp +++ b/engines/dm/movesens.cpp @@ -62,7 +62,7 @@ bool MovesensMan::sensorIsTriggeredByClickOnWall(int16 mapX, int16 mapY, uint16 Thing squareFirstThing = dungeon.getSquareFirstThing(mapX, mapY); Thing thingBeingProcessed = squareFirstThing; - while (thingBeingProcessed != Thing::_endOfList) { + while (thingBeingProcessed != _vm->_thingEndOfList) { ThingType thingType = thingBeingProcessed.getType(); if (thingType == kDMThingTypeSensor) sensorCountToProcessPerCell[thingBeingProcessed.getCell()]++; @@ -71,7 +71,7 @@ bool MovesensMan::sensorIsTriggeredByClickOnWall(int16 mapX, int16 mapY, uint16 thingBeingProcessed = dungeon.getNextThing(thingBeingProcessed); } - for (thingBeingProcessed = squareFirstThing; thingBeingProcessed != Thing::_endOfList; thingBeingProcessed = dungeon.getNextThing(thingBeingProcessed)) { + for (thingBeingProcessed = squareFirstThing; thingBeingProcessed != _vm->_thingEndOfList; thingBeingProcessed = dungeon.getNextThing(thingBeingProcessed)) { Thing lastProcessedThing = thingBeingProcessed; uint16 ProcessedThingType = thingBeingProcessed.getType(); if (ProcessedThingType == kDMThingTypeSensor) { @@ -114,7 +114,7 @@ bool MovesensMan::sensorIsTriggeredByClickOnWall(int16 mapX, int16 mapY, uint16 break; Sensor *lastSensor = (Sensor *)dungeon.getThingData(lastProcessedThing); lastSensor->setNextThing(currentSensor->getNextThing()); - currentSensor->setNextThing(Thing::_none); + currentSensor->setNextThing(_vm->_thingNone); thingBeingProcessed = lastProcessedThing; } @@ -133,18 +133,18 @@ bool MovesensMan::sensorIsTriggeredByClickOnWall(int16 mapX, int16 mapY, uint16 case kDMSensorWallSingleObjStorageRotateSensors: if (_vm->_championMan->_leaderEmptyHanded) { leaderHandObject = getObjectOfTypeInCell(mapX, mapY, cellIdx, sensorData); - if (leaderHandObject == Thing::_none) + if (leaderHandObject == _vm->_thingNone) continue; dungeon.unlinkThingFromList(leaderHandObject, Thing(0), mapX, mapY); _vm->_championMan->putObjectInLeaderHand(leaderHandObject, true); } else { - if ((_vm->_objectMan->getObjectType(leaderHandObject) != sensorData) || (getObjectOfTypeInCell(mapX, mapY, cellIdx, sensorData) != Thing::_none)) + if ((_vm->_objectMan->getObjectType(leaderHandObject) != sensorData) || (getObjectOfTypeInCell(mapX, mapY, cellIdx, sensorData) != _vm->_thingNone)) continue; _vm->_championMan->getObjectRemovedFromLeaderHand(); dungeon.linkThingToList(_vm->thingWithNewCell(leaderHandObject, cellIdx), Thing(0), mapX, mapY); - leaderHandObject = Thing::_none; + leaderHandObject = _vm->_thingNone; } triggerLocalEffect(kDMSensorEffectToggle, mapX, mapY, cellIdx); /* This will cause a rotation of the sensors at the specified cell on the specified square after all sensors have been processed */ if ((sensorEffect == kDMSensorEffectHold) && !_vm->_championMan->_leaderEmptyHanded) @@ -158,7 +158,7 @@ bool MovesensMan::sensorIsTriggeredByClickOnWall(int16 mapX, int16 mapY, uint16 continue; Thing thingOnSquare = dungeon.getSquareFirstObject(mapX, mapY); - if ((_vm->_objectMan->getObjectType(leaderHandObject) != sensorData) || (thingOnSquare == Thing::_none)) + if ((_vm->_objectMan->getObjectType(leaderHandObject) != sensorData) || (thingOnSquare == _vm->_thingNone)) continue; dungeon.unlinkThingFromList(thingOnSquare, Thing(0), mapX, mapY); @@ -188,13 +188,13 @@ bool MovesensMan::sensorIsTriggeredByClickOnWall(int16 mapX, int16 mapY, uint16 if (!_vm->_championMan->_leaderEmptyHanded && ((processedSensorType == kDMSensorWallOrnClickWithSpecObjRemoved) || (processedSensorType == kDMSensorWallOrnClickWithSpecObjRemovedRotateSensors) || (processedSensorType == kDMSensorWallOrnClickWithSpecObjRemovedSensor))) { Thing *leaderThing = (Thing *)dungeon.getThingData(leaderHandObject); - *leaderThing = Thing::_none; + *leaderThing = _vm->_thingNone; _vm->_championMan->getObjectRemovedFromLeaderHand(); - leaderHandObject = Thing::_none; + leaderHandObject = _vm->_thingNone; } else if (_vm->_championMan->_leaderEmptyHanded && (processedSensorType == kDMSensorWallObjGeneratorRotateSensors)) { leaderHandObject = dungeon.getObjForProjectileLaucherOrObjGen(sensorData); - if (leaderHandObject != Thing::_none) + if (leaderHandObject != _vm->_thingNone) _vm->_championMan->putObjectInLeaderHand(leaderHandObject, true); } triggerEffect(currentSensor, sensorEffect, mapX, mapY, cellIdx); @@ -218,13 +218,13 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM uint16 thingCell = 0; bool thingLevitates = false; - if (thing != Thing::_party) { + if (thing != _vm->_thingParty) { thingType = thing.getType(); thingCell = thing.getCell(); thingLevitates = isLevitating(thing); } /* If moving the party or a creature on the party map from a dungeon square then check for a projectile impact */ - if ((mapX >= 0) && ((thing == Thing::_party) || ((thingType == kDMThingTypeGroup) && (dungeon._currMapIndex == dungeon._partyMapIndex)))) { + if ((mapX >= 0) && ((thing == _vm->_thingParty) || ((thingType == kDMThingTypeGroup) && (dungeon._currMapIndex == dungeon._partyMapIndex)))) { if (moveIsKilledByProjectileImpact(mapX, mapY, destMapX, destMapY, thing)) return true; /* The specified group thing cannot be moved because it was killed by a projectile impact */ } @@ -243,7 +243,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM bool drawDungeonViewWhileFalling = false; bool destinationIsTeleporterTarget = false; int16 requiredTeleporterScope; - if (thing == Thing::_party) { + if (thing == _vm->_thingParty) { dungeon._partyMapX = destMapX; dungeon._partyMapY = destMapY; requiredTeleporterScope = kDMTeleporterScopeObjectsOrParty; @@ -280,7 +280,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM destMapY = teleporter->getTargetMapY(); audibleTeleporter = teleporter->isAudible(); dungeon.setCurrentMap(mapIndexDestination = teleporter->getTargetMapIndex()); - if (thing == Thing::_party) { + if (thing == _vm->_thingParty) { dungeon._partyMapX = destMapX; dungeon._partyMapY = destMapY; if (teleporter->isAudible()) @@ -321,7 +321,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM } mapIndexDestination = dungeon.getLocationAfterLevelChange(mapIndexDestination, 1, &destMapX, &destMapY); dungeon.setCurrentMap(mapIndexDestination); - if (thing == Thing::_party) { + if (thing == _vm->_thingParty) { dungeon._partyMapX = destMapX; dungeon._partyMapY = destMapY; if (_vm->_championMan->_partyChampionCount > 0) { @@ -346,7 +346,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM if (outcome == kDMKillOutcomeSomeCreaturesInGroup) _vm->_groupMan->dropMovingCreatureFixedPossession(thing, destMapX, destMapY); } - } else if ((destinationSquareType == (int)kDMElementTypeStairs) && (thing != Thing::_party) && (thingType != kDMThingTypeProjectile)) { + } else if ((destinationSquareType == (int)kDMElementTypeStairs) && (thing != _vm->_thingParty) && (thingType != kDMThingTypeProjectile)) { if (!getFlag(destinationSquareData, kDMSquareMaskStairsUp)) { mapIndexDestination = dungeon.getLocationAfterLevelChange(mapIndexDestination, 1, &destMapX, &destMapY); dungeon.setCurrentMap(mapIndexDestination); @@ -376,13 +376,13 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM _moveResultCell = thing.getCell(); partySquare = (mapIndexDestination == mapIndexSource) && (destMapX == mapX) && (destMapY == mapY); if (partySquare) { - if (thing == Thing::_party) { + if (thing == _vm->_thingParty) { if (dungeon._partyDir == direction) return false; } else if ((_moveResultCell == thingCell) && (thingType != kDMThingTypeProjectile)) return false; } else { - if ((thing == Thing::_party) && _vm->_championMan->_partyChampionCount) { + if ((thing == _vm->_thingParty) && _vm->_championMan->_partyChampionCount) { uint16 oldDestinationSquare = destinationSquareData; int16 scentIndex = _vm->_championMan->_party._scentCount; while (scentIndex >= 24) { @@ -410,23 +410,23 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM } } if (mapX >= 0) { - if (thing == Thing::_party) - processThingAdditionOrRemoval(mapX, mapY, Thing::_party, partySquare, false); + if (thing == _vm->_thingParty) + processThingAdditionOrRemoval(mapX, mapY, _vm->_thingParty, partySquare, false); else if (thingLevitates) - dungeon.unlinkThingFromList(thing, Thing::_none, mapX, mapY); + dungeon.unlinkThingFromList(thing, _vm->_thingNone, mapX, mapY); else processThingAdditionOrRemoval(mapX, mapY, thing, (dungeon._currMapIndex == dungeon._partyMapIndex) && (mapX == dungeon._partyMapX) && (mapY == dungeon._partyMapY), false); } if (destMapX >= 0) { - if (thing == Thing::_party) { + if (thing == _vm->_thingParty) { dungeon.setCurrentMap(mapIndexDestination); - if ((thing = _vm->_groupMan->groupGetThing(dungeon._partyMapX, dungeon._partyMapY)) != Thing::_endOfList) { /* Delete group if party moves onto its square */ + if ((thing = _vm->_groupMan->groupGetThing(dungeon._partyMapX, dungeon._partyMapY)) != _vm->_thingEndOfList) { /* Delete group if party moves onto its square */ _vm->_groupMan->dropGroupPossessions(dungeon._partyMapX, dungeon._partyMapY, thing, kDMSoundModePlayIfPrioritized); _vm->_groupMan->groupDelete(dungeon._partyMapX, dungeon._partyMapY); } if (mapIndexDestination == mapIndexSource) - processThingAdditionOrRemoval(dungeon._partyMapX, dungeon._partyMapY, Thing::_party, partySquare, true); + processThingAdditionOrRemoval(dungeon._partyMapX, dungeon._partyMapY, _vm->_thingParty, partySquare, true); else { dungeon.setCurrentMap(mapIndexSource); _vm->_newPartyMapIndex = mapIndexDestination; @@ -436,7 +436,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM dungeon.setCurrentMap(mapIndexDestination); Teleporter *L0712_ps_Teleporter = (Teleporter *)dungeon.getThingData(thing); int16 activeGroupIndex = ((Group *)L0712_ps_Teleporter)->getActiveGroupIndex(); - if (((mapIndexDestination == dungeon._partyMapIndex) && (destMapX == dungeon._partyMapX) && (destMapY == dungeon._partyMapY)) || (_vm->_groupMan->groupGetThing(destMapX, destMapY) != Thing::_endOfList)) { /* If a group tries to move to the party square or over another group then create an event to move the group later */ + if (((mapIndexDestination == dungeon._partyMapIndex) && (destMapX == dungeon._partyMapX) && (destMapY == dungeon._partyMapY)) || (_vm->_groupMan->groupGetThing(destMapX, destMapY) != _vm->_thingEndOfList)) { /* If a group tries to move to the party square or over another group then create an event to move the group later */ dungeon.setCurrentMap(mapIndexSource); if (mapX >= 0) _vm->_groupMan->groupDeleteEvents(mapX, mapY); @@ -522,7 +522,7 @@ bool MovesensMan::moveIsKilledByProjectileImpact(int16 srcMapX, int16 srcMapY, i championOrCreatureOrdinalInCell[i] = 0; ElementType impactType; - if (thing == Thing::_party) { + if (thing == _vm->_thingParty) { impactType = kDMElementTypeChampion; for (uint16 cellIdx = kDMCellNorthWest; cellIdx < kDMCellSouthWest + 1; cellIdx++) { if (_vm->_championMan->getIndexInCell((ViewCell)cellIdx) >= 0) @@ -565,7 +565,7 @@ bool MovesensMan::moveIsKilledByProjectileImpact(int16 srcMapX, int16 srcMapY, i uint16 projectileMapY = srcMapY; T0266017_CheckProjectileImpacts: Thing curThing = dungeon.getSquareFirstThing(projectileMapX, projectileMapY); - while (curThing != Thing::_endOfList) { + while (curThing != _vm->_thingEndOfList) { if ((curThing.getType() == kDMThingTypeProjectile) && (_vm->_timeline->_events[(((Projectile *)dungeon._thingData[kDMThingTypeProjectile])[curThing.getIndex()])._eventIndex]._type != kDMEventTypeMoveProjectileIgnoreImpacts)) { int16 championOrCreatureOrdinal = championOrCreatureOrdinalInCell[curThing.getCell()]; @@ -706,7 +706,7 @@ void MovesensMan::processThingAdditionOrRemoval(uint16 mapX, uint16 mapY, Thing int16 thingType; IconIndice objectType; - if (thing != Thing::_party) { + if (thing != _vm->_thingParty) { thingType = thing.getType(); objectType = _vm->_objectMan->getObjectType(thing); } else { @@ -730,7 +730,7 @@ void MovesensMan::processThingAdditionOrRemoval(uint16 mapX, uint16 mapY, Thing bool squareContainsThingOfDifferentType = false; Thing curThing = dungeon.getSquareFirstThing(mapX, mapY); if (sensorTriggeredCell == kDMCellAny) { - while (curThing != Thing::_endOfList) { + while (curThing != _vm->_thingEndOfList) { uint16 curThingType = curThing.getType(); if (curThingType == kDMThingTypeGroup) squareContainsGroup = true; @@ -745,7 +745,7 @@ void MovesensMan::processThingAdditionOrRemoval(uint16 mapX, uint16 mapY, Thing curThing = dungeon.getNextThing(curThing); } } else { - while (curThing != Thing::_endOfList) { + while (curThing != _vm->_thingEndOfList) { if ((sensorTriggeredCell == curThing.getCell()) && (curThing.getType() > kDMThingTypeGroup)) { squareContainsObject = true; squareContainsThingOfSameType |= (_vm->_objectMan->getObjectType(curThing) == objectType); @@ -757,7 +757,7 @@ void MovesensMan::processThingAdditionOrRemoval(uint16 mapX, uint16 mapY, Thing if (addThing && (thingType != kDMThingTypeParty)) dungeon.linkThingToList(thing, Thing(0), mapX, mapY); - for (curThing = dungeon.getSquareFirstThing(mapX, mapY); curThing != Thing::_endOfList; curThing = dungeon.getNextThing(curThing)) { + for (curThing = dungeon.getSquareFirstThing(mapX, mapY); curThing != _vm->_thingEndOfList; curThing = dungeon.getNextThing(curThing)) { uint16 curThingType = curThing.getType(); if (curThingType == kDMThingTypeSensor) { Sensor *curSensor = (Sensor *)dungeon.getThingData(curThing); @@ -890,7 +890,7 @@ bool MovesensMan::isObjectInPartyPossession(int16 objectType) { if (curObjectType == kDMIconIndiceContainerChestClosed) { Container *container = (Container *)dungeon.getThingData(curThing); curThing = container->getSlot(); - while (curThing != Thing::_endOfList) { + while (curThing != _vm->_thingEndOfList) { if (_vm->_objectMan->getObjectType(curThing) == objectType) return true; @@ -975,17 +975,17 @@ void MovesensMan::processRotationEffect() { } Sensor *firstSensor = (Sensor *)dungeon.getThingData(firstSensorThing); Thing lastSensorThing = firstSensor->getNextThing(); - while ((lastSensorThing != Thing::_endOfList) + while ((lastSensorThing != _vm->_thingEndOfList) && ((lastSensorThing.getType() != kDMThingTypeSensor) || ((_sensorRotationEffCell != kDMCellAny) && (lastSensorThing.getCell() != _sensorRotationEffCell)))) { lastSensorThing = dungeon.getNextThing(lastSensorThing); } - if (lastSensorThing == Thing::_endOfList) + if (lastSensorThing == _vm->_thingEndOfList) break; dungeon.unlinkThingFromList(firstSensorThing, Thing(0), _sensorRotationEffMapX, _sensorRotationEffMapY); Sensor *lastSensor = (Sensor *)dungeon.getThingData(lastSensorThing); lastSensorThing = dungeon.getNextThing(lastSensorThing); - while (((lastSensorThing != Thing::_endOfList) && (lastSensorThing.getType() == kDMThingTypeSensor))) { + while (((lastSensorThing != _vm->_thingEndOfList) && (lastSensorThing.getType() == kDMThingTypeSensor))) { if ((_sensorRotationEffCell == kDMCellAny) || (lastSensorThing.getCell() == _sensorRotationEffCell)) lastSensor = (Sensor *)dungeon.getThingData(lastSensorThing); lastSensorThing = dungeon.getNextThing(lastSensorThing); @@ -1010,12 +1010,12 @@ void MovesensMan::createEventMoveGroup(Thing groupThing, int16 mapX, int16 mapY, Thing MovesensMan::getObjectOfTypeInCell(int16 mapX, int16 mapY, int16 cell, int16 objectType) { DungeonMan &dungeon = *_vm->_dungeonMan; Thing curThing = dungeon.getSquareFirstObject(mapX, mapY); - while (curThing != Thing::_endOfList) { + while (curThing != _vm->_thingEndOfList) { if ((_vm->_objectMan->getObjectType(curThing) == objectType) && ((cell == kDMCellAny) || (curThing.getCell() == cell))) return curThing; curThing = dungeon.getNextThing(curThing); } - return Thing::_none; + return _vm->_thingNone; } } diff --git a/engines/dm/objectman.cpp b/engines/dm/objectman.cpp index 3b191e877c..66c6761f9a 100644 --- a/engines/dm/objectman.cpp +++ b/engines/dm/objectman.cpp @@ -132,7 +132,7 @@ void ObjectMan::loadObjectNames() { } IconIndice ObjectMan::getObjectType(Thing thing) { - if (thing == Thing::_none) + if (thing == _vm->_thingNone) return kDMIconIndiceNone; int16 objectInfoIndex = _vm->_dungeonMan->getObjectInfoIndex(thing); diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index e4faa3f627..85767cd633 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -47,7 +47,7 @@ ProjExpl::ProjExpl(DMEngine *vm) : _vm(vm) { void ProjExpl::createProjectile(Thing thing, int16 mapX, int16 mapY, uint16 cell, Direction dir, byte kineticEnergy, byte attack, byte stepEnergy) { Thing projectileThing = _vm->_dungeonMan->getUnusedThing(kDMThingTypeProjectile); - if (projectileThing == Thing::_none) /* BUG0_16 If the game cannot create a projectile thing because it has run out of such things (60 maximum) then the object being thrown/shot/launched is orphaned. If the game has run out of projectile things it will try to remove a projectile from elsewhere in the dungeon, except in an area of 11x11 squares centered around the party (to make sure the player cannot actually see the thing disappear on screen) */ + if (projectileThing == _vm->_thingNone) /* BUG0_16 If the game cannot create a projectile thing because it has run out of such things (60 maximum) then the object being thrown/shot/launched is orphaned. If the game has run out of projectile things it will try to remove a projectile from elsewhere in the dungeon, except in an area of 11x11 squares centered around the party (to make sure the player cannot actually see the thing disappear on screen) */ return; projectileThing = _vm->thingWithNewCell(projectileThing, cell); @@ -80,18 +80,18 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in Thing projectileAssociatedThing = projectileThingData->_slot; int16 projectileAssociatedThingType = projectileAssociatedThing.getType(); Potion *potion = nullptr; - Thing explosionThing = Thing::_none; + Thing explosionThing = _vm->_thingNone; if (projectileAssociatedThingType == kDMThingTypePotion) { Group *projectileAssociatedGroup = (Group *)_vm->_dungeonMan->getThingData(projectileAssociatedThing); PotionType potionType = ((Potion *)projectileAssociatedGroup)->getType(); if ((potionType == kDMPotionTypeVen) || (potionType == kDMPotionTypeFulBomb)) { - explosionThing = (potionType == kDMPotionTypeVen) ? Thing::_explPoisonCloud: Thing::_explFireBall; + explosionThing = (potionType == kDMPotionTypeVen) ? _vm->_thingExplPoisonCloud: _vm->_thingExplFireBall; removePotion = true; potionPower = ((Potion *)projectileAssociatedGroup)->getPower(); potion = (Potion *)projectileAssociatedGroup; } } - bool createExplosionOnImpact = (projectileAssociatedThingType == kDMThingTypeExplosion) && (projectileAssociatedThing != Thing::_explSlime) && (projectileAssociatedThing != Thing::_explPoisonBolt); + bool createExplosionOnImpact = (projectileAssociatedThingType == kDMThingTypeExplosion) && (projectileAssociatedThing != _vm->_thingExplSlime) && (projectileAssociatedThing != _vm->_thingExplPoisonBolt); Thing *curGroupSlot = nullptr; int16 projectileMapX; int16 projectileMapY; @@ -116,7 +116,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in byte curSquare = _vm->_dungeonMan->_currMapData[projectileTargetMapX][projectileTargetMapY]; int16 curDoorState = Square(curSquare).getDoorState(); Door *curDoor = (Door *)_vm->_dungeonMan->getSquareFirstThingData(projectileTargetMapX, projectileTargetMapY); - if ((curDoorState != kDMDoorStateDestroyed) && (projectileAssociatedThing == Thing::_explOpenDoor)) { + if ((curDoorState != kDMDoorStateDestroyed) && (projectileAssociatedThing == _vm->_thingExplOpenDoor)) { if (curDoor->hasButton()) _vm->_moveSens->addEvent(kDMEventTypeDoor, projectileTargetMapX, projectileTargetMapY, kDMCellNorthWest, kDMSensorEffectToggle, _vm->_gameTime + 1); break; @@ -128,7 +128,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in DoorInfo curDoorInfo = _vm->_dungeonMan->_currMapDoorInfo[curDoor->getType()]; if (getFlag(curDoorInfo._attributes, kDMMaskDoorInfoProjectilesCanPassThrough)) { if (projectileAssociatedThingType == kDMThingTypeExplosion) { - if (projectileAssociatedThing.toUint16() >= Thing::_explHarmNonMaterial.toUint16()) + if (projectileAssociatedThing.toUint16() >= _vm->_thingExplHarmNonMaterial.toUint16()) return false; } else { int16 associatedThingIndex = _vm->_dungeonMan->getObjectInfoIndex(projectileAssociatedThing); @@ -165,12 +165,12 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in curCreatureIndex--; CreatureType curCreatureType = curGroup->_type; CreatureInfo *curCreatureInfo = &_vm->_dungeonMan->_creatureInfos[curCreatureType]; - if ((projectileAssociatedThing == Thing::_explFireBall) && (curCreatureType == kDMCreatureTypeBlackFlame)) { + if ((projectileAssociatedThing == _vm->_thingExplFireBall) && (curCreatureType == kDMCreatureTypeBlackFlame)) { uint16 *curCreatureHealth = &curGroup->_health[curCreatureIndex]; *curCreatureHealth = MIN(1000, *curCreatureHealth + getProjectileImpactAttack(projectileThingData, projectileAssociatedThing)); goto T0217044; } - if (getFlag(curCreatureInfo->_attributes, kDMCreatureMaskNonMaterial) && (projectileAssociatedThing != Thing::_explHarmNonMaterial)) + if (getFlag(curCreatureInfo->_attributes, kDMCreatureMaskNonMaterial) && (projectileAssociatedThing != _vm->_thingExplHarmNonMaterial)) return false; attack = (uint16)((unsigned long)getProjectileImpactAttack(projectileThingData, projectileAssociatedThing) << 6) / curCreatureInfo->_defense; @@ -206,14 +206,14 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in } else { explosionAttack = projectileThingData->_kineticEnergy; } - if ((projectileAssociatedThing == Thing::_explLightningBolt) && !(explosionAttack >>= 1)) + if ((projectileAssociatedThing == _vm->_thingExplLightningBolt) && !(explosionAttack >>= 1)) goto T0217044; - createExplosion(projectileAssociatedThing, explosionAttack, mapXCombo, mapYCombo, (projectileAssociatedThing == Thing::_explPoisonCloud) ? (uint16)kDMCreatureTypeSingleCenteredCreature : cell); + createExplosion(projectileAssociatedThing, explosionAttack, mapXCombo, mapYCombo, (projectileAssociatedThing == _vm->_thingExplPoisonCloud) ? (uint16)kDMCreatureTypeSingleCenteredCreature : cell); } else { uint16 soundIndex; if ((projectileAssociatedThing).getType() == kDMThingTypeWeapon) soundIndex = kDMSoundIndexMetallicThud; - else if (projectileAssociatedThing == Thing::_explPoisonBolt) + else if (projectileAssociatedThing == _vm->_thingExplPoisonBolt) soundIndex = kDMSoundIndexSpell; else soundIndex = kDMSoundIndexWoodenThudAttackTrolinAntmanStoneGolem; @@ -222,7 +222,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in } T0217044: if (removePotion) { - potion->_nextThing = Thing::_none; + potion->_nextThing = _vm->_thingNone; projectileThingData->_slot = explosionThing; } _vm->_dungeonMan->unlinkThingFromList(projectileThing, Thing(0), projectileMapX, projectileMapY); @@ -246,14 +246,14 @@ uint16 ProjExpl::getProjectileImpactAttack(Projectile *projectile, Thing thing) attack = _vm->getRandomNumber(4); attack += _vm->_dungeonMan->getObjectWeight(thing) >> 1; - } else if (thing == Thing::_explSlime) { + } else if (thing == _vm->_thingExplSlime) { attack = _vm->getRandomNumber(16); _projectilePoisonAttack = attack + 10; attack += _vm->getRandomNumber(32); } else { - if (thing.toUint16() >= Thing::_explHarmNonMaterial.toUint16()) { + if (thing.toUint16() >= _vm->_thingExplHarmNonMaterial.toUint16()) { _projectileAttackType = kDMAttackTypeMagic; - if (thing == Thing::_explPoisonBolt) { + if (thing == _vm->_thingExplPoisonBolt) { _projectilePoisonAttack = kineticEnergy; return 1; } @@ -261,7 +261,7 @@ uint16 ProjExpl::getProjectileImpactAttack(Projectile *projectile, Thing thing) } _projectileAttackType = kDMAttackTypeFire; attack = _vm->getRandomNumber(16) + _vm->getRandomNumber(16) + 10; - if (thing == Thing::_explLightningBolt) { + if (thing == _vm->_thingExplLightningBolt) { _projectileAttackType = kDMAttackTypeLightning; attack *= 5; } @@ -274,7 +274,7 @@ uint16 ProjExpl::getProjectileImpactAttack(Projectile *projectile, Thing thing) void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo, uint16 mapYCombo, uint16 cell) { Thing unusedThing = _vm->_dungeonMan->getUnusedThing(kDMThingTypeExplosion); - if (unusedThing == Thing::_none) + if (unusedThing == _vm->_thingNone) return; Explosion *explosion = &((Explosion *)_vm->_dungeonMan->_thingData[kDMThingTypeExplosion])[(unusedThing).getIndex()]; @@ -301,35 +301,35 @@ void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo, unusedThing = _vm->thingWithNewCell(unusedThing, cell); } - explosion->setType(explThing.toUint16() - Thing::_firstExplosion.toUint16()); + explosion->setType(explThing.toUint16() - _vm->_thingFirstExplosion.toUint16()); explosion->setAttack(attack); - if (explThing.toUint16() < Thing::_explHarmNonMaterial.toUint16()) { + if (explThing.toUint16() < _vm->_thingExplHarmNonMaterial.toUint16()) { uint16 soundIndex = (attack > 80) ? kDMSoundIndexStrongExplosion : kDMSoundIndexWeakExplosion; _vm->_sound->requestPlay(soundIndex, projectileMapX, projectileMapY, kDMSoundModePlayIfPrioritized); - } else if (explThing != Thing::_explSmoke) + } else if (explThing != _vm->_thingExplSmoke) _vm->_sound->requestPlay(kDMSoundIndexSpell, projectileMapX, projectileMapY, kDMSoundModePlayIfPrioritized); _vm->_dungeonMan->linkThingToList(unusedThing, Thing(0), projectileMapX, projectileMapY); TimelineEvent newEvent; - newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, _vm->_gameTime + ((explThing == Thing::_explRebirthStep1) ? 5 : 1)); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, _vm->_gameTime + ((explThing == _vm->_thingExplRebirthStep1) ? 5 : 1)); newEvent._type = kDMEventTypeExplosion; newEvent._priority = 0; newEvent._Cu._slot = unusedThing.toUint16(); newEvent._Bu._location._mapX = projectileMapX; newEvent._Bu._location._mapY = projectileMapY; _vm->_timeline->addEventGetEventIndex(&newEvent); - if ((explThing == Thing::_explLightningBolt) || (explThing == Thing::_explFireBall)) { + if ((explThing == _vm->_thingExplLightningBolt) || (explThing == _vm->_thingExplFireBall)) { projectileMapX = projectileTargetMapX; projectileMapY = projectileTargetMapY; attack = (attack >> 1) + 1; attack += _vm->getRandomNumber(attack) + 1; - if ((explThing == Thing::_explFireBall) || (attack >>= 1)) { + if ((explThing == _vm->_thingExplFireBall) || (attack >>= 1)) { if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (projectileMapX == _vm->_dungeonMan->_partyMapX) && (projectileMapY == _vm->_dungeonMan->_partyMapY)) { int16 wounds = kDMWoundReadHand | kDMWoundActionHand | kDMWoundHead | kDMWoundTorso | kDMWoundLegs | kDMWoundFeet; _vm->_championMan->getDamagedChampionCount(attack, wounds, kDMAttackTypeFire); } else { unusedThing = _vm->_groupMan->groupGetThing(projectileMapX, projectileMapY); - if (unusedThing != Thing::_endOfList) { + if (unusedThing != _vm->_thingEndOfList) { Group *creatureGroup = (Group *)_vm->_dungeonMan->getThingData(unusedThing); CreatureInfo *creatureInfo = &_vm->_dungeonMan->_creatureInfos[creatureGroup->_type]; int16 creatureFireResistance = creatureInfo->getFireResistance(); @@ -351,7 +351,7 @@ int16 ProjExpl::projectileGetImpactCount(int16 impactType, int16 mapX, int16 map int16 impactCount = 0; _creatureDamageOutcome = kDMKillOutcomeNoCreaturesInGroup; - for (Thing curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); curThing != Thing::_endOfList; ) { + for (Thing curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); curThing != _vm->_thingEndOfList; ) { if (((curThing).getType() == kDMThingTypeProjectile) && ((curThing).getCell() == cell) && hasProjectileImpactOccurred(impactType, mapX, mapY, cell, curThing)) { projectileDeleteEvent(curThing); @@ -377,16 +377,16 @@ void ProjExpl::projectileDelete(Thing projectileThing, Thing *groupSlot, int16 m if (projectileSlotThing.getType() != kDMThingTypeExplosion) { if (groupSlot != NULL) { Thing previousThing = *groupSlot; - if (previousThing == Thing::_endOfList) { + if (previousThing == _vm->_thingEndOfList) { Thing *genericThing = (Thing *)_vm->_dungeonMan->getThingData(projectileSlotThing); - *genericThing = Thing::_endOfList; + *genericThing = _vm->_thingEndOfList; *groupSlot = projectileSlotThing; } else _vm->_dungeonMan->linkThingToList(projectileSlotThing, previousThing, kDMMapXNotOnASquare, 0); } else _vm->_moveSens->getMoveResult(Thing((projectileSlotThing).getTypeAndIndex() | getFlag(projectileThing.toUint16(), 0xC)), -2, 0, mapX, mapY); } - projectile->_nextThing = Thing::_none; + projectile->_nextThing = _vm->_thingNone; } void ProjExpl::processEvents48To49(TimelineEvent *event) { @@ -407,7 +407,7 @@ void ProjExpl::processEvents48To49(TimelineEvent *event) { if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (destinationMapX == _vm->_dungeonMan->_partyMapX) && (destinationMapY == _vm->_dungeonMan->_partyMapY) && hasProjectileImpactOccurred(kDMElementTypeChampion, destinationMapX, destinationMapY, projectileCurCell, projectileThingNewCell)) return; - if ((_vm->_groupMan->groupGetThing(destinationMapX, destinationMapY) != Thing::_endOfList) && hasProjectileImpactOccurred(kDMElementTypeCreature, destinationMapX, destinationMapY, projectileCurCell, projectileThing)) + if ((_vm->_groupMan->groupGetThing(destinationMapX, destinationMapY) != _vm->_thingEndOfList) && hasProjectileImpactOccurred(kDMElementTypeCreature, destinationMapX, destinationMapY, projectileCurCell, projectileThing)) return; uint16 stepEnergy = curEvent->_Cu._projectile.getStepEnergy(); @@ -481,15 +481,15 @@ void ProjExpl::processEvent25(TimelineEvent *event) { CreatureInfo *creatureInfo = nullptr; CreatureType creatureType; - if (groupThing != Thing::_endOfList) { + if (groupThing != _vm->_thingEndOfList) { group = (Group *)_vm->_dungeonMan->getThingData(groupThing); creatureType = group->_type; creatureInfo = &_vm->_dungeonMan->_creatureInfos[creatureType]; } - Thing explosionThing = Thing(Thing::_firstExplosion.toUint16() + explosion->getType()); + Thing explosionThing = Thing(_vm->_thingFirstExplosion.toUint16() + explosion->getType()); int16 attack; - if (explosionThing == Thing::_explPoisonCloud) + if (explosionThing == _vm->_thingExplPoisonCloud) attack = MAX(1, MIN(explosion->getAttack() >> 5, 4) + _vm->getRandomNumber(2)); /* Value between 1 and 5 */ else { attack = (explosion->getAttack() >> 1) + 1; @@ -508,7 +508,7 @@ void ProjExpl::processEvent25(TimelineEvent *event) { break; case 0xFF83: - if ((groupThing != Thing::_endOfList) && getFlag(creatureInfo->_attributes, kDMCreatureMaskNonMaterial)) { + if ((groupThing != _vm->_thingEndOfList) && getFlag(creatureInfo->_attributes, kDMCreatureMaskNonMaterial)) { if ((creatureType == kDMCreatureTypeMaterializerZytaz) && (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex)) { int16 nonMaterialAdditionalAttack = attack >> 3; attack -= nonMaterialAdditionalAttack; @@ -537,7 +537,7 @@ void ProjExpl::processEvent25(TimelineEvent *event) { case 0xFF87: if (explosionOnPartySquare) _vm->_championMan->getDamagedChampionCount(attack, kDMWoundNone, kDMAttackTypeNormal); - else if ((groupThing != Thing::_endOfList) + else if ((groupThing != _vm->_thingEndOfList) && (attack = _vm->_groupMan->groupGetResistanceAdjustedPoisonAttack(creatureType, attack)) && (_vm->_groupMan->getDamageAllCreaturesOutcome(group, mapX, mapY, attack, true) != kDMKillOutcomeAllCreaturesInGroup) && (attack > 2)) { @@ -556,7 +556,7 @@ void ProjExpl::processEvent25(TimelineEvent *event) { _vm->_timeline->addEventGetEventIndex(&newEvent); } else { _vm->_dungeonMan->unlinkThingFromList(Thing(event->_Cu._slot), Thing(0), mapX, mapY); - explosion->setNextThing(Thing::_none); + explosion->setNextThing(_vm->_thingNone); } } } diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp index c6a77ece46..7ee1a467c7 100644 --- a/engines/dm/timeline.cpp +++ b/engines/dm/timeline.cpp @@ -310,7 +310,7 @@ void Timeline::processTimeline() { if (!_vm->_gameWon) { _vm->_dungeonMan->unlinkThingFromList(Thing(newEvent._Cu._slot), Thing(0), newEvent._Bu._location._mapX, newEvent._Bu._location._mapY); curEvent = (TimelineEvent *)_vm->_dungeonMan->getThingData(Thing(newEvent._Cu._slot)); - ((Explosion *)curEvent)->setNextThing(Thing::_none); + ((Explosion *)curEvent)->setNextThing(_vm->_thingNone); } break; case kDMEventTypeEnableChampionAction: @@ -413,7 +413,7 @@ void Timeline::processEventDoorAnimation(TimelineEvent *event) { } Thing groupThing = _vm->_groupMan->groupGetThing(mapX, mapY); uint16 creatureAttributes = _vm->_dungeonMan->getCreatureAttributes(groupThing); - if ((groupThing != Thing::_endOfList) && !getFlag(creatureAttributes, kDMCreatureMaskNonMaterial)) { + if ((groupThing != _vm->_thingEndOfList) && !getFlag(creatureAttributes, kDMCreatureMaskNonMaterial)) { if (doorState >= (verticalDoorFl ? CreatureInfo::getHeight(creatureAttributes) : 1)) { /* Creature height or 1 */ if (_vm->_groupMan->getDamageAllCreaturesOutcome((Group *)_vm->_dungeonMan->getThingData(groupThing), mapX, mapY, 5, true) != kDMKillOutcomeAllCreaturesInGroup) _vm->_groupMan->processEvents29to41(mapX, mapY, kDMEventTypeCreateReactionDangerOnSquare, 0); @@ -463,7 +463,7 @@ void Timeline::processEventSquareFakewall(TimelineEvent *event) { addEventGetEventIndex(event); } else { Thing groupThing = _vm->_groupMan->groupGetThing(mapX, mapY); - if ((groupThing != Thing::_endOfList) && !getFlag(_vm->_dungeonMan->getCreatureAttributes(groupThing), kDMCreatureMaskNonMaterial)) { + if ((groupThing != _vm->_thingEndOfList) && !getFlag(_vm->_dungeonMan->getCreatureAttributes(groupThing), kDMCreatureMaskNonMaterial)) { event->_mapTime++; addEventGetEventIndex(event); } else @@ -511,25 +511,25 @@ void Timeline::processEventSquarePit(TimelineEvent *event) { void Timeline::moveTeleporterOrPitSquareThings(uint16 mapX, uint16 mapY) { if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (mapX == _vm->_dungeonMan->_partyMapX) && (mapY == _vm->_dungeonMan->_partyMapY)) { - _vm->_moveSens->getMoveResult(Thing::_party, mapX, mapY, mapX, mapY); + _vm->_moveSens->getMoveResult(_vm->_thingParty, mapX, mapY, mapX, mapY); _vm->_championMan->drawChangedObjectIcons(); } Thing curThing = _vm->_groupMan->groupGetThing(mapX, mapY); - if (curThing != Thing::_endOfList) + if (curThing != _vm->_thingEndOfList) _vm->_moveSens->getMoveResult(curThing, mapX, mapY, mapX, mapY); curThing = _vm->_dungeonMan->getSquareFirstObject(mapX, mapY); Thing nextThing = curThing; int16 thingsToMoveCount = 0; - while (curThing != Thing::_endOfList) { + while (curThing != _vm->_thingEndOfList) { if (curThing.getType() > kDMThingTypeGroup) thingsToMoveCount++; curThing = _vm->_dungeonMan->getNextThing(curThing); } curThing = nextThing; - while ((curThing != Thing::_endOfList) && thingsToMoveCount) { + while ((curThing != _vm->_thingEndOfList) && thingsToMoveCount) { thingsToMoveCount--; nextThing = _vm->_dungeonMan->getNextThing(curThing); uint16 curThingType = curThing.getType(); @@ -580,7 +580,7 @@ void Timeline::processEventSquareWall(TimelineEvent *event) { int16 mapY = event->_Bu._location._mapY; Thing curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); uint16 curCell = event->_Cu.A._cell; - while (curThing != Thing::_endOfList) { + while (curThing != _vm->_thingEndOfList) { int16 curThingType = curThing.getType(); if ((curThingType == kDMstringTypeText) && (curThing.getCell() == event->_Cu.A._cell)) { TextString *textString = (TextString *)_vm->_dungeonMan->getThingData(curThing); @@ -657,39 +657,39 @@ void Timeline::triggerProjectileLauncher(Sensor *sensor, TimelineEvent *event) { Thing firstProjectileAssociatedThing; Thing secondProjectileAssociatedThing; if ((sensorType == kDMSensorWallSingleProjLauncherExplosion) || (sensorType == kDMSensorWallDoubleProjLauncherExplosion)) - firstProjectileAssociatedThing = secondProjectileAssociatedThing = Thing(sensorData + Thing::_firstExplosion.toUint16()); + firstProjectileAssociatedThing = secondProjectileAssociatedThing = Thing(sensorData + _vm->_thingFirstExplosion.toUint16()); else if ((sensorType == kDMSensorWallSingleProjLauncherSquareObj) || (sensorType == kDMSensorWallDoubleProjLauncherSquareObj)) { firstProjectileAssociatedThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); - while (firstProjectileAssociatedThing != Thing::_none) { /* BUG0_19 The game crashes when an object launcher sensor is triggered. Thing::_none should be Thing::_endOfList. If there are no more objects on the square then this loop may return an undefined value, this can crash the game. In the original DM and CSB dungeons, the number of times that these sensors are triggered is always controlled to be equal to the number of available objects (with a countdown sensor or a number of once only sensors) */ + while (firstProjectileAssociatedThing != _vm->_thingNone) { /* BUG0_19 The game crashes when an object launcher sensor is triggered. _vm->_none should be _vm->_endOfList. If there are no more objects on the square then this loop may return an undefined value, this can crash the game. In the original DM and CSB dungeons, the number of times that these sensors are triggered is always controlled to be equal to the number of available objects (with a countdown sensor or a number of once only sensors) */ uint16 projectiveThingCell = firstProjectileAssociatedThing.getCell(); if ((firstProjectileAssociatedThing.getType() > kDMThingTypeSensor) && ((projectiveThingCell == cell) || (projectiveThingCell == _vm->turnDirRight(cell)))) break; firstProjectileAssociatedThing = _vm->_dungeonMan->getNextThing(firstProjectileAssociatedThing); } - if (firstProjectileAssociatedThing == Thing::_none) /* BUG0_19 The game crashes when an object launcher sensor is triggered. Thing::_none should be Thing::_endOfList */ + if (firstProjectileAssociatedThing == _vm->_thingNone) /* BUG0_19 The game crashes when an object launcher sensor is triggered. _vm->_none should be _vm->_endOfList */ return; _vm->_dungeonMan->unlinkThingFromList(firstProjectileAssociatedThing, Thing(0), mapX, mapY); /* The object is removed without triggering any sensor effects */ if (!launchSingleProjectile) { secondProjectileAssociatedThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); - while (secondProjectileAssociatedThing != Thing::_none) { /* BUG0_19 The game crashes when an object launcher sensor is triggered. Thing::_none should be Thing::_endOfList. If there are no more objects on the square then this loop may return an undefined value, this can crash the game */ + while (secondProjectileAssociatedThing != _vm->_thingNone) { /* BUG0_19 The game crashes when an object launcher sensor is triggered. _vm->_none should be _vm->_endOfList. If there are no more objects on the square then this loop may return an undefined value, this can crash the game */ uint16 projectiveThingCell = secondProjectileAssociatedThing.getCell(); if ((secondProjectileAssociatedThing.getType() > kDMThingTypeSensor) && ((projectiveThingCell == cell) || (projectiveThingCell == _vm->turnDirRight(cell)))) break; secondProjectileAssociatedThing = _vm->_dungeonMan->getNextThing(secondProjectileAssociatedThing); } - if (secondProjectileAssociatedThing == Thing::_none) /* BUG0_19 The game crashes when an object launcher sensor is triggered. Thing::_none should be Thing::_endOfList */ + if (secondProjectileAssociatedThing == _vm->_thingNone) /* BUG0_19 The game crashes when an object launcher sensor is triggered. _vm->_none should be _vm->_endOfList */ launchSingleProjectile = true; else - _vm->_dungeonMan->unlinkThingFromList(secondProjectileAssociatedThing, Thing::_none, mapX, mapY); /* The object is removed without triggering any sensor effects */ + _vm->_dungeonMan->unlinkThingFromList(secondProjectileAssociatedThing, _vm->_thingNone, mapX, mapY); /* The object is removed without triggering any sensor effects */ } } else { firstProjectileAssociatedThing = _vm->_dungeonMan->getObjForProjectileLaucherOrObjGen(sensorData); - if ((firstProjectileAssociatedThing) == Thing::_none) + if ((firstProjectileAssociatedThing) == _vm->_thingNone) return; secondProjectileAssociatedThing = _vm->_dungeonMan->getObjForProjectileLaucherOrObjGen(sensorData); - if (!launchSingleProjectile && (secondProjectileAssociatedThing == Thing::_none)) + if (!launchSingleProjectile && (secondProjectileAssociatedThing == _vm->_thingNone)) launchSingleProjectile = true; } if (launchSingleProjectile) @@ -710,7 +710,7 @@ void Timeline::processEventSquareCorridor(TimelineEvent *event) { uint16 mapX = event->_Bu._location._mapX; uint16 mapY = event->_Bu._location._mapY; Thing curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); - while (curThing != Thing::_endOfList) { + while (curThing != _vm->_thingEndOfList) { int16 curThingType = curThing.getType(); if (curThingType == kDMstringTypeText) { TextString *textString = (TextString *)_vm->_dungeonMan->getThingData(curThing); @@ -772,7 +772,7 @@ void Timeline::processEventsMoveGroup(TimelineEvent *event) { uint16 mapY = event->_Bu._location._mapY; T0252001: - if (((_vm->_dungeonMan->_currMapIndex != _vm->_dungeonMan->_partyMapIndex) || (mapX != _vm->_dungeonMan->_partyMapX) || (mapY != _vm->_dungeonMan->_partyMapY)) && (_vm->_groupMan->groupGetThing(mapX, mapY) == Thing::_endOfList)) { /* BUG0_24 Lord Chaos may teleport into one of the Black Flames and become invisible until the Black Flame is killed. In this case, _vm->_groupMan->f175_groupGetThing returns the Black Flame thing and the Lord Chaos thing is not moved into the dungeon until the Black Flame is killed */ + if (((_vm->_dungeonMan->_currMapIndex != _vm->_dungeonMan->_partyMapIndex) || (mapX != _vm->_dungeonMan->_partyMapX) || (mapY != _vm->_dungeonMan->_partyMapY)) && (_vm->_groupMan->groupGetThing(mapX, mapY) == _vm->_thingEndOfList)) { /* BUG0_24 Lord Chaos may teleport into one of the Black Flames and become invisible until the Black Flame is killed. In this case, _vm->_groupMan->f175_groupGetThing returns the Black Flame thing and the Lord Chaos thing is not moved into the dungeon until the Black Flame is killed */ if (event->_type == kDMEventTypeMoveGroupAudible) _vm->_sound->requestPlay(kDMSoundIndexBuzz, mapX, mapY, kDMSoundModePlayIfPrioritized); @@ -806,7 +806,7 @@ T0252001: void Timeline::procesEventEnableGroupGenerator(TimelineEvent *event) { Thing curThing = _vm->_dungeonMan->getSquareFirstThing(event->_Bu._location._mapX, event->_Bu._location._mapY); - while (curThing != Thing::_none) { + while (curThing != _vm->_thingNone) { if ((curThing.getType()) == kDMThingTypeSensor) { Sensor *curSensor = (Sensor *)_vm->_dungeonMan->getThingData(curThing); if (curSensor->getType() == kDMSensorDisabled) { @@ -826,7 +826,7 @@ void Timeline::processEventEnableChampionAction(uint16 champIndex) { curChampion->_actionDefense -= _actionDefense[curChampion->_actionDefense]; } if (curChampion->_currHealth) { - if ((curChampion->_actionIndex == kDMActionShoot) && (curChampion->_slots[kDMSlotReadyHand] == Thing::_none)) { + if ((curChampion->_actionIndex == kDMActionShoot) && (curChampion->_slots[kDMSlotReadyHand] == _vm->_thingNone)) { int16 slotIndex = kDMSlotQuiverLine1_1; if (_vm->_championMan->isAmmunitionCompatibleWithWeapon(champIndex, kDMSlotActionHand, slotIndex)) _vm->_championMan->addObjectInSlot((ChampionIndex)champIndex, _vm->_championMan->getObjectRemovedFromSlot(champIndex, slotIndex), kDMSlotReadyHand); @@ -846,7 +846,7 @@ void Timeline::processEventEnableChampionAction(uint16 champIndex) { void Timeline::processEventMoveWeaponFromQuiverToSlot(uint16 champIndex, uint16 slotIndex) { Champion *curChampion = &_vm->_championMan->_champions[champIndex]; - if (curChampion->_slots[slotIndex] != Thing::_none) + if (curChampion->_slots[slotIndex] != _vm->_thingNone) return; if (hasWeaponMovedSlot(champIndex, curChampion, kDMSlotQuiverLine1_1, slotIndex)) @@ -925,7 +925,7 @@ void Timeline::processEventViAltarRebirth(TimelineEvent *event) { uint16 rebirthStep = event->_Cu.A._effect; switch (rebirthStep) { /* Rebirth is a 3 steps process (Step 2 -> Step 1 -> Step 0). Step is stored in the Effect value of the event */ case 2: - _vm->_projexpl->createExplosion(Thing::_explRebirthStep1, 0, mapX, mapY, cell); + _vm->_projexpl->createExplosion(_vm->_thingExplRebirthStep1, 0, mapX, mapY, cell); event->_mapTime += 5; T0255002: rebirthStep--; @@ -934,14 +934,14 @@ T0255002: break; case 1: { Thing curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); - while (curThing != Thing::_endOfList) { + while (curThing != _vm->_thingEndOfList) { if ((curThing.getCell() == cell) && (curThing.getType() == kDMThingTypeJunk)) { int16 iconIndex = _vm->_objectMan->getIconIndex(curThing); if (iconIndex == kDMIconIndiceJunkChampionBones) { Junk *junkData = (Junk *)_vm->_dungeonMan->getThingData(curThing); if (junkData->getChargeCount() == championIndex) { _vm->_dungeonMan->unlinkThingFromList(curThing, Thing(0), mapX, mapY); /* BUG0_25 When a champion dies, no bones object is created so it is not possible to bring the champion back to life at an altar of Vi. Each time a champion is brought back to life, the bones object is removed from the dungeon but it is not marked as unused and thus becomes an orphan. After a large number of champion deaths, all JUNK things are exhausted and the game cannot create any more. This also affects the creation of JUNK things dropped by some creatures when they die (Screamer, Rockpile, Magenta Worm, Pain Rat, Red Dragon) */ - junkData->setNextThing(Thing::_none); + junkData->setNextThing(_vm->_thingNone); event->_mapTime += 1; goto T0255002; } |