diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/dm/champion.cpp | 10 | ||||
-rw-r--r-- | engines/dm/console.cpp | 2 | ||||
-rw-r--r-- | engines/dm/dm.h | 4 | ||||
-rw-r--r-- | engines/dm/group.cpp | 28 | ||||
-rw-r--r-- | engines/dm/inventory.cpp | 2 | ||||
-rw-r--r-- | engines/dm/loadsave.h | 2 | ||||
-rw-r--r-- | engines/dm/menus.cpp | 24 | ||||
-rw-r--r-- | engines/dm/menus.h | 20 | ||||
-rw-r--r-- | engines/dm/movesens.cpp | 6 | ||||
-rw-r--r-- | engines/dm/movesens.h | 1 | ||||
-rw-r--r-- | engines/dm/objectman.cpp | 12 | ||||
-rw-r--r-- | engines/dm/objectman.h | 12 | ||||
-rw-r--r-- | engines/dm/projexpl.cpp | 12 | ||||
-rw-r--r-- | engines/dm/projexpl.h | 8 | ||||
-rw-r--r-- | engines/dm/timeline.cpp | 2 |
15 files changed, 74 insertions, 71 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index b6c0e7d18e..a8e655a913 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -440,7 +440,7 @@ bool ChampionMan::hasObjectIconInSlotBoxChanged(int16 slotBoxIndex, Thing thing) || (currIconIndex == kDMIconIndicePotionEmptyFlask)) { IconIndice newIconIndex = objMan.getIconIndex(thing); if (newIconIndex != currIconIndex) { - if ((slotBoxIndex < k8_SlotBoxInventoryFirstSlot) && !_mousePointerHiddenToDrawChangedObjIconOnScreen) { + if ((slotBoxIndex < kDMSlotBoxInventoryFirstSlot) && !_mousePointerHiddenToDrawChangedObjIconOnScreen) { _mousePointerHiddenToDrawChangedObjIconOnScreen = true; _vm->_eventMan->hideMouse(); } @@ -496,7 +496,7 @@ void ChampionMan::drawChangedObjectIcons() { uint16 drawViewport = 0; for (uint16 slotIndex = kDMSlotReadyHand; slotIndex < kDMSlotChest1; slotIndex++, thing++) { - uint16 objIconChanged = hasObjectIconInSlotBoxChanged(slotIndex + k8_SlotBoxInventoryFirstSlot, *thing) ? 1 : 0; + uint16 objIconChanged = hasObjectIconInSlotBoxChanged(slotIndex + kDMSlotBoxInventoryFirstSlot, *thing) ? 1 : 0; drawViewport |= objIconChanged; if (objIconChanged && (slotIndex == kDMSlotActionHand)) { menuMan.drawActionIcon((ChampionIndex)_vm->ordinalToIndex(invChampOrdinal)); @@ -1294,7 +1294,7 @@ void ChampionMan::clickOnSlotBox(uint16 slotBoxIndex) { uint16 champIndex; uint16 slotIndex; - if (slotBoxIndex < k8_SlotBoxInventoryFirstSlot) { + if (slotBoxIndex < kDMSlotBoxInventoryFirstSlot) { if (_candidateChampionOrdinal) return; @@ -1305,7 +1305,7 @@ void ChampionMan::clickOnSlotBox(uint16 slotBoxIndex) { slotIndex = getHandSlotIndex(slotBoxIndex); } else { champIndex = _vm->ordinalToIndex(_vm->_inventoryMan->_inventoryChampionOrdinal); - slotIndex = slotBoxIndex - k8_SlotBoxInventoryFirstSlot; + slotIndex = slotBoxIndex - kDMSlotBoxInventoryFirstSlot; } Thing leaderHandObject = _leaderHandObject; @@ -2309,7 +2309,7 @@ void ChampionMan::drawSlot(uint16 champIndex, int16 slotIndex) { return; slotBoxIndex = (champIndex << 1) + slotIndex; } else - slotBoxIndex = k8_SlotBoxInventoryFirstSlot + slotIndex; + slotBoxIndex = kDMSlotBoxInventoryFirstSlot + slotIndex; Thing thing; if (slotIndex >= kDMSlotChest1) diff --git a/engines/dm/console.cpp b/engines/dm/console.cpp index c4bef55216..c5310ddd87 100644 --- a/engines/dm/console.cpp +++ b/engines/dm/console.cpp @@ -218,7 +218,7 @@ bool Console::Cmd_listItems(int argc, const char** argv) { if(strstr(_vm->_objectMan->_objectNames[0], searchedString.c_str()) != nullptr) debugPrintf("| %s", _vm->_objectMan->_objectNames[0]); - for (uint16 i = 1; i < k199_ObjectNameCount; ++i) { + for (uint16 i = 1; i < kDMObjectNameCount; ++i) { const char *name = _vm->_objectMan->_objectNames[i - 1]; const char *prevName = _vm->_objectMan->_objectNames[i]; diff --git a/engines/dm/dm.h b/engines/dm/dm.h index c346fa0874..e4fc837558 100644 --- a/engines/dm/dm.h +++ b/engines/dm/dm.h @@ -148,7 +148,9 @@ enum MapIndice { #define kDMMaskDecodeEvenIfInvisible 0x8000 // @ MASK0x8000_DECODE_EVEN_IF_INVISIBLE #define kDMMaskMergeCycles 0x8000 // @ MASK0x8000_MERGE_CYCLES -#define kDMSlotBoxChestFirstSlot 38 // @ C38_SLOT_BOX_CHEST_FIRST_SLOT +#define kDMSlotBoxInventoryFirstSlot 8 // @ C08_SLOT_BOX_INVENTORY_FIRST_SLOT +#define kDMSlotBoxInventoryActionHand 9 // @ C09_SLOT_BOX_INVENTORY_ACTION_HAND +#define kDMSlotBoxChestFirstSlot 38 // @ C38_SLOT_BOX_CHEST_FIRST_SLOT struct DMADGameDescription { ADGameDescription _desc; diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp index 1fa79fd67a..aa29da916f 100644 --- a/engines/dm/group.cpp +++ b/engines/dm/group.cpp @@ -390,7 +390,7 @@ int16 GroupMan::groupGetDamageCreatureOutcome(Group *group, uint16 creatureIndex CreatureType creatureType = group->_type; CreatureInfo *creatureInfo = &_vm->_dungeonMan->_creatureInfos[creatureType]; if (getFlag(creatureInfo->_attributes, kDMCreatureMaskArchenemy)) /* Lord Chaos cannot be damaged */ - return k0_outcomeKilledNoCreaturesInGroup; + return kDMKillOutcomeNoCreaturesInGroup; if (group->_health[creatureIndex] <= damage) { uint16 groupCells = getGroupCells(group, _vm->_dungeonMan->_currMapIndex); @@ -403,7 +403,7 @@ int16 GroupMan::groupGetDamageCreatureOutcome(Group *group, uint16 creatureIndex dropGroupPossessions(mapX, mapY, groupGetThing(mapX, mapY), kDMSoundModePlayOneTickLater); groupDelete(mapX, mapY); } - retVal = k2_outcomeKilledAllCreaturesInGroup; + retVal = kDMKillOutcomeAllCreaturesInGroup; } else { /* If there are several creatures in the group */ uint16 groupDirections = getGroupDirections(group, _vm->_dungeonMan->_currMapIndex); if (getFlag(creatureInfo->_attributes, kDMCreatureMaskDropFixedPoss)) { @@ -464,7 +464,7 @@ int16 GroupMan::groupGetDamageCreatureOutcome(Group *group, uint16 creatureIndex _vm->_dungeonMan->setGroupCells(group, groupCells, _vm->_dungeonMan->_currMapIndex); _vm->_dungeonMan->setGroupDirections(group, groupDirections, _vm->_dungeonMan->_currMapIndex); group->setCount(group->getCount() - 1); - retVal = k1_outcomeKilledSomeCreaturesInGroup; + retVal = kDMKillOutcomeSomeCreaturesInGroup; } CreatureSize creatureSize = (CreatureSize)getFlag(creatureInfo->_attributes, kDMCreatureMaskSize); @@ -483,7 +483,7 @@ int16 GroupMan::groupGetDamageCreatureOutcome(Group *group, uint16 creatureIndex if (damage > 0) group->_health[creatureIndex] -= damage; - return k0_outcomeKilledNoCreaturesInGroup; + return kDMKillOutcomeNoCreaturesInGroup; } void GroupMan::groupDelete(int16 mapX, int16 mapY) { @@ -538,13 +538,13 @@ int16 GroupMan::getDamageAllCreaturesOutcome(Group *group, int16 mapX, int16 map killedSomeCreatures = killedSomeCreatures || outcomeVal; } while (creatureIndex--); if (killedAllCreatures) - return k2_outcomeKilledAllCreaturesInGroup; + return kDMKillOutcomeAllCreaturesInGroup; if (killedSomeCreatures) - return k1_outcomeKilledSomeCreaturesInGroup; + return kDMKillOutcomeSomeCreaturesInGroup; } - return k0_outcomeKilledNoCreaturesInGroup; + return kDMKillOutcomeNoCreaturesInGroup; } int16 GroupMan::groupGetResistanceAdjustedPoisonAttack(CreatureType creatureType, int16 poisonAttack) { @@ -971,7 +971,7 @@ T0209096_SetBehavior0_Wander: } /* If 1/8 chance and the creature is not adjacent to the party and is a quarter square sized creature then process projectile impacts and update the creature cell if still alive. When the creature is not in front of the party, it has 7/8 chances of dodging a projectile by moving to another cell or staying in the center of the square */ if (!(AL0446_i_GroupCellsCriteria & 0x0038) && (distanceToVisibleParty != 1) && (creatureSize == kDMCreatureSizeQuarter)) { - if (_vm->_projexpl->projectileGetImpactCount(kDMElementTypeCreature, eventMapX, eventMapY, activeGroup->_cells) && (_vm->_projexpl->_creatureDamageOutcome == k2_outcomeKilledAllCreaturesInGroup)) /* This call to F0218_PROJECTILE_GetImpactCount works fine because there is a single creature in the group so L0445_ps_ActiveGroup->Cells contains only one cell index */ + if (_vm->_projexpl->projectileGetImpactCount(kDMElementTypeCreature, eventMapX, eventMapY, activeGroup->_cells) && (_vm->_projexpl->_creatureDamageOutcome == kDMKillOutcomeAllCreaturesInGroup)) /* This call to F0218_PROJECTILE_GetImpactCount works fine because there is a single creature in the group so L0445_ps_ActiveGroup->Cells contains only one cell index */ return; activeGroup->_cells = _vm->normalizeModulo4(AL0446_i_GroupCellsCriteria); } @@ -1001,9 +1001,9 @@ T0209096_SetBehavior0_Wander: AL0446_i_Cell = _vm->normalizeModulo4(AL0446_i_Cell); if (!getCreatureOrdinalInCell(curGroup, AL0446_i_Cell) || (_vm->getRandomNumber(2) && !getCreatureOrdinalInCell(curGroup, AL0446_i_Cell = _vm->returnOppositeDir((Direction)AL0446_i_Cell)))) { /* If the selected cell (or the opposite cell) is not already occupied by a creature */ - if (_vm->_projexpl->projectileGetImpactCount(kDMElementTypeCreature, eventMapX, eventMapY, activeGroup->_cells) && (_vm->_projexpl->_creatureDamageOutcome == k2_outcomeKilledAllCreaturesInGroup)) /* BUG0_70 A projectile impact on a creature may be ignored. The function F0218_PROJECTILE_GetImpactCount to detect projectile impacts when a quarter square sized creature moves inside a group (to another cell on the same square) may fail if there are several creatures in the group because the function expects a single cell index for its last parameter. The function should be called once for each cell where there is a creature */ + if (_vm->_projexpl->projectileGetImpactCount(kDMElementTypeCreature, eventMapX, eventMapY, activeGroup->_cells) && (_vm->_projexpl->_creatureDamageOutcome == kDMKillOutcomeAllCreaturesInGroup)) /* BUG0_70 A projectile impact on a creature may be ignored. The function F0218_PROJECTILE_GetImpactCount to detect projectile impacts when a quarter square sized creature moves inside a group (to another cell on the same square) may fail if there are several creatures in the group because the function expects a single cell index for its last parameter. The function should be called once for each cell where there is a creature */ return; - if (_vm->_projexpl->_creatureDamageOutcome != k1_outcomeKilledSomeCreaturesInGroup) { + if (_vm->_projexpl->_creatureDamageOutcome != kDMKillOutcomeSomeCreaturesInGroup) { activeGroup->_cells = getGroupValueUpdatedWithCreatureValue(activeGroup->_cells, AL0447_i_CreatureIndex, AL0446_i_Cell); } } @@ -1811,9 +1811,9 @@ int16 GroupMan::getMeleeActionDamage(Champion *champ, int16 champIndex, Group *g int16 doubledMapDifficulty = _vm->_dungeonMan->_currMap->_difficulty << 1; CreatureInfo *creatureInfo = &_vm->_dungeonMan->_creatureInfos[group->_type]; int16 actionHandObjectIconIndex = _vm->_objectMan->getIconIndex(champ->_slots[kDMSlotActionHand]); - bool actionHitsNonMaterialCreatures = getFlag(actionHitProbability, k0x8000_hitNonMaterialCreatures); + bool actionHitsNonMaterialCreatures = getFlag(actionHitProbability, kDMActionMaskHitNonMaterialCreatures); if (actionHitsNonMaterialCreatures) - clearFlag(actionHitProbability, k0x8000_hitNonMaterialCreatures); + clearFlag(actionHitProbability, kDMActionMaskHitNonMaterialCreatures); if ((!getFlag(creatureInfo->_attributes, kDMCreatureMaskNonMaterial) || actionHitsNonMaterialCreatures) && ((_vm->_championMan->getDexterity(champ) > (_vm->getRandomNumber(32) + creatureInfo->_dexterity + doubledMapDifficulty - 16)) || @@ -1869,11 +1869,11 @@ T0231009: } T0231015: L0565_i_Damage = 0; - L0569_i_Outcome = k0_outcomeKilledNoCreaturesInGroup; + L0569_i_Outcome = kDMKillOutcomeNoCreaturesInGroup; _vm->_championMan->decrementStamina(champIndex, _vm->getRandomNumber(2) + 2); T0231016: _vm->_championMan->drawChampionState((ChampionIndex)champIndex); - if (L0569_i_Outcome != k2_outcomeKilledAllCreaturesInGroup) { + if (L0569_i_Outcome != kDMKillOutcomeAllCreaturesInGroup) { processEvents29to41(mapX, mapY, kM1_TMEventTypeCreateReactionEvent31ParyIsAdjacent, 0); } return L0565_i_Damage; diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp index 93f66289ff..608fadc759 100644 --- a/engines/dm/inventory.cpp +++ b/engines/dm/inventory.cpp @@ -365,7 +365,7 @@ void InventoryMan::openAndDrawChest(Thing thingToOpen, Container *chest, bool is _openChest = thingToOpen; if (!isPressingEye) { - objMan.drawIconInSlotBox(k9_SlotBoxInventoryActionHand, kDMIconIndiceContainerChestOpen); + objMan.drawIconInSlotBox(kDMSlotBoxInventoryActionHand, kDMIconIndiceContainerChestOpen); } dispMan.blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k25_PanelOpenChestIndice), _boxPanel, k72_byteWidth, kDMColorRed, 73); diff --git a/engines/dm/loadsave.h b/engines/dm/loadsave.h index ca8f4d6369..4f77726434 100644 --- a/engines/dm/loadsave.h +++ b/engines/dm/loadsave.h @@ -36,9 +36,7 @@ class LoadsaveMan { DMEngine *_vm; public: explicit LoadsaveMan(DMEngine *vm); - }; - } #endif diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp index 894bf658a9..317368e94f 100644 --- a/engines/dm/menus.cpp +++ b/engines/dm/menus.cpp @@ -425,7 +425,7 @@ void MenuMan::buildSpellAreaLine(int16 spellAreaBitmapLine) { char spellSymbolString[2] = {'\0', '\0'}; Champion *magicChampion = &_vm->_championMan->_champions[_vm->_championMan->_magicCasterChampionIndex]; - if (spellAreaBitmapLine == k2_SpellAreaAvailableSymbols) { + if (spellAreaBitmapLine == kDMSpellAreaAvailableSymbols) { _vm->_displayMan->_useByteBoxCoordinates = false; _vm->_displayMan->blitToBitmap(_bitmapSpellAreaLines, _bitmapSpellAreaLine, boxSpellAreaLine, 0, 12, k48_byteWidth, k48_byteWidth, kDMColorNoTransparency, 36, 12); int16 x = 1; @@ -435,7 +435,7 @@ void MenuMan::buildSpellAreaLine(int16 spellAreaBitmapLine) { x += 14; _vm->_textMan->printTextToBitmap(_bitmapSpellAreaLine, 48, x, 8, kDMColorCyan, kDMColorBlack, spellSymbolString, 12); } - } else if (spellAreaBitmapLine == k3_SpellAreaChampionSymbols) { + } else if (spellAreaBitmapLine == kDMSpellAreaChampionSymbols) { _vm->_displayMan->_useByteBoxCoordinates = false; _vm->_displayMan->blitToBitmap(_bitmapSpellAreaLines, _bitmapSpellAreaLine, boxSpellAreaLine, 0, 24, k48_byteWidth, k48_byteWidth, kDMColorNoTransparency, 36, 12); int16 x = 8; @@ -470,11 +470,11 @@ void MenuMan::setMagicCasterAndDrawSpellArea(ChampionIndex champIndex) { return; } _vm->_championMan->_magicCasterChampionIndex = champIndex; - buildSpellAreaLine(k2_SpellAreaAvailableSymbols); + buildSpellAreaLine(kDMSpellAreaAvailableSymbols); _vm->_eventMan->showMouse(); drawSpellAreaControls(champIndex); _vm->_displayMan->blitToScreen(_bitmapSpellAreaLine, &boxSpellAreaLine2, k48_byteWidth, kDMColorNoTransparency, 12); - buildSpellAreaLine(k3_SpellAreaChampionSymbols); + buildSpellAreaLine(kDMSpellAreaChampionSymbols); _vm->_displayMan->blitToScreen(_bitmapSpellAreaLine, &boxSpellAreaLine3, k48_byteWidth, kDMColorNoTransparency, 12); _vm->_eventMan->hideMouse(); } @@ -1144,7 +1144,7 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) { break; case kDMActionShoot: { if (Thing(curChampion->_slots[kDMSlotReadyHand]).getType() != kDMThingTypeWeapon) { - _actionDamage = kM2_damageNoAmmunition; + _actionDamage = kDMDamageNoAmmunition; actionExperienceGain = 0; actionPerformed = false; break; @@ -1157,7 +1157,7 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) { int16 stepEnergy = actionHandWeaponClass; if ((actionHandWeaponClass >= kDMWeaponClassFirstBow) && (actionHandWeaponClass <= kDMWeaponClassLastBow)) { if (readyHandWeaponClass != kDMWeaponClassBowAmmunition) { - _actionDamage = kM2_damageNoAmmunition; + _actionDamage = kDMDamageNoAmmunition; actionExperienceGain = 0; actionPerformed = false; break; @@ -1165,7 +1165,7 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) { stepEnergy -= kDMWeaponClassFirstBow; } else if ((actionHandWeaponClass >= kDMWeaponClassFirstSling) && (actionHandWeaponClass <= kDMWeaponClassLastSling)) { if (readyHandWeaponClass != kDMWeaponClassSlingAmmunition) { - _actionDamage = kM2_damageNoAmmunition; + _actionDamage = kDMDamageNoAmmunition; actionExperienceGain = 0; actionPerformed = false; break; @@ -1496,7 +1496,7 @@ bool MenuMan::isMeleeActionPerformed(int16 champIndex, Champion *champ, int16 ac uint16 cellDelta = (viewCell == kDMViewCellBackRight) ? 3 : 1; /* Check if there is another champion in front */ if (_vm->_championMan->getIndexInCell(_vm->normalizeModulo4(championCell + cellDelta)) != kDMChampionNone) { - _actionDamage = kM1_damageCantReach; + _actionDamage = kDMDamageCantReach; return false; } break; @@ -1508,7 +1508,7 @@ bool MenuMan::isMeleeActionPerformed(int16 champIndex, Champion *champ, int16 ac uint16 actionHitProbability = actionHitProbabilityArray[actionIndex]; uint16 actionDamageFactor = actionDamageFactorArray[actionIndex]; if ((_vm->_objectMan->getIconIndex(champ->_slots[kDMSlotActionHand]) == kDMIconIndiceWeaponVorpalBlade) || (actionIndex == kDMActionDisrupt)) { - setFlag(actionHitProbability, k0x8000_hitNonMaterialCreatures); + setFlag(actionHitProbability, kDMActionMaskHitNonMaterialCreatures); } _actionDamage = _vm->_groupMan->getMeleeActionDamage(champ, champIndex, (Group *)_vm->_dungeonMan->getThingData(_actionTargetGroupThing), _vm->ordinalToIndex(targetCreatureOrdinal), targetMapX, targetMapY, actionHitProbability, actionDamageFactor, skillIndex); return true; @@ -1681,10 +1681,10 @@ void MenuMan::setActionList(ActionSet *actionSet) { continue; uint16 minimumSkillLevel = actionSet->_actionProperties[idx - 1]; - if (getFlag(minimumSkillLevel, k0x0080_actionRequiresCharge) && !getActionObjectChargeCount()) + if (getFlag(minimumSkillLevel, kDMActionMaskRequiresCharge) && !getActionObjectChargeCount()) continue; - clearFlag(minimumSkillLevel, k0x0080_actionRequiresCharge); + clearFlag(minimumSkillLevel, kDMActionMaskRequiresCharge); if (_vm->_championMan->getSkillLevel(_vm->ordinalToIndex(_vm->_championMan->_actingChampionOrdinal), _actionSkillIndex[actionIndex]) >= minimumSkillLevel) { _actionList._actionIndices[nextAvailableActionListIndex] = (ChampionAction)actionIndex; _actionList._minimumSkillLevel[nextAvailableActionListIndex] = minimumSkillLevel; @@ -1745,7 +1745,7 @@ void MenuMan::drawActionDamage(int16 damage) { const char *displayString; int16 textPosX; - if (damage == kM1_damageCantReach) { + if (damage == kDMDamageCantReach) { textPosX = pos[0]; displayString = message[0]; } else { diff --git a/engines/dm/menus.h b/engines/dm/menus.h index 11232486d5..551fbda793 100644 --- a/engines/dm/menus.h +++ b/engines/dm/menus.h @@ -34,13 +34,20 @@ namespace DM { -#define kM1_damageCantReach -1 // @ CM1_DAMAGE_CANT_REACH -#define kM2_damageNoAmmunition -2 // @ CM2_DAMAGE_NO_AMMUNITION -#define k2_SpellAreaAvailableSymbols 2 // @ C2_SPELL_AREA_AVAILABLE_SYMBOLS -#define k3_SpellAreaChampionSymbols 3 // @ C3_SPELL_AREA_CHAMPION_SYMBOLS +enum Damage { + kDMDamageCantReach = -1, // @ CM1_DAMAGE_CANT_REACH + kDMDamageNoAmmunition = -2 // @ CM2_DAMAGE_NO_AMMUNITION +}; -#define k0x0080_actionRequiresCharge 0x0080 // @ MASK0x0080_ACTION_REQUIRES_CHARGE -#define k0x8000_hitNonMaterialCreatures 0x8000 // @ MASK0x8000_HIT_NON_MATERIAL_CREATURES +enum SpellArea { + kDMSpellAreaAvailableSymbols = 2, // @ C2_SPELL_AREA_AVAILABLE_SYMBOLS + kDMSpellAreaChampionSymbols = 3 // @ C3_SPELL_AREA_CHAMPION_SYMBOLS +}; + +enum ActionMask { + kDMActionMaskRequiresCharge = 0x0080, // @ MASK0x0080_ACTION_REQUIRES_CHARGE + kDMActionMaskHitNonMaterialCreatures = 0x8000 // @ MASK0x8000_HIT_NON_MATERIAL_CREATURES +}; class ActionList { public: @@ -129,7 +136,6 @@ public: void initConstants(); }; - } #endif // DM_MENUS_H diff --git a/engines/dm/movesens.cpp b/engines/dm/movesens.cpp index d22db51cfa..5ad6ac8451 100644 --- a/engines/dm/movesens.cpp +++ b/engines/dm/movesens.cpp @@ -334,11 +334,11 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM _vm->_dungeonMan->setCurrentMap(mapIndexSource); uint16 outcome = _vm->_groupMan->getDamageAllCreaturesOutcome((Group *)_vm->_dungeonMan->getThingData(thing), mapX, mapY, 20, false); _vm->_dungeonMan->setCurrentMap(mapIndexDestination); - fallKilledGroup = (outcome == k2_outcomeKilledAllCreaturesInGroup); + fallKilledGroup = (outcome == kDMKillOutcomeAllCreaturesInGroup); if (fallKilledGroup) break; - if (outcome == k1_outcomeKilledSomeCreaturesInGroup) + if (outcome == kDMKillOutcomeSomeCreaturesInGroup) _vm->_groupMan->dropMovingCreatureFixedPossession(thing, destMapX, destMapY); } } else if ((destinationSquareType == (int)kDMElementTypeStairs) && (thing != Thing::_party) && (thingType != kDMThingTypeProjectile)) { @@ -564,7 +564,7 @@ T0266017_CheckProjectileImpacts: int16 championOrCreatureOrdinal = championOrCreatureOrdinalInCell[curThing.getCell()]; if (championOrCreatureOrdinal && _vm->_projexpl->hasProjectileImpactOccurred(impactType, srcMapX, srcMapY, _vm->ordinalToIndex(championOrCreatureOrdinal), curThing)) { _vm->_projexpl->projectileDeleteEvent(curThing); - if (_vm->_projexpl->_creatureDamageOutcome == k2_outcomeKilledAllCreaturesInGroup) + if (_vm->_projexpl->_creatureDamageOutcome == kDMKillOutcomeAllCreaturesInGroup) return true; goto T0266017_CheckProjectileImpacts; diff --git a/engines/dm/movesens.h b/engines/dm/movesens.h index 5d2787fc0b..75bc0737b7 100644 --- a/engines/dm/movesens.h +++ b/engines/dm/movesens.h @@ -77,7 +77,6 @@ public: void createEventMoveGroup(Thing groupThing, int16 mapX, int16 mapY, int16 mapIndex, bool audible); // @ F0265_MOVE_CreateEvent60To61_MoveGroup Thing getObjectOfTypeInCell(int16 mapX, int16 mapY, int16 cell, int16 objectType); // @ F0273_SENSOR_GetObjectOfTypeInCell }; - } #endif diff --git a/engines/dm/objectman.cpp b/engines/dm/objectman.cpp index 5b3407b42a..20e3ceb2ad 100644 --- a/engines/dm/objectman.cpp +++ b/engines/dm/objectman.cpp @@ -98,7 +98,7 @@ void ObjectMan::initConstants() { } ObjectMan::ObjectMan(DMEngine *vm) : _vm(vm) { - for (uint16 i = 0; i < k199_ObjectNameCount; ++i) + for (uint16 i = 0; i < kDMObjectNameCount; ++i) _objectNames[i] = nullptr; _objectIconForMousePointer = nullptr; @@ -116,10 +116,10 @@ void ObjectMan::loadObjectNames() { _objectIconForMousePointer = new byte[16 * 16]; - char *objectNames = new char[dispMan.getCompressedDataSize(k556_ObjectNamesGraphicIndice) + k199_ObjectNameCount]; - Common::MemoryReadStream stream = dispMan.getCompressedData(k556_ObjectNamesGraphicIndice); + char *objectNames = new char[dispMan.getCompressedDataSize(kDMObjectNamesGraphicIndice) + kDMObjectNameCount]; + Common::MemoryReadStream stream = dispMan.getCompressedData(kDMObjectNamesGraphicIndice); - for (uint16 objNameIndex = 0; objNameIndex < k199_ObjectNameCount; ++objNameIndex) { + for (uint16 objNameIndex = 0; objNameIndex < kDMObjectNameCount; ++objNameIndex) { _objectNames[objNameIndex] = objectNames; byte tmpByte; @@ -221,7 +221,7 @@ void ObjectMan::drawIconInSlotBox(uint16 slotBoxIndex, int16 iconIndex) { int16 byteWidth; byte* blitDestination; int16 destHeight; - if (slotBoxIndex >= k8_SlotBoxInventoryFirstSlot) { + if (slotBoxIndex >= kDMSlotBoxInventoryFirstSlot) { blitDestination = _vm->_displayMan->_bitmapViewport; byteWidth = k112_byteWidthViewport; destHeight = 136; @@ -257,7 +257,7 @@ void ObjectMan::drawLeaderObjectName(Thing thing) { } else objectName = Common::String(_objectNames[iconIndex]); - _vm->_textMan->printWithTrailingSpaces(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, 233, 37, kDMColorCyan, kDMColorBlack, objectName.c_str(), k14_ObjectNameMaximumLength, k200_heightScreen); + _vm->_textMan->printWithTrailingSpaces(_vm->_displayMan->_bitmapScreen, k160_byteWidthScreen, 233, 37, kDMColorCyan, kDMColorBlack, objectName.c_str(), kDMObjectNameMaximumLength, k200_heightScreen); } IconIndice ObjectMan::getIconIndexInSlotBox(uint16 slotBoxIndex) { diff --git a/engines/dm/objectman.h b/engines/dm/objectman.h index 7a69d75566..0457788e2d 100644 --- a/engines/dm/objectman.h +++ b/engines/dm/objectman.h @@ -33,12 +33,9 @@ namespace DM { -#define k8_SlotBoxInventoryFirstSlot 8 // @ C08_SLOT_BOX_INVENTORY_FIRST_SLOT -#define k9_SlotBoxInventoryActionHand 9 // @ C09_SLOT_BOX_INVENTORY_ACTION_HAND - -#define k14_ObjectNameMaximumLength 14 // @ C014_OBJECT_NAME_MAXIMUM_LENGTH -#define k199_ObjectNameCount 199 // @ C199_OBJECT_NAME_COUNT -#define k556_ObjectNamesGraphicIndice 556 // @ C556_GRAPHIC_OBJECT_NAMES +#define kDMObjectNameMaximumLength 14 // @ C014_OBJECT_NAME_MAXIMUM_LENGTH +#define kDMObjectNameCount 199 // @ C199_OBJECT_NAME_COUNT +#define kDMObjectNamesGraphicIndice 556 // @ C556_GRAPHIC_OBJECT_NAMES class SlotBox { public: @@ -58,7 +55,7 @@ public: void loadObjectNames(); // @ F0031_OBJECT_LoadNames SlotBox _slotBoxes[46]; // @ G0030_as_Graphic562_SlotBoxes; - char *_objectNames[k199_ObjectNameCount]; // @ G0352_apc_ObjectNames + char *_objectNames[kDMObjectNameCount]; // @ G0352_apc_ObjectNames byte *_objectIconForMousePointer; // @ G0412_puc_Bitmap_ObjectIconForMousePointer IconIndice getObjectType(Thing thing); // @ F0032_OBJECT_GetType @@ -75,7 +72,6 @@ public: void initConstants(); }; - } #endif diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index dc08ee7f89..cc6cb9a523 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -76,7 +76,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in Projectile *projectileThingData = (Projectile *)_vm->_dungeonMan->getThingData(Thing(projectileThing)); bool removePotion = false; int16 potionPower = 0; - _creatureDamageOutcome = k0_outcomeKilledNoCreaturesInGroup; + _creatureDamageOutcome = kDMKillOutcomeNoCreaturesInGroup; Thing projectileAssociatedThing = projectileThingData->_slot; int16 projectileAssociatedThingType = projectileAssociatedThing.getType(); Potion *potion = nullptr; @@ -176,11 +176,11 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in attack = (uint16)((unsigned long)getProjectileImpactAttack(projectileThingData, projectileAssociatedThing) << 6) / curCreatureInfo->_defense; if (attack) { int16 outcome = _vm->_groupMan->groupGetDamageCreatureOutcome(curGroup, curCreatureIndex, projectileTargetMapX, projectileTargetMapY, attack + _vm->_groupMan->groupGetResistanceAdjustedPoisonAttack(curCreatureType, _projectilePoisonAttack), true); - if (outcome != k0_outcomeKilledNoCreaturesInGroup) + if (outcome != kDMKillOutcomeNoCreaturesInGroup) _vm->_groupMan->processEvents29to41(projectileTargetMapX, projectileTargetMapY, kM2_TMEventTypeCreateReactionEvent30HitByProjectile, 0); _creatureDamageOutcome = outcome; - if (!createExplosionOnImpact && (outcome == k0_outcomeKilledNoCreaturesInGroup) + if (!createExplosionOnImpact && (outcome == kDMKillOutcomeNoCreaturesInGroup) && (projectileAssociatedThingType == kDMThingTypeWeapon) && getFlag(curCreatureInfo->_attributes, kDMCreatureMaskKeepThrownSharpWeapon)) { Weapon *weapon = (Weapon *)_vm->_dungeonMan->getThingData(projectileAssociatedThing); @@ -349,14 +349,14 @@ void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo, int16 ProjExpl::projectileGetImpactCount(int16 impactType, int16 mapX, int16 mapY, int16 cell) { int16 impactCount = 0; - _creatureDamageOutcome = k0_outcomeKilledNoCreaturesInGroup; + _creatureDamageOutcome = kDMKillOutcomeNoCreaturesInGroup; for (Thing curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); curThing != Thing::_endOfList; ) { if (((curThing).getType() == kDMThingTypeProjectile) && ((curThing).getCell() == cell) && hasProjectileImpactOccurred(impactType, mapX, mapY, cell, curThing)) { projectileDeleteEvent(curThing); impactCount++; - if ((impactType == kDMElementTypeCreature) && (_creatureDamageOutcome == k2_outcomeKilledAllCreaturesInGroup)) + if ((impactType == kDMElementTypeCreature) && (_creatureDamageOutcome == kDMKillOutcomeAllCreaturesInGroup)) break; curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); @@ -539,7 +539,7 @@ void ProjExpl::processEvent25(TimelineEvent *event) { _vm->_championMan->getDamagedChampionCount(attack, kDMWoundNone, kDMAttackTypeNormal); else if ((groupThing != Thing::_endOfList) && (attack = _vm->_groupMan->groupGetResistanceAdjustedPoisonAttack(creatureType, attack)) - && (_vm->_groupMan->getDamageAllCreaturesOutcome(group, mapX, mapY, attack, true) != k2_outcomeKilledAllCreaturesInGroup) + && (_vm->_groupMan->getDamageAllCreaturesOutcome(group, mapX, mapY, attack, true) != kDMKillOutcomeAllCreaturesInGroup) && (attack > 2)) { _vm->_groupMan->processEvents29to41(mapX, mapY, kM3_TMEventTypeCreateReactionEvent29DangerOnSquare, 0); } diff --git a/engines/dm/projexpl.h b/engines/dm/projexpl.h index 7559fef361..c11d62ecbc 100644 --- a/engines/dm/projexpl.h +++ b/engines/dm/projexpl.h @@ -31,9 +31,11 @@ namespace DM { -#define k0_outcomeKilledNoCreaturesInGroup 0 // @ C0_OUTCOME_KILLED_NO_CREATURES_IN_GROUP -#define k1_outcomeKilledSomeCreaturesInGroup 1 // @ C1_OUTCOME_KILLED_SOME_CREATURES_IN_GROUP -#define k2_outcomeKilledAllCreaturesInGroup 2 // @ C2_OUTCOME_KILLED_ALL_CREATURES_IN_GROUP +enum KillOutcome { + kDMKillOutcomeNoCreaturesInGroup = 0, // @ C0_OUTCOME_KILLED_NO_CREATURES_IN_GROUP + kDMKillOutcomeSomeCreaturesInGroup = 1, // @ C1_OUTCOME_KILLED_SOME_CREATURES_IN_GROUP + kDMKillOutcomeAllCreaturesInGroup = 2 // @ C2_OUTCOME_KILLED_ALL_CREATURES_IN_GROUP +}; #define k00_soundMETALLIC_THUD 0 // @ C00_SOUND_METALLIC_THUD #define k01_soundSWITCH 1 // @ C01_SOUND_SWITCH diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp index 8c3f11c288..10c3aa07c6 100644 --- a/engines/dm/timeline.cpp +++ b/engines/dm/timeline.cpp @@ -412,7 +412,7 @@ void Timeline::processEventDoorAnimation(TimelineEvent *event) { uint16 creatureAttributes = _vm->_dungeonMan->getCreatureAttributes(groupThing); if ((groupThing != Thing::_endOfList) && !getFlag(creatureAttributes, kDMCreatureMaskNonMaterial)) { if (doorState >= (verticalDoorFl ? CreatureInfo::getHeight(creatureAttributes) : 1)) { /* Creature height or 1 */ - if (_vm->_groupMan->getDamageAllCreaturesOutcome((Group *)_vm->_dungeonMan->getThingData(groupThing), mapX, mapY, 5, true) != k2_outcomeKilledAllCreaturesInGroup) + if (_vm->_groupMan->getDamageAllCreaturesOutcome((Group *)_vm->_dungeonMan->getThingData(groupThing), mapX, mapY, 5, true) != kDMKillOutcomeAllCreaturesInGroup) _vm->_groupMan->processEvents29to41(mapX, mapY, kM3_TMEventTypeCreateReactionEvent29DangerOnSquare, 0); int16 nextState = doorState - 1; |