diff options
Diffstat (limited to 'engines/dm/projexpl.cpp')
-rw-r--r-- | engines/dm/projexpl.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index b30fb72dde..e4faa3f627 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -57,11 +57,11 @@ void ProjExpl::createProjectile(Thing thing, int16 mapX, int16 mapY, uint16 cell projectilePtr->_attack = attack; _vm->_dungeonMan->linkThingToList(projectileThing, Thing(0), mapX, mapY); /* Projectiles are added on the square and not 'moved' onto the square. In the case of a projectile launcher sensor, this means that the new projectile traverses the square in front of the launcher without any trouble: there is no impact if it is a wall, the projectile direction is not changed if it is a teleporter. Impacts with creatures and champions are still processed */ TimelineEvent newEvent; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_currMapIndex, _vm->_gameTime + 1); + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, _vm->_gameTime + 1); if (_createLauncherProjectile) - newEvent._type = k49_TMEventTypeMoveProjectile; /* Launcher projectiles can impact immediately */ + newEvent._type = kDMEventTypeMoveProjectile; /* Launcher projectiles can impact immediately */ else - newEvent._type = k48_TMEventTypeMoveProjectileIgnoreImpacts; /* Projectiles created by champions or creatures ignore impacts on their first movement */ + newEvent._type = kDMEventTypeMoveProjectileIgnoreImpacts; /* Projectiles created by champions or creatures ignore impacts on their first movement */ newEvent._priority = 0; newEvent._Bu._slot = projectileThing.toUint16(); @@ -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; @@ -118,7 +118,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in Door *curDoor = (Door *)_vm->_dungeonMan->getSquareFirstThingData(projectileTargetMapX, projectileTargetMapY); if ((curDoorState != kDMDoorStateDestroyed) && (projectileAssociatedThing == Thing::_explOpenDoor)) { if (curDoor->hasButton()) - _vm->_moveSens->addEvent(k10_TMEventTypeDoor, projectileTargetMapX, projectileTargetMapY, kDMCellNorthWest, kDMSensorEffectToggle, _vm->_gameTime + 1); + _vm->_moveSens->addEvent(kDMEventTypeDoor, projectileTargetMapX, projectileTargetMapY, kDMCellNorthWest, kDMSensorEffectToggle, _vm->_gameTime + 1); break; } @@ -163,26 +163,26 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in return false; curCreatureIndex--; - uint16 curCreatureType = curGroup->_type; + CreatureType curCreatureType = curGroup->_type; CreatureInfo *curCreatureInfo = &_vm->_dungeonMan->_creatureInfos[curCreatureType]; - if ((projectileAssociatedThing == Thing::_explFireBall) && (curCreatureType == k11_CreatureTypeBlackFlame)) { + if ((projectileAssociatedThing == Thing::_explFireBall) && (curCreatureType == kDMCreatureTypeBlackFlame)) { uint16 *curCreatureHealth = &curGroup->_health[curCreatureIndex]; *curCreatureHealth = MIN(1000, *curCreatureHealth + getProjectileImpactAttack(projectileThingData, projectileAssociatedThing)); goto T0217044; } - if (getFlag(curCreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial) && (projectileAssociatedThing != Thing::_explHarmNonMaterial)) + if (getFlag(curCreatureInfo->_attributes, kDMCreatureMaskNonMaterial) && (projectileAssociatedThing != Thing::_explHarmNonMaterial)) return false; 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) - _vm->_groupMan->processEvents29to41(projectileTargetMapX, projectileTargetMapY, kM2_TMEventTypeCreateReactionEvent30HitByProjectile, 0); + if (outcome != kDMKillOutcomeNoCreaturesInGroup) + _vm->_groupMan->processEvents29to41(projectileTargetMapX, projectileTargetMapY, kDMEventTypeCreateReactionHitByProjectile, 0); _creatureDamageOutcome = outcome; - if (!createExplosionOnImpact && (outcome == k0_outcomeKilledNoCreaturesInGroup) + if (!createExplosionOnImpact && (outcome == kDMKillOutcomeNoCreaturesInGroup) && (projectileAssociatedThingType == kDMThingTypeWeapon) - && getFlag(curCreatureInfo->_attributes, k0x0400_MaskCreatureInfo_keepThrownSharpWeapon)) { + && getFlag(curCreatureInfo->_attributes, kDMCreatureMaskKeepThrownSharpWeapon)) { Weapon *weapon = (Weapon *)_vm->_dungeonMan->getThingData(projectileAssociatedThing); WeaponType weaponType = weapon->getType(); if ((weaponType == kDMWeaponDagger) || (weaponType == kDMWeaponArrow) @@ -208,15 +208,15 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in } if ((projectileAssociatedThing == Thing::_explLightningBolt) && !(explosionAttack >>= 1)) goto T0217044; - createExplosion(projectileAssociatedThing, explosionAttack, mapXCombo, mapYCombo, (projectileAssociatedThing == Thing::_explPoisonCloud) ? (uint16)k255_CreatureTypeSingleCenteredCreature : cell); + createExplosion(projectileAssociatedThing, explosionAttack, mapXCombo, mapYCombo, (projectileAssociatedThing == Thing::_explPoisonCloud) ? (uint16)kDMCreatureTypeSingleCenteredCreature : cell); } else { uint16 soundIndex; if ((projectileAssociatedThing).getType() == kDMThingTypeWeapon) - soundIndex = k00_soundMETALLIC_THUD; + soundIndex = kDMSoundIndexMetallicThud; else if (projectileAssociatedThing == Thing::_explPoisonBolt) - soundIndex = k13_soundSPELL; + soundIndex = kDMSoundIndexSpell; else - soundIndex = k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM; + soundIndex = kDMSoundIndexWoodenThudAttackTrolinAntmanStoneGolem; _vm->_sound->requestPlay(soundIndex, projectileMapX, projectileMapY, kDMSoundModePlayIfPrioritized); } @@ -294,7 +294,7 @@ void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo, projectileMapY >>= 8; } - if (cell == k255_CreatureTypeSingleCenteredCreature) + if (cell == kDMCreatureTypeSingleCenteredCreature) explosion->setCentered(true); else { explosion->setCentered(false); @@ -304,15 +304,15 @@ void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo, explosion->setType(explThing.toUint16() - Thing::_firstExplosion.toUint16()); explosion->setAttack(attack); if (explThing.toUint16() < Thing::_explHarmNonMaterial.toUint16()) { - uint16 soundIndex = (attack > 80) ? k05_soundSTRONG_EXPLOSION : k20_soundWEAK_EXPLOSION; + uint16 soundIndex = (attack > 80) ? kDMSoundIndexStrongExplosion : kDMSoundIndexWeakExplosion; _vm->_sound->requestPlay(soundIndex, projectileMapX, projectileMapY, kDMSoundModePlayIfPrioritized); } else if (explThing != Thing::_explSmoke) - _vm->_sound->requestPlay(k13_soundSPELL, projectileMapX, projectileMapY, kDMSoundModePlayIfPrioritized); + _vm->_sound->requestPlay(kDMSoundIndexSpell, projectileMapX, projectileMapY, kDMSoundModePlayIfPrioritized); _vm->_dungeonMan->linkThingToList(unusedThing, Thing(0), projectileMapX, projectileMapY); TimelineEvent newEvent; - _vm->setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_currMapIndex, _vm->_gameTime + ((explThing == Thing::_explRebirthStep1) ? 5 : 1)); - newEvent._type = k25_TMEventTypeExplosion; + newEvent._mapTime = _vm->setMapAndTime(_vm->_dungeonMan->_currMapIndex, _vm->_gameTime + ((explThing == Thing::_explRebirthStep1) ? 5 : 1)); + newEvent._type = kDMEventTypeExplosion; newEvent._priority = 0; newEvent._Cu._slot = unusedThing.toUint16(); newEvent._Bu._location._mapX = projectileMapX; @@ -334,7 +334,7 @@ void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo, CreatureInfo *creatureInfo = &_vm->_dungeonMan->_creatureInfos[creatureGroup->_type]; int16 creatureFireResistance = creatureInfo->getFireResistance(); if (creatureFireResistance != kDMImmuneToFire) { - if (getFlag(creatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)) + if (getFlag(creatureInfo->_attributes, kDMCreatureMaskNonMaterial)) attack >>= 2; if ((attack -= _vm->getRandomNumber((creatureFireResistance << 1) + 1)) > 0) @@ -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); @@ -400,8 +400,8 @@ void ProjExpl::processEvents48To49(TimelineEvent *event) { int16 destinationMapX = curEvent->_Cu._projectile.getMapX(); int16 destinationMapY = curEvent->_Cu._projectile.getMapY(); - if (curEvent->_type == k48_TMEventTypeMoveProjectileIgnoreImpacts) - curEvent->_type = k49_TMEventTypeMoveProjectile; + if (curEvent->_type == kDMEventTypeMoveProjectileIgnoreImpacts) + curEvent->_type = kDMEventTypeMoveProjectile; else { uint16 projectileCurCell = projectileThingNewCell.getCell(); if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (destinationMapX == _vm->_dungeonMan->_partyMapX) && (destinationMapY == _vm->_dungeonMan->_partyMapY) && hasProjectileImpactOccurred(kDMElementTypeChampion, destinationMapX, destinationMapY, projectileCurCell, projectileThingNewCell)) @@ -453,7 +453,7 @@ void ProjExpl::processEvents48To49(TimelineEvent *event) { curEvent->_Cu._projectile.setMapY(_vm->_moveSens->_moveResultMapY); curEvent->_Cu._projectile.setDir((Direction)_vm->_moveSens->_moveResultDir); projectileThingNewCell = _vm->thingWithNewCell(projectileThingNewCell, _vm->_moveSens->_moveResultCell); - M31_setMap(curEvent->_mapTime, _vm->_moveSens->_moveResultMapIndex); + _vm->setMap(curEvent->_mapTime, _vm->_moveSens->_moveResultMapIndex); } else { if ((Square(_vm->_dungeonMan->getSquare(destinationMapX, destinationMapY)).getType() == kDMElementTypeDoor) && hasProjectileImpactOccurred(kDMElementTypeDoor, destinationMapX, destinationMapY, projectileNewCell, projectileThing)) return; @@ -480,7 +480,7 @@ void ProjExpl::processEvent25(TimelineEvent *event) { Group *group = nullptr; CreatureInfo *creatureInfo = nullptr; - uint16 creatureType = 0; + CreatureType creatureType; if (groupThing != Thing::_endOfList) { group = (Group *)_vm->_dungeonMan->getThingData(groupThing); creatureType = group->_type; @@ -508,15 +508,15 @@ void ProjExpl::processEvent25(TimelineEvent *event) { break; case 0xFF83: - if ((groupThing != Thing::_endOfList) && getFlag(creatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)) { - if ((creatureType == k19_CreatureTypeMaterializerZytaz) && (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex)) { + if ((groupThing != Thing::_endOfList) && getFlag(creatureInfo->_attributes, kDMCreatureMaskNonMaterial)) { + if ((creatureType == kDMCreatureTypeMaterializerZytaz) && (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex)) { int16 nonMaterialAdditionalAttack = attack >> 3; attack -= nonMaterialAdditionalAttack; nonMaterialAdditionalAttack <<= 1; nonMaterialAdditionalAttack++; int16 creatureCount = group->getCount(); do { - if (getFlag(_vm->_groupMan->_activeGroups[group->getActiveGroupIndex()]._aspect[creatureCount], k0x0080_MaskActiveGroupIsAttacking)) /* Materializer / Zytaz can only be damaged while they are attacking */ + if (getFlag(_vm->_groupMan->_activeGroups[group->getActiveGroupIndex()]._aspect[creatureCount], kDMAspectMaskActiveGroupIsAttacking)) /* Materializer / Zytaz can only be damaged while they are attacking */ _vm->_groupMan->groupGetDamageCreatureOutcome(group, creatureCount, mapX, mapY, attack + _vm->getRandomNumber(nonMaterialAdditionalAttack) + _vm->getRandomNumber(4), true); } while (--creatureCount >= 0); } else @@ -525,7 +525,7 @@ void ProjExpl::processEvent25(TimelineEvent *event) { break; case 0xFFE4: explosion->setType(explosion->getType() + 1); - _vm->_sound->requestPlay(k05_soundSTRONG_EXPLOSION, mapX, mapY, kDMSoundModePlayIfPrioritized); + _vm->_sound->requestPlay(kDMSoundIndexStrongExplosion, mapX, mapY, kDMSoundModePlayIfPrioritized); AddEventFl = true; break; case 0xFFA8: @@ -539,9 +539,9 @@ 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); + _vm->_groupMan->processEvents29to41(mapX, mapY, kDMEventTypeCreateReactionDangerOnSquare, 0); } if (explosion->getAttack() >= 6) { explosion->setAttack(explosion->getAttack() - 3); |