aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/dm/champion.cpp38
-rw-r--r--engines/dm/detection.cpp20
-rw-r--r--engines/dm/dialog.cpp2
-rw-r--r--engines/dm/dialog.h24
-rw-r--r--engines/dm/dm.cpp22
-rw-r--r--engines/dm/dm.h157
-rw-r--r--engines/dm/dungeonman.cpp106
-rw-r--r--engines/dm/eventman.cpp2
-rw-r--r--engines/dm/gfx.cpp24
-rw-r--r--engines/dm/group.cpp52
-rw-r--r--engines/dm/inventory.cpp22
-rw-r--r--engines/dm/loadsave.cpp10
-rw-r--r--engines/dm/menus.cpp16
-rw-r--r--engines/dm/movesens.cpp106
-rw-r--r--engines/dm/projexpl.cpp28
-rw-r--r--engines/dm/sounds.cpp8
-rw-r--r--engines/dm/timeline.cpp26
17 files changed, 335 insertions, 328 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp
index 3d54fad827..71e864e059 100644
--- a/engines/dm/champion.cpp
+++ b/engines/dm/champion.cpp
@@ -50,7 +50,7 @@ void Champion::resetToZero() {
memset(_statistics, 0, 7 * 3);
memset(_name, '\0', 8);
memset(_title, '\0', 20);
- _dir = kDirNorth;
+ _dir = kDMDirNorth;
_cell = k0_ViewCellFronLeft;
_actionIndex = kDMActionN;
_symbolStep = 0;
@@ -222,7 +222,7 @@ bool ChampionMan::isObjectThrown(uint16 champIndex, int16 slotIndex, int16 side)
disableAction(champIndex, 4);
int16 experience = 8;
int16 weaponKineticEnergy = 1;
- if (curThing.getType() == k5_WeaponThingType) {
+ if (curThing.getType() == kDMThingTypeWeapon) {
experience += 4;
WeaponInfo *curWeapon = _vm->_dungeonMan->getWeaponInfo(curThing);
if (curWeapon->_class <= k12_WeaponClassPoisinDart) {
@@ -292,9 +292,9 @@ void ChampionMan::applyModifiersToStatistics(Champion *champ, int16 slotIndex, i
ThingType thingType = thing.getType();
bool cursed = false;
- if (((thingType == k5_WeaponThingType) || (thingType == k6_ArmourThingType))
+ if (((thingType == kDMThingTypeWeapon) || (thingType == kDMThingTypeArmour))
&& (slotIndex >= kDMSlotReadyHand) && (slotIndex <= kDMSlotQuiverLine1_1)) {
- if (thingType == k5_WeaponThingType) {
+ if (thingType == kDMThingTypeWeapon) {
Weapon *weapon = (Weapon *)_vm->_dungeonMan->getThingData(thing);
cursed = weapon->getCursed();
} else {
@@ -637,7 +637,7 @@ uint16 ChampionMan::getStrength(int16 champIndex, int16 slotIndex) {
strength -= (objectWeight - loadThreshold) << 1;
}
}
- if (curThing.getType() == k5_WeaponThingType) {
+ if (curThing.getType() == kDMThingTypeWeapon) {
WeaponInfo *weaponInfo = _vm->_dungeonMan->getWeaponInfo(curThing);
strength += weaponInfo->_strength;
uint16 skillLevel = 0;
@@ -850,7 +850,7 @@ int16 ChampionMan::getWoundDefense(int16 champIndex, uint16 woundIndex) {
uint16 armorShieldDefense = 0;
for (int16 slotIndex = kDMSlotReadyHand; slotIndex <= kDMSlotActionHand; slotIndex++) {
Thing curThing = curChampion->_slots[slotIndex];
- if (curThing.getType() == k6_ArmourThingType) {
+ if (curThing.getType() == kDMThingTypeArmour) {
ArmourInfo *armorInfo = (ArmourInfo *)_vm->_dungeonMan->getThingData(curThing);
armorInfo = &_vm->_dungeonMan->_armourInfos[((Armour *)armorInfo)->getType()];
if (getFlag(armorInfo->_attributes, k0x0080_ArmourAttributeIsAShield))
@@ -865,7 +865,7 @@ int16 ChampionMan::getWoundDefense(int16 champIndex, uint16 woundIndex) {
woundDefense += curChampion->_actionDefense + curChampion->_shieldDefense + _party._shieldDefense + armorShieldDefense;
if (woundIndex > kDMSlotActionHand) {
Thing curThing = curChampion->_slots[woundIndex];
- if (curThing.getType() == k6_ArmourThingType) {
+ if (curThing.getType() == kDMThingTypeArmour) {
ArmourInfo *armourInfo = (ArmourInfo *)_vm->_dungeonMan->getThingData(curThing);
woundDefense += _vm->_dungeonMan->getArmourDefense(&_vm->_dungeonMan->_armourInfos[((Armour *)armourInfo)->getType()], useSharpDefense);
}
@@ -1247,7 +1247,7 @@ int16 ChampionMan::getMovementTicks(Champion *champ) {
bool ChampionMan::isAmmunitionCompatibleWithWeapon(uint16 champIndex, uint16 weaponSlotIndex, uint16 ammunitionSlotIndex) {
Champion *curChampion = &_champions[champIndex];
Thing curThing = curChampion->_slots[weaponSlotIndex];
- if (curThing.getType() != k5_WeaponThingType)
+ if (curThing.getType() != kDMThingTypeWeapon)
return false;
WeaponInfo *weaponInfo = _vm->_dungeonMan->getWeaponInfo(curThing);
@@ -1263,7 +1263,7 @@ bool ChampionMan::isAmmunitionCompatibleWithWeapon(uint16 champIndex, uint16 wea
curThing = curChampion->_slots[ammunitionSlotIndex];
weaponInfo = _vm->_dungeonMan->getWeaponInfo(curThing);
- return ((curThing.getType() == k5_WeaponThingType) && (weaponInfo->_class == weaponClass));
+ return ((curThing.getType() == kDMThingTypeWeapon) && (weaponInfo->_class == weaponClass));
}
void ChampionMan::drawAllChampionStates() {
@@ -1274,7 +1274,7 @@ void ChampionMan::drawAllChampionStates() {
void ChampionMan::viAltarRebirth(uint16 champIndex) {
Champion *curChampion = &_champions[champIndex];
if (getIndexInCell(curChampion->_cell) != kDMChampionNone) {
- uint16 numCell = k0_CellNorthWest;
+ uint16 numCell = kDMCellNorthWest;
while (getIndexInCell(numCell) != kDMChampionNone)
numCell++;
@@ -1468,7 +1468,7 @@ void ChampionMan::championKill(uint16 champIndex) {
_vm->_inventoryMan->toggleInventory(kDMChampionCloseInventory);
}
dropAllObjects(champIndex);
- Thing unusedThing = _vm->_dungeonMan->getUnusedThing(k0x8000_championBones | k10_JunkThingType);
+ Thing unusedThing = _vm->_dungeonMan->getUnusedThing(k0x8000_championBones | kDMThingTypeJunk);
uint16 curCell = 0;
if (unusedThing != Thing::_none) {
Junk *L0966_ps_Junk = (Junk *)_vm->_dungeonMan->getThingData(unusedThing);
@@ -1893,7 +1893,7 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) {
championPtr->_slots[slotIdx] = Thing::_none;
Thing curThing = _vm->_dungeonMan->getSquareFirstThing(_vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY);
- while (curThing.getType() != k2_TextstringType)
+ while (curThing.getType() != kDMstringTypeText)
curThing = _vm->_dungeonMan->getNextThing(curThing);
char L0807_ac_DecodedChampionText[77];
@@ -1966,11 +1966,11 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) {
int16 slotIdx = kDMSlotBackpackLine1_1;
while (curThing != Thing::_endOfList) {
ThingType thingType = curThing.getType();
- if ((thingType > k3_SensorThingType) && (curThing.getCell() == championObjectsCell)) {
+ if ((thingType > kDMThingTypeSensor) && (curThing.getCell() == championObjectsCell)) {
int16 objectAllowedSlots = _vm->_dungeonMan->_objectInfos[_vm->_dungeonMan->getObjectInfoIndex(curThing)]._allowedSlots;
uint16 curSlotIndex = kDMSlotReadyHand;
switch (thingType) {
- case k6_ArmourThingType: {
+ case kDMThingTypeArmour: {
bool skipCheck = false;
for (curSlotIndex = kDMSlotHead; curSlotIndex <= kDMSlotFeet; curSlotIndex++) {
if (objectAllowedSlots & _slotMasks[curSlotIndex]) {
@@ -1989,7 +1989,7 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) {
break;
}
- case k5_WeaponThingType:
+ case kDMThingTypeWeapon:
if (championPtr->_slots[kDMSlotActionHand] == Thing::_none)
curSlotIndex = kDMSlotActionHand;
else if ((objectAllowedSlots & _slotMasks[kDMSlotNeck]) && (championPtr->_slots[kDMSlotNeck] == Thing::_none))
@@ -1997,8 +1997,8 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) {
else
curSlotIndex = slotIdx++;
break;
- case k7_ScrollThingType:
- case k8_PotionThingType:
+ case kDMThingTypeScroll:
+ case kDMThingTypePotion:
if (championPtr->_slots[kDMSlotPouch1] == Thing::_none)
curSlotIndex = kDMSlotPouch1;
else if (championPtr->_slots[kDMSlotPouch_2] == Thing::_none)
@@ -2008,8 +2008,8 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) {
else
curSlotIndex = slotIdx++;
break;
- case k9_ContainerThingType:
- case k10_JunkThingType:
+ case kDMThingTypeContainer:
+ case kDMThingTypeJunk:
if ((objectAllowedSlots & _slotMasks[kDMSlotNeck]) && (championPtr->_slots[kDMSlotNeck] == Thing::_none))
curSlotIndex = kDMSlotNeck;
else
diff --git a/engines/dm/detection.cpp b/engines/dm/detection.cpp
index 71528710fb..8ac2aa552c 100644
--- a/engines/dm/detection.cpp
+++ b/engines/dm/detection.cpp
@@ -51,10 +51,10 @@ static const DMADGameDescription gameDescriptions[] = {
},
Common::EN_ANY, Common::kPlatformAmiga, ADGF_NO_FLAGS, GUIO1(GUIO_NONE)
},
- k_saveTarget_DM21, k_saveFormat_dm_amiga__2_x_pc98_x68000_fm_towns_csb_atari_st, k_savePlatform_amiga,
- { k_saveTarget_DM21, k_saveTarget_endOfList },
- { k_saveFormat_dm_amiga__2_x_pc98_x68000_fm_towns_csb_atari_st, k_saveFormat_endOfList},
- { k_savePlatform_accept_any}
+ kDMSaveTargetDM21, kDMSaveFormatAmigaPC98FmTowns, kDMSavePlatformAmiga,
+ { kDMSaveTargetDM21, kDMSaveTargetEndOfList },
+ { kDMSaveFormatAmigaPC98FmTowns, kDMSaveFormatEndOfList},
+ { kDMSavePlatformAcceptAny}
},
{
{"dm", "Atari ???v English",
@@ -65,15 +65,15 @@ static const DMADGameDescription gameDescriptions[] = {
},
Common::EN_ANY, Common::kPlatformAtariST, ADGF_NO_FLAGS, GUIO1(GUIO_NONE),
},
- k_saveTarget_DM21, k_saveFormat_dm_amiga__2_x_pc98_x68000_fm_towns_csb_atari_st, k_savePlatform_atari_st,
- { k_saveTarget_DM21, k_saveTarget_endOfList},
- { k_saveFormat_dm_amiga__2_x_pc98_x68000_fm_towns_csb_atari_st, k_saveFormat_endOfList},
- { k_savePlatform_accept_any }
+ kDMSaveTargetDM21, kDMSaveFormatAmigaPC98FmTowns, kDMSavePlatformAtariSt,
+ { kDMSaveTargetDM21, kDMSaveTargetEndOfList},
+ { kDMSaveFormatAmigaPC98FmTowns, kDMSaveFormatEndOfList},
+ { kDMSavePlatformAcceptAny }
},
{
- AD_TABLE_END_MARKER, k_saveTarget_none, k_saveFormat_none, k_savePlatform_none,
- {k_saveTarget_none}, {k_saveFormat_none}, {k_savePlatform_none}
+ AD_TABLE_END_MARKER, kDMSaveTargetNone, kDMSaveFormatNone, kDMSavePlatformNone,
+ {kDMSaveTargetNone}, {kDMSaveFormatNone}, {kDMSavePlatformNone}
}
};
diff --git a/engines/dm/dialog.cpp b/engines/dm/dialog.cpp
index dd2e15836c..47888090f9 100644
--- a/engines/dm/dialog.cpp
+++ b/engines/dm/dialog.cpp
@@ -182,7 +182,7 @@ int16 DialogMan::getChoice(uint16 choiceCount, uint16 dialogSetIndex, int16 driv
if ((_selectedDialogChoice == 99) && (choiceCount == 1)
&& (eventType != Common::EVENT_INVALID) && key.kbd.keycode == Common::KEYCODE_RETURN) {
/* If a choice has not been made yet with the mouse and the dialog has only one possible choice and carriage return was pressed on the keyboard */
- _selectedDialogChoice = k1_DIALOG_CHOICE_1;
+ _selectedDialogChoice = kDMDialogChoice1;
}
} while (_selectedDialogChoice == 99);
_vm->_displayMan->_useByteBoxCoordinates = false;
diff --git a/engines/dm/dialog.h b/engines/dm/dialog.h
index c736f35b63..2b592f6c71 100644
--- a/engines/dm/dialog.h
+++ b/engines/dm/dialog.h
@@ -32,17 +32,19 @@
namespace DM {
-#define k0_DIALOG_SET_VIEWPORT 0
-#define k1_DIALOG_SET_SCREEN 1
-#define k2_DIALOG_SET_UNKNOWN 2
-#define k1_ONE_CHOICE 1
-#define k2_TWO_CHOICES 2
-#define k4_FOUR_CHOICES 4
-#define k0_DIALOG_CHOICE_NONE 0
-#define k1_DIALOG_CHOICE_1 1
-#define k2_DIALOG_CHOICE_2 2
-#define k3_DIALOG_CHOICE_3 3
-#define k4_DIALOG_CHOICE_4 4
+enum DialogCommand {
+ kDMDialogCommandSetViewport = 0,
+ kDMDialogCommandSetScreen = 1,
+ kDMDialogCommandSetUnknown = 2
+};
+
+enum DialogChoice {
+ kDMDialogChoiceNone = 0,
+ kDMDialogChoice1 = 1,
+ kDMDialogChoice2 = 2,
+ kDMDialogChoice3 = 3,
+ kDMDialogChoice4 = 4
+};
class DialogMan {
DMEngine *_vm;
diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp
index 78ef3a79e5..cb1014e443 100644
--- a/engines/dm/dm.cpp
+++ b/engines/dm/dm.cpp
@@ -167,7 +167,7 @@ DMEngine::DMEngine(OSystem *syst, const DMADGameDescription *desc) : Engine(syst
_projectileDisableMovementTicks = 0;
_lastProjectileDisabledMovementDirection = 0;
_gameWon = false;
- _newPartyMapIndex = kM1_mapIndexNone;
+ _newPartyMapIndex = kDMMapIndexNone;
_setMousePointerToObjectInMainLoop = false;
_disabledMovementTicks = 0;
_gameTime = 0;
@@ -219,7 +219,7 @@ bool DMEngine::hasFeature(EngineFeature f) const {
}
Common::Error DMEngine::loadGameState(int slot) {
- if (loadgame(slot) != kM1_LoadgameFailure) {
+ if (loadgame(slot) != kDMLoadgameFailure) {
_displayMan->fillScreen(k0_ColorBlack);
_displayMan->startEndFadeToPalette(_displayMan->_palDungeonView[0]);
_newGameFl = k0_modeLoadSavedGame;
@@ -282,7 +282,7 @@ void DMEngine::initializeGame() {
delete dialog;
}
}
- } while (loadgame(saveSlot) != k1_LoadgameSuccess);
+ } while (loadgame(saveSlot) != kDMLoadgameSuccess);
_displayMan->loadIntoBitmap(k11_MenuSpellAreLinesIndice, _menuMan->_bitmapSpellAreaLines); // @ F0396_MENUS_LoadSpellAreaLinesBitmap
@@ -422,15 +422,15 @@ void DMEngine::gameloop() {
for (;;) {
- if (_newPartyMapIndex != kM1_mapIndexNone) {
+ if (_newPartyMapIndex != kDMMapIndexNone) {
processNewPartyMap(_newPartyMapIndex);
_moveSens->getMoveResult(Thing::_party, kM1_MapXNotOnASquare, 0, _dungeonMan->_partyMapX, _dungeonMan->_partyMapY);
- _newPartyMapIndex = kM1_mapIndexNone;
+ _newPartyMapIndex = kDMMapIndexNone;
_eventMan->discardAllInput();
}
_timeline->processTimeline();
- if (_newPartyMapIndex == kM1_mapIndexNone)
+ if (_newPartyMapIndex == kDMMapIndexNone)
break;
}
@@ -722,7 +722,7 @@ T0444017:
_displayMan->fillScreen(k0_ColorBlack);
_displayMan->startEndFadeToPalette(_displayMan->_palDungeonView[0]);
_newGameFl = k0_modeLoadSavedGame;
- if (loadgame(1) != kM1_LoadgameFailure) {
+ if (loadgame(1) != kDMLoadgameFailure) {
startGame();
_restartGameRequest = false;
_eventMan->hideMouse();
@@ -763,7 +763,7 @@ void DMEngine::drawEntrance() {
byte *microDungeonCurrentMapData[32];
- _dungeonMan->_partyMapIndex = k255_mapIndexEntrance;
+ _dungeonMan->_partyMapIndex = kDMMapIndexEntrance;
_displayMan->_drawFloorAndCeilingRequested = true;
_dungeonMan->_currMapWidth = 5;
_dungeonMan->_currMapHeight = 5;
@@ -784,7 +784,7 @@ void DMEngine::drawEntrance() {
// note, a global variable is used here in the original
_displayMan->loadIntoBitmap(k4_entranceGraphicIndice, _displayMan->_bitmapScreen);
- _displayMan->drawDungeon(kDirSouth, 2, 0);
+ _displayMan->drawDungeon(kDMDirSouth, 2, 0);
if (!_savedScreenForOpenEntranceDoors)
_savedScreenForOpenEntranceDoors = new byte[k200_heightScreen * k160_byteWidthScreen * 2];
@@ -941,7 +941,7 @@ void DMEngine::fuseSequence() {
for (;;) {
Thing curThing = _dungeonMan->getSquareFirstObject(fluxCageMapX, fluxcageMapY);
while (curThing != Thing::_endOfList) {
- if (curThing.getType() == k15_ExplosionThingType) {
+ if (curThing.getType() == kDMThingTypeExplosion) {
Explosion *curExplosion = (Explosion*)_dungeonMan->getThingData(curThing);
if (curExplosion->getType() == k50_ExplosionType_Fluxcage) {
_dungeonMan->unlinkThingFromList(curThing, Thing(0), fluxCageMapX, fluxcageMapY);
@@ -999,7 +999,7 @@ void DMEngine::fuseSequence() {
int16 textStringThingCount = 0;
Thing textStringThings[8];
while (curThing != Thing::_endOfList) {
- if (curThing.getType() == k2_TextstringType)
+ if (curThing.getType() == kDMstringTypeText)
textStringThings[textStringThingCount++] = curThing;
curThing = _dungeonMan->getNextThing(curThing);
diff --git a/engines/dm/dm.h b/engines/dm/dm.h
index 6127da0038..051b5e8e0e 100644
--- a/engines/dm/dm.h
+++ b/engines/dm/dm.h
@@ -60,37 +60,89 @@ class DialogMan;
class SoundMan;
enum OriginalSaveFormat {
- k_saveFormat_accept_any = -1,
- k_saveFormat_endOfList = 0,
- k_saveFormat_none = 0,
- k_saveFormat_dm_atari_st = 1,
- k_saveFormat_dm_amiga__2_x_pc98_x68000_fm_towns_csb_atari_st = 2,
- k_saveFormat_dm_apple_iigs = 3,
- k_saveFormat_dm_amiga_36_pc_csb_amiga_pc98_x68000_fm_towns = 5,
- k_saveFormat_total
+ kDMSaveFormatAcceptAny = -1,
+ kDMSaveFormatEndOfList = 0,
+ kDMSaveFormatNone = 0,
+ kDMSaveFormatAtari = 1,
+ kDMSaveFormatAmigaPC98FmTowns = 2,
+ kCSBSaveFormatAtari = 2,
+ kDMSaveFormatAppleIIgs = 3,
+ kDMSaveFormatAmiga36PC = 5,
+ kCSBSaveFormatAmigaPC98FmTowns = 5,
+ kDMSaveFormatTotal
};
enum OriginalSavePlatform {
- k_savePlatform_accept_any = -1,
- k_savePlatform_endOfList = 0,
- k_savePlatform_none = 0,
- k_savePlatform_atari_st = 1, // @ C1_PLATFORM_ATARI_ST
- k_savePlatform_apple_iigs = 2, // @ C2_PLATFORM_APPLE_IIGS
- k_savePlatform_amiga = 3, // @ C3_PLATFORM_AMIGA
- k_savePlatform_pc98 = 5, // @ C5_PLATFORM_PC98
- k_savePlatform_x68000 = 6, // @ C6_PLATFORM_X68000
- k_savePlatform_fm_towns_en = 7, // @ C7_PLATFORM_FM_TOWNS_EN
- k_savePlatform_fm_towns_jp = 8, // @ C8_PLATFORM_FM_TOWNS_JP
- k_savePlatform_pc = 9, // @ C9_PLATFORM_PC
- k_savePlatform_total
+ kDMSavePlatformAcceptAny = -1,
+ kDMSavePlatformEndOfList = 0,
+ kDMSavePlatformNone = 0,
+ kDMSavePlatformAtariSt = 1, // @ C1_PLATFORM_ATARI_ST
+ kDMSavePlatformAppleIIgs = 2, // @ C2_PLATFORM_APPLE_IIGS
+ kDMSavePlatformAmiga = 3, // @ C3_PLATFORM_AMIGA
+ kDMSavePlatformPC98 = 5, // @ C5_PLATFORM_PC98
+ kDMSavePlatformX68000 = 6, // @ C6_PLATFORM_X68000
+ kDMSavePlatformFmTownsEN = 7, // @ C7_PLATFORM_FM_TOWNS_EN
+ kDMSavePlatformFmTownsJP = 8, // @ C8_PLATFORM_FM_TOWNS_JP
+ kDMSavePlatformPC = 9, // @ C9_PLATFORM_PC
+ kDMSavePlatformTotal
};
enum SaveTarget {
- k_saveTarget_accept_any = -1,
- k_saveTarget_endOfList = 0,
- k_saveTarget_none = 0,
- k_saveTarget_DM21 = 1,
- k_saveTarget_total
+ kDMSaveTargetAcceptAny = -1,
+ kDMSaveTargetEndOfList = 0,
+ kDMSaveTargetNone = 0,
+ kDMSaveTargetDM21 = 1,
+ kDMSaveTargetTotal
+};
+
+enum Direction {
+ kDMDirNorth = 0,
+ kDMDirEast = 1,
+ kDMDirSouth = 2,
+ kDMDirWest = 3
+};
+
+enum ThingType {
+ kDMThingTypeParty = -1, // @ CM1_THING_TYPE_PARTY
+ kDMThingTypeDoor = 0, // @ C00_THING_TYPE_DOOR
+ kDMThingTypeTeleporter = 1, // @ C01_THING_TYPE_TELEPORTER
+ kDMstringTypeText = 2, // @ C02_THING_TYPE_TEXTSTRING
+ kDMThingTypeSensor = 3, // @ C03_THING_TYPE_SENSOR
+ kDMThingTypeGroup = 4, // @ C04_THING_TYPE_GROUP
+ kDMThingTypeWeapon = 5, // @ C05_THING_TYPE_WEAPON
+ kDMThingTypeArmour = 6, // @ C06_THING_TYPE_ARMOUR
+ kDMThingTypeScroll = 7, // @ C07_THING_TYPE_SCROLL
+ kDMThingTypePotion = 8, // @ C08_THING_TYPE_POTION
+ kDMThingTypeContainer = 9, // @ C09_THING_TYPE_CONTAINER
+ kDMThingTypeJunk = 10, // @ C10_THING_TYPE_JUNK
+ kDMThingTypeProjectile = 14, // @ C14_THING_TYPE_PROJECTILE
+ kDMThingTypeExplosion = 15, // @ C15_THING_TYPE_EXPLOSION
+ kDMThingTypeTotal = 16 // +1 than the last (explosionThingType)
+}; // @ C[00..15]_THING_TYPE_...
+
+enum Cell {
+ kDMCellAny = -1, // @ CM1_CELL_ANY
+ kDMCellNorthWest = 0, // @ C00_CELL_NORTHWEST
+ kDMCellNorthEast = 1, // @ C01_CELL_NORTHEAST
+ kDMCellSouthEast = 2, // @ C02_CELL_SOUTHEAST
+ kDMCellSouthWest = 3 // @ C03_CELL_SOUTHWEST
+};
+
+enum GameMode {
+ k0_modeLoadSavedGame = 0, // @ C000_MODE_LOAD_SAVED_GAME
+ k1_modeLoadDungeon = 1, // @ C001_MODE_LOAD_DUNGEON
+ k99_modeWaitingOnEntrance = 99, // @ C099_MODE_WAITING_ON_ENTRANCE
+ k202_modeEntranceDrawCredits = 202 // @ C202_MODE_ENTRANCE_DRAW_CREDITS
+};
+
+enum LoadgameResult {
+ kDMLoadgameFailure = -1, // @ CM1_LOAD_GAME_FAILURE
+ kDMLoadgameSuccess = 1// @ C01_LOAD_GAME_SUCCESS
+};
+
+enum MapIndice {
+ kDMMapIndexNone = -1, // @ CM1_MAP_INDEX_NONE
+ kDMMapIndexEntrance = 255 // @ C255_MAP_INDEX_ENTRANCE
};
struct DMADGameDescription {
@@ -100,39 +152,13 @@ struct DMADGameDescription {
OriginalSaveFormat _origSaveFormatToWrite;
OriginalSavePlatform _origPlatformToWrite;
- SaveTarget _saveTargetToAccept[k_saveTarget_total + 1];
- OriginalSaveFormat _saveFormatToAccept[k_saveFormat_total + 1];
- OriginalSavePlatform _origPlatformToAccept[k_savePlatform_total + 1];
-};
-
-enum Direction {
- kDirNorth = 0,
- kDirEast = 1,
- kDirSouth = 2,
- kDirWest = 3
+ SaveTarget _saveTargetToAccept[kDMSaveTargetTotal + 1];
+ OriginalSaveFormat _saveFormatToAccept[kDMSaveFormatTotal + 1];
+ OriginalSavePlatform _origPlatformToAccept[kDMSavePlatformTotal + 1];
};
const char *debugGetDirectionName(Direction dir);
-enum ThingType {
- kM1_PartyThingType = -1, // @ CM1_THING_TYPE_PARTY
- k0_DoorThingType = 0, // @ C00_THING_TYPE_DOOR
- k1_TeleporterThingType = 1, // @ C01_THING_TYPE_TELEPORTER
- k2_TextstringType = 2, // @ C02_THING_TYPE_TEXTSTRING
- k3_SensorThingType = 3, // @ C03_THING_TYPE_SENSOR
- k4_GroupThingType = 4, // @ C04_THING_TYPE_GROUP
- k5_WeaponThingType = 5, // @ C05_THING_TYPE_WEAPON
- k6_ArmourThingType = 6, // @ C06_THING_TYPE_ARMOUR
- k7_ScrollThingType = 7, // @ C07_THING_TYPE_SCROLL
- k8_PotionThingType = 8, // @ C08_THING_TYPE_POTION
- k9_ContainerThingType = 9, // @ C09_THING_TYPE_CONTAINER
- k10_JunkThingType = 10, // @ C10_THING_TYPE_JUNK
- k14_ProjectileThingType = 14, // @ C14_THING_TYPE_PROJECTILE
- k15_ExplosionThingType = 15, // @ C15_THING_TYPE_EXPLOSION
- k16_ThingTypeTotal = 16 // +1 than the last (explosionThingType)
-}; // @ C[00..15]_THING_TYPE_...
-
-
class Thing {
public:
uint16 _data;
@@ -194,17 +220,6 @@ uint16 getMap(int32 map_time); // @ M29_MAP
Thing thingWithNewCell(Thing thing, int16 cell); // @ M15_THING_WITH_NEW_CELL
int16 getDistance(int16 mapx1, int16 mapy1, int16 mapx2, int16 mapy2);// @ M38_DISTANCE
-enum Cell {
- kM1_CellAny = -1, // @ CM1_CELL_ANY
- k0_CellNorthWest = 0, // @ C00_CELL_NORTHWEST
- k1_CellNorthEast = 1, // @ C01_CELL_NORTHEAST
- k2_CellSouthEast = 2, // @ C02_CELL_SOUTHEAST
- k3_CellSouthWest = 3 // @ C03_CELL_SOUTHWEST
-};
-
-#define kM1_mapIndexNone -1 // @ CM1_MAP_INDEX_NONE
-#define k255_mapIndexEntrance 255 // @ C255_MAP_INDEX_ENTRANCE
-
//TODO: Directly use CLIP
template<typename T>
inline T getBoundedValue(T min, T val, T max) {
@@ -213,16 +228,6 @@ inline T getBoundedValue(T min, T val, T max) {
#define CALL_MEMBER_FN(object,ptrToMember) ((object).*(ptrToMember))
-#define k0_modeLoadSavedGame 0 // @ C000_MODE_LOAD_SAVED_GAME
-#define k1_modeLoadDungeon 1 // @ C001_MODE_LOAD_DUNGEON
-#define k99_modeWaitingOnEntrance 99 // @ C099_MODE_WAITING_ON_ENTRANCE
-#define k202_modeEntranceDrawCredits 202 // @ C202_MODE_ENTRANCE_DRAW_CREDITS
-
-enum LoadgameResponse {
- kM1_LoadgameFailure = -1, // @ CM1_LOAD_GAME_FAILURE
- k1_LoadgameSuccess = 1// @ C01_LOAD_GAME_SUCCESS
-};
-
struct SaveGameHeader {
byte _version;
SaveStateDescriptor _descr;
@@ -256,7 +261,7 @@ public:
int16 indexToOrdinal(int16 val); // @ M00_INDEX_TO_ORDINAL
virtual Common::Error run(); // @ main
void saveGame(); // @ F0433_STARTEND_ProcessCommand140_SaveGame_CPSCDF
- LoadgameResponse loadgame(int16 slot); // @ F0435_STARTEND_LoadGame_CPSF
+ LoadgameResult loadgame(int16 slot); // @ F0435_STARTEND_LoadGame_CPSF
void processEntrance(); // @ F0441_STARTEND_ProcessEntrance
void endGame(bool doNotDrawCreditsOnly); // @ F0444_STARTEND_Endgame
diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp
index 5527e1e9c1..f10d69bcd9 100644
--- a/engines/dm/dungeonman.cpp
+++ b/engines/dm/dungeonman.cpp
@@ -428,7 +428,7 @@ DungeonMan::DungeonMan(DMEngine *dmEngine) : _vm(dmEngine) {
_partyMapX = 0;
_partyMapY = 0;
_partyMapIndex = 0;
- _currMapIndex = kM1_mapIndexNone;
+ _currMapIndex = kDMMapIndexNone;
_currMapData = nullptr;
_currMap = nullptr;
_currMapWidth = 0;
@@ -583,7 +583,7 @@ void DungeonMan::loadDungeonFile(Common::InSaveFile *file) {
_dungeonFileHeader._textDataWordCount = dunDataStream->readUint16BE();
_dungeonFileHeader._partyStartLocation = dunDataStream->readUint16BE();
_dungeonFileHeader._squareFirstThingCount = dunDataStream->readUint16BE();
- for (uint16 i = 0; i < k16_ThingTypeTotal; ++i)
+ for (uint16 i = 0; i < kDMThingTypeTotal; ++i)
_dungeonFileHeader._thingCounts[i] = dunDataStream->readUint16BE();
// init party position and mapindex
@@ -680,10 +680,10 @@ void DungeonMan::loadDungeonFile(Common::InSaveFile *file) {
_vm->_timeline->_eventMaxCount = 100;
// load things
- for (uint16 thingType = k0_DoorThingType; thingType < k16_ThingTypeTotal; ++thingType) {
+ for (uint16 thingType = kDMThingTypeDoor; thingType < kDMThingTypeTotal; ++thingType) {
uint16 thingCount = _dungeonFileHeader._thingCounts[thingType];
if (_vm->_newGameFl)
- _dungeonFileHeader._thingCounts[thingType] = MIN((thingType == k15_ExplosionThingType) ? 768 : 1024, thingCount + additionalThingCounts[thingType]);
+ _dungeonFileHeader._thingCounts[thingType] = MIN((thingType == kDMThingTypeExplosion) ? 768 : 1024, thingCount + additionalThingCounts[thingType]);
uint16 thingStoreWordCount = _thingDataWordCount[thingType];
@@ -695,7 +695,7 @@ void DungeonMan::loadDungeonFile(Common::InSaveFile *file) {
_thingData[thingType] = new uint16[_dungeonFileHeader._thingCounts[thingType] * thingStoreWordCount];
}
- if ((thingType == k4_GroupThingType || thingType == k14_ProjectileThingType) && !file) { // !file because save files have diff. structure than dungeon.dat
+ if ((thingType == kDMThingTypeGroup || thingType == kDMThingTypeProjectile) && !file) { // !file because save files have diff. structure than dungeon.dat
for (uint16 i = 0; i < thingCount; ++i) {
uint16 *nextSlot = _thingData[thingType] + i *thingStoreWordCount;
for (uint16 j = 0; j < thingStoreWordCount; ++j) {
@@ -714,7 +714,7 @@ void DungeonMan::loadDungeonFile(Common::InSaveFile *file) {
}
if (_vm->_newGameFl) {
- if ((thingType == k4_GroupThingType) || thingType >= k14_ProjectileThingType)
+ if ((thingType == kDMThingTypeGroup) || thingType >= kDMThingTypeProjectile)
_vm->_timeline->_eventMaxCount += _dungeonFileHeader._thingCounts[thingType];
for (uint16 i = 0; i < additionalThingCounts[thingType]; ++i)
@@ -866,22 +866,22 @@ void DungeonMan::setSquareAspect(uint16 *aspectArray, Direction dir, int16 mapX,
switch (aspectArray[k0_ElementAspect]) {
case k0_ElementTypeWall:
switch (dir) {
- case kDirNorth:
+ case kDMDirNorth:
leftRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0004_WallEastRandOrnAllowed);
frontRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0002_WallSouthRandOrnAllowed);
rightRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0001_WallWestRandOrnAllowed);
break;
- case kDirEast:
+ case kDMDirEast:
leftRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0002_WallSouthRandOrnAllowed);
frontRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0001_WallWestRandOrnAllowed);
rightRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0008_WallNorthRandOrnAllowed);
break;
- case kDirSouth:
+ case kDMDirSouth:
leftRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0001_WallWestRandOrnAllowed);
frontRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0008_WallNorthRandOrnAllowed);
rightRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0004_WallEastRandOrnAllowed);
break;
- case kDirWest:
+ case kDMDirWest:
leftRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0008_WallNorthRandOrnAllowed);
frontRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0004_WallEastRandOrnAllowed);
rightRandomWallOrnamentAllowed = getFlag(AL0307_uc_Square, k0x0002_WallSouthRandOrnAllowed);
@@ -893,12 +893,12 @@ 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() <= k3_SensorThingType)) {
+ while ((curThing != Thing::_endOfList) && (curThing.getType() <= kDMThingTypeSensor)) {
ThingType curThingType = curThing.getType();
int16 AL0310_i_SideIndex = normalizeModulo4(curThing.getCell() - dir);
if (AL0310_i_SideIndex) { /* Invisible on the back wall if 0 */
Sensor *curSensor = (Sensor *)getThingData(curThing);
- if (curThingType == k2_TextstringType) {
+ if (curThingType == kDMstringTypeText) {
if (((TextString *)curSensor)->isVisible()) {
aspectArray[AL0310_i_SideIndex + 1] = _currMapInscriptionWallOrnIndex + 1;
_vm->_displayMan->_inscriptionThing = curThing; /* BUG0_76 The same text is drawn on multiple sides of a wall square. The engine stores only a single text to draw on a wall in a global variable. Even if different texts are placed on different sides of the wall, the same text is drawn on each affected side */
@@ -946,8 +946,8 @@ T0172010_ClosedFakeWall:
AL0307_uc_FootprintsAllowed = true;
}
- while ((curThing != Thing::_endOfList) && (curThing.getType() <= k3_SensorThingType)) {
- if (curThing.getType() == k3_SensorThingType) {
+ while ((curThing != Thing::_endOfList) && (curThing.getType() <= kDMThingTypeSensor)) {
+ if (curThing.getType() == kDMThingTypeSensor) {
Sensor *curSensor = (Sensor *)getThingData(curThing);
aspectArray[k4_FloorOrnOrdAspect] = curSensor->getAttrOrnOrdinal();
}
@@ -963,7 +963,7 @@ T0172010_ClosedFakeWall:
aspectArray[k0_ElementAspect] = (bool((getFlag(AL0307_uc_Square, k0x0008_StairsNorthSouthOrient) >> 3)) == isOrientedWestEast(dir)) ? k18_ElementTypeStairsSide : k19_ElementTypeStaisFront;
aspectArray[k2_StairsUpAspect] = getFlag(AL0307_uc_Square, k0x0004_StairsUp);
AL0307_uc_FootprintsAllowed = false;
- while ((curThing != Thing::_endOfList) && (curThing.getType() <= k3_SensorThingType))
+ while ((curThing != Thing::_endOfList) && (curThing.getType() <= kDMThingTypeSensor))
curThing = getNextThing(curThing);
break;
case k4_DoorElemType:
@@ -976,7 +976,7 @@ T0172010_ClosedFakeWall:
}
AL0307_uc_FootprintsAllowed = true;
- while ((curThing != Thing::_endOfList) && (curThing.getType() <= k3_SensorThingType))
+ while ((curThing != Thing::_endOfList) && (curThing.getType() <= kDMThingTypeSensor))
curThing = getNextThing(curThing);
AL0307_uc_ScentOrdinal = _vm->_championMan->getScentOrdinal(mapX, mapY);
@@ -1117,7 +1117,7 @@ void DungeonMan::decodeText(char *destString, Thing thing, TextType type) {
{0, 0, 0, 0, 0, 0, 0, 0}
};
- TextString textString(_thingData[k2_TextstringType] + thing.getIndex() * _thingDataWordCount[k2_TextstringType]);
+ TextString textString(_thingData[kDMstringTypeText] + thing.getIndex() * _thingDataWordCount[kDMstringTypeText]);
if ((textString.isVisible()) || (type & k0x8000_DecodeEvenIfInvisible)) {
type = (TextType)(type & ~k0x8000_DecodeEvenIfInvisible);
char sepChar;
@@ -1182,9 +1182,9 @@ void DungeonMan::decodeText(char *destString, Thing thing, TextType type) {
Thing DungeonMan::getUnusedThing(uint16 thingType) {
int16 thingCount = _dungeonFileHeader._thingCounts[getFlag(thingType, k0x7FFF_thingType)];
- if (thingType == (k0x8000_championBones | k10_JunkThingType)) {
- thingType = k10_JunkThingType;
- } else if (thingType == k10_JunkThingType)
+ if (thingType == (k0x8000_championBones | kDMThingTypeJunk)) {
+ thingType = kDMThingTypeJunk;
+ } else if (thingType == kDMThingTypeJunk)
thingCount -= 3; /* Always keep 3 unused JUNK things for the bones of dead champions */
int16 thingIdx = thingCount;
@@ -1249,19 +1249,19 @@ uint16 DungeonMan::getObjectWeight(Thing thing) {
Junk *junk = (Junk *)getThingData(thing);
switch (thing.getType()) {
- case k5_WeaponThingType:
+ case kDMThingTypeWeapon:
weight = _weaponInfos[((Weapon *)junk)->getType()]._weight;
break;
- case k6_ArmourThingType:
+ case kDMThingTypeArmour:
weight = _armourInfos[((Armour *)junk)->getType()]._weight;
break;
- case k10_JunkThingType:
+ case kDMThingTypeJunk:
weight = junkInfo[junk->getType()];
if (junk->getType() == k1_JunkTypeWaterskin)
weight += junk->getChargeCount() << 1;
break;
- case k9_ContainerThingType:
+ case kDMThingTypeContainer:
weight = 50;
thing = ((Container *)junk)->getSlot();
while (thing != Thing::_endOfList) {
@@ -1269,13 +1269,13 @@ uint16 DungeonMan::getObjectWeight(Thing thing) {
thing = getNextThing(thing);
}
break;
- case k8_PotionThingType:
+ case kDMThingTypePotion:
if (((Potion *)junk)->getType() == k20_PotionTypeEmptyFlask)
weight = 1;
else
weight = 3;
break;
- case k7_ScrollThingType:
+ case kDMThingTypeScroll:
weight = 1;
break;
default:
@@ -1288,17 +1288,17 @@ uint16 DungeonMan::getObjectWeight(Thing thing) {
int16 DungeonMan::getObjectInfoIndex(Thing thing) {
uint16 *rawType = getThingData(thing);
switch (thing.getType()) {
- case k7_ScrollThingType:
+ case kDMThingTypeScroll:
return k0_ObjectInfoIndexFirstScroll;
- case k9_ContainerThingType:
+ case kDMThingTypeContainer:
return k1_ObjectInfoIndexFirstContainer + Container(rawType).getType();
- case k10_JunkThingType:
+ case kDMThingTypeJunk:
return k127_ObjectInfoIndexFirstJunk + Junk(rawType).getType();
- case k5_WeaponThingType:
+ case kDMThingTypeWeapon:
return k23_ObjectInfoIndexFirstWeapon + Weapon(rawType).getType();
- case k6_ArmourThingType:
+ case kDMThingTypeArmour:
return k69_ObjectInfoIndexFirstArmour + Armour(rawType).getType();
- case k8_PotionThingType:
+ case kDMThingTypePotion:
return k2_ObjectInfoIndexFirstPotion + Potion(rawType).getType();
default:
return -1;
@@ -1354,7 +1354,7 @@ WeaponInfo *DungeonMan::getWeaponInfo(Thing thing) {
int16 DungeonMan::getProjectileAspect(Thing thing) {
ThingType thingType = thing.getType();
- if (thingType == k15_ExplosionThingType) {
+ if (thingType == kDMThingTypeExplosion) {
if (thing == Thing::_explFireBall)
return -_vm->indexToOrdinal(k10_ProjectileAspectExplosionFireBall);
if (thing == Thing::_explSlime)
@@ -1365,7 +1365,7 @@ int16 DungeonMan::getProjectileAspect(Thing thing) {
return -_vm->indexToOrdinal(k13_ProjectileAspectExplosionPoisonBoltCloud);
return -_vm->indexToOrdinal(k11_ProjectileAspectExplosionDefault);
- } else if (thingType == k5_WeaponThingType) {
+ } else if (thingType == kDMThingTypeWeapon) {
WeaponInfo *weaponInfo = getWeaponInfo(thing);
int16 projAspOrd = weaponInfo->getProjectileAspectOrdinal();
if (projAspOrd)
@@ -1376,8 +1376,8 @@ int16 DungeonMan::getProjectileAspect(Thing thing) {
}
int16 DungeonMan::getLocationAfterLevelChange(int16 mapIndex, int16 levelDelta, int16 *mapX, int16 *mapY) {
- if (_partyMapIndex == k255_mapIndexEntrance)
- return kM1_mapIndexNone;
+ if (_partyMapIndex == kDMMapIndexEntrance)
+ return kDMMapIndexNone;
Map *map = _dungeonMaps + mapIndex;
int16 newMapX = map->_offsetMapX + *mapX;
@@ -1395,12 +1395,12 @@ int16 DungeonMan::getLocationAfterLevelChange(int16 mapIndex, int16 levelDelta,
}
map++;
}
- return kM1_mapIndexNone;
+ return kDMMapIndexNone;
}
Thing DungeonMan::getSquareFirstObject(int16 mapX, int16 mapY) {
Thing thing = getSquareFirstThing(mapX, mapY);
- while ((thing != Thing::_endOfList) && (thing.getType() < k4_GroupThingType))
+ while ((thing != Thing::_endOfList) && (thing.getType() < kDMThingTypeGroup))
thing = getNextThing(thing);
return thing;
@@ -1418,7 +1418,7 @@ Thing DungeonMan::getDiscardThing(uint16 thingType) {
// CHECKME: Shouldn't it be saved in the savegames?
static unsigned char lastDiscardedThingMapIndex[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- if (thingType == k15_ExplosionThingType)
+ if (thingType == kDMThingTypeExplosion)
return Thing::_none;
int16 currentMapIdx = _currMapIndex;
@@ -1442,19 +1442,19 @@ Thing DungeonMan::getDiscardThing(uint16 thingType) {
do {
ThingType squareThingType = squareThing.getType();
- if (squareThingType == k3_SensorThingType) {
+ if (squareThingType == kDMThingTypeSensor) {
Thing *squareThingData = (Thing *)getThingData(squareThing);
if (((Sensor *)squareThingData)->getType()) /* If sensor is not disabled */
break;
} else if (squareThingType == thingType) {
Thing *squareThingData = (Thing *)getThingData(squareThing);
switch (thingType) {
- case k4_GroupThingType:
+ case kDMThingTypeGroup:
if (((Group *)squareThingData)->getDoNotDiscard())
continue;
- case k14_ProjectileThingType:
+ case kDMThingTypeProjectile:
setCurrentMap(mapIndex);
- if (thingType == k4_GroupThingType) {
+ if (thingType == kDMThingTypeGroup) {
_vm->_groupMan->dropGroupPossessions(currMapX, currMapY, squareThing, kM1_soundModeDoNotPlaySound);
_vm->_groupMan->groupDelete(currMapX, currMapY);
} else {
@@ -1463,28 +1463,28 @@ Thing DungeonMan::getDiscardThing(uint16 thingType) {
_vm->_projexpl->projectileDelete(squareThing, 0, currMapX, currMapY);
}
break;
- case k6_ArmourThingType:
+ case kDMThingTypeArmour:
if (((Armour *)squareThingData)->getDoNotDiscard())
continue;
setCurrentMap(mapIndex);
_vm->_moveSens->getMoveResult(squareThing, currMapX, currMapY, kM1_MapXNotOnASquare, 0);
break;
- case k5_WeaponThingType:
+ case kDMThingTypeWeapon:
if (((Weapon *)squareThingData)->getDoNotDiscard())
continue;
setCurrentMap(mapIndex);
_vm->_moveSens->getMoveResult(squareThing, currMapX, currMapY, kM1_MapXNotOnASquare, 0);
break;
- case k10_JunkThingType:
+ case kDMThingTypeJunk:
if (((Junk *)squareThingData)->getDoNotDiscard())
continue;
setCurrentMap(mapIndex);
_vm->_moveSens->getMoveResult(squareThing, currMapX, currMapY, kM1_MapXNotOnASquare, 0);
break;
- case k8_PotionThingType:
+ case kDMThingTypePotion:
if (((Potion *)squareThingData)->getDoNotDiscard())
continue;
@@ -1599,11 +1599,11 @@ int16 DungeonMan::getStairsExitDirection(int16 mapX, int16 mapY) {
bool northSouthOrientedStairs = !getFlag(getSquare(mapX, mapY).toByte(), k0x0008_StairsNorthSouthOrient);
if (northSouthOrientedStairs) {
- mapX = mapX + _vm->_dirIntoStepCountEast[kDirEast];
- mapY = mapY + _vm->_dirIntoStepCountNorth[kDirEast];
+ mapX = mapX + _vm->_dirIntoStepCountEast[kDMDirEast];
+ mapY = mapY + _vm->_dirIntoStepCountNorth[kDMDirEast];
} else {
- mapX = mapX + _vm->_dirIntoStepCountEast[kDirNorth];
- mapY = mapY + _vm->_dirIntoStepCountNorth[kDirNorth];
+ mapX = mapX + _vm->_dirIntoStepCountEast[kDMDirNorth];
+ mapY = mapY + _vm->_dirIntoStepCountNorth[kDMDirNorth];
}
int16 squareType = Square(getSquare(mapX, mapY)).getType();
@@ -1615,7 +1615,7 @@ int16 DungeonMan::getStairsExitDirection(int16 mapX, int16 mapY) {
}
Thing DungeonMan::getObjForProjectileLaucherOrObjGen(uint16 iconIndex) {
- int16 thingType = k5_WeaponThingType;
+ int16 thingType = kDMThingTypeWeapon;
if ((iconIndex >= kDMIconIndiceWeaponTorchUnlit) && (iconIndex <= kDMIconIndiceWeaponTorchLit))
iconIndex = kDMIconIndiceWeaponTorchUnlit;
@@ -1627,7 +1627,7 @@ Thing DungeonMan::getObjForProjectileLaucherOrObjGen(uint16 iconIndex) {
break;
case kDMIconIndiceJunkBoulder:
junkType = k25_JunkTypeBoulder;
- thingType = k10_JunkThingType;
+ thingType = kDMThingTypeJunk;
break;
case kDMIconIndiceWeaponArrow:
junkType = k27_WeaponTypeArrow;
diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp
index e95f7e3bf1..73c47d1d02 100644
--- a/engines/dm/eventman.cpp
+++ b/engines/dm/eventman.cpp
@@ -1265,7 +1265,7 @@ void EventManager::commandProcessCommands160To162ClickInResurrectReincarnatePane
}
Thing thing = dunMan.getSquareFirstThing(mapX, mapY);
for (;;) { // infinite
- if (thing.getType() == k3_SensorThingType) {
+ if (thing.getType() == kDMThingTypeSensor) {
((Sensor*)dunMan.getThingData(thing))->setTypeDisabled();
break;
}
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp
index e02baa7632..4fcba5b2b8 100644
--- a/engines/dm/gfx.cpp
+++ b/engines/dm/gfx.cpp
@@ -1057,7 +1057,7 @@ void DisplayMan::drawDoor(uint16 doorThingIndex, uint16 doorState, int16* doorNa
return;
DoorFrames *doorFramesTemp = doorFrames;
- Door *door = (Door *)(_vm->_dungeonMan->_thingData[k0_DoorThingType]) + doorThingIndex;
+ Door *door = (Door *)(_vm->_dungeonMan->_thingData[kDMThingTypeDoor]) + doorThingIndex;
uint16 doorType = door->getType();
memmove(_tmpBitmap, getNativeBitmapOrGraphic(doorNativeBitmapIndices[doorType]), byteCount * 2);
drawDoorOrnament(door->getOrnOrdinal(), viewDoorOrnIndex);
@@ -1328,7 +1328,7 @@ void DisplayMan::drawSquareD3R(Direction dir, int16 posX, int16 posY) {
drawObjectsCreaturesProjectilesExplosions(Thing(squareAspect[k1_FirstGroupOrObjectAspect]), dir, posX, posY, k2_ViewSquare_D3R, k0x0128_CellOrder_DoorPass1_BackRight_BackLeft);
memmove(_tmpBitmap, _bitmapWallSetDoorFrameLeftD3L, 32 * 44);
drawDoorFrameBitmapFlippedHorizontally(_tmpBitmap, &doorFrameRightD3R);
- if (((Door *)_vm->_dungeonMan->_thingData[k0_DoorThingType])[squareAspect[k3_DoorThingIndexAspect]].hasButton())
+ if (((Door *)_vm->_dungeonMan->_thingData[kDMThingTypeDoor])[squareAspect[k3_DoorThingIndexAspect]].hasButton())
drawDoorButton(_vm->indexToOrdinal(k0_DoorButton), k0_viewDoorButton_D3R);
drawDoor(squareAspect[k3_DoorThingIndexAspect],
@@ -1406,7 +1406,7 @@ void DisplayMan::drawSquareD3C(Direction dir, int16 posX, int16 posY) {
drawWallSetBitmap(_bitmapWallSetDoorFrameLeftD3C, doorFrameLeftD3C);
memmove(_tmpBitmap, _bitmapWallSetDoorFrameLeftD3C, 32 * 44);
drawDoorFrameBitmapFlippedHorizontally(_tmpBitmap, &doorFrameRightD3C);
- if (((Door *)_vm->_dungeonMan->_thingData[k0_DoorThingType])[squareAspect[k3_DoorThingIndexAspect]].hasButton())
+ if (((Door *)_vm->_dungeonMan->_thingData[kDMThingTypeDoor])[squareAspect[k3_DoorThingIndexAspect]].hasButton())
drawDoorButton(_vm->indexToOrdinal(k0_DoorButton), k1_ViewDoorOrnament_D2LCR);
drawDoor(squareAspect[k3_DoorThingIndexAspect], squareAspect[k2_DoorStateAspect],
@@ -1656,7 +1656,7 @@ void DisplayMan::drawSquareD2C(Direction dir, int16 posX, int16 posY) {
drawWallSetBitmap(_bitmapWallSetDoorFrameLeftD2C, doorFrameLeftD2C);
memcpy(_tmpBitmap, _bitmapWallSetDoorFrameLeftD2C, 48 * 65);
drawDoorFrameBitmapFlippedHorizontally(_tmpBitmap, &doorFrameRightD2C);
- if (((Door *)_vm->_dungeonMan->_thingData[k0_DoorThingType])[squareAspect[k3_DoorThingIndexAspect]].hasButton())
+ if (((Door *)_vm->_dungeonMan->_thingData[kDMThingTypeDoor])[squareAspect[k3_DoorThingIndexAspect]].hasButton())
drawDoorButton(_vm->indexToOrdinal(k0_DoorButton), k2_viewDoorButton_D2C);
drawDoor(squareAspect[k3_DoorThingIndexAspect], squareAspect[k2_DoorStateAspect],
@@ -1910,7 +1910,7 @@ void DisplayMan::drawSquareD1C(Direction dir, int16 posX, int16 posY) {
drawWallSetBitmap(_bitmapWallSetDoorFrameTopD1LCR, doorFrameTopD1C);
drawWallSetBitmap(_bitmapWallSetDoorFrameLeftD1C, _doorFrameLeftD1C);
drawWallSetBitmap(_bitmapWallSetDoorFrameRightD1C, _doorFrameRightD1C);
- if (((Door *)_vm->_dungeonMan->_thingData[k0_DoorThingType])[squareAspect[k3_DoorThingIndexAspect]].hasButton())
+ if (((Door *)_vm->_dungeonMan->_thingData[kDMThingTypeDoor])[squareAspect[k3_DoorThingIndexAspect]].hasButton())
drawDoorButton(_vm->indexToOrdinal(k0_DoorButton), k3_viewDoorButton_D1C);
drawDoor(squareAspect[k3_DoorThingIndexAspect], squareAspect[k2_DoorStateAspect],
@@ -2146,8 +2146,8 @@ void DisplayMan::drawDungeon(Direction dir, int16 posX, int16 posY) {
_bitmapWallSetWallD0R = _bitmapWallD0RNative;
}
- drawViewport((_vm->_dungeonMan->_partyMapIndex != k255_mapIndexEntrance) ? 1 : 0);
- if (_vm->_dungeonMan->_partyMapIndex != k255_mapIndexEntrance)
+ drawViewport((_vm->_dungeonMan->_partyMapIndex != kDMMapIndexEntrance) ? 1 : 0);
+ if (_vm->_dungeonMan->_partyMapIndex != kDMMapIndexEntrance)
drawFloorAndCeiling();
}
@@ -3090,17 +3090,17 @@ void DisplayMan::drawObjectsCreaturesProjectilesExplosions(Thing thingParam, Dir
objectShiftIndex += (cellYellowBear & 0x0001) << 3;
drawProjectileAsObject = false;
do {
- if ((AL_4_thingType = thingParam.getType()) == k4_GroupThingType) {
+ if ((AL_4_thingType = thingParam.getType()) == kDMThingTypeGroup) {
groupThing = thingParam;
continue;
}
- if (AL_4_thingType == k14_ProjectileThingType) {
+ if (AL_4_thingType == kDMThingTypeProjectile) {
squareHasProjectile = true;
continue;
}
- if (AL_4_thingType == k15_ExplosionThingType) {
+ if (AL_4_thingType == kDMThingTypeExplosion) {
squareHasExplosion = true;
continue;
}
@@ -3478,7 +3478,7 @@ T0115129_DrawProjectiles:
thingParam = firstThingToDraw; /* Restart processing list of objects from the beginning. The next loop draws only projectile objects among the list */
do {
- if ((thingParam.getType() == k14_ProjectileThingType) && (thingParam.getCell() == cellYellowBear)) {
+ if ((thingParam.getType() == kDMThingTypeProjectile) && (thingParam.getCell() == cellYellowBear)) {
Projectile *projectile = (Projectile *)_vm->_dungeonMan->getThingData(thingParam);
if ((AL_4_projectileAspect = _vm->_dungeonMan->getProjectileAspect(projectile->_slot)) < 0) { /* Negative value: projectile aspect is the ordinal of a PROJECTIL_ASPECT */
objectAspect = (ObjectAspect *)&_projectileAspect[_vm->ordinalToIndex(-AL_4_projectileAspect)];
@@ -3606,7 +3606,7 @@ T0115171_BackFromT0115015_DrawProjectileAsObject:;
AL_10_explosionScaleIndex = AL_1_viewSquareExplosionIndex / 3;
thingParam = firstThingToDraw; /* Restart processing list of things from the beginning. The next loop draws only explosion things among the list */
do {
- if (thingParam.getType() == k15_ExplosionThingType) {
+ if (thingParam.getType() == kDMThingTypeExplosion) {
AL_2_cellPurpleMan = thingParam.getCell();
Explosion *explosion = (Explosion *)_vm->_dungeonMan->getThingData(thingParam);
bool rebirthExplosion = ((uint16)(AL_4_explosionType = explosion->getType()) >= k100_ExplosionType_RebirthStep1);
diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp
index f8d175ad4a..e4c720f1a8 100644
--- a/engines/dm/group.cpp
+++ b/engines/dm/group.cpp
@@ -152,7 +152,7 @@ void GroupMan::dropGroupPossessions(int16 mapX, int16 mapY, Thing groupThing, in
do {
nextThing = _vm->_dungeonMan->getNextThing(currentThing);
currentThing = thingWithNewCell(currentThing, _vm->getRandomNumber(4));
- if ((currentThing).getType() == k5_WeaponThingType) {
+ if ((currentThing).getType() == kDMThingTypeWeapon) {
L0371_B_WeaponDropped = true;
}
_vm->_moveSens->getMoveResult(currentThing, kM1_MapXNotOnASquare, 0, mapX, mapY);
@@ -264,14 +264,14 @@ void GroupMan::dropCreatureFixedPossessions(uint16 creatureType, int16 mapX, int
int16 currThingType;
if (clearFlag(currFixedPossession, k0x8000_randomDrop) >= k127_ObjectInfoIndexFirstJunk) {
- currThingType = k10_JunkThingType;
+ currThingType = kDMThingTypeJunk;
currFixedPossession -= k127_ObjectInfoIndexFirstJunk;
} else if (currFixedPossession >= k69_ObjectInfoIndexFirstArmour) {
- currThingType = k6_ArmourThingType;
+ currThingType = kDMThingTypeArmour;
currFixedPossession -= k69_ObjectInfoIndexFirstArmour;
} else {
weaponDropped = true;
- currThingType = k5_WeaponThingType;
+ currThingType = kDMThingTypeWeapon;
currFixedPossession -= k23_ObjectInfoIndexFirstWeapon;
}
@@ -294,25 +294,25 @@ int16 GroupMan::getDirsWhereDestIsVisibleFromSource(int16 srcMapX, int16 srcMapY
if (srcMapX == destMapX) {
_vm->_projexpl->_secondaryDirToOrFromParty = (_vm->getRandomNumber(65536) & 0x0002) + 1; /* Resulting direction may be 1 or 3 (East or West) */
if (srcMapY > destMapY)
- return kDirNorth;
+ return kDMDirNorth;
- return kDirSouth;
+ return kDMDirSouth;
}
if (srcMapY == destMapY) {
_vm->_projexpl->_secondaryDirToOrFromParty = (_vm->getRandomNumber(65536) & 0x0002) + 0; /* Resulting direction may be 0 or 2 (North or South) */
if (srcMapX > destMapX)
- return kDirWest;
+ return kDMDirWest;
- return kDirEast;
+ return kDMDirEast;
}
- int16 curDirection = kDirNorth;
+ int16 curDirection = kDMDirNorth;
for (;;) {
if (isDestVisibleFromSource(curDirection, srcMapX, srcMapY, destMapX, destMapY)) {
_vm->_projexpl->_secondaryDirToOrFromParty = returnNextVal(curDirection);
if (!isDestVisibleFromSource(_vm->_projexpl->_secondaryDirToOrFromParty, srcMapX, srcMapY, destMapX, destMapY)) {
_vm->_projexpl->_secondaryDirToOrFromParty = returnPrevVal(curDirection);
- if ((curDirection != kDirNorth) || !isDestVisibleFromSource(_vm->_projexpl->_secondaryDirToOrFromParty, srcMapX, srcMapY, destMapX, destMapY)) {
+ if ((curDirection != kDMDirNorth) || !isDestVisibleFromSource(_vm->_projexpl->_secondaryDirToOrFromParty, srcMapX, srcMapY, destMapX, destMapY)) {
_vm->_projexpl->_secondaryDirToOrFromParty = returnNextVal((_vm->getRandomNumber(65536) & 0x0002) + curDirection);
return curDirection;
}
@@ -330,15 +330,15 @@ int16 GroupMan::getDirsWhereDestIsVisibleFromSource(int16 srcMapX, int16 srcMapY
bool GroupMan::isDestVisibleFromSource(uint16 dir, int16 srcMapX, int16 srcMapY, int16 destMapX, int16 destMapY) {
switch (dir) { /* If direction is not 'West' then swap variables so that the same test as for west can be applied */
- case kDirSouth:
+ case kDMDirSouth:
SWAP(srcMapX, destMapY);
SWAP(destMapX, srcMapY);
break;
- case kDirEast:
+ case kDMDirEast:
SWAP(srcMapX, destMapX);
SWAP(destMapY, srcMapY);
break;
- case kDirNorth:
+ case kDMDirNorth:
SWAP(srcMapX, srcMapY);
SWAP(destMapX, destMapY);
break;
@@ -373,7 +373,7 @@ bool GroupMan::groupIsDoorDestoryedByAttack(uint16 mapX, uint16 mapY, int16 atta
Thing GroupMan::groupGetThing(int16 mapX, int16 mapY) {
Thing curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY);
- while ((curThing != Thing::_endOfList) && (curThing.getType() != k4_GroupThingType))
+ while ((curThing != Thing::_endOfList) && (curThing.getType() != kDMThingTypeGroup))
curThing = _vm->_dungeonMan->getNextThing(curThing);
return curThing;
@@ -1076,7 +1076,7 @@ bool GroupMan::isMovementPossible(CreatureInfo *creatureInfo, int16 mapX, int16
if (getFlag(creatureInfo->_attributes, k0x2000_MaskCreatureInfo_archenemy)) {
Thing curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY);
while (curThing != Thing::_endOfList) {
- if ((curThing).getType() == k15_ExplosionThingType) {
+ if ((curThing).getType() == kDMThingTypeExplosion) {
Teleporter *curTeleporter = (Teleporter *)_vm->_dungeonMan->getThingData(curThing);
if (((Explosion *)curTeleporter)->setType(k50_ExplosionType_Fluxcage)) {
_fluxCages[dir] = true;
@@ -1128,7 +1128,7 @@ int16 GroupMan::groupGetDistanceToVisibleParty(Group *group, int16 creatureIndex
if (getFlag(groupCreatureInfo->_attributes, k0x0004_MaskCreatureInfo_sideAttack)) { /* If creature can see in all directions */
alwaysSee = true;
checkDirectionsCount = 1;
- creatureViewDirections[0] = kDirNorth;
+ creatureViewDirections[0] = kDMDirNorth;
} else {
groupDirections = _activeGroups[group->getActiveGroupIndex()]._directions;
if (creatureIndex < 0) { /* Negative index means test if each creature in the group can see the party in their respective direction */
@@ -1240,7 +1240,7 @@ bool GroupMan::isViewPartyBlocked(uint16 mapX, uint16 mapY) {
}
int32 GroupMan::getCreatureAspectUpdateTime(ActiveGroup *activeGroup, int16 creatureIndex, bool isAttacking) {
- Group *group = &(((Group *)_vm->_dungeonMan->_thingData[k4_GroupThingType])[activeGroup->_groupThingIndex]);
+ Group *group = &(((Group *)_vm->_dungeonMan->_thingData[kDMThingTypeGroup])[activeGroup->_groupThingIndex]);
uint16 creatureType = group->_type;
uint16 creatureGraphicInfo = _vm->_dungeonMan->_creatureInfos[creatureType]._graphicInfo;
bool processGroup = (creatureIndex < 0);
@@ -1370,7 +1370,7 @@ bool GroupMan::isSmellPartyBlocked(uint16 mapX, uint16 mapY) {
}
int16 GroupMan::getFirstPossibleMovementDirOrdinal(CreatureInfo *info, int16 mapX, int16 mapY, bool allowMovementOverImaginaryPitsAndFakeWalls) {
- for (int16 direction = kDirNorth; direction <= kDirWest; direction++) {
+ for (int16 direction = kDMDirNorth; direction <= kDMDirWest; direction++) {
if ((!_groupMovementTestedDirections[direction]) && isMovementPossible(info, mapX, mapY, direction, allowMovementOverImaginaryPitsAndFakeWalls)) {
return _vm->indexToOrdinal(direction);
}
@@ -1661,8 +1661,8 @@ void GroupMan::addActiveGroup(Thing thing, int16 mapX, int16 mapY) {
_currActiveGroupCount++;
activeGroup->_groupThingIndex = (thing).getIndex();
- Group *curGroup = (Group *)(_vm->_dungeonMan->_thingData[k4_GroupThingType] +
- _vm->_dungeonMan->_thingDataWordCount[k4_GroupThingType] * activeGroup->_groupThingIndex);
+ Group *curGroup = (Group *)(_vm->_dungeonMan->_thingData[kDMThingTypeGroup] +
+ _vm->_dungeonMan->_thingDataWordCount[kDMThingTypeGroup] * activeGroup->_groupThingIndex);
activeGroup->_cells = curGroup->_cells;
curGroup->getActiveGroupIndex() = activeGroupIndex;
@@ -1682,7 +1682,7 @@ void GroupMan::removeActiveGroup(uint16 activeGroupIndex) {
return;
ActiveGroup *activeGroup = &_activeGroups[activeGroupIndex];
- Group *group = &((Group *)_vm->_dungeonMan->_thingData[k4_GroupThingType])[activeGroup->_groupThingIndex];
+ Group *group = &((Group *)_vm->_dungeonMan->_thingData[kDMThingTypeGroup])[activeGroup->_groupThingIndex];
_currActiveGroupCount--;
group->_cells = activeGroup->_cells;
group->setDir(normalizeModulo4(activeGroup->_directions));
@@ -1708,7 +1708,7 @@ void GroupMan::addAllActiveGroups() {
if (getFlag(*curSquare++, k0x0010_ThingListPresent)) {
Thing curThing = *squareCurThing++;
do {
- if (curThing.getType() == k4_GroupThingType) {
+ if (curThing.getType() == kDMThingTypeGroup) {
groupDeleteEvents(mapX, mapY);
addActiveGroup(curThing, mapX, mapY);
startWandering(mapX, mapY);
@@ -1722,7 +1722,7 @@ void GroupMan::addAllActiveGroups() {
}
Thing GroupMan::groupGetGenerated(int16 creatureType, int16 healthMultiplier, uint16 creatureCount, Direction dir, int16 mapX, int16 mapY) {
- Thing groupThing = _vm->_dungeonMan->getUnusedThing(k4_GroupThingType);
+ Thing groupThing = _vm->_dungeonMan->getUnusedThing(kDMThingTypeGroup);
if (((_currActiveGroupCount >= (_maxActiveGroupCount - 5)) && (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex))
|| (groupThing == Thing::_none)) {
return Thing::_none;
@@ -1877,12 +1877,12 @@ void GroupMan::fluxCageAction(int16 mapX, int16 mapY) {
if ((squareType == k0_WallElemType) || (squareType == k3_StairsElemType))
return;
- Thing unusedThing = _vm->_dungeonMan->getUnusedThing(k15_ExplosionThingType);
+ Thing unusedThing = _vm->_dungeonMan->getUnusedThing(kDMThingTypeExplosion);
if (unusedThing == Thing::_none)
return;
_vm->_dungeonMan->linkThingToList(unusedThing, Thing(0), mapX, mapY);
- (((Explosion *)_vm->_dungeonMan->_thingData[k15_ExplosionThingType])[unusedThing.getIndex()]).setType(k50_ExplosionType_Fluxcage);
+ (((Explosion *)_vm->_dungeonMan->_thingData[kDMThingTypeExplosion])[unusedThing.getIndex()]).setType(k50_ExplosionType_Fluxcage);
TimelineEvent newEvent;
setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_currMapIndex, _vm->_gameTime + 100);
newEvent._type = k24_TMEventTypeRemoveFluxcage;
@@ -1935,7 +1935,7 @@ bool GroupMan::isFluxcageOnSquare(int16 mapX, int16 mapY) {
Thing thing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY);
while (thing != Thing::_endOfList) {
- if ((thing.getType() == k15_ExplosionThingType) && (((Explosion *)_vm->_dungeonMan->_thingData[k15_ExplosionThingType])[thing.getIndex()].getType() == k50_ExplosionType_Fluxcage))
+ if ((thing.getType() == kDMThingTypeExplosion) && (((Explosion *)_vm->_dungeonMan->_thingData[kDMThingTypeExplosion])[thing.getIndex()].getType() == k50_ExplosionType_Fluxcage))
return true;
thing = _vm->_dungeonMan->getNextThing(thing);
diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp
index 60c6f62096..38e9833838 100644
--- a/engines/dm/inventory.cpp
+++ b/engines/dm/inventory.cpp
@@ -250,10 +250,10 @@ void InventoryMan::drawPanel() {
_panelContent = k0_PanelContentFoodWaterPoisoned;
switch (thing.getType()) {
- case k9_ContainerThingType:
+ case kDMThingTypeContainer:
_panelContent = k4_PanelContentChest;
break;
- case k7_ScrollThingType:
+ case kDMThingTypeScroll:
_panelContent = k2_PanelContentScroll;
break;
default:
@@ -488,9 +488,9 @@ void InventoryMan::drawPanelObject(Thing thingToDraw, bool pressingEye) {
uint16 *rawThingPtr = dunMan.getThingData(thingToDraw);
drawPanelObjectDescriptionString("\f"); // form feed
ThingType thingType = thingToDraw.getType();
- if (thingType == k7_ScrollThingType)
+ if (thingType == kDMThingTypeScroll)
drawPanelScroll((Scroll *)rawThingPtr);
- else if (thingType == k9_ContainerThingType)
+ else if (thingType == kDMThingTypeContainer)
openAndDrawChest(thingToDraw, (Container *)rawThingPtr, pressingEye);
else {
IconIndice iconIndex = objMan.getIconIndex(thingToDraw);
@@ -513,7 +513,7 @@ void InventoryMan::drawPanelObject(Thing thingToDraw, bool pressingEye) {
}
descString = str;
- } else if ((thingType == k8_PotionThingType)
+ } else if ((thingType == kDMThingTypePotion)
&& (iconIndex != kDMIconIndicePotionWaterFlask)
&& (champMan.getSkillLevel((ChampionIndex)_vm->ordinalToIndex(_inventoryChampionOrdinal), kDMSkillPriest) > 1)) {
str = ('_' + ((Potion *)rawThingPtr)->getPower() / 40);
@@ -533,7 +533,7 @@ void InventoryMan::drawPanelObject(Thing thingToDraw, bool pressingEye) {
uint16 potentialAttribMask = 0;
uint16 actualAttribMask = 0;
switch (thingType) {
- case k5_WeaponThingType: {
+ case kDMThingTypeWeapon: {
potentialAttribMask = k0x0008_DescriptionMaskCursed | k0x0002_DescriptionMaskPoisoned | k0x0004_DescriptionMaskBroken;
Weapon *weapon = (Weapon *)rawThingPtr;
actualAttribMask = (weapon->getCursed() << 3) | (weapon->getPoisoned() << 1) | (weapon->getBroken() << 2);
@@ -556,19 +556,19 @@ void InventoryMan::drawPanelObject(Thing thingToDraw, bool pressingEye) {
}
break;
}
- case k6_ArmourThingType: {
+ case kDMThingTypeArmour: {
potentialAttribMask = k0x0008_DescriptionMaskCursed | k0x0004_DescriptionMaskBroken;
Armour *armour = (Armour *)rawThingPtr;
actualAttribMask = (armour->getCursed() << 3) | (armour->getBroken() << 2);
break;
}
- case k8_PotionThingType: {
+ case kDMThingTypePotion: {
potentialAttribMask = k0x0001_DescriptionMaskConsumable;
Potion *potion = (Potion *)rawThingPtr;
actualAttribMask = _vm->_dungeonMan->_objectInfos[k2_ObjectInfoIndexFirstPotion + potion->getType()].getAllowedSlots();
break;
}
- case k10_JunkThingType: {
+ case kDMThingTypeJunk: {
if ((iconIndex >= kDMIconIndiceJunkWater) && (iconIndex <= kDMIconIndiceJunkWaterSkin)) {
potentialAttribMask = 0;
const char *descStringEN[4] = {"(EMPTY)", "(ALMOST EMPTY)", "(ALMOST FULL)", "(FULL)"};
@@ -915,7 +915,7 @@ void InventoryMan::clickOnMouth() {
curChampion->_water = MIN(curChampion->_water + 800, 2048);
junkData->setChargeCount(junkData->getChargeCount() - 1);
removeObjectFromLeaderHand = false;
- } else if (handThingType == k8_PotionThingType)
+ } else if (handThingType == kDMThingTypePotion)
removeObjectFromLeaderHand = false;
else {
junkData->setNextThing(Thing::_none);
@@ -925,7 +925,7 @@ void InventoryMan::clickOnMouth() {
if (removeObjectFromLeaderHand)
_vm->_championMan->getObjectRemovedFromLeaderHand();
- if (handThingType == k8_PotionThingType) {
+ if (handThingType == kDMThingTypePotion) {
uint16 potionPower = ((Potion *)junkData)->getPower();
uint16 counter = ((511 - potionPower) / (32 + (potionPower + 1) / 8)) >> 1;
uint16 adjustedPotionPower = (potionPower / 25) + 8; /* Value between 8 and 18 */
diff --git a/engines/dm/loadsave.cpp b/engines/dm/loadsave.cpp
index 5feb484523..a0b1190ae2 100644
--- a/engines/dm/loadsave.cpp
+++ b/engines/dm/loadsave.cpp
@@ -42,9 +42,9 @@
namespace DM {
-LoadgameResponse DMEngine::loadgame(int16 slot) {
+LoadgameResult DMEngine::loadgame(int16 slot) {
if (slot == -1 && _newGameFl == k0_modeLoadSavedGame)
- return kM1_LoadgameFailure;
+ return kDMLoadgameFailure;
bool fadePalette = true;
Common::String fileName;
@@ -156,7 +156,7 @@ LoadgameResponse DMEngine::loadgame(int16 slot) {
}
_championMan->_partyDead = false;
- return k1_LoadgameSuccess;
+ return kDMLoadgameSuccess;
}
@@ -184,7 +184,7 @@ void DMEngine::saveGame() {
kLoad = 4
};
- SaveAndPlayChoice saveAndPlayChoice = (SaveAndPlayChoice)_dialog->getChoice(4, k0_DIALOG_SET_VIEWPORT, 0, k0_DIALOG_CHOICE_NONE);
+ SaveAndPlayChoice saveAndPlayChoice = (SaveAndPlayChoice)_dialog->getChoice(4, kDMDialogCommandSetViewport, 0, kDMDialogChoiceNone);
if (saveAndPlayChoice == kLoad) {
GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false);
@@ -227,7 +227,7 @@ void DMEngine::saveGame() {
if (!writeCompleteSaveFile(saveSlot, saveDescription, saveAndPlayChoice)) {
_dialog->dialogDraw(nullptr, "Unable to open file for saving", "OK", nullptr, nullptr, nullptr, false, false, false);
- _dialog->getChoice(1, k0_DIALOG_SET_VIEWPORT, 0, k0_DIALOG_CHOICE_NONE);
+ _dialog->getChoice(1, kDMDialogCommandSetViewport, 0, kDMDialogChoiceNone);
}
if (!_championMan->_leaderEmptyHanded) {
diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp
index 20e733b00f..3cc1f0489e 100644
--- a/engines/dm/menus.cpp
+++ b/engines/dm/menus.cpp
@@ -650,7 +650,7 @@ int16 MenuMan::getChampionSpellCastResult(uint16 champIndex) {
}
break;
case kDMSpellTypeOtherZokathra: {
- Thing unusedObject = _vm->_dungeonMan->getUnusedThing(k10_JunkThingType);
+ Thing unusedObject = _vm->_dungeonMan->getUnusedThing(kDMThingTypeJunk);
if (unusedObject == Thing::_none)
break;
@@ -1129,7 +1129,7 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) {
actionPerformed = isGroupFrightenedByAction(champIndex, actionIndex, nextMapX, nextMapY);
break;
case kDMActionShoot: {
- if (Thing(curChampion->_slots[kDMSlotReadyHand]).getType() != k5_WeaponThingType) {
+ if (Thing(curChampion->_slots[kDMSlotReadyHand]).getType() != kDMThingTypeWeapon) {
_actionDamage = kM2_damageNoAmmunition;
actionExperienceGain = 0;
actionPerformed = false;
@@ -1350,17 +1350,17 @@ void MenuMan::decrementCharges(Champion *champ) {
Thing slotActionThing = champ->_slots[kDMSlotActionHand];
Junk *slotActionData = (Junk *)_vm->_dungeonMan->getThingData(slotActionThing);
switch (slotActionThing.getType()) {
- case k5_WeaponThingType:
+ case kDMThingTypeWeapon:
if (((Weapon *)slotActionData)->getChargeCount()) {
((Weapon *)slotActionData)->setChargeCount(((Weapon *)slotActionData)->getChargeCount() - 1);
}
break;
- case k6_ArmourThingType:
+ case kDMThingTypeArmour:
if (((Armour *)slotActionData)->getChargeCount()) {
((Armour *)slotActionData)->setChargeCount(((Armour *)slotActionData)->getChargeCount() - 1);
}
break;
- case k10_JunkThingType:
+ case kDMThingTypeJunk:
if (slotActionData->getChargeCount()) {
slotActionData->setChargeCount(slotActionData->getChargeCount() - 1);
}
@@ -1684,11 +1684,11 @@ int16 MenuMan::getActionObjectChargeCount() {
Thing slotActionThing = _vm->_championMan->_champions[_vm->ordinalToIndex(_vm->_championMan->_actingChampionOrdinal)]._slots[kDMSlotActionHand];
Junk *junkData = (Junk *)_vm->_dungeonMan->getThingData(slotActionThing);
switch (slotActionThing.getType()) {
- case k5_WeaponThingType:
+ case kDMThingTypeWeapon:
return ((Weapon *)junkData)->getChargeCount();
- case k6_ArmourThingType:
+ case kDMThingTypeArmour:
return ((Armour *)junkData)->getChargeCount();
- case k10_JunkThingType:
+ case kDMThingTypeJunk:
return junkData->getChargeCount();
default:
return 1;
diff --git a/engines/dm/movesens.cpp b/engines/dm/movesens.cpp
index 5e41a1cd18..5e39338aae 100644
--- a/engines/dm/movesens.cpp
+++ b/engines/dm/movesens.cpp
@@ -57,16 +57,16 @@ bool MovesensMan::sensorIsTriggeredByClickOnWall(int16 mapX, int16 mapY, uint16
bool atLeastOneSensorWasTriggered = false;
Thing leaderHandObject = _vm->_championMan->_leaderHandObject;
int16 sensorCountToProcessPerCell[4];
- for (int16 i = k0_CellNorthWest; i < k3_CellSouthWest + 1; i++)
+ for (int16 i = kDMCellNorthWest; i < kDMCellSouthWest + 1; i++)
sensorCountToProcessPerCell[i] = 0;
Thing squareFirstThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY);
Thing thingBeingProcessed = squareFirstThing;
while (thingBeingProcessed != Thing::_endOfList) {
ThingType thingType = thingBeingProcessed.getType();
- if (thingType == k3_SensorThingType)
+ if (thingType == kDMThingTypeSensor)
sensorCountToProcessPerCell[thingBeingProcessed.getCell()]++;
- else if (thingType >= k4_GroupThingType)
+ else if (thingType >= kDMThingTypeGroup)
break;
thingBeingProcessed = _vm->_dungeonMan->getNextThing(thingBeingProcessed);
@@ -74,7 +74,7 @@ bool MovesensMan::sensorIsTriggeredByClickOnWall(int16 mapX, int16 mapY, uint16
for (Thing thingBeingProcessed = squareFirstThing; thingBeingProcessed != Thing::_endOfList; thingBeingProcessed = _vm->_dungeonMan->getNextThing(thingBeingProcessed)) {
Thing lastProcessedThing = thingBeingProcessed;
uint16 ProcessedThingType = thingBeingProcessed.getType();
- if (ProcessedThingType == k3_SensorThingType) {
+ if (ProcessedThingType == kDMThingTypeSensor) {
int16 cellIdx = thingBeingProcessed.getCell();
sensorCountToProcessPerCell[cellIdx]--;
Sensor *currentSensor = (Sensor *)_vm->_dungeonMan->getThingData(thingBeingProcessed);
@@ -204,7 +204,7 @@ bool MovesensMan::sensorIsTriggeredByClickOnWall(int16 mapX, int16 mapY, uint16
}
continue;
}
- if (ProcessedThingType >= k4_GroupThingType)
+ if (ProcessedThingType >= kDMThingTypeGroup)
break;
}
processRotationEffect();
@@ -212,7 +212,7 @@ bool MovesensMan::sensorIsTriggeredByClickOnWall(int16 mapX, int16 mapY, uint16
}
bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destMapX, int16 destMapY) {
- ThingType thingType = kM1_PartyThingType;
+ ThingType thingType = kDMThingTypeParty;
int16 traversedPitCount = 0;
uint16 moveGroupResult = 0;
uint16 thingCell = 0;
@@ -224,7 +224,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM
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 == k4_GroupThingType) && (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex)))) {
+ if ((mapX >= 0) && ((thing == Thing::_party) || ((thingType == kDMThingTypeGroup) && (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_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 */
}
@@ -249,12 +249,12 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM
requiredTeleporterScope = k0x0002_TelepScopeObjOrParty;
drawDungeonViewWhileFalling = !_vm->_inventoryMan->_inventoryChampionOrdinal && !_vm->_championMan->_partyIsSleeping;
direction = _vm->_dungeonMan->_partyDir;
- } else if (thingType == k4_GroupThingType)
+ } else if (thingType == kDMThingTypeGroup)
requiredTeleporterScope = k0x0001_TelepScopeCreatures;
else
requiredTeleporterScope = (k0x0001_TelepScopeCreatures | k0x0002_TelepScopeObjOrParty);
- if (thingType == k14_ProjectileThingType) {
+ if (thingType == kDMThingTypeProjectile) {
Teleporter *L0712_ps_Teleporter = (Teleporter *)_vm->_dungeonMan->getThingData(thing);
_moveResultDir = (_vm->_timeline->_events[((Projectile *)L0712_ps_Teleporter)->_eventIndex])._Cu._projectile.getDir();
}
@@ -269,7 +269,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM
break;
Teleporter *teleporter = (Teleporter *)_vm->_dungeonMan->getSquareFirstThingData(destMapX, destMapY);
- if ((teleporter->getScope() == k0x0001_TelepScopeCreatures) && (thingType != k4_GroupThingType))
+ if ((teleporter->getScope() == k0x0001_TelepScopeCreatures) && (thingType != kDMThingTypeGroup))
break;
if ((requiredTeleporterScope != (k0x0001_TelepScopeCreatures | k0x0002_TelepScopeObjOrParty)) && !getFlag(teleporter->getScope(), requiredTeleporterScope))
@@ -292,13 +292,13 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM
else
_vm->_championMan->setPartyDirection(normalizeModulo4(_vm->_dungeonMan->_partyDir + teleporter->getRotation()));
} else {
- if (thingType == k4_GroupThingType) {
+ if (thingType == kDMThingTypeGroup) {
if (teleporter->isAudible())
_vm->_sound->requestPlay(k17_soundBUZZ, destMapX, destMapY, k1_soundModePlayIfPrioritized);
moveGroupResult = getTeleporterRotatedGroupResult(teleporter, thing, mapIndexSource);
} else {
- if (thingType == k14_ProjectileThingType)
+ if (thingType == kDMThingTypeProjectile)
thing = getTeleporterRotatedProjectileThing(teleporter, thing);
else if (!(teleporter->getAbsoluteRotation()) && (mapX != -2))
thing = thingWithNewCell(thing, normalizeModulo4(thing.getCell() + teleporter->getRotation()));
@@ -335,7 +335,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM
_vm->_sound->requestPlay(k06_soundSCREAM, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, k0_soundModePlayImmediately);
}
_useRopeToClimbDownPit = false;
- } else if (thingType == k4_GroupThingType) {
+ } else if (thingType == kDMThingTypeGroup) {
_vm->_dungeonMan->setCurrentMap(mapIndexSource);
uint16 outcome = _vm->_groupMan->getDamageAllCreaturesOutcome((Group *)_vm->_dungeonMan->getThingData(thing), mapX, mapY, 20, false);
_vm->_dungeonMan->setCurrentMap(mapIndexDestination);
@@ -346,7 +346,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM
if (outcome == k1_outcomeKilledSomeCreaturesInGroup)
_vm->_groupMan->dropMovingCreatureFixedPossession(thing, destMapX, destMapY);
}
- } else if ((destinationSquareType == k3_ElementTypeStairs) && (thing != Thing::_party) && (thingType != k14_ProjectileThingType)) {
+ } else if ((destinationSquareType == k3_ElementTypeStairs) && (thing != Thing::_party) && (thingType != kDMThingTypeProjectile)) {
if (!getFlag(destinationSquareData, k0x0004_StairsUp)) {
mapIndexDestination = _vm->_dungeonMan->getLocationAfterLevelChange(mapIndexDestination, 1, &destMapX, &destMapY);
_vm->_dungeonMan->setCurrentMap(mapIndexDestination);
@@ -361,7 +361,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM
break;
}
}
- if ((thingType == k4_GroupThingType) && (fallKilledGroup || !_vm->_dungeonMan->isCreatureAllowedOnMap(thing, mapIndexDestination))) {
+ if ((thingType == kDMThingTypeGroup) && (fallKilledGroup || !_vm->_dungeonMan->isCreatureAllowedOnMap(thing, mapIndexDestination))) {
_vm->_groupMan->dropMovingCreatureFixedPossession(thing, destMapX, destMapY);
_vm->_groupMan->dropGroupPossessions(destMapX, destMapY, thing, k2_soundModePlayOneTickLater);
_vm->_dungeonMan->setCurrentMap(mapIndexSource);
@@ -379,7 +379,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM
if (thing == Thing::_party) {
if (_vm->_dungeonMan->_partyDir == direction)
return false;
- } else if ((_moveResultCell == thingCell) && (thingType != k14_ProjectileThingType))
+ } else if ((_moveResultCell == thingCell) && (thingType != kDMThingTypeProjectile))
return false;
} else {
if ((thing == Thing::_party) && _vm->_championMan->_partyChampionCount) {
@@ -432,7 +432,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM
_vm->_newPartyMapIndex = mapIndexDestination;
}
} else {
- if (thingType == k4_GroupThingType) {
+ if (thingType == kDMThingTypeGroup) {
_vm->_dungeonMan->setCurrentMap(mapIndexDestination);
Teleporter *L0712_ps_Teleporter = (Teleporter *)_vm->_dungeonMan->getThingData(thing);
int16 activeGroupIndex = ((Group *)L0712_ps_Teleporter)->getActiveGroupIndex();
@@ -447,7 +447,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM
createEventMoveGroup(thing, destMapX, destMapY, mapIndexDestination, audibleTeleporter);
return true; /* The specified group thing cannot be moved because the party or another group is on the destination square */
}
- uint16 movementSoundIndex = getSound(((Group *)_vm->_dungeonMan->_thingData[k4_GroupThingType])[thing.getIndex()]._type);
+ uint16 movementSoundIndex = getSound(((Group *)_vm->_dungeonMan->_thingData[kDMThingTypeGroup])[thing.getIndex()]._type);
if (movementSoundIndex < k34_D13_soundCount)
_vm->_sound->requestPlay(movementSoundIndex, destMapX, destMapY, k1_soundModePlayIfPrioritized);
@@ -476,7 +476,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM
return moveGroupResult;
}
_vm->_dungeonMan->setCurrentMap(mapIndexDestination);
- if (thingType == k14_ProjectileThingType) /* BUG0_29 An explosion can trigger a floor sensor. Explosions do not trigger floor sensors on the square where they are created. However, if an explosion is moved by a teleporter (or by falling into a pit, see BUG0_26) after it was created, it can trigger floor sensors on the destination square. This is because explosions are not considered as levitating in the code, while projectiles are. The condition here should be (L0713_B_ThingLevitates) so that explosions would not start sensor processing on their destination square as they should be Levitating. This would work if F0264_MOVE_IsLevitating returned true for explosions (see BUG0_26) */
+ if (thingType == kDMThingTypeProjectile) /* BUG0_29 An explosion can trigger a floor sensor. Explosions do not trigger floor sensors on the square where they are created. However, if an explosion is moved by a teleporter (or by falling into a pit, see BUG0_26) after it was created, it can trigger floor sensors on the destination square. This is because explosions are not considered as levitating in the code, while projectiles are. The condition here should be (L0713_B_ThingLevitates) so that explosions would not start sensor processing on their destination square as they should be Levitating. This would work if F0264_MOVE_IsLevitating returned true for explosions (see BUG0_26) */
_vm->_dungeonMan->linkThingToList(thing, Thing(0), destMapX, destMapY);
else
processThingAdditionOrRemoval(destMapX, destMapY, thing, (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (destMapX == _vm->_dungeonMan->_partyMapX) && (destMapY == _vm->_dungeonMan->_partyMapY), true);
@@ -490,9 +490,9 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM
bool MovesensMan::isLevitating(Thing thing) {
ThingType thingType = thing.getType();
bool retVal = false;
- if (thingType == k4_GroupThingType)
+ if (thingType == kDMThingTypeGroup)
retVal = getFlag(_vm->_dungeonMan->getCreatureAttributes(thing), k0x0020_MaskCreatureInfo_levitation);
- else if ((thingType == k14_ProjectileThingType) || (thingType == k15_ExplosionThingType))
+ else if ((thingType == kDMThingTypeProjectile) || (thingType == kDMThingTypeExplosion))
// Fix original bug involving explosions falling in pits
retVal = true;
@@ -521,7 +521,7 @@ bool MovesensMan::moveIsKilledByProjectileImpact(int16 srcMapX, int16 srcMapY, i
SquareType impactType;
if (thing == Thing::_party) {
impactType = kM2_ChampionElemType;
- for (uint16 cellIdx = k0_CellNorthWest; cellIdx < k3_CellSouthWest + 1; cellIdx++) {
+ for (uint16 cellIdx = kDMCellNorthWest; cellIdx < kDMCellSouthWest + 1; cellIdx++) {
if (_vm->_championMan->getIndexInCell((ViewCell)cellIdx) >= 0)
championOrCreatureOrdinalInCell[cellIdx] = _vm->indexToOrdinal(cellIdx);
}
@@ -529,7 +529,7 @@ bool MovesensMan::moveIsKilledByProjectileImpact(int16 srcMapX, int16 srcMapY, i
impactType = kM1_CreatureElemType;
Group *curGroup = (Group *)_vm->_dungeonMan->getThingData(thing);
int16 creatureAlive = 0;
- for (uint16 cellIdx = k0_CellNorthWest; cellIdx < k3_CellSouthWest + 1; cellIdx++) {
+ for (uint16 cellIdx = kDMCellNorthWest; cellIdx < kDMCellSouthWest + 1; cellIdx++) {
creatureAlive |= curGroup->_health[cellIdx];
if (_vm->_groupMan->getCreatureOrdinalInCell(curGroup, cellIdx))
championOrCreatureOrdinalInCell[cellIdx] = _vm->indexToOrdinal(cellIdx);
@@ -563,8 +563,8 @@ bool MovesensMan::moveIsKilledByProjectileImpact(int16 srcMapX, int16 srcMapY, i
T0266017_CheckProjectileImpacts:
Thing curThing = _vm->_dungeonMan->getSquareFirstThing(projectileMapX, projectileMapY);
while (curThing != Thing::_endOfList) {
- if ((curThing.getType() == k14_ProjectileThingType) &&
- (_vm->_timeline->_events[(((Projectile *)_vm->_dungeonMan->_thingData[k14_ProjectileThingType])[curThing.getIndex()])._eventIndex]._type != k48_TMEventTypeMoveProjectileIgnoreImpacts)) {
+ if ((curThing.getType() == kDMThingTypeProjectile) &&
+ (_vm->_timeline->_events[(((Projectile *)_vm->_dungeonMan->_thingData[kDMThingTypeProjectile])[curThing.getIndex()])._eventIndex]._type != k48_TMEventTypeMoveProjectileIgnoreImpacts)) {
int16 championOrCreatureOrdinal = championOrCreatureOrdinalInCell[curThing.getCell()];
if (championOrCreatureOrdinal && _vm->_projexpl->hasProjectileImpactOccurred(impactType, srcMapX, srcMapY, _vm->ordinalToIndex(championOrCreatureOrdinal), curThing)) {
_vm->_projexpl->projectileDeleteEvent(curThing);
@@ -703,11 +703,11 @@ void MovesensMan::processThingAdditionOrRemoval(uint16 mapX, uint16 mapY, Thing
thingType = thing.getType();
objectType = _vm->_objectMan->getObjectType(thing);
} else {
- thingType = kM1_PartyThingType;
+ thingType = kDMThingTypeParty;
objectType = kDMIconIndiceNone;
}
- if ((!addThing) && (thingType != kM1_PartyThingType))
+ if ((!addThing) && (thingType != kDMThingTypeParty))
_vm->_dungeonMan->unlinkThingFromList(thing, Thing(0), mapX, mapY);
Square curSquare = Square(_vm->_dungeonMan->_currMapData[mapX][mapY]);
@@ -715,22 +715,22 @@ void MovesensMan::processThingAdditionOrRemoval(uint16 mapX, uint16 mapY, Thing
if (curSquare.getType() == k0_WallElemType)
sensorTriggeredCell = thing.getCell();
else
- sensorTriggeredCell = kM1_CellAny; // this will wrap around
+ sensorTriggeredCell = kDMCellAny; // this will wrap around
bool squareContainsObject = false;
bool squareContainsGroup = false;
bool squareContainsThingOfSameType = false;
bool squareContainsThingOfDifferentType = false;
Thing curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY);
- if (sensorTriggeredCell == kM1_CellAny) {
+ if (sensorTriggeredCell == kDMCellAny) {
while (curThing != Thing::_endOfList) {
uint16 curThingType = curThing.getType();
- if (curThingType == k4_GroupThingType)
+ if (curThingType == kDMThingTypeGroup)
squareContainsGroup = true;
- else if ((curThingType == k2_TextstringType) && (thingType == kM1_PartyThingType) && addThing && !partySquare) {
+ else if ((curThingType == kDMstringTypeText) && (thingType == kDMThingTypeParty) && addThing && !partySquare) {
_vm->_dungeonMan->decodeText(_vm->_stringBuildBuffer, curThing, k1_TextTypeMessage);
_vm->_textMan->printMessage(k15_ColorWhite, _vm->_stringBuildBuffer);
- } else if ((curThingType > k4_GroupThingType) && (curThingType < k14_ProjectileThingType)) {
+ } else if ((curThingType > kDMThingTypeGroup) && (curThingType < kDMThingTypeProjectile)) {
squareContainsObject = true;
squareContainsThingOfSameType |= (_vm->_objectMan->getObjectType(curThing) == objectType);
squareContainsThingOfDifferentType |= (_vm->_objectMan->getObjectType(curThing) != objectType);
@@ -739,7 +739,7 @@ void MovesensMan::processThingAdditionOrRemoval(uint16 mapX, uint16 mapY, Thing
}
} else {
while (curThing != Thing::_endOfList) {
- if ((sensorTriggeredCell == curThing.getCell()) && (curThing.getType() > k4_GroupThingType)) {
+ if ((sensorTriggeredCell == curThing.getCell()) && (curThing.getType() > kDMThingTypeGroup)) {
squareContainsObject = true;
squareContainsThingOfSameType |= (_vm->_objectMan->getObjectType(curThing) == objectType);
squareContainsThingOfDifferentType |= (_vm->_objectMan->getObjectType(curThing) != objectType);
@@ -747,30 +747,30 @@ void MovesensMan::processThingAdditionOrRemoval(uint16 mapX, uint16 mapY, Thing
curThing = _vm->_dungeonMan->getNextThing(curThing);
}
}
- if (addThing && (thingType != kM1_PartyThingType))
+ if (addThing && (thingType != kDMThingTypeParty))
_vm->_dungeonMan->linkThingToList(thing, Thing(0), mapX, mapY);
for (curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); curThing != Thing::_endOfList; curThing = _vm->_dungeonMan->getNextThing(curThing)) {
uint16 curThingType = curThing.getType();
- if (curThingType == k3_SensorThingType) {
+ if (curThingType == kDMThingTypeSensor) {
Sensor *curSensor = (Sensor *)_vm->_dungeonMan->getThingData(curThing);
if (curSensor->getType() == k0_SensorDisabled)
continue;
int16 curSensorData = curSensor->getData();
bool triggerSensor = addThing;
- if (sensorTriggeredCell == kM1_CellAny) {
+ if (sensorTriggeredCell == kDMCellAny) {
switch (curSensor->getType()) {
case k1_SensorFloorTheronPartyCreatureObj:
if (partySquare || squareContainsObject || squareContainsGroup) /* BUG0_30 A floor sensor is not triggered when you put an object on the floor if a levitating creature is present on the same square. The condition to determine if the sensor should be triggered checks if there is a creature on the square but does not check whether the creature is levitating. While it is normal not to trigger the sensor if there is a non levitating creature on the square (because it was already triggered by the creature itself), a levitating creature should not prevent triggering the sensor with an object. */
continue;
break;
case k2_SensorFloorTheronPartyCreature:
- if ((thingType > k4_GroupThingType) || partySquare || squareContainsGroup)
+ if ((thingType > kDMThingTypeGroup) || partySquare || squareContainsGroup)
continue;
break;
case k3_SensorFloorParty:
- if ((thingType != kM1_PartyThingType) || (_vm->_championMan->_partyChampionCount == 0))
+ if ((thingType != kDMThingTypeParty) || (_vm->_championMan->_partyChampionCount == 0))
continue;
if (curSensorData == 0) {
@@ -786,24 +786,24 @@ void MovesensMan::processThingAdditionOrRemoval(uint16 mapX, uint16 mapY, Thing
continue;
break;
case k5_SensorFloorPartyOnStairs:
- if ((thingType != kM1_PartyThingType) || (curSquare.getType() != k3_StairsElemType))
+ if ((thingType != kDMThingTypeParty) || (curSquare.getType() != k3_StairsElemType))
continue;
break;
case k6_SensorFloorGroupGenerator:
continue;
break;
case k7_SensorFloorCreature:
- if ((thingType > k4_GroupThingType) || (thingType == kM1_PartyThingType) || squareContainsGroup)
+ if ((thingType > kDMThingTypeGroup) || (thingType == kDMThingTypeParty) || squareContainsGroup)
continue;
break;
case k8_SensorFloorPartyPossession:
- if (thingType != kM1_PartyThingType)
+ if (thingType != kDMThingTypeParty)
continue;
triggerSensor = isObjectInPartyPossession(curSensorData);
break;
case k9_SensorFloorVersionChecker:
- if ((thingType != kM1_PartyThingType) || !addThing || partySquare)
+ if ((thingType != kDMThingTypeParty) || !addThing || partySquare)
continue;
// Strangerke: 20 is a hardcoded version of the game. later version uses 21. Not present in the original dungeons anyway.
@@ -846,11 +846,11 @@ void MovesensMan::processThingAdditionOrRemoval(uint16 mapX, uint16 mapY, Thing
if (curSensor->getAttrAudibleA())
_vm->_sound->requestPlay(k01_soundSWITCH, mapX, mapY, k1_soundModePlayIfPrioritized);
- triggerEffect(curSensor, curSensorEffect, mapX, mapY, (uint16)kM1_CellAny); // this will wrap around
+ triggerEffect(curSensor, curSensorEffect, mapX, mapY, (uint16)kDMCellAny); // this will wrap around
continue;
}
- if (curThingType >= k4_GroupThingType)
+ if (curThingType >= kDMThingTypeGroup)
break;
}
processRotationEffect();
@@ -919,7 +919,7 @@ void MovesensMan::triggerEffect(Sensor *sensor, int16 effect, int16 mapX, int16
if (curSquareType == k0_ElementTypeWall)
targetCell = sensor->getActionTargetCell();
else
- targetCell = k0_CellNorthWest;
+ targetCell = kDMCellNorthWest;
addEvent(squareTypeToEventTypeArray[curSquareType], targetMapX, targetMapY, targetCell, effect, endTime);
}
@@ -927,7 +927,7 @@ void MovesensMan::triggerEffect(Sensor *sensor, int16 effect, int16 mapX, int16
void MovesensMan::triggerLocalEffect(int16 localEffect, int16 effX, int16 effY, int16 effCell) {
if (localEffect == k10_SensorEffAddExp) {
- addSkillExperience(kDMSkillSteal, 300, localEffect != kM1_CellAny);
+ addSkillExperience(kDMSkillSteal, 300, localEffect != kDMCellAny);
return;
}
_sensorRotationEffect = localEffect;
@@ -958,15 +958,15 @@ void MovesensMan::processRotationEffect() {
case k1_SensorEffClear:
case k2_SensorEffToggle:
Thing firstSensorThing = _vm->_dungeonMan->getSquareFirstThing(_sensorRotationEffMapX, _sensorRotationEffMapY);
- while ((firstSensorThing.getType() != k3_SensorThingType)
- || ((_sensorRotationEffCell != kM1_CellAny) && (firstSensorThing.getCell() != _sensorRotationEffCell))) {
+ while ((firstSensorThing.getType() != kDMThingTypeSensor)
+ || ((_sensorRotationEffCell != kDMCellAny) && (firstSensorThing.getCell() != _sensorRotationEffCell))) {
firstSensorThing = _vm->_dungeonMan->getNextThing(firstSensorThing);
}
Sensor *firstSensor = (Sensor *)_vm->_dungeonMan->getThingData(firstSensorThing);
Thing lastSensorThing = firstSensor->getNextThing();
while ((lastSensorThing != Thing::_endOfList)
- && ((lastSensorThing.getType() != k3_SensorThingType)
- || ((_sensorRotationEffCell != kM1_CellAny) && (lastSensorThing.getCell() != _sensorRotationEffCell)))) {
+ && ((lastSensorThing.getType() != kDMThingTypeSensor)
+ || ((_sensorRotationEffCell != kDMCellAny) && (lastSensorThing.getCell() != _sensorRotationEffCell)))) {
lastSensorThing = _vm->_dungeonMan->getNextThing(lastSensorThing);
}
if (lastSensorThing == Thing::_endOfList)
@@ -974,8 +974,8 @@ void MovesensMan::processRotationEffect() {
_vm->_dungeonMan->unlinkThingFromList(firstSensorThing, Thing(0), _sensorRotationEffMapX, _sensorRotationEffMapY);
Sensor *lastSensor = (Sensor *)_vm->_dungeonMan->getThingData(lastSensorThing);
lastSensorThing = _vm->_dungeonMan->getNextThing(lastSensorThing);
- while (((lastSensorThing != Thing::_endOfList) && (lastSensorThing.getType() == k3_SensorThingType))) {
- if ((_sensorRotationEffCell == kM1_CellAny) || (lastSensorThing.getCell() == _sensorRotationEffCell))
+ while (((lastSensorThing != Thing::_endOfList) && (lastSensorThing.getType() == kDMThingTypeSensor))) {
+ if ((_sensorRotationEffCell == kDMCellAny) || (lastSensorThing.getCell() == _sensorRotationEffCell))
lastSensor = (Sensor *)_vm->_dungeonMan->getThingData(lastSensorThing);
lastSensorThing = _vm->_dungeonMan->getNextThing(lastSensorThing);
}
@@ -1000,7 +1000,7 @@ Thing MovesensMan::getObjectOfTypeInCell(int16 mapX, int16 mapY, int16 cell, int
Thing curThing = _vm->_dungeonMan->getSquareFirstObject(mapX, mapY);
while (curThing != Thing::_endOfList) {
if (_vm->_objectMan->getObjectType(curThing) == objectType) {
- if ((cell == kM1_CellAny) || (curThing.getCell() == cell))
+ if ((cell == kDMCellAny) || (curThing.getCell() == cell))
return curThing;
}
curThing = _vm->_dungeonMan->getNextThing(curThing);
diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp
index 26d63673dc..e28b0f6bda 100644
--- a/engines/dm/projexpl.cpp
+++ b/engines/dm/projexpl.cpp
@@ -46,7 +46,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(k14_ProjectileThingType);
+ 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) */
return;
@@ -81,7 +81,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in
int16 projectileAssociatedThingType = projectileAssociatedThing.getType();
Potion *potion = nullptr;
Thing explosionThing = Thing::_none;
- if (projectileAssociatedThingType == k8_PotionThingType) {
+ if (projectileAssociatedThingType == kDMThingTypePotion) {
Group *projectileAssociatedGroup = (Group *)_vm->_dungeonMan->getThingData(projectileAssociatedThing);
PotionType potionType = ((Potion *)projectileAssociatedGroup)->getType();
if ((potionType == k3_PotionTypeVen) || (potionType == k19_PotionTypeFulBomb)) {
@@ -91,7 +91,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in
potion = (Potion *)projectileAssociatedGroup;
}
}
- bool createExplosionOnImpact = (projectileAssociatedThingType == k15_ExplosionThingType) && (projectileAssociatedThing != Thing::_explSlime) && (projectileAssociatedThing != Thing::_explPoisonBolt);
+ bool createExplosionOnImpact = (projectileAssociatedThingType == kDMThingTypeExplosion) && (projectileAssociatedThing != Thing::_explSlime) && (projectileAssociatedThing != Thing::_explPoisonBolt);
Thing *curGroupSlot = nullptr;
int16 projectileMapX;
int16 projectileMapY;
@@ -127,7 +127,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in
DoorInfo curDoorInfo = _vm->_dungeonMan->_currMapDoorInfo[curDoor->getType()];
if (getFlag(curDoorInfo._attributes, k0x0002_MaskDoorInfo_ProjectilesCanPassThrough)) {
- if (projectileAssociatedThingType == k15_ExplosionThingType) {
+ if (projectileAssociatedThingType == kDMThingTypeExplosion) {
if (projectileAssociatedThing.toUint16() >= Thing::_explHarmNonMaterial.toUint16())
return false;
} else {
@@ -137,7 +137,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in
if ((projectileThingData->_attack > _vm->getRandomNumber(128))
&& getFlag(associatedAllowedSlots, k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors)
- && ( (projectileAssociatedThingType != k10_JunkThingType)
+ && ( (projectileAssociatedThingType != kDMThingTypeJunk)
|| (iconIndex < kDMIconIndiceJunkIronKey)
|| (iconIndex > kDMIconIndiceJunkMasterKey)
)) {
@@ -181,7 +181,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in
_creatureDamageOutcome = outcome;
if (!createExplosionOnImpact && (outcome == k0_outcomeKilledNoCreaturesInGroup)
- && (projectileAssociatedThingType == k5_WeaponThingType)
+ && (projectileAssociatedThingType == kDMThingTypeWeapon)
&& getFlag(curCreatureInfo->_attributes, k0x0400_MaskCreatureInfo_keepThrownSharpWeapon)) {
Weapon *weapon = (Weapon *)_vm->_dungeonMan->getThingData(projectileAssociatedThing);
WeaponType weaponType = weapon->getType();
@@ -211,7 +211,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in
createExplosion(projectileAssociatedThing, explosionAttack, mapXCombo, mapYCombo, (projectileAssociatedThing == Thing::_explPoisonCloud) ? k255_CreatureTypeSingleCenteredCreature : cell);
} else {
uint16 soundIndex;
- if ((projectileAssociatedThing).getType() == k5_WeaponThingType)
+ if ((projectileAssociatedThing).getType() == kDMThingTypeWeapon)
soundIndex = k00_soundMETALLIC_THUD;
else if (projectileAssociatedThing == Thing::_explPoisonBolt)
soundIndex = k13_soundSPELL;
@@ -237,8 +237,8 @@ uint16 ProjExpl::getProjectileImpactAttack(Projectile *projectile, Thing thing)
uint16 kineticEnergy = projectile->_kineticEnergy;
ThingType thingType = thing.getType();
uint16 attack;
- if (thingType != k15_ExplosionThingType) {
- if (thingType == k5_WeaponThingType) {
+ if (thingType != kDMThingTypeExplosion) {
+ if (thingType == kDMThingTypeWeapon) {
WeaponInfo *weaponInfo = _vm->_dungeonMan->getWeaponInfo(thing);
attack = weaponInfo->_kineticEnergy;
_projectileAttackType = kDMAttackTypeBlunt;
@@ -273,11 +273,11 @@ 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(k15_ExplosionThingType);
+ Thing unusedThing = _vm->_dungeonMan->getUnusedThing(kDMThingTypeExplosion);
if (unusedThing == Thing::_none)
return;
- Explosion *explosion = &((Explosion *)_vm->_dungeonMan->_thingData[k15_ExplosionThingType])[(unusedThing).getIndex()];
+ Explosion *explosion = &((Explosion *)_vm->_dungeonMan->_thingData[kDMThingTypeExplosion])[(unusedThing).getIndex()];
int16 projectileTargetMapX;
int16 projectileTargetMapY;
uint16 projectileMapX = mapXCombo;
@@ -352,7 +352,7 @@ int16 ProjExpl::projectileGetImpactCount(int16 impactType, int16 mapX, int16 map
_creatureDamageOutcome = k0_outcomeKilledNoCreaturesInGroup;
for (Thing curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); curThing != Thing::_endOfList; ) {
- if (((curThing).getType() == k14_ProjectileThingType) && ((curThing).getCell() == cell) &&
+ if (((curThing).getType() == kDMThingTypeProjectile) && ((curThing).getCell() == cell) &&
hasProjectileImpactOccurred(impactType, mapX, mapY, cell, curThing)) {
projectileDeleteEvent(curThing);
impactCount++;
@@ -374,7 +374,7 @@ void ProjExpl::projectileDeleteEvent(Thing thing) {
void ProjExpl::projectileDelete(Thing projectileThing, Thing *groupSlot, int16 mapX, int16 mapY) {
Projectile *projectile = (Projectile *)_vm->_dungeonMan->getThingData(projectileThing);
Thing projectileSlotThing = projectile->_slot;
- if (projectileSlotThing.getType() != k15_ExplosionThingType) {
+ if (projectileSlotThing.getType() != kDMThingTypeExplosion) {
if (groupSlot != NULL) {
Thing previousThing = *groupSlot;
if (previousThing == Thing::_endOfList) {
@@ -472,7 +472,7 @@ void ProjExpl::processEvents48To49(TimelineEvent *event) {
void ProjExpl::processEvent25(TimelineEvent *event) {
uint16 mapX = event->_Bu._location._mapX;
uint16 mapY = event->_Bu._location._mapY;
- Explosion *explosion = &((Explosion *)_vm->_dungeonMan->_thingData[k15_ExplosionThingType])[Thing((event->_Cu._slot)).getIndex()];
+ Explosion *explosion = &((Explosion *)_vm->_dungeonMan->_thingData[kDMThingTypeExplosion])[Thing((event->_Cu._slot)).getIndex()];
int16 curSquareType = Square(_vm->_dungeonMan->_currMapData[mapX][mapY]).getType();
bool explosionOnPartySquare = (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (mapX == _vm->_dungeonMan->_partyMapX) && (mapY == _vm->_dungeonMan->_partyMapY);
Thing groupThing = _vm->_groupMan->groupGetThing(mapX, mapY);
diff --git a/engines/dm/sounds.cpp b/engines/dm/sounds.cpp
index 4cb8eaf26f..f09d8312a4 100644
--- a/engines/dm/sounds.cpp
+++ b/engines/dm/sounds.cpp
@@ -163,19 +163,19 @@ bool SoundMan::soundGetVolume(int16 mapX, int16 mapY, uint8 *leftVolume, uint8 *
int16 rightVolumeColumnIndex = 0;
switch (_vm->_dungeonMan->_partyDir) {
- case kDirNorth:
+ case kDMDirNorth:
rightVolumeColumnIndex = mapX - _vm->_dungeonMan->_partyMapX;
lineIndex = mapY - _vm->_dungeonMan->_partyMapY;
break;
- case kDirEast:
+ case kDMDirEast:
rightVolumeColumnIndex = mapY - _vm->_dungeonMan->_partyMapY;
lineIndex = -(mapX - _vm->_dungeonMan->_partyMapX);
break;
- case kDirSouth:
+ case kDMDirSouth:
rightVolumeColumnIndex = -(mapX - _vm->_dungeonMan->_partyMapX);
lineIndex = -(mapY - _vm->_dungeonMan->_partyMapY);
break;
- case kDirWest:
+ case kDMDirWest:
rightVolumeColumnIndex = -(mapY - _vm->_dungeonMan->_partyMapY);
lineIndex = mapX - _vm->_dungeonMan->_partyMapX;
break;
diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp
index 127ba0d435..aba859081f 100644
--- a/engines/dm/timeline.cpp
+++ b/engines/dm/timeline.cpp
@@ -517,7 +517,7 @@ void Timeline::moveTeleporterOrPitSquareThings(uint16 mapX, uint16 mapY) {
Thing nextThing = curThing;
int16 thingsToMoveCount = 0;
while (curThing != Thing::_endOfList) {
- if (curThing.getType() > k4_GroupThingType)
+ if (curThing.getType() > kDMThingTypeGroup)
thingsToMoveCount++;
curThing = _vm->_dungeonMan->getNextThing(curThing);
@@ -527,10 +527,10 @@ void Timeline::moveTeleporterOrPitSquareThings(uint16 mapX, uint16 mapY) {
thingsToMoveCount--;
nextThing = _vm->_dungeonMan->getNextThing(curThing);
uint16 curThingType = curThing.getType();
- if (curThingType > k4_GroupThingType)
+ if (curThingType > kDMThingTypeGroup)
_vm->_moveSens->getMoveResult(curThing, mapX, mapY, mapX, mapY);
- if (curThingType == k14_ProjectileThingType) {
+ if (curThingType == kDMThingTypeProjectile) {
Projectile *projectile = (Projectile *)_vm->_dungeonMan->getThingData(curThing);
TimelineEvent *newEvent;
newEvent = &_events[projectile->_eventIndex];
@@ -539,7 +539,7 @@ void Timeline::moveTeleporterOrPitSquareThings(uint16 mapX, uint16 mapY) {
newEvent->_Cu._projectile.setDir((Direction)_vm->_moveSens->_moveResultDir);
newEvent->_Bu._slot = thingWithNewCell(curThing, _vm->_moveSens->_moveResultCell).toUint16();
M31_setMap(newEvent->_mapTime, _vm->_moveSens->_moveResultMapIndex);
- } else if (curThingType == k15_ExplosionThingType) {
+ } else if (curThingType == kDMThingTypeExplosion) {
TimelineEvent *newEvent = _events;
for (uint16 i = 0; i < _eventMaxCount; newEvent++, i++) {
if ((newEvent->_type == k25_TMEventTypeExplosion) && (newEvent->_Cu._slot == curThing.toUint16())) { /* BUG0_23 A Fluxcage explosion remains on a square forever. If you open a pit or teleporter on a square where there is a Fluxcage explosion, the Fluxcage explosion is moved but the associated event is not updated (because Fluxcage explosions do not use k25_TMEventTypeExplosion but rather k24_TMEventTypeRemoveFluxcage) causing the Fluxcage explosion to remain in the dungeon forever on its destination square. When the k24_TMEventTypeRemoveFluxcage expires the explosion thing is not removed, but it is marked as unused. Consequently, any objects placed on the Fluxcage square after it was moved but before it expires become orphans upon expiration. After expiration, any object placed on the fluxcage square is cloned when picked up */
@@ -576,13 +576,13 @@ void Timeline::processEventSquareWall(TimelineEvent *event) {
uint16 curCell = event->_Cu.A._cell;
while (curThing != Thing::_endOfList) {
int16 curThingType = curThing.getType();
- if ((curThingType == k2_TextstringType) && (curThing.getCell() == event->_Cu.A._cell)) {
+ if ((curThingType == kDMstringTypeText) && (curThing.getCell() == event->_Cu.A._cell)) {
TextString *textString = (TextString *)_vm->_dungeonMan->getThingData(curThing);
if (event->_Cu.A._effect == k2_SensorEffToggle)
textString->setVisible(!textString->isVisible());
else
textString->setVisible(event->_Cu.A._effect == k0_SensorEffSet);
- } else if (curThingType == k3_SensorThingType) {
+ } else if (curThingType == kDMThingTypeSensor) {
Sensor *curThingSensor = (Sensor *)_vm->_dungeonMan->getThingData(curThing);
uint16 curSensorType = curThingSensor->getType();
uint16 curSensorData = curThingSensor->getData();
@@ -656,7 +656,7 @@ void Timeline::triggerProjectileLauncher(Sensor *sensor, TimelineEvent *event) {
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) */
uint16 projectiveThingCell = firstProjectileAssociatedThing.getCell();
- if ((firstProjectileAssociatedThing.getType() > k3_SensorThingType) && ((projectiveThingCell == cell) || (projectiveThingCell == returnNextVal(cell))))
+ if ((firstProjectileAssociatedThing.getType() > kDMThingTypeSensor) && ((projectiveThingCell == cell) || (projectiveThingCell == returnNextVal(cell))))
break;
firstProjectileAssociatedThing = _vm->_dungeonMan->getNextThing(firstProjectileAssociatedThing);
}
@@ -668,7 +668,7 @@ void Timeline::triggerProjectileLauncher(Sensor *sensor, TimelineEvent *event) {
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 */
uint16 projectiveThingCell = secondProjectileAssociatedThing.getCell();
- if ((secondProjectileAssociatedThing.getType() > k3_SensorThingType) && ((projectiveThingCell == cell) || (projectiveThingCell == returnNextVal(cell))))
+ if ((secondProjectileAssociatedThing.getType() > kDMThingTypeSensor) && ((projectiveThingCell == cell) || (projectiveThingCell == returnNextVal(cell))))
break;
secondProjectileAssociatedThing = _vm->_dungeonMan->getNextThing(secondProjectileAssociatedThing);
}
@@ -706,7 +706,7 @@ void Timeline::processEventSquareCorridor(TimelineEvent *event) {
Thing curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY);
while (curThing != Thing::_endOfList) {
int16 curThingType = curThing.getType();
- if (curThingType == k2_TextstringType) {
+ if (curThingType == kDMstringTypeText) {
TextString *textString = (TextString *)_vm->_dungeonMan->getThingData(curThing);
bool textCurrentlyVisible = textString->isVisible();
if (event->_Cu.A._effect == k2_SensorEffToggle)
@@ -718,7 +718,7 @@ void Timeline::processEventSquareCorridor(TimelineEvent *event) {
_vm->_dungeonMan->decodeText(_vm->_stringBuildBuffer, curThing, k1_TextTypeMessage);
_vm->_textMan->printMessage(k15_ColorWhite, _vm->_stringBuildBuffer);
}
- } else if (curThingType == k3_SensorThingType) {
+ } else if (curThingType == kDMThingTypeSensor) {
Sensor *curSensor = (Sensor *)_vm->_dungeonMan->getThingData(curThing);
if (curSensor->getType() == k6_SensorFloorGroupGenerator) {
int16 creatureCount = curSensor->getAttrValue();
@@ -801,7 +801,7 @@ T0252001:
void Timeline::procesEventEnableGroupGenerator(TimelineEvent *event) {
Thing curThing = _vm->_dungeonMan->getSquareFirstThing(event->_Bu._location._mapX, event->_Bu._location._mapY);
while (curThing != Thing::_none) {
- if ((curThing.getType()) == k3_SensorThingType) {
+ if ((curThing.getType()) == kDMThingTypeSensor) {
Sensor *curSensor = (Sensor *)_vm->_dungeonMan->getThingData(curThing);
if (curSensor->getType() == k0_SensorDisabled) {
curSensor->setDatAndTypeWithOr(k6_SensorFloorGroupGenerator);
@@ -853,7 +853,7 @@ void Timeline::processEventMoveWeaponFromQuiverToSlot(uint16 champIndex, uint16
}
bool Timeline::hasWeaponMovedSlot(int16 champIndex, Champion *champ, uint16 sourceSlotIndex, int16 destSlotIndex) {
- if (Thing(champ->_slots[sourceSlotIndex]).getType() == k5_WeaponThingType) {
+ if (Thing(champ->_slots[sourceSlotIndex]).getType() == kDMThingTypeWeapon) {
_vm->_championMan->addObjectInSlot((ChampionIndex)champIndex, _vm->_championMan->getObjectRemovedFromSlot(champIndex, sourceSlotIndex),
(ChampionSlot)destSlotIndex);
return true;
@@ -928,7 +928,7 @@ T0255002:
case 1: {
Thing curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY);
while (curThing != Thing::_endOfList) {
- if ((curThing.getCell() == cell) && (curThing.getType() == k10_JunkThingType)) {
+ if ((curThing.getCell() == cell) && (curThing.getType() == kDMThingTypeJunk)) {
int16 iconIndex = _vm->_objectMan->getIconIndex(curThing);
if (iconIndex == kDMIconIndiceJunkChampionBones) {
Junk *junkData = (Junk *)_vm->_dungeonMan->getThingData(curThing);