From c95b23317ce179fe168a20f39a132b4cd9ec4f32 Mon Sep 17 00:00:00 2001 From: Bendegúz Nagy Date: Thu, 7 Jul 2016 00:46:51 +0200 Subject: DM: Add some missing code --- engines/dm/projexpl.cpp | 418 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 418 insertions(+) create mode 100644 engines/dm/projexpl.cpp (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp new file mode 100644 index 0000000000..95d40bbaea --- /dev/null +++ b/engines/dm/projexpl.cpp @@ -0,0 +1,418 @@ +/* ScummVM - Graphic Adventure Engine +* +* ScummVM is the legal property of its developers, whose names +* are too numerous to list here. Please refer to the COPYRIGHT +* file distributed with this source distribution. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +* +*/ + +/* +* Based on the Reverse Engineering work of Christophe Fontanel, +* maintainer of the Dungeon Master Encyclopaedia (http://dmweb.free.fr/) +*/ + + +#include "projexpl.h" +#include "dungeonman.h" +#include "timeline.h" +#include "group.h" +#include "objectman.h" +#include "movesens.h" + +namespace DM { + +ProjExpl::ProjExpl(DMEngine* vm) : _vm(vm) { + _g361_lastCreatureAttackTime = -200; +} + +void ProjExpl::f212_projectileCreate(Thing thing, int16 mapX, int16 mapY, uint16 cell, direction dir, byte kineticEnergy, byte attack, byte stepEnergy) { + Thing L0466_T_ProjectileThing; + Projectile* L0467_ps_Projectile; + TimelineEvent L0468_s_Event; + + + if ((L0466_T_ProjectileThing = _vm->_dungeonMan->f166_getUnusedThing(k14_ProjectileThingType)) == 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; + } + L0466_T_ProjectileThing = M15_thingWithNewCell(L0466_T_ProjectileThing, cell); + L0467_ps_Projectile = (Projectile*)_vm->_dungeonMan->f156_getThingData(L0466_T_ProjectileThing); + L0467_ps_Projectile->_slot = thing; + L0467_ps_Projectile->_kineticEnergy = MIN((int16)kineticEnergy, (int16)255); + L0467_ps_Projectile->_attack = attack; + _vm->_dungeonMan->f163_linkThingToList(L0466_T_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 */ + M33_setMapAndTime(L0468_s_Event._mapTime, _vm->_dungeonMan->_g272_currMapIndex, _vm->_g313_gameTime + 1); + if (_g365_createLanucherProjectile) { + L0468_s_Event._type = k49_TMEventTypeMoveProjectile; /* Launcher projectiles can impact immediately */ + } else { + L0468_s_Event._type = k48_TMEventTypeMoveProjectileIgnoreImpacts; /* Projectiles created by champions or creatures ignore impacts on their first movement */ + } + L0468_s_Event._priority = 0; + L0468_s_Event._B._slot = L0466_T_ProjectileThing; + L0468_s_Event._C._projectile.setMapX(mapX); + L0468_s_Event._C._projectile.setMapY(mapY); + L0468_s_Event._C._projectile.setStepEnergy(stepEnergy); + L0468_s_Event._C._projectile.setDir(dir); + L0467_ps_Projectile->_eventIndex = _vm->_timeline->f238_addEventGetEventIndex(&L0468_s_Event); +} + +bool ProjExpl::f217_projectileHasImpactOccurred(int16 impactType, int16 mapXCombo, int16 mapYCombo, int16 cell, Thing projectileThing) { +#define AP0454_i_ProjectileTargetMapX mapXCombo +#define AP0455_i_ProjectileTargetMapY mapYCombo +#define AP0456_i_ChampionIndex cell + Projectile* L0490_ps_Projectile; + Group* L0491_ps_Group; + Thing L0486_T_ProjectileAssociatedThing; + int16 L0487_i_Multiple; +#define AL0487_i_DoorState L0487_i_Multiple +#define AL0487_i_IconIndex L0487_i_Multiple +#define AL0487_i_Outcome L0487_i_Multiple +#define AL0487_i_WeaponType L0487_i_Multiple + int16 L0488_i_Attack = 0; + Potion* L0492_ps_Potion = nullptr; + CreatureInfo* L0493_ps_CreatureInfo; + Door* L0494_ps_Door; + Weapon* L0495_ps_Weapon; + uint16* L0496_pui_CreatureHealth; + Thing* L0497_pT_GroupSlot; + Thing L0498_T_ExplosionThing; + int16 L0499_i_ProjectileMapX; + int16 L0500_i_ProjectileMapY; + int16 L0501_i_MapXCombo; + int16 L0502_i_MapYCombo; + byte L0503_uc_Square; + bool L0505_B_CreateExplosionOnImpact; + int16 L0489_i_ChampionAttack; + uint16 L0507_ui_Multiple; +#define AL0507_ui_ExplosionAttack L0507_ui_Multiple +#define AL0507_ui_SoundIndex L0507_ui_Multiple + int16 L0508_i_PotionPower = 0; + bool L0509_B_RemovePotion; + int16 L0510_i_ProjectileAssociatedThingType; + uint16 L0511_ui_CreatureType; + uint16 L0512_ui_CreatureIndex; + + L0490_ps_Projectile = (Projectile*)_vm->_dungeonMan->f156_getThingData(Thing(projectileThing)); + L0501_i_MapXCombo = mapXCombo; + L0502_i_MapYCombo = mapYCombo; + L0509_B_RemovePotion = false; + _g364_creatureDamageOutcome = k0_outcomeKilledNoCreaturesInGroup; + if ((L0510_i_ProjectileAssociatedThingType = (L0486_T_ProjectileAssociatedThing = L0490_ps_Projectile->_slot).getType()) == k8_PotionThingType) { + L0491_ps_Group = (Group*)_vm->_dungeonMan->f156_getThingData(L0486_T_ProjectileAssociatedThing); + switch (((Potion*)L0491_ps_Group)->getType()) { + case k3_PotionTypeVen: + L0498_T_ExplosionThing = Thing::_explPoisonCloud; + goto T0217004; + case k19_PotionTypeFulBomb: + L0498_T_ExplosionThing = Thing::_explFireBall; +T0217004: + L0509_B_RemovePotion = true; + L0508_i_PotionPower = ((Potion*)L0491_ps_Group)->getPower(); + L0492_ps_Potion = (Potion*)L0491_ps_Group; + } + } + L0505_B_CreateExplosionOnImpact = (L0510_i_ProjectileAssociatedThingType == k15_ExplosionThingType) && (L0486_T_ProjectileAssociatedThing != Thing::_explSlime) && (L0486_T_ProjectileAssociatedThing != Thing::_explPoisonBolt); + L0497_pT_GroupSlot = NULL; + L0489_i_ChampionAttack = 0; + if (mapXCombo <= 255) { + L0499_i_ProjectileMapX = mapXCombo; + L0500_i_ProjectileMapY = mapYCombo; + } else { + L0499_i_ProjectileMapX = (mapXCombo >> 8) - 1; + L0500_i_ProjectileMapY = (mapYCombo >> 8); + AP0454_i_ProjectileTargetMapX &= 0x00FF; + AP0455_i_ProjectileTargetMapY &= 0x00FF; + } + switch (impactType) { + case k4_DoorElemType: + AL0487_i_DoorState = Square(L0503_uc_Square = _vm->_dungeonMan->_g271_currMapData[AP0454_i_ProjectileTargetMapX][AP0455_i_ProjectileTargetMapY]).getDoorState(); + L0494_ps_Door = (Door*)_vm->_dungeonMan->f157_getSquareFirstThingData(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY); + if ((AL0487_i_DoorState != k5_doorState_DESTROYED) && (L0486_T_ProjectileAssociatedThing == Thing::_explOpenDoor)) { + if (L0494_ps_Door->hasButton()) { + _vm->_movsens->f268_addEvent(k10_TMEventTypeDoor, AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, 0, k2_SensorEffToggle, _vm->_g313_gameTime + 1); + } + break; + } + if ((AL0487_i_DoorState == k5_doorState_DESTROYED) || + (AL0487_i_DoorState <= k1_doorState_FOURTH) || + (getFlag(_vm->_dungeonMan->_g275_currMapDoorInfo[L0494_ps_Door->getType()]._attributes, k0x0002_MaskDoorInfo_ProjectilesCanPassThrough) && + ((L0510_i_ProjectileAssociatedThingType == k15_ExplosionThingType) ? + (L0486_T_ProjectileAssociatedThing.toUint16() >= Thing::_explHarmNonMaterial.toUint16()) : + ((L0490_ps_Projectile->_attack > _vm->getRandomNumber(128)) && + getFlag(g237_ObjectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(L0486_T_ProjectileAssociatedThing)].getAllowedSlots(), k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors) + && ((L0510_i_ProjectileAssociatedThingType != k10_JunkThingType) || + ((AL0487_i_IconIndex = _vm->_objectMan->f33_getIconIndex(L0486_T_ProjectileAssociatedThing)) < 0) || + (!((AL0487_i_IconIndex >= k176_IconIndiceJunkIronKey) && (AL0487_i_IconIndex <= k191_IconIndiceJunkMasterKey)))) + )))) { /* ASSEMBLY_COMPILATION_DIFFERENCE jmp */ + return false; + } + L0488_i_Attack = f216_projectileGetImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing) + 1; + _vm->_groupMan->f232_groupIsDoorDestoryedByAttack(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, L0488_i_Attack + _vm->getRandomNumber(L0488_i_Attack), false, 0); + break; + case kM2_ChampionElemType: + if ((AP0456_i_ChampionIndex = _vm->_championMan->f285_getIndexInCell(cell)) < 0) { + return false; + } + L0489_i_ChampionAttack = L0488_i_Attack = f216_projectileGetImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing); + break; + case kM1_CreatureElemType: + L0491_ps_Group = (Group*)_vm->_dungeonMan->f156_getThingData(_vm->_groupMan->f175_groupGetThing(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY)); + if (!(L0512_ui_CreatureIndex = _vm->_groupMan->f176_getCreatureOrdinalInCell(L0491_ps_Group, cell))) { + return false; + } + L0512_ui_CreatureIndex--; + L0493_ps_CreatureInfo = &g243_CreatureInfo[L0511_ui_CreatureType = L0491_ps_Group->_type]; + if ((L0486_T_ProjectileAssociatedThing == Thing::_explFireBall) && (L0511_ui_CreatureType == k11_CreatureTypeBlackFlame)) { + L0496_pui_CreatureHealth = &L0491_ps_Group->_health[L0512_ui_CreatureIndex]; + *L0496_pui_CreatureHealth = MIN(1000, *L0496_pui_CreatureHealth + f216_projectileGetImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing)); + goto T0217044; + } + if (getFlag(L0493_ps_CreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial) && (L0486_T_ProjectileAssociatedThing != Thing::_explHarmNonMaterial)) { + return false; + } + if (L0488_i_Attack = (uint16)((unsigned long)f216_projectileGetImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing) << 6) / L0493_ps_CreatureInfo->_defense) { + if ((AL0487_i_Outcome = _vm->_groupMan->f190_groupGetDamageCreatureOutcome(L0491_ps_Group, L0512_ui_CreatureIndex, AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, L0488_i_Attack + _vm->_groupMan->f192_groupGetResistanceAdjustedPoisonAttack(L0511_ui_CreatureType, _g366_projectilePoisonAttack), true)) != k0_outcomeKilledNoCreaturesInGroup) { + _vm->_groupMan->f209_processEvents29to41(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, kM2_TMEventTypeCreateReactionEvent30HitByProjectile, 0); + } + _g364_creatureDamageOutcome = AL0487_i_Outcome; + if (!L0505_B_CreateExplosionOnImpact && + (AL0487_i_Outcome == k0_outcomeKilledNoCreaturesInGroup) && + (L0510_i_ProjectileAssociatedThingType == k5_WeaponThingType) && + getFlag(L0493_ps_CreatureInfo->_attributes, k0x0400_MaskCreatureInfo_keepThrownSharpWeapon)) { + L0495_ps_Weapon = (Weapon*)_vm->_dungeonMan->f156_getThingData(L0486_T_ProjectileAssociatedThing); + AL0487_i_WeaponType = L0495_ps_Weapon->getType(); + if ((AL0487_i_WeaponType == k8_WeaponTypeDagger) || (AL0487_i_WeaponType == k27_WeaponTypeArrow) || (AL0487_i_WeaponType == k28_WeaponTypeSlayer) || (AL0487_i_WeaponType == k31_WeaponTypePoisonDart) || (AL0487_i_WeaponType == k32_WeaponTypeThrowingStar)) { + L0497_pT_GroupSlot = &L0491_ps_Group->_slot; + } + } + } + } + if (L0489_i_ChampionAttack && _vm->_championMan->f321_addPendingDamageAndWounds_getDamage(AP0456_i_ChampionIndex, L0488_i_Attack, k0x0004_ChampionWoundHead | k0x0008_ChampionWoundTorso, _g367_projectileAttackType) && _g366_projectilePoisonAttack && _vm->getRandomNumber(2)) { + _vm->_championMan->f322_championPoison(AP0456_i_ChampionIndex, _g366_projectilePoisonAttack); + } + if (L0505_B_CreateExplosionOnImpact || L0509_B_RemovePotion + ) { + if (L0509_B_RemovePotion) { + L0486_T_ProjectileAssociatedThing = L0498_T_ExplosionThing; + AL0507_ui_ExplosionAttack = L0508_i_PotionPower; + } else { + AL0507_ui_ExplosionAttack = L0490_ps_Projectile->_kineticEnergy; + } + if ((L0486_T_ProjectileAssociatedThing == Thing::_explLightningBolt) && !(AL0507_ui_ExplosionAttack >>= 1)) + goto T0217044; + f213_explosionCreate(L0486_T_ProjectileAssociatedThing, AL0507_ui_ExplosionAttack, L0501_i_MapXCombo, L0502_i_MapYCombo, (L0486_T_ProjectileAssociatedThing == Thing::_explPoisonCloud) ? k255_CreatureTypeSingleCenteredCreature : cell); + } else { + if ((L0486_T_ProjectileAssociatedThing).getType() == k5_WeaponThingType) { + AL0507_ui_SoundIndex = k00_soundMETALLIC_THUD; + } else { + if (L0486_T_ProjectileAssociatedThing == Thing::_explPoisonBolt) { + AL0507_ui_SoundIndex = k13_soundSPELL; + } else { + AL0507_ui_SoundIndex = k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM; + } + } + warning("MISSING CODE: F0064_SOUND_RequestPlay_CPSD"); + } +T0217044: + if (L0509_B_RemovePotion) { + L0492_ps_Potion->_nextThing = Thing::_none; + L0490_ps_Projectile->_slot = L0498_T_ExplosionThing; + } + _vm->_dungeonMan->f164_unlinkThingFromList(projectileThing, Thing(0), L0499_i_ProjectileMapX, L0500_i_ProjectileMapY); + f215_projectileDelete(projectileThing, L0497_pT_GroupSlot, L0499_i_ProjectileMapX, L0500_i_ProjectileMapY); + return true; +} + +uint16 ProjExpl::f216_projectileGetImpactAttack(Projectile* projectile, Thing thing) { + WeaponInfo* L0485_ps_WeaponInfo; + uint16 L0483_ui_Multiple; +#define AL0483_ui_ThingType L0483_ui_Multiple +#define AL0483_ui_Attack L0483_ui_Multiple + uint16 L0484_ui_KineticEnergy; + + + _g366_projectilePoisonAttack = 0; + _g367_projectileAttackType = k3_attackType_BLUNT; + + L0484_ui_KineticEnergy = projectile->_kineticEnergy; + if ((AL0483_ui_ThingType = (thing).getType()) != k15_ExplosionThingType) { + if (AL0483_ui_ThingType == k5_WeaponThingType) { + L0485_ps_WeaponInfo = _vm->_dungeonMan->f158_getWeaponInfo(thing); + AL0483_ui_Attack = L0485_ps_WeaponInfo->_kineticEnergy; + _g367_projectileAttackType = k3_attackType_BLUNT; + } else { + AL0483_ui_Attack = _vm->getRandomNumber(4); + } + AL0483_ui_Attack += _vm->_dungeonMan->f140_getObjectWeight(thing) >> 1; + } else { + if (thing == Thing::_explSlime) { + AL0483_ui_Attack = _vm->getRandomNumber(16); + _g366_projectilePoisonAttack = AL0483_ui_Attack + 10; + AL0483_ui_Attack += _vm->getRandomNumber(32); + } else { + if (thing.toUint16() >= Thing::_explHarmNonMaterial.toUint16()) { + _g367_projectileAttackType = k5_attackType_MAGIC; + if (thing == Thing::_explPoisonBolt) { + _g366_projectilePoisonAttack = L0484_ui_KineticEnergy; + return 1; + } + return 0; + } + _g367_projectileAttackType = k1_attackType_FIRE; + AL0483_ui_Attack = _vm->getRandomNumber(16) + _vm->getRandomNumber(16) + 10; + if (thing == Thing::_explLightningBolt) { + _g367_projectileAttackType = k7_attackType_LIGHTNING; + AL0483_ui_Attack *= 5; + } + } + } + AL0483_ui_Attack = ((AL0483_ui_Attack + L0484_ui_KineticEnergy) >> 4) + 1; + AL0483_ui_Attack += _vm->getRandomNumber((AL0483_ui_Attack >> 1) + 1) + _vm->getRandomNumber(4); + AL0483_ui_Attack = MAX(AL0483_ui_Attack >> 1, AL0483_ui_Attack - (32 - (projectile->_attack >> 3))); + return AL0483_ui_Attack; +} + +void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXCombo, uint16 mapYCombo, uint16 cell) { +#define AP0443_ui_ProjectileMapX mapXCombo +#define AP0444_ui_ProjectileMapY mapYCombo + Explosion* L0470_ps_Explosion; + CreatureInfo* L0471_ps_CreatureInfo; + Group* L0472_ps_Group; + Thing L0473_T_Thing; + int16 L0474_i_ProjectileTargetMapX; + int16 L0475_i_ProjectileTargetMapY; + int16 L0469_i_CreatureFireResistance; + TimelineEvent L0476_s_Event; + + + if ((L0473_T_Thing = _vm->_dungeonMan->f166_getUnusedThing(k15_ExplosionThingType)) == Thing::_none) { + return; + } + L0470_ps_Explosion = &((Explosion*)_vm->_dungeonMan->_g284_thingData[k15_ExplosionThingType])[(L0473_T_Thing).getIndex()]; + if (mapXCombo <= 255) { + L0474_i_ProjectileTargetMapX = mapXCombo; + L0475_i_ProjectileTargetMapY = mapYCombo; + } else { + L0474_i_ProjectileTargetMapX = mapXCombo & 0x00FF; + L0475_i_ProjectileTargetMapY = mapYCombo & 0x00FF; + AP0443_ui_ProjectileMapX >>= 8; + AP0443_ui_ProjectileMapX--; + AP0444_ui_ProjectileMapY >>= 8; + } + if (cell == k255_CreatureTypeSingleCenteredCreature) { + L0470_ps_Explosion->setCentered(true); + } else { + L0470_ps_Explosion->setCentered(false); + L0473_T_Thing = M15_thingWithNewCell(L0473_T_Thing, cell); + } + L0470_ps_Explosion->setType(explThing.toUint16() - Thing::_firstExplosion.toUint16()); + L0470_ps_Explosion->setAttack(attack); + if (explThing.toUint16() < Thing::_explHarmNonMaterial.toUint16()) { + warning("MISING CODE: F0064_SOUND_RequestPlay_CPSD"); + } else { + if (explThing != Thing::_explSmoke) { + warning("MISSING CODE: F0064_SOUND_RequestPlay_CPSD"); + } + } + _vm->_dungeonMan->f163_linkThingToList(L0473_T_Thing, Thing(0), AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY); + M33_setMapAndTime(L0476_s_Event._mapTime, _vm->_dungeonMan->_g272_currMapIndex, _vm->_g313_gameTime + ((explThing == Thing::_explRebirthStep1) ? 5 : 1)); + L0476_s_Event._type = k25_TMEventTypeExplosion; + L0476_s_Event._priority = 0; + L0476_s_Event._C._slot = L0473_T_Thing; + L0476_s_Event._B._location._mapX = AP0443_ui_ProjectileMapX; + L0476_s_Event._B._location._mapY = AP0444_ui_ProjectileMapY; + _vm->_timeline->f238_addEventGetEventIndex(&L0476_s_Event); + if ((explThing == Thing::_explLightningBolt) || (explThing == Thing::_explFireBall)) { + AP0443_ui_ProjectileMapX = L0474_i_ProjectileTargetMapX; + AP0444_ui_ProjectileMapY = L0475_i_ProjectileTargetMapY; + attack = (attack >> 1) + 1; + attack += _vm->getRandomNumber(attack) + 1; + if ((explThing == Thing::_explFireBall) || (attack >>= 1)) { + if ((_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex) && (AP0443_ui_ProjectileMapX == _vm->_dungeonMan->_g306_partyMapX) && (AP0444_ui_ProjectileMapY == _vm->_dungeonMan->_g307_partyMapY)) { + _vm->_championMan->f324_damageAll_getDamagedChampionCount(attack, k0x0001_ChampionWoundReadHand | k0x0002_ChampionWoundActionHand | k0x0004_ChampionWoundHead | k0x0008_ChampionWoundTorso | k0x0010_ChampionWoundLegs | k0x0020_ChampionWoundFeet, k1_attackType_FIRE); + } else { + if ((L0473_T_Thing = _vm->_groupMan->f175_groupGetThing(AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY)) != Thing::_endOfList) { /* ASSEMBLY_COMPILATION_DIFFERENCE jmp */ + L0472_ps_Group = (Group*)_vm->_dungeonMan->f156_getThingData(L0473_T_Thing); + L0471_ps_CreatureInfo = &g243_CreatureInfo[L0472_ps_Group->_type]; + if ((L0469_i_CreatureFireResistance = (L0471_ps_CreatureInfo->M60_getFireResistance())) != k15_immuneToFire) { + if (getFlag(L0471_ps_CreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)) { + attack >>= 2; + } + if ((attack -= _vm->getRandomNumber((L0469_i_CreatureFireResistance << 1) + 1)) > 0) { + _g364_creatureDamageOutcome = _vm->_groupMan->f191_getDamageAllCreaturesOutcome(L0472_ps_Group, AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY, attack, true); + } + } + } + } + } + } +} + +int16 ProjExpl::f218_projectileGetImpactCount(int16 impactType, int16 mapX, int16 mapY, int16 cell) { + Thing L0513_T_Thing; + int16 L0514_i_ImpactCount; + + + L0514_i_ImpactCount = 0; + _g364_creatureDamageOutcome = k0_outcomeKilledNoCreaturesInGroup; +T0218001: + L0513_T_Thing = _vm->_dungeonMan->f161_getSquareFirstThing(mapX, mapY); + while (L0513_T_Thing != Thing::_endOfList) { + if (((L0513_T_Thing).getType() == k14_ProjectileThingType) && + ((L0513_T_Thing).getCell() == cell) && + f217_projectileHasImpactOccurred(impactType, mapX, mapY, cell, L0513_T_Thing)) { + f214_projectileDeleteEvent(L0513_T_Thing); + L0514_i_ImpactCount++; + if ((impactType == kM1_CreatureElemType) && (_g364_creatureDamageOutcome == k2_outcomeKilledAllCreaturesInGroup)) + break; + goto T0218001; + } + L0513_T_Thing = _vm->_dungeonMan->f159_getNextThing(L0513_T_Thing); + } + return L0514_i_ImpactCount; +} + +void ProjExpl::f214_projectileDeleteEvent(Thing thing) { + Projectile* L0477_ps_Projectile; + + + L0477_ps_Projectile = (Projectile*)_vm->_dungeonMan->f156_getThingData(thing); + _vm->_timeline->f237_deleteEvent(L0477_ps_Projectile->_eventIndex); +} + +void ProjExpl::f215_projectileDelete(Thing projectileThing, Thing* groupSlot, int16 mapX, int16 mapY) { + Thing L0478_T_PreviousThing; + Thing L0479_T_Thing; + Projectile* L0480_ps_Projectile; + Thing* L0481_ps_Generic; + + L0480_ps_Projectile = (Projectile*)_vm->_dungeonMan->f156_getThingData(projectileThing); + if ((L0479_T_Thing = L0480_ps_Projectile->_slot).getType() != k15_ExplosionThingType) { + if (groupSlot != NULL) { + if ((L0478_T_PreviousThing = *groupSlot) == Thing::_endOfList) { + L0481_ps_Generic = (Thing*)_vm->_dungeonMan->f156_getThingData(L0479_T_Thing); + *L0481_ps_Generic = Thing::_endOfList; + *groupSlot = L0479_T_Thing; + } else { + _vm->_dungeonMan->f163_linkThingToList(L0479_T_Thing, L0478_T_PreviousThing, kM1_MapXNotOnASquare, 0); + } + } else { + _vm->_movsens->f267_getMoveResult(Thing((L0479_T_Thing).getTypeAndIndex() | getFlag(projectileThing.toUint16(), 0xC)), -2, 0, mapX, mapY); + } + } + L0480_ps_Projectile->_nextThing = Thing::_none; +} +} -- cgit v1.2.3 From 723c96fffe2d0eb1775983f3059828ac58354a0e Mon Sep 17 00:00:00 2001 From: Bendegúz Nagy Date: Fri, 26 Aug 2016 22:50:01 +0200 Subject: DM: Clean up some initialization --- engines/dm/projexpl.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 95d40bbaea..5ce7b20fd2 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -36,7 +36,13 @@ namespace DM { ProjExpl::ProjExpl(DMEngine* vm) : _vm(vm) { + _g364_creatureDamageOutcome = 0; + _g363_secondaryDirToOrFromParty = 0; _g361_lastCreatureAttackTime = -200; + _g365_createLanucherProjectile = false; + _g366_projectilePoisonAttack = 0; + _g367_projectileAttackType = 0; + _g362_lastPartyMovementTime = 0; } void ProjExpl::f212_projectileCreate(Thing thing, int16 mapX, int16 mapY, uint16 cell, direction dir, byte kineticEnergy, byte attack, byte stepEnergy) { -- cgit v1.2.3 From 0a0e79357d2495e376e3be408e0272072a96d233 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 7 Jul 2016 23:14:40 +0200 Subject: DM: Fix compilation using MSVC9 --- engines/dm/projexpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 5ce7b20fd2..f773ffbc58 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -67,7 +67,7 @@ void ProjExpl::f212_projectileCreate(Thing thing, int16 mapX, int16 mapY, uint16 L0468_s_Event._type = k48_TMEventTypeMoveProjectileIgnoreImpacts; /* Projectiles created by champions or creatures ignore impacts on their first movement */ } L0468_s_Event._priority = 0; - L0468_s_Event._B._slot = L0466_T_ProjectileThing; + L0468_s_Event._B._slot = L0466_T_ProjectileThing.toUint16(); L0468_s_Event._C._projectile.setMapX(mapX); L0468_s_Event._C._projectile.setMapY(mapY); L0468_s_Event._C._projectile.setStepEnergy(stepEnergy); @@ -337,7 +337,7 @@ void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXC M33_setMapAndTime(L0476_s_Event._mapTime, _vm->_dungeonMan->_g272_currMapIndex, _vm->_g313_gameTime + ((explThing == Thing::_explRebirthStep1) ? 5 : 1)); L0476_s_Event._type = k25_TMEventTypeExplosion; L0476_s_Event._priority = 0; - L0476_s_Event._C._slot = L0473_T_Thing; + L0476_s_Event._C._slot = L0473_T_Thing.toUint16(); L0476_s_Event._B._location._mapX = AP0443_ui_ProjectileMapX; L0476_s_Event._B._location._mapY = AP0444_ui_ProjectileMapY; _vm->_timeline->f238_addEventGetEventIndex(&L0476_s_Event); -- cgit v1.2.3 From 8504f944e07d4a73f570e642476ae1819eb28568 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 7 Jul 2016 23:27:13 +0200 Subject: DM: Fix style used for pointer casts --- engines/dm/projexpl.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index f773ffbc58..4c0821487d 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -55,7 +55,7 @@ void ProjExpl::f212_projectileCreate(Thing thing, int16 mapX, int16 mapY, uint16 return; } L0466_T_ProjectileThing = M15_thingWithNewCell(L0466_T_ProjectileThing, cell); - L0467_ps_Projectile = (Projectile*)_vm->_dungeonMan->f156_getThingData(L0466_T_ProjectileThing); + L0467_ps_Projectile = (Projectile *)_vm->_dungeonMan->f156_getThingData(L0466_T_ProjectileThing); L0467_ps_Projectile->_slot = thing; L0467_ps_Projectile->_kineticEnergy = MIN((int16)kineticEnergy, (int16)255); L0467_ps_Projectile->_attack = attack; @@ -111,14 +111,14 @@ bool ProjExpl::f217_projectileHasImpactOccurred(int16 impactType, int16 mapXComb uint16 L0511_ui_CreatureType; uint16 L0512_ui_CreatureIndex; - L0490_ps_Projectile = (Projectile*)_vm->_dungeonMan->f156_getThingData(Thing(projectileThing)); + L0490_ps_Projectile = (Projectile *)_vm->_dungeonMan->f156_getThingData(Thing(projectileThing)); L0501_i_MapXCombo = mapXCombo; L0502_i_MapYCombo = mapYCombo; L0509_B_RemovePotion = false; _g364_creatureDamageOutcome = k0_outcomeKilledNoCreaturesInGroup; if ((L0510_i_ProjectileAssociatedThingType = (L0486_T_ProjectileAssociatedThing = L0490_ps_Projectile->_slot).getType()) == k8_PotionThingType) { - L0491_ps_Group = (Group*)_vm->_dungeonMan->f156_getThingData(L0486_T_ProjectileAssociatedThing); - switch (((Potion*)L0491_ps_Group)->getType()) { + L0491_ps_Group = (Group *)_vm->_dungeonMan->f156_getThingData(L0486_T_ProjectileAssociatedThing); + switch (((Potion *)L0491_ps_Group)->getType()) { case k3_PotionTypeVen: L0498_T_ExplosionThing = Thing::_explPoisonCloud; goto T0217004; @@ -126,8 +126,8 @@ bool ProjExpl::f217_projectileHasImpactOccurred(int16 impactType, int16 mapXComb L0498_T_ExplosionThing = Thing::_explFireBall; T0217004: L0509_B_RemovePotion = true; - L0508_i_PotionPower = ((Potion*)L0491_ps_Group)->getPower(); - L0492_ps_Potion = (Potion*)L0491_ps_Group; + L0508_i_PotionPower = ((Potion *)L0491_ps_Group)->getPower(); + L0492_ps_Potion = (Potion *)L0491_ps_Group; } } L0505_B_CreateExplosionOnImpact = (L0510_i_ProjectileAssociatedThingType == k15_ExplosionThingType) && (L0486_T_ProjectileAssociatedThing != Thing::_explSlime) && (L0486_T_ProjectileAssociatedThing != Thing::_explPoisonBolt); @@ -145,7 +145,7 @@ T0217004: switch (impactType) { case k4_DoorElemType: AL0487_i_DoorState = Square(L0503_uc_Square = _vm->_dungeonMan->_g271_currMapData[AP0454_i_ProjectileTargetMapX][AP0455_i_ProjectileTargetMapY]).getDoorState(); - L0494_ps_Door = (Door*)_vm->_dungeonMan->f157_getSquareFirstThingData(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY); + L0494_ps_Door = (Door *)_vm->_dungeonMan->f157_getSquareFirstThingData(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY); if ((AL0487_i_DoorState != k5_doorState_DESTROYED) && (L0486_T_ProjectileAssociatedThing == Thing::_explOpenDoor)) { if (L0494_ps_Door->hasButton()) { _vm->_movsens->f268_addEvent(k10_TMEventTypeDoor, AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, 0, k2_SensorEffToggle, _vm->_g313_gameTime + 1); @@ -175,7 +175,7 @@ T0217004: L0489_i_ChampionAttack = L0488_i_Attack = f216_projectileGetImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing); break; case kM1_CreatureElemType: - L0491_ps_Group = (Group*)_vm->_dungeonMan->f156_getThingData(_vm->_groupMan->f175_groupGetThing(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY)); + L0491_ps_Group = (Group *)_vm->_dungeonMan->f156_getThingData(_vm->_groupMan->f175_groupGetThing(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY)); if (!(L0512_ui_CreatureIndex = _vm->_groupMan->f176_getCreatureOrdinalInCell(L0491_ps_Group, cell))) { return false; } @@ -198,7 +198,7 @@ T0217004: (AL0487_i_Outcome == k0_outcomeKilledNoCreaturesInGroup) && (L0510_i_ProjectileAssociatedThingType == k5_WeaponThingType) && getFlag(L0493_ps_CreatureInfo->_attributes, k0x0400_MaskCreatureInfo_keepThrownSharpWeapon)) { - L0495_ps_Weapon = (Weapon*)_vm->_dungeonMan->f156_getThingData(L0486_T_ProjectileAssociatedThing); + L0495_ps_Weapon = (Weapon *)_vm->_dungeonMan->f156_getThingData(L0486_T_ProjectileAssociatedThing); AL0487_i_WeaponType = L0495_ps_Weapon->getType(); if ((AL0487_i_WeaponType == k8_WeaponTypeDagger) || (AL0487_i_WeaponType == k27_WeaponTypeArrow) || (AL0487_i_WeaponType == k28_WeaponTypeSlayer) || (AL0487_i_WeaponType == k31_WeaponTypePoisonDart) || (AL0487_i_WeaponType == k32_WeaponTypeThrowingStar)) { L0497_pT_GroupSlot = &L0491_ps_Group->_slot; @@ -307,7 +307,7 @@ void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXC if ((L0473_T_Thing = _vm->_dungeonMan->f166_getUnusedThing(k15_ExplosionThingType)) == Thing::_none) { return; } - L0470_ps_Explosion = &((Explosion*)_vm->_dungeonMan->_g284_thingData[k15_ExplosionThingType])[(L0473_T_Thing).getIndex()]; + L0470_ps_Explosion = &((Explosion *)_vm->_dungeonMan->_g284_thingData[k15_ExplosionThingType])[(L0473_T_Thing).getIndex()]; if (mapXCombo <= 255) { L0474_i_ProjectileTargetMapX = mapXCombo; L0475_i_ProjectileTargetMapY = mapYCombo; @@ -351,7 +351,7 @@ void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXC _vm->_championMan->f324_damageAll_getDamagedChampionCount(attack, k0x0001_ChampionWoundReadHand | k0x0002_ChampionWoundActionHand | k0x0004_ChampionWoundHead | k0x0008_ChampionWoundTorso | k0x0010_ChampionWoundLegs | k0x0020_ChampionWoundFeet, k1_attackType_FIRE); } else { if ((L0473_T_Thing = _vm->_groupMan->f175_groupGetThing(AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY)) != Thing::_endOfList) { /* ASSEMBLY_COMPILATION_DIFFERENCE jmp */ - L0472_ps_Group = (Group*)_vm->_dungeonMan->f156_getThingData(L0473_T_Thing); + L0472_ps_Group = (Group *)_vm->_dungeonMan->f156_getThingData(L0473_T_Thing); L0471_ps_CreatureInfo = &g243_CreatureInfo[L0472_ps_Group->_type]; if ((L0469_i_CreatureFireResistance = (L0471_ps_CreatureInfo->M60_getFireResistance())) != k15_immuneToFire) { if (getFlag(L0471_ps_CreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)) { @@ -395,7 +395,7 @@ void ProjExpl::f214_projectileDeleteEvent(Thing thing) { Projectile* L0477_ps_Projectile; - L0477_ps_Projectile = (Projectile*)_vm->_dungeonMan->f156_getThingData(thing); + L0477_ps_Projectile = (Projectile *)_vm->_dungeonMan->f156_getThingData(thing); _vm->_timeline->f237_deleteEvent(L0477_ps_Projectile->_eventIndex); } @@ -405,11 +405,11 @@ void ProjExpl::f215_projectileDelete(Thing projectileThing, Thing* groupSlot, in Projectile* L0480_ps_Projectile; Thing* L0481_ps_Generic; - L0480_ps_Projectile = (Projectile*)_vm->_dungeonMan->f156_getThingData(projectileThing); + L0480_ps_Projectile = (Projectile *)_vm->_dungeonMan->f156_getThingData(projectileThing); if ((L0479_T_Thing = L0480_ps_Projectile->_slot).getType() != k15_ExplosionThingType) { if (groupSlot != NULL) { if ((L0478_T_PreviousThing = *groupSlot) == Thing::_endOfList) { - L0481_ps_Generic = (Thing*)_vm->_dungeonMan->f156_getThingData(L0479_T_Thing); + L0481_ps_Generic = (Thing *)_vm->_dungeonMan->f156_getThingData(L0479_T_Thing); *L0481_ps_Generic = Thing::_endOfList; *groupSlot = L0479_T_Thing; } else { -- cgit v1.2.3 From af42277a93bfb9286c6487f0820d45899547f55f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 10 Jul 2016 12:23:27 +0200 Subject: DM: Reduce some variable scopes, silent CppCheck warnings --- engines/dm/projexpl.cpp | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 4c0821487d..c312be1f4b 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -294,20 +294,14 @@ uint16 ProjExpl::f216_projectileGetImpactAttack(Projectile* projectile, Thing th void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXCombo, uint16 mapYCombo, uint16 cell) { #define AP0443_ui_ProjectileMapX mapXCombo #define AP0444_ui_ProjectileMapY mapYCombo - Explosion* L0470_ps_Explosion; - CreatureInfo* L0471_ps_CreatureInfo; - Group* L0472_ps_Group; - Thing L0473_T_Thing; - int16 L0474_i_ProjectileTargetMapX; - int16 L0475_i_ProjectileTargetMapY; - int16 L0469_i_CreatureFireResistance; - TimelineEvent L0476_s_Event; - - - if ((L0473_T_Thing = _vm->_dungeonMan->f166_getUnusedThing(k15_ExplosionThingType)) == Thing::_none) { + Thing L0473_T_Thing = _vm->_dungeonMan->f166_getUnusedThing(k15_ExplosionThingType); + if (L0473_T_Thing == Thing::_none) { return; } - L0470_ps_Explosion = &((Explosion *)_vm->_dungeonMan->_g284_thingData[k15_ExplosionThingType])[(L0473_T_Thing).getIndex()]; + + Explosion *L0470_ps_Explosion = &((Explosion *)_vm->_dungeonMan->_g284_thingData[k15_ExplosionThingType])[(L0473_T_Thing).getIndex()]; + int16 L0474_i_ProjectileTargetMapX; + int16 L0475_i_ProjectileTargetMapY; if (mapXCombo <= 255) { L0474_i_ProjectileTargetMapX = mapXCombo; L0475_i_ProjectileTargetMapY = mapYCombo; @@ -334,6 +328,7 @@ void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXC } } _vm->_dungeonMan->f163_linkThingToList(L0473_T_Thing, Thing(0), AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY); + TimelineEvent L0476_s_Event; M33_setMapAndTime(L0476_s_Event._mapTime, _vm->_dungeonMan->_g272_currMapIndex, _vm->_g313_gameTime + ((explThing == Thing::_explRebirthStep1) ? 5 : 1)); L0476_s_Event._type = k25_TMEventTypeExplosion; L0476_s_Event._priority = 0; @@ -351,9 +346,10 @@ void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXC _vm->_championMan->f324_damageAll_getDamagedChampionCount(attack, k0x0001_ChampionWoundReadHand | k0x0002_ChampionWoundActionHand | k0x0004_ChampionWoundHead | k0x0008_ChampionWoundTorso | k0x0010_ChampionWoundLegs | k0x0020_ChampionWoundFeet, k1_attackType_FIRE); } else { if ((L0473_T_Thing = _vm->_groupMan->f175_groupGetThing(AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY)) != Thing::_endOfList) { /* ASSEMBLY_COMPILATION_DIFFERENCE jmp */ - L0472_ps_Group = (Group *)_vm->_dungeonMan->f156_getThingData(L0473_T_Thing); - L0471_ps_CreatureInfo = &g243_CreatureInfo[L0472_ps_Group->_type]; - if ((L0469_i_CreatureFireResistance = (L0471_ps_CreatureInfo->M60_getFireResistance())) != k15_immuneToFire) { + Group *L0472_ps_Group = (Group *)_vm->_dungeonMan->f156_getThingData(L0473_T_Thing); + CreatureInfo *L0471_ps_CreatureInfo = &g243_CreatureInfo[L0472_ps_Group->_type]; + int16 L0469_i_CreatureFireResistance = L0471_ps_CreatureInfo->M60_getFireResistance(); + if (L0469_i_CreatureFireResistance != k15_immuneToFire) { if (getFlag(L0471_ps_CreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)) { attack >>= 2; } @@ -400,16 +396,13 @@ void ProjExpl::f214_projectileDeleteEvent(Thing thing) { } void ProjExpl::f215_projectileDelete(Thing projectileThing, Thing* groupSlot, int16 mapX, int16 mapY) { - Thing L0478_T_PreviousThing; - Thing L0479_T_Thing; - Projectile* L0480_ps_Projectile; - Thing* L0481_ps_Generic; - - L0480_ps_Projectile = (Projectile *)_vm->_dungeonMan->f156_getThingData(projectileThing); - if ((L0479_T_Thing = L0480_ps_Projectile->_slot).getType() != k15_ExplosionThingType) { + Projectile *L0480_ps_Projectile = (Projectile *)_vm->_dungeonMan->f156_getThingData(projectileThing); + Thing L0479_T_Thing = L0480_ps_Projectile->_slot; + if (L0479_T_Thing.getType() != k15_ExplosionThingType) { if (groupSlot != NULL) { - if ((L0478_T_PreviousThing = *groupSlot) == Thing::_endOfList) { - L0481_ps_Generic = (Thing *)_vm->_dungeonMan->f156_getThingData(L0479_T_Thing); + Thing L0478_T_PreviousThing = *groupSlot; + if (L0478_T_PreviousThing == Thing::_endOfList) { + Thing *L0481_ps_Generic = (Thing *)_vm->_dungeonMan->f156_getThingData(L0479_T_Thing); *L0481_ps_Generic = Thing::_endOfList; *groupSlot = L0479_T_Thing; } else { -- cgit v1.2.3 From 9c4236d0392f8e8c844566d8af9cb514d91b56d0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 10 Jul 2016 12:34:41 +0200 Subject: DM: Remove extra parenthesis --- engines/dm/projexpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index c312be1f4b..97240bc929 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -254,7 +254,7 @@ uint16 ProjExpl::f216_projectileGetImpactAttack(Projectile* projectile, Thing th _g367_projectileAttackType = k3_attackType_BLUNT; L0484_ui_KineticEnergy = projectile->_kineticEnergy; - if ((AL0483_ui_ThingType = (thing).getType()) != k15_ExplosionThingType) { + if ((AL0483_ui_ThingType = thing.getType()) != k15_ExplosionThingType) { if (AL0483_ui_ThingType == k5_WeaponThingType) { L0485_ps_WeaponInfo = _vm->_dungeonMan->f158_getWeaponInfo(thing); AL0483_ui_Attack = L0485_ps_WeaponInfo->_kineticEnergy; -- cgit v1.2.3 From 14bef5326a0c9939c3a8d669ffba7e2d86ddf295 Mon Sep 17 00:00:00 2001 From: Bendegúz Nagy Date: Mon, 11 Jul 2016 11:37:01 +0200 Subject: DM: Add warning with repeat parameter --- engines/dm/projexpl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 97240bc929..94d9d21847 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -230,7 +230,7 @@ T0217004: AL0507_ui_SoundIndex = k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM; } } - warning("MISSING CODE: F0064_SOUND_RequestPlay_CPSD"); + warning(false, "MISSING CODE: F0064_SOUND_RequestPlay_CPSD"); } T0217044: if (L0509_B_RemovePotion) { @@ -321,10 +321,10 @@ void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXC L0470_ps_Explosion->setType(explThing.toUint16() - Thing::_firstExplosion.toUint16()); L0470_ps_Explosion->setAttack(attack); if (explThing.toUint16() < Thing::_explHarmNonMaterial.toUint16()) { - warning("MISING CODE: F0064_SOUND_RequestPlay_CPSD"); + warning(false, "MISING CODE: F0064_SOUND_RequestPlay_CPSD"); } else { if (explThing != Thing::_explSmoke) { - warning("MISSING CODE: F0064_SOUND_RequestPlay_CPSD"); + warning(false, "MISSING CODE: F0064_SOUND_RequestPlay_CPSD"); } } _vm->_dungeonMan->f163_linkThingToList(L0473_T_Thing, Thing(0), AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY); -- cgit v1.2.3 From 12f06fd1d9460524ba8e9307a89edc1454516c27 Mon Sep 17 00:00:00 2001 From: Bendegúz Nagy Date: Mon, 11 Jul 2016 15:20:00 +0200 Subject: DM: Add f219_processEvents48To49_projectile --- engines/dm/projexpl.cpp | 86 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 94d9d21847..53b3f3afef 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -414,4 +414,90 @@ void ProjExpl::f215_projectileDelete(Thing projectileThing, Thing* groupSlot, in } L0480_ps_Projectile->_nextThing = Thing::_none; } + +void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) { + TimelineEvent* L0519_ps_Event; + Projectile* L0520_ps_Projectile; + Thing L0515_T_ProjectileThingNewCell; + uint16 L0516_ui_Multiple; +#define AL0516_ui_StepEnergy L0516_ui_Multiple +#define AL0516_ui_Square L0516_ui_Multiple + Thing L0521_T_ProjectileThing; + uint16 L0517_ui_ProjectileDirection; + bool L0522_B_ProjectileMovesToOtherSquare; + int16 L0523_i_DestinationMapX; + int16 L0524_i_DestinationMapY; + uint16 L0518_ui_Cell; + int16 L0525_i_SourceMapX; + int16 L0526_i_SourceMapY; + TimelineEvent L0527_s_Event; + + + L0527_s_Event = *event; + L0519_ps_Event = &L0527_s_Event; + L0520_ps_Projectile = (Projectile*)_vm->_dungeonMan->f156_getThingData(L0521_T_ProjectileThing = L0515_T_ProjectileThingNewCell = Thing(L0519_ps_Event->_B._slot)); + L0523_i_DestinationMapX = L0519_ps_Event->_C._projectile.getMapX(); + L0524_i_DestinationMapY = L0519_ps_Event->_C._projectile.getMapY(); + if (L0519_ps_Event->_type == k48_TMEventTypeMoveProjectileIgnoreImpacts) { + L0519_ps_Event->_type = k49_TMEventTypeMoveProjectile; + } else { + L0518_ui_Cell = (L0515_T_ProjectileThingNewCell).getCell(); + if ((_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex) && (L0523_i_DestinationMapX == _vm->_dungeonMan->_g306_partyMapX) && (L0524_i_DestinationMapY == _vm->_dungeonMan->_g307_partyMapY) && f217_projectileHasImpactOccurred(kM2_ChampionElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0515_T_ProjectileThingNewCell)) { + return; + } + if ((_vm->_groupMan->f175_groupGetThing(L0523_i_DestinationMapX, L0524_i_DestinationMapY) != Thing::_endOfList) && f217_projectileHasImpactOccurred(kM1_CreatureElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0521_T_ProjectileThing)) { + return; + } + if (L0520_ps_Projectile->_kineticEnergy <= (AL0516_ui_StepEnergy = L0519_ps_Event->_C._projectile.getStepEnergy())) { + _vm->_dungeonMan->f164_unlinkThingFromList(L0515_T_ProjectileThingNewCell = L0521_T_ProjectileThing, Thing(0), L0523_i_DestinationMapX, L0524_i_DestinationMapY); + f215_projectileDelete(L0515_T_ProjectileThingNewCell, NULL, L0523_i_DestinationMapX, L0524_i_DestinationMapY); + return; + } + L0520_ps_Projectile->_kineticEnergy -= AL0516_ui_StepEnergy; + if (L0520_ps_Projectile->_attack < AL0516_ui_StepEnergy) { + L0520_ps_Projectile->_attack = 0; + } else { + L0520_ps_Projectile->_attack -= AL0516_ui_StepEnergy; + } + } + if (L0522_B_ProjectileMovesToOtherSquare = ((L0517_ui_ProjectileDirection = L0519_ps_Event->_C._projectile.getDir()) == (L0518_ui_Cell = (L0515_T_ProjectileThingNewCell = Thing(L0519_ps_Event->_B._slot)).getCell())) || (returnNextVal(L0517_ui_ProjectileDirection) == L0518_ui_Cell)) { + L0525_i_SourceMapX = L0523_i_DestinationMapX; + L0526_i_SourceMapY = L0524_i_DestinationMapY; + L0523_i_DestinationMapX += _vm->_dirIntoStepCountEast[L0517_ui_ProjectileDirection], L0524_i_DestinationMapY += _vm->_dirIntoStepCountNorth[L0517_ui_ProjectileDirection]; + if ((Square(AL0516_ui_Square = _vm->_dungeonMan->f151_getSquare(L0523_i_DestinationMapX, L0524_i_DestinationMapY).toByte()).getType() == k0_ElementTypeWall) || + ((Square(AL0516_ui_Square).getType() == k6_ElementTypeFakeWall) && !getFlag(AL0516_ui_Square, (k0x0001_FakeWallImaginary | k0x0004_FakeWallOpen))) || + ((Square(AL0516_ui_Square).getType() == k3_ElementTypeStairs) && (Square(_vm->_dungeonMan->_g271_currMapData[L0525_i_SourceMapX][L0526_i_SourceMapY]).getType() == k3_ElementTypeStairs))) { + if (f217_projectileHasImpactOccurred(Square(AL0516_ui_Square).getType(), L0525_i_SourceMapX, L0526_i_SourceMapY, L0518_ui_Cell, L0515_T_ProjectileThingNewCell)) { + return; + } + } + } + if ((L0517_ui_ProjectileDirection & 0x0001) == (L0518_ui_Cell & 0x0001)) { + L0518_ui_Cell--; + } else { + L0518_ui_Cell++; + } + L0515_T_ProjectileThingNewCell = M15_thingWithNewCell(L0515_T_ProjectileThingNewCell, L0518_ui_Cell &= 0x0003); + if (L0522_B_ProjectileMovesToOtherSquare) { + _vm->_movsens->f267_getMoveResult(L0515_T_ProjectileThingNewCell, L0525_i_SourceMapX, L0526_i_SourceMapY, L0523_i_DestinationMapX, L0524_i_DestinationMapY); + L0519_ps_Event->_C._projectile.setMapX(_vm->_movsens->_g397_moveResultMapX); + L0519_ps_Event->_C._projectile.setMapY(_vm->_movsens->_g398_moveResultMapY); + L0519_ps_Event->_C._projectile.setDir((direction)_vm->_movsens->_g400_moveResultDir); + L0515_T_ProjectileThingNewCell = M15_thingWithNewCell(L0515_T_ProjectileThingNewCell, _vm->_movsens->_g401_moveResultCell); + M31_setMap(L0519_ps_Event->_mapTime, _vm->_movsens->_g399_moveResultMapIndex); + } else { + if ((Square(_vm->_dungeonMan->f151_getSquare(L0523_i_DestinationMapX, L0524_i_DestinationMapY)).getType() == k4_DoorElemType) && f217_projectileHasImpactOccurred(k4_DoorElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0521_T_ProjectileThing)) { + return; + } + _vm->_dungeonMan->f164_unlinkThingFromList(L0515_T_ProjectileThingNewCell, Thing(0), L0523_i_DestinationMapX, L0524_i_DestinationMapY); + _vm->_dungeonMan->f163_linkThingToList(L0515_T_ProjectileThingNewCell, Thing(0), L0523_i_DestinationMapX, L0524_i_DestinationMapY); + } + L0519_ps_Event->_mapTime += (_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex) ? 1 : 3; + //Strangerke: CHECKME: Maybe we should keep that piece of code too as it sounds like it's fixing a weird behavior of projectiles on different maps +#ifdef COMPILE42_CSB20EN_CSB21EN /* CHANGE7_20_IMPROVEMENT Projectiles now move at the same speed on all maps instead of moving slower on maps other than the party map */ + L0519_ps_Event->Map_Time++; +#endif + L0519_ps_Event->_B._slot = L0515_T_ProjectileThingNewCell.toUint16(); + L0520_ps_Projectile->_eventIndex = _vm->_timeline->f238_addEventGetEventIndex(L0519_ps_Event); +} } -- cgit v1.2.3 From cc5f1ab478e21d99ac3edeba621fea73bf591ea5 Mon Sep 17 00:00:00 2001 From: Bendegúz Nagy Date: Mon, 11 Jul 2016 16:00:53 +0200 Subject: DM: Add f220_explosionProcessEvent25_explosion --- engines/dm/projexpl.cpp | 92 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 53b3f3afef..e8464aab8d 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -500,4 +500,96 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) { L0519_ps_Event->_B._slot = L0515_T_ProjectileThingNewCell.toUint16(); L0520_ps_Projectile->_eventIndex = _vm->_timeline->f238_addEventGetEventIndex(L0519_ps_Event); } + +void ProjExpl::f220_explosionProcessEvent25_explosion(TimelineEvent* event) { + Explosion* L0532_ps_Explosion; + Group* L0533_ps_Group; + CreatureInfo* L0534_ps_CreatureInfo; + uint16 L0528_ui_MapX; + uint16 L0529_ui_MapY; + int16 L0530_i_Attack; + int16 L0531_i_Multiple; +#define AL0531_i_SquareType L0531_i_Multiple +#define AL0531_i_CreatureCount L0531_i_Multiple + Thing L0535_T_GroupThing; + Thing L0536_T_ExplosionThing; + uint16 L0537_ui_Multiple; +#define AL0537_ui_CreatureType L0537_ui_Multiple +#define AL0537_ui_NonMaterialAdditionalAttack L0537_ui_Multiple + bool L0538_B_ExplosionOnPartySquare; + TimelineEvent L0539_s_Event; + + L0528_ui_MapX = event->_B._location._mapX; + L0529_ui_MapY = event->_B._location._mapY; + L0532_ps_Explosion = &((Explosion*)_vm->_dungeonMan->_g284_thingData[k15_ExplosionThingType])[Thing((event->_C._slot)).getIndex()]; + AL0531_i_SquareType = Square(_vm->_dungeonMan->_g271_currMapData[L0528_ui_MapX][L0529_ui_MapY]).getType(); + L0538_B_ExplosionOnPartySquare = (_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex) && (L0528_ui_MapX == _vm->_dungeonMan->_g306_partyMapX) && (L0529_ui_MapY == _vm->_dungeonMan->_g307_partyMapY); + if ((L0535_T_GroupThing = _vm->_groupMan->f175_groupGetThing(L0528_ui_MapX, L0529_ui_MapY)) != Thing::_endOfList) { + L0533_ps_Group = (Group*)_vm->_dungeonMan->f156_getThingData(L0535_T_GroupThing); + L0534_ps_CreatureInfo = &g243_CreatureInfo[AL0537_ui_CreatureType = L0533_ps_Group->_type]; + } + if ((L0536_T_ExplosionThing = Thing(Thing::_firstExplosion.toUint16() + L0532_ps_Explosion->getType())) == Thing::_explPoisonCloud) { + L0530_i_Attack = MAX(1, MIN(L0532_ps_Explosion->getAttack() >> 5, 4) + _vm->getRandomNumber(2)); /* Value between 1 and 5 */ + } else { + L0530_i_Attack = (L0532_ps_Explosion->getAttack() >> 1) + 1; + L0530_i_Attack += _vm->getRandomNumber(L0530_i_Attack) + 1; + } + + + switch (L0536_T_ExplosionThing.toUint16()) { + case 0xFF82: + if (!(L0530_i_Attack >>= 1)) + break; + case 0xFF80: + if (AL0531_i_SquareType == k4_DoorElemType) { + _vm->_groupMan->f232_groupIsDoorDestoryedByAttack(L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack, true, 0); + } + break; + case 0xFF83: + if ((L0535_T_GroupThing != Thing::_endOfList) && getFlag(L0534_ps_CreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)) { + if ((AL0537_ui_CreatureType == k19_CreatureTypeMaterializerZytaz) && (_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex)) { /* ASSEMBLY_COMPILATION_DIFFERENCE jmp */ + L0530_i_Attack -= (AL0537_ui_NonMaterialAdditionalAttack = L0530_i_Attack >> 3); + AL0537_ui_NonMaterialAdditionalAttack <<= 1; + AL0537_ui_NonMaterialAdditionalAttack++; + AL0531_i_CreatureCount = L0533_ps_Group->getCount(); + do { + if (getFlag(_vm->_groupMan->_g375_activeGroups[L0533_ps_Group->getActiveGroupIndex()]._aspect[AL0531_i_CreatureCount], k0x0080_MaskActiveGroupIsAttacking)) { /* Materializer / Zytaz can only be damaged while they are attacking */ + _vm->_groupMan->f190_groupGetDamageCreatureOutcome(L0533_ps_Group, AL0531_i_CreatureCount, L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack + _vm->getRandomNumber(AL0537_ui_NonMaterialAdditionalAttack) + _vm->getRandomNumber(4), true); + } + } while (--AL0531_i_CreatureCount >= 0); + } else { + _vm->_groupMan->f191_getDamageAllCreaturesOutcome(L0533_ps_Group, L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack, true); + } + } + break; + case 0xFFE4: + L0532_ps_Explosion->setType(L0532_ps_Explosion->getType() + 1); + warning(false, "MISSING CODE: F0064_SOUND_RequestPlay_CPSD"); + goto T0220026; + case 0xFFA8: + if (L0532_ps_Explosion->getAttack() > 55) { + L0532_ps_Explosion->setAttack(L0532_ps_Explosion->getAttack() - 40); + goto T0220026; + } + break; + case 0xFF87: + if (L0538_B_ExplosionOnPartySquare) { + _vm->_championMan->f324_damageAll_getDamagedChampionCount(L0530_i_Attack, k0x0000_ChampionWoundNone, k0_attackType_NORMAL); + } else { + if ((L0535_T_GroupThing != Thing::_endOfList) && (L0530_i_Attack = _vm->_groupMan->f192_groupGetResistanceAdjustedPoisonAttack(AL0537_ui_CreatureType, L0530_i_Attack)) && (_vm->_groupMan->f191_getDamageAllCreaturesOutcome(L0533_ps_Group, L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack, true) != k2_outcomeKilledAllCreaturesInGroup) && (L0530_i_Attack > 2)) { + _vm->_groupMan->f209_processEvents29to41(L0528_ui_MapX, L0529_ui_MapY, kM3_TMEventTypeCreateReactionEvent29DangerOnSquare, 0); + } + } + if (L0532_ps_Explosion->getAttack() >= 6) { + L0532_ps_Explosion->setAttack(L0532_ps_Explosion->getAttack() - 3); +T0220026: + L0539_s_Event = *event; + L0539_s_Event._mapTime++; + _vm->_timeline->f238_addEventGetEventIndex(&L0539_s_Event); + return; + } + } + _vm->_dungeonMan->f164_unlinkThingFromList(Thing(event->_C._slot), Thing(0), L0528_ui_MapX, L0529_ui_MapY); + L0532_ps_Explosion->setNextThing(Thing::_none); +} } -- cgit v1.2.3 From 81a8c8cf742314d12850163ff7ffba48f1837bac Mon Sep 17 00:00:00 2001 From: Bendegúz Nagy Date: Mon, 11 Jul 2016 16:20:55 +0200 Subject: DM: Clear some warnings --- engines/dm/projexpl.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index e8464aab8d..7d99b97648 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -428,8 +428,8 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) { int16 L0523_i_DestinationMapX; int16 L0524_i_DestinationMapY; uint16 L0518_ui_Cell; - int16 L0525_i_SourceMapX; - int16 L0526_i_SourceMapY; + int16 L0525_i_SourceMapX = -1; + int16 L0526_i_SourceMapY = -1; TimelineEvent L0527_s_Event; @@ -503,8 +503,8 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) { void ProjExpl::f220_explosionProcessEvent25_explosion(TimelineEvent* event) { Explosion* L0532_ps_Explosion; - Group* L0533_ps_Group; - CreatureInfo* L0534_ps_CreatureInfo; + Group* L0533_ps_Group = nullptr; + CreatureInfo* L0534_ps_CreatureInfo = nullptr; uint16 L0528_ui_MapX; uint16 L0529_ui_MapY; int16 L0530_i_Attack; @@ -513,7 +513,7 @@ void ProjExpl::f220_explosionProcessEvent25_explosion(TimelineEvent* event) { #define AL0531_i_CreatureCount L0531_i_Multiple Thing L0535_T_GroupThing; Thing L0536_T_ExplosionThing; - uint16 L0537_ui_Multiple; + uint16 L0537_ui_Multiple = 0; #define AL0537_ui_CreatureType L0537_ui_Multiple #define AL0537_ui_NonMaterialAdditionalAttack L0537_ui_Multiple bool L0538_B_ExplosionOnPartySquare; -- cgit v1.2.3 From ebd672770ada3685c2e84299368c9586d944ba2a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 23 Jul 2016 12:54:25 +0200 Subject: DM: Properly stub f064_SOUND_RequestPlay_CPSD --- engines/dm/projexpl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 7d99b97648..8996693f4b 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -230,7 +230,7 @@ T0217004: AL0507_ui_SoundIndex = k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM; } } - warning(false, "MISSING CODE: F0064_SOUND_RequestPlay_CPSD"); + _vm->f064_SOUND_RequestPlay_CPSD(AL0507_ui_SoundIndex, L0499_i_ProjectileMapX, L0500_i_ProjectileMapY, k1_soundModePlayIfPrioritized); } T0217044: if (L0509_B_RemovePotion) { @@ -321,10 +321,10 @@ void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXC L0470_ps_Explosion->setType(explThing.toUint16() - Thing::_firstExplosion.toUint16()); L0470_ps_Explosion->setAttack(attack); if (explThing.toUint16() < Thing::_explHarmNonMaterial.toUint16()) { - warning(false, "MISING CODE: F0064_SOUND_RequestPlay_CPSD"); + _vm->f064_SOUND_RequestPlay_CPSD((attack > 80) ? k05_soundSTRONG_EXPLOSION : k20_soundWEAK_EXPLOSION, AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY, k1_soundModePlayIfPrioritized); } else { if (explThing != Thing::_explSmoke) { - warning(false, "MISSING CODE: F0064_SOUND_RequestPlay_CPSD"); + _vm->f064_SOUND_RequestPlay_CPSD(k13_soundSPELL, AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY, k1_soundModePlayIfPrioritized); } } _vm->_dungeonMan->f163_linkThingToList(L0473_T_Thing, Thing(0), AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY); @@ -564,7 +564,7 @@ void ProjExpl::f220_explosionProcessEvent25_explosion(TimelineEvent* event) { break; case 0xFFE4: L0532_ps_Explosion->setType(L0532_ps_Explosion->getType() + 1); - warning(false, "MISSING CODE: F0064_SOUND_RequestPlay_CPSD"); + _vm->f064_SOUND_RequestPlay_CPSD(k05_soundSTRONG_EXPLOSION, L0528_ui_MapX, L0529_ui_MapY, k1_soundModePlayIfPrioritized); goto T0220026; case 0xFFA8: if (L0532_ps_Explosion->getAttack() > 55) { -- cgit v1.2.3 From b174331e71f4c63b2847762acddcf8d20a712cb8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 25 Jul 2016 14:35:26 +0200 Subject: DM: refact f293_drawAllChampionStates, f283_viAltarRebirth, f327_isProjectileSpellCast and f326_championShootProjectile. Rename Direction. --- engines/dm/projexpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 8996693f4b..06ba83afd8 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -45,7 +45,7 @@ ProjExpl::ProjExpl(DMEngine* vm) : _vm(vm) { _g362_lastPartyMovementTime = 0; } -void ProjExpl::f212_projectileCreate(Thing thing, int16 mapX, int16 mapY, uint16 cell, direction dir, byte kineticEnergy, byte attack, byte stepEnergy) { +void ProjExpl::f212_projectileCreate(Thing thing, int16 mapX, int16 mapY, uint16 cell, Direction dir, byte kineticEnergy, byte attack, byte stepEnergy) { Thing L0466_T_ProjectileThing; Projectile* L0467_ps_Projectile; TimelineEvent L0468_s_Event; @@ -482,7 +482,7 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) { _vm->_movsens->f267_getMoveResult(L0515_T_ProjectileThingNewCell, L0525_i_SourceMapX, L0526_i_SourceMapY, L0523_i_DestinationMapX, L0524_i_DestinationMapY); L0519_ps_Event->_C._projectile.setMapX(_vm->_movsens->_g397_moveResultMapX); L0519_ps_Event->_C._projectile.setMapY(_vm->_movsens->_g398_moveResultMapY); - L0519_ps_Event->_C._projectile.setDir((direction)_vm->_movsens->_g400_moveResultDir); + L0519_ps_Event->_C._projectile.setDir((Direction)_vm->_movsens->_g400_moveResultDir); L0515_T_ProjectileThingNewCell = M15_thingWithNewCell(L0515_T_ProjectileThingNewCell, _vm->_movsens->_g401_moveResultCell); M31_setMap(L0519_ps_Event->_mapTime, _vm->_movsens->_g399_moveResultMapIndex); } else { -- cgit v1.2.3 From cdbbc15e5623f47a0e93e5d9113ac64b709cf6de Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 25 Jul 2016 16:13:53 +0200 Subject: DM: Refactor f318_dropAllObjects, f319_championKill and f323_unpoison. Rename _moveSens --- engines/dm/projexpl.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 06ba83afd8..937e144e25 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -148,7 +148,7 @@ T0217004: L0494_ps_Door = (Door *)_vm->_dungeonMan->f157_getSquareFirstThingData(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY); if ((AL0487_i_DoorState != k5_doorState_DESTROYED) && (L0486_T_ProjectileAssociatedThing == Thing::_explOpenDoor)) { if (L0494_ps_Door->hasButton()) { - _vm->_movsens->f268_addEvent(k10_TMEventTypeDoor, AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, 0, k2_SensorEffToggle, _vm->_g313_gameTime + 1); + _vm->_moveSens->f268_addEvent(k10_TMEventTypeDoor, AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, 0, k2_SensorEffToggle, _vm->_g313_gameTime + 1); } break; } @@ -409,7 +409,7 @@ void ProjExpl::f215_projectileDelete(Thing projectileThing, Thing* groupSlot, in _vm->_dungeonMan->f163_linkThingToList(L0479_T_Thing, L0478_T_PreviousThing, kM1_MapXNotOnASquare, 0); } } else { - _vm->_movsens->f267_getMoveResult(Thing((L0479_T_Thing).getTypeAndIndex() | getFlag(projectileThing.toUint16(), 0xC)), -2, 0, mapX, mapY); + _vm->_moveSens->f267_getMoveResult(Thing((L0479_T_Thing).getTypeAndIndex() | getFlag(projectileThing.toUint16(), 0xC)), -2, 0, mapX, mapY); } } L0480_ps_Projectile->_nextThing = Thing::_none; @@ -479,12 +479,12 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) { } L0515_T_ProjectileThingNewCell = M15_thingWithNewCell(L0515_T_ProjectileThingNewCell, L0518_ui_Cell &= 0x0003); if (L0522_B_ProjectileMovesToOtherSquare) { - _vm->_movsens->f267_getMoveResult(L0515_T_ProjectileThingNewCell, L0525_i_SourceMapX, L0526_i_SourceMapY, L0523_i_DestinationMapX, L0524_i_DestinationMapY); - L0519_ps_Event->_C._projectile.setMapX(_vm->_movsens->_g397_moveResultMapX); - L0519_ps_Event->_C._projectile.setMapY(_vm->_movsens->_g398_moveResultMapY); - L0519_ps_Event->_C._projectile.setDir((Direction)_vm->_movsens->_g400_moveResultDir); - L0515_T_ProjectileThingNewCell = M15_thingWithNewCell(L0515_T_ProjectileThingNewCell, _vm->_movsens->_g401_moveResultCell); - M31_setMap(L0519_ps_Event->_mapTime, _vm->_movsens->_g399_moveResultMapIndex); + _vm->_moveSens->f267_getMoveResult(L0515_T_ProjectileThingNewCell, L0525_i_SourceMapX, L0526_i_SourceMapY, L0523_i_DestinationMapX, L0524_i_DestinationMapY); + L0519_ps_Event->_C._projectile.setMapX(_vm->_moveSens->_g397_moveResultMapX); + L0519_ps_Event->_C._projectile.setMapY(_vm->_moveSens->_g398_moveResultMapY); + L0519_ps_Event->_C._projectile.setDir((Direction)_vm->_moveSens->_g400_moveResultDir); + L0515_T_ProjectileThingNewCell = M15_thingWithNewCell(L0515_T_ProjectileThingNewCell, _vm->_moveSens->_g401_moveResultCell); + M31_setMap(L0519_ps_Event->_mapTime, _vm->_moveSens->_g399_moveResultMapIndex); } else { if ((Square(_vm->_dungeonMan->f151_getSquare(L0523_i_DestinationMapX, L0524_i_DestinationMapY)).getType() == k4_DoorElemType) && f217_projectileHasImpactOccurred(k4_DoorElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0521_T_ProjectileThing)) { return; -- cgit v1.2.3 From 0eb61d0a7d1450ca79adfe8ef4bd3874de51ce67 Mon Sep 17 00:00:00 2001 From: Bendegúz Nagy Date: Tue, 16 Aug 2016 19:15:35 +0200 Subject: DM: Pull sound handling into a separate class --- engines/dm/projexpl.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 937e144e25..b65e03a3c6 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -32,6 +32,7 @@ #include "group.h" #include "objectman.h" #include "movesens.h" +#include "sounds.h" namespace DM { @@ -230,7 +231,7 @@ T0217004: AL0507_ui_SoundIndex = k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM; } } - _vm->f064_SOUND_RequestPlay_CPSD(AL0507_ui_SoundIndex, L0499_i_ProjectileMapX, L0500_i_ProjectileMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->f064_SOUND_RequestPlay_CPSD(AL0507_ui_SoundIndex, L0499_i_ProjectileMapX, L0500_i_ProjectileMapY, k1_soundModePlayIfPrioritized); } T0217044: if (L0509_B_RemovePotion) { @@ -321,10 +322,10 @@ void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXC L0470_ps_Explosion->setType(explThing.toUint16() - Thing::_firstExplosion.toUint16()); L0470_ps_Explosion->setAttack(attack); if (explThing.toUint16() < Thing::_explHarmNonMaterial.toUint16()) { - _vm->f064_SOUND_RequestPlay_CPSD((attack > 80) ? k05_soundSTRONG_EXPLOSION : k20_soundWEAK_EXPLOSION, AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->f064_SOUND_RequestPlay_CPSD((attack > 80) ? k05_soundSTRONG_EXPLOSION : k20_soundWEAK_EXPLOSION, AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY, k1_soundModePlayIfPrioritized); } else { if (explThing != Thing::_explSmoke) { - _vm->f064_SOUND_RequestPlay_CPSD(k13_soundSPELL, AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->f064_SOUND_RequestPlay_CPSD(k13_soundSPELL, AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY, k1_soundModePlayIfPrioritized); } } _vm->_dungeonMan->f163_linkThingToList(L0473_T_Thing, Thing(0), AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY); @@ -564,7 +565,7 @@ void ProjExpl::f220_explosionProcessEvent25_explosion(TimelineEvent* event) { break; case 0xFFE4: L0532_ps_Explosion->setType(L0532_ps_Explosion->getType() + 1); - _vm->f064_SOUND_RequestPlay_CPSD(k05_soundSTRONG_EXPLOSION, L0528_ui_MapX, L0529_ui_MapY, k1_soundModePlayIfPrioritized); + _vm->_sound->f064_SOUND_RequestPlay_CPSD(k05_soundSTRONG_EXPLOSION, L0528_ui_MapX, L0529_ui_MapY, k1_soundModePlayIfPrioritized); goto T0220026; case 0xFFA8: if (L0532_ps_Explosion->getAttack() > 55) { -- cgit v1.2.3 From a5b8085c48f11dde20e090b063c3c9558d5f6c66 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 20 Aug 2016 00:37:28 +0200 Subject: DM: Fix regression (pressure plate), fix compilation --- engines/dm/projexpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index b65e03a3c6..5e21cbd94f 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -159,7 +159,7 @@ T0217004: ((L0510_i_ProjectileAssociatedThingType == k15_ExplosionThingType) ? (L0486_T_ProjectileAssociatedThing.toUint16() >= Thing::_explHarmNonMaterial.toUint16()) : ((L0490_ps_Projectile->_attack > _vm->getRandomNumber(128)) && - getFlag(g237_ObjectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(L0486_T_ProjectileAssociatedThing)].getAllowedSlots(), k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors) + getFlag(_vm->_dungeonMan->g237_ObjectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(L0486_T_ProjectileAssociatedThing)].getAllowedSlots(), k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors) && ((L0510_i_ProjectileAssociatedThingType != k10_JunkThingType) || ((AL0487_i_IconIndex = _vm->_objectMan->f33_getIconIndex(L0486_T_ProjectileAssociatedThing)) < 0) || (!((AL0487_i_IconIndex >= k176_IconIndiceJunkIronKey) && (AL0487_i_IconIndex <= k191_IconIndiceJunkMasterKey)))) -- cgit v1.2.3 From 705e906698505e8a547ef46c8a2fc65e3f48a49b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 20 Aug 2016 10:36:28 +0200 Subject: DM: Some renaming, move some globals to class member --- engines/dm/projexpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 5e21cbd94f..95e3165907 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -159,7 +159,7 @@ T0217004: ((L0510_i_ProjectileAssociatedThingType == k15_ExplosionThingType) ? (L0486_T_ProjectileAssociatedThing.toUint16() >= Thing::_explHarmNonMaterial.toUint16()) : ((L0490_ps_Projectile->_attack > _vm->getRandomNumber(128)) && - getFlag(_vm->_dungeonMan->g237_ObjectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(L0486_T_ProjectileAssociatedThing)].getAllowedSlots(), k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors) + getFlag(_vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(L0486_T_ProjectileAssociatedThing)].getAllowedSlots(), k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors) && ((L0510_i_ProjectileAssociatedThingType != k10_JunkThingType) || ((AL0487_i_IconIndex = _vm->_objectMan->f33_getIconIndex(L0486_T_ProjectileAssociatedThing)) < 0) || (!((AL0487_i_IconIndex >= k176_IconIndiceJunkIronKey) && (AL0487_i_IconIndex <= k191_IconIndiceJunkMasterKey)))) -- cgit v1.2.3 From 0233b503f1e74b15350f71d7d906e10091ac2688 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 23 Aug 2016 00:31:34 +0200 Subject: DM: Some more work on GCC warnings --- engines/dm/projexpl.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 95e3165907..2ca7be1951 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -129,6 +129,9 @@ T0217004: L0509_B_RemovePotion = true; L0508_i_PotionPower = ((Potion *)L0491_ps_Group)->getPower(); L0492_ps_Potion = (Potion *)L0491_ps_Group; + break; + default: + break; } } L0505_B_CreateExplosionOnImpact = (L0510_i_ProjectileAssociatedThingType == k15_ExplosionThingType) && (L0486_T_ProjectileAssociatedThing != Thing::_explSlime) && (L0486_T_ProjectileAssociatedThing != Thing::_explPoisonBolt); @@ -190,7 +193,8 @@ T0217004: if (getFlag(L0493_ps_CreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial) && (L0486_T_ProjectileAssociatedThing != Thing::_explHarmNonMaterial)) { return false; } - if (L0488_i_Attack = (uint16)((unsigned long)f216_projectileGetImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing) << 6) / L0493_ps_CreatureInfo->_defense) { + L0488_i_Attack = (uint16)((unsigned long)f216_projectileGetImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing) << 6) / L0493_ps_CreatureInfo->_defense; + if (L0488_i_Attack) { if ((AL0487_i_Outcome = _vm->_groupMan->f190_groupGetDamageCreatureOutcome(L0491_ps_Group, L0512_ui_CreatureIndex, AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, L0488_i_Attack + _vm->_groupMan->f192_groupGetResistanceAdjustedPoisonAttack(L0511_ui_CreatureType, _g366_projectilePoisonAttack), true)) != k0_outcomeKilledNoCreaturesInGroup) { _vm->_groupMan->f209_processEvents29to41(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, kM2_TMEventTypeCreateReactionEvent30HitByProjectile, 0); } @@ -466,8 +470,8 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) { L0526_i_SourceMapY = L0524_i_DestinationMapY; L0523_i_DestinationMapX += _vm->_dirIntoStepCountEast[L0517_ui_ProjectileDirection], L0524_i_DestinationMapY += _vm->_dirIntoStepCountNorth[L0517_ui_ProjectileDirection]; if ((Square(AL0516_ui_Square = _vm->_dungeonMan->f151_getSquare(L0523_i_DestinationMapX, L0524_i_DestinationMapY).toByte()).getType() == k0_ElementTypeWall) || - ((Square(AL0516_ui_Square).getType() == k6_ElementTypeFakeWall) && !getFlag(AL0516_ui_Square, (k0x0001_FakeWallImaginary | k0x0004_FakeWallOpen))) || - ((Square(AL0516_ui_Square).getType() == k3_ElementTypeStairs) && (Square(_vm->_dungeonMan->_g271_currMapData[L0525_i_SourceMapX][L0526_i_SourceMapY]).getType() == k3_ElementTypeStairs))) { + ((Square(AL0516_ui_Square).getType() == k6_FakeWallElemType) && !getFlag(AL0516_ui_Square, (k0x0001_FakeWallImaginary | k0x0004_FakeWallOpen))) || + ((Square(AL0516_ui_Square).getType() == k3_StairsElemType) && (Square(_vm->_dungeonMan->_g271_currMapData[L0525_i_SourceMapX][L0526_i_SourceMapY]).getType() == k3_ElementTypeStairs))) { if (f217_projectileHasImpactOccurred(Square(AL0516_ui_Square).getType(), L0525_i_SourceMapX, L0526_i_SourceMapY, L0518_ui_Cell, L0515_T_ProjectileThingNewCell)) { return; } -- cgit v1.2.3 From 857d4e72ed28c762bb63a47408743885c6c5d934 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 23 Aug 2016 07:54:16 +0200 Subject: DM: Renaming of Champion and ChampionMan functions --- engines/dm/projexpl.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 2ca7be1951..5fd4b12b9a 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -173,7 +173,7 @@ T0217004: _vm->_groupMan->f232_groupIsDoorDestoryedByAttack(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, L0488_i_Attack + _vm->getRandomNumber(L0488_i_Attack), false, 0); break; case kM2_ChampionElemType: - if ((AP0456_i_ChampionIndex = _vm->_championMan->f285_getIndexInCell(cell)) < 0) { + if ((AP0456_i_ChampionIndex = _vm->_championMan->getIndexInCell(cell)) < 0) { return false; } L0489_i_ChampionAttack = L0488_i_Attack = f216_projectileGetImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing); @@ -211,8 +211,8 @@ T0217004: } } } - if (L0489_i_ChampionAttack && _vm->_championMan->f321_addPendingDamageAndWounds_getDamage(AP0456_i_ChampionIndex, L0488_i_Attack, k0x0004_ChampionWoundHead | k0x0008_ChampionWoundTorso, _g367_projectileAttackType) && _g366_projectilePoisonAttack && _vm->getRandomNumber(2)) { - _vm->_championMan->f322_championPoison(AP0456_i_ChampionIndex, _g366_projectilePoisonAttack); + if (L0489_i_ChampionAttack && _vm->_championMan->addPendingDamageAndWounds_getDamage(AP0456_i_ChampionIndex, L0488_i_Attack, k0x0004_ChampionWoundHead | k0x0008_ChampionWoundTorso, _g367_projectileAttackType) && _g366_projectilePoisonAttack && _vm->getRandomNumber(2)) { + _vm->_championMan->championPoison(AP0456_i_ChampionIndex, _g366_projectilePoisonAttack); } if (L0505_B_CreateExplosionOnImpact || L0509_B_RemovePotion ) { @@ -348,7 +348,7 @@ void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXC attack += _vm->getRandomNumber(attack) + 1; if ((explThing == Thing::_explFireBall) || (attack >>= 1)) { if ((_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex) && (AP0443_ui_ProjectileMapX == _vm->_dungeonMan->_g306_partyMapX) && (AP0444_ui_ProjectileMapY == _vm->_dungeonMan->_g307_partyMapY)) { - _vm->_championMan->f324_damageAll_getDamagedChampionCount(attack, k0x0001_ChampionWoundReadHand | k0x0002_ChampionWoundActionHand | k0x0004_ChampionWoundHead | k0x0008_ChampionWoundTorso | k0x0010_ChampionWoundLegs | k0x0020_ChampionWoundFeet, k1_attackType_FIRE); + _vm->_championMan->getDamagedChampionCount(attack, k0x0001_ChampionWoundReadHand | k0x0002_ChampionWoundActionHand | k0x0004_ChampionWoundHead | k0x0008_ChampionWoundTorso | k0x0010_ChampionWoundLegs | k0x0020_ChampionWoundFeet, k1_attackType_FIRE); } else { if ((L0473_T_Thing = _vm->_groupMan->f175_groupGetThing(AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY)) != Thing::_endOfList) { /* ASSEMBLY_COMPILATION_DIFFERENCE jmp */ Group *L0472_ps_Group = (Group *)_vm->_dungeonMan->f156_getThingData(L0473_T_Thing); @@ -579,7 +579,7 @@ void ProjExpl::f220_explosionProcessEvent25_explosion(TimelineEvent* event) { break; case 0xFF87: if (L0538_B_ExplosionOnPartySquare) { - _vm->_championMan->f324_damageAll_getDamagedChampionCount(L0530_i_Attack, k0x0000_ChampionWoundNone, k0_attackType_NORMAL); + _vm->_championMan->getDamagedChampionCount(L0530_i_Attack, k0x0000_ChampionWoundNone, k0_attackType_NORMAL); } else { if ((L0535_T_GroupThing != Thing::_endOfList) && (L0530_i_Attack = _vm->_groupMan->f192_groupGetResistanceAdjustedPoisonAttack(AL0537_ui_CreatureType, L0530_i_Attack)) && (_vm->_groupMan->f191_getDamageAllCreaturesOutcome(L0533_ps_Group, L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack, true) != k2_outcomeKilledAllCreaturesInGroup) && (L0530_i_Attack > 2)) { _vm->_groupMan->f209_processEvents29to41(L0528_ui_MapX, L0529_ui_MapY, kM3_TMEventTypeCreateReactionEvent29DangerOnSquare, 0); -- cgit v1.2.3 From 5bd446407690f00dd4282c9840e9c82014bc2f52 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 23 Aug 2016 22:08:51 +0200 Subject: DM: Fix some more GCC warnings --- engines/dm/projexpl.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 5fd4b12b9a..7600bafd66 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -465,13 +465,18 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) { L0520_ps_Projectile->_attack -= AL0516_ui_StepEnergy; } } - if (L0522_B_ProjectileMovesToOtherSquare = ((L0517_ui_ProjectileDirection = L0519_ps_Event->_C._projectile.getDir()) == (L0518_ui_Cell = (L0515_T_ProjectileThingNewCell = Thing(L0519_ps_Event->_B._slot)).getCell())) || (returnNextVal(L0517_ui_ProjectileDirection) == L0518_ui_Cell)) { + L0517_ui_ProjectileDirection = L0519_ps_Event->_C._projectile.getDir(); + L0515_T_ProjectileThingNewCell = Thing(L0519_ps_Event->_B._slot); + L0518_ui_Cell = L0515_T_ProjectileThingNewCell.getCell(); + L0522_B_ProjectileMovesToOtherSquare = (L0517_ui_ProjectileDirection == L0518_ui_Cell) || (returnNextVal(L0517_ui_ProjectileDirection) == L0518_ui_Cell); + if (L0522_B_ProjectileMovesToOtherSquare) { L0525_i_SourceMapX = L0523_i_DestinationMapX; L0526_i_SourceMapY = L0524_i_DestinationMapY; L0523_i_DestinationMapX += _vm->_dirIntoStepCountEast[L0517_ui_ProjectileDirection], L0524_i_DestinationMapY += _vm->_dirIntoStepCountNorth[L0517_ui_ProjectileDirection]; - if ((Square(AL0516_ui_Square = _vm->_dungeonMan->f151_getSquare(L0523_i_DestinationMapX, L0524_i_DestinationMapY).toByte()).getType() == k0_ElementTypeWall) || + AL0516_ui_Square = _vm->_dungeonMan->f151_getSquare(L0523_i_DestinationMapX, L0524_i_DestinationMapY).toByte(); + if ((Square(AL0516_ui_Square).getType() == k0_WallElemType) || ((Square(AL0516_ui_Square).getType() == k6_FakeWallElemType) && !getFlag(AL0516_ui_Square, (k0x0001_FakeWallImaginary | k0x0004_FakeWallOpen))) || - ((Square(AL0516_ui_Square).getType() == k3_StairsElemType) && (Square(_vm->_dungeonMan->_g271_currMapData[L0525_i_SourceMapX][L0526_i_SourceMapY]).getType() == k3_ElementTypeStairs))) { + ((Square(AL0516_ui_Square).getType() == k3_StairsElemType) && (Square(_vm->_dungeonMan->_g271_currMapData[L0525_i_SourceMapX][L0526_i_SourceMapY]).getType() == k3_StairsElemType))) { if (f217_projectileHasImpactOccurred(Square(AL0516_ui_Square).getType(), L0525_i_SourceMapX, L0526_i_SourceMapY, L0518_ui_Cell, L0515_T_ProjectileThingNewCell)) { return; } -- cgit v1.2.3 From e728cb706eadc8ea31b2df0e3bc6b53c96994a5d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 23 Aug 2016 23:36:18 +0200 Subject: DM: Rename functions of DMEngine and DialogMan --- engines/dm/projexpl.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 7600bafd66..7eee98a100 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -55,13 +55,13 @@ void ProjExpl::f212_projectileCreate(Thing thing, int16 mapX, int16 mapY, uint16 if ((L0466_T_ProjectileThing = _vm->_dungeonMan->f166_getUnusedThing(k14_ProjectileThingType)) == 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; } - L0466_T_ProjectileThing = M15_thingWithNewCell(L0466_T_ProjectileThing, cell); + L0466_T_ProjectileThing = thingWithNewCell(L0466_T_ProjectileThing, cell); L0467_ps_Projectile = (Projectile *)_vm->_dungeonMan->f156_getThingData(L0466_T_ProjectileThing); L0467_ps_Projectile->_slot = thing; L0467_ps_Projectile->_kineticEnergy = MIN((int16)kineticEnergy, (int16)255); L0467_ps_Projectile->_attack = attack; _vm->_dungeonMan->f163_linkThingToList(L0466_T_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 */ - M33_setMapAndTime(L0468_s_Event._mapTime, _vm->_dungeonMan->_g272_currMapIndex, _vm->_g313_gameTime + 1); + setMapAndTime(L0468_s_Event._mapTime, _vm->_dungeonMan->_g272_currMapIndex, _vm->_gameTime + 1); if (_g365_createLanucherProjectile) { L0468_s_Event._type = k49_TMEventTypeMoveProjectile; /* Launcher projectiles can impact immediately */ } else { @@ -152,7 +152,7 @@ T0217004: L0494_ps_Door = (Door *)_vm->_dungeonMan->f157_getSquareFirstThingData(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY); if ((AL0487_i_DoorState != k5_doorState_DESTROYED) && (L0486_T_ProjectileAssociatedThing == Thing::_explOpenDoor)) { if (L0494_ps_Door->hasButton()) { - _vm->_moveSens->f268_addEvent(k10_TMEventTypeDoor, AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, 0, k2_SensorEffToggle, _vm->_g313_gameTime + 1); + _vm->_moveSens->f268_addEvent(k10_TMEventTypeDoor, AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, 0, k2_SensorEffToggle, _vm->_gameTime + 1); } break; } @@ -321,7 +321,7 @@ void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXC L0470_ps_Explosion->setCentered(true); } else { L0470_ps_Explosion->setCentered(false); - L0473_T_Thing = M15_thingWithNewCell(L0473_T_Thing, cell); + L0473_T_Thing = thingWithNewCell(L0473_T_Thing, cell); } L0470_ps_Explosion->setType(explThing.toUint16() - Thing::_firstExplosion.toUint16()); L0470_ps_Explosion->setAttack(attack); @@ -334,7 +334,7 @@ void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXC } _vm->_dungeonMan->f163_linkThingToList(L0473_T_Thing, Thing(0), AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY); TimelineEvent L0476_s_Event; - M33_setMapAndTime(L0476_s_Event._mapTime, _vm->_dungeonMan->_g272_currMapIndex, _vm->_g313_gameTime + ((explThing == Thing::_explRebirthStep1) ? 5 : 1)); + setMapAndTime(L0476_s_Event._mapTime, _vm->_dungeonMan->_g272_currMapIndex, _vm->_gameTime + ((explThing == Thing::_explRebirthStep1) ? 5 : 1)); L0476_s_Event._type = k25_TMEventTypeExplosion; L0476_s_Event._priority = 0; L0476_s_Event._C._slot = L0473_T_Thing.toUint16(); @@ -487,13 +487,13 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) { } else { L0518_ui_Cell++; } - L0515_T_ProjectileThingNewCell = M15_thingWithNewCell(L0515_T_ProjectileThingNewCell, L0518_ui_Cell &= 0x0003); + L0515_T_ProjectileThingNewCell = thingWithNewCell(L0515_T_ProjectileThingNewCell, L0518_ui_Cell &= 0x0003); if (L0522_B_ProjectileMovesToOtherSquare) { _vm->_moveSens->f267_getMoveResult(L0515_T_ProjectileThingNewCell, L0525_i_SourceMapX, L0526_i_SourceMapY, L0523_i_DestinationMapX, L0524_i_DestinationMapY); L0519_ps_Event->_C._projectile.setMapX(_vm->_moveSens->_g397_moveResultMapX); L0519_ps_Event->_C._projectile.setMapY(_vm->_moveSens->_g398_moveResultMapY); L0519_ps_Event->_C._projectile.setDir((Direction)_vm->_moveSens->_g400_moveResultDir); - L0515_T_ProjectileThingNewCell = M15_thingWithNewCell(L0515_T_ProjectileThingNewCell, _vm->_moveSens->_g401_moveResultCell); + L0515_T_ProjectileThingNewCell = thingWithNewCell(L0515_T_ProjectileThingNewCell, _vm->_moveSens->_g401_moveResultCell); M31_setMap(L0519_ps_Event->_mapTime, _vm->_moveSens->_g399_moveResultMapIndex); } else { if ((Square(_vm->_dungeonMan->f151_getSquare(L0523_i_DestinationMapX, L0524_i_DestinationMapY)).getType() == k4_DoorElemType) && f217_projectileHasImpactOccurred(k4_DoorElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0521_T_ProjectileThing)) { -- cgit v1.2.3 From 544ce3578b9c190169d85cfa9ab2c0138684b525 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 23 Aug 2016 23:47:09 +0200 Subject: DM: rename members of dungeonman --- engines/dm/projexpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 7eee98a100..bc0c1a97e8 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -353,7 +353,7 @@ void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXC if ((L0473_T_Thing = _vm->_groupMan->f175_groupGetThing(AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY)) != Thing::_endOfList) { /* ASSEMBLY_COMPILATION_DIFFERENCE jmp */ Group *L0472_ps_Group = (Group *)_vm->_dungeonMan->f156_getThingData(L0473_T_Thing); CreatureInfo *L0471_ps_CreatureInfo = &g243_CreatureInfo[L0472_ps_Group->_type]; - int16 L0469_i_CreatureFireResistance = L0471_ps_CreatureInfo->M60_getFireResistance(); + int16 L0469_i_CreatureFireResistance = L0471_ps_CreatureInfo->getFireResistance(); if (L0469_i_CreatureFireResistance != k15_immuneToFire) { if (getFlag(L0471_ps_CreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)) { attack >>= 2; -- cgit v1.2.3 From 64b1c4fdf11001acc442fea7367b11f45336b25f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 24 Aug 2016 08:03:55 +0200 Subject: DM: Rename DungeonMan class members --- engines/dm/projexpl.cpp | 84 ++++++++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index bc0c1a97e8..4fdda2ede0 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -52,16 +52,16 @@ void ProjExpl::f212_projectileCreate(Thing thing, int16 mapX, int16 mapY, uint16 TimelineEvent L0468_s_Event; - if ((L0466_T_ProjectileThing = _vm->_dungeonMan->f166_getUnusedThing(k14_ProjectileThingType)) == Thing::_none) { /* BUG0_16 If the game cannot create a projectile thing because it has run out of such things (60 maximum) then the object being thrown/shot/launched is orphaned. If the game has run out of projectile things it will try to remove a projectile from elsewhere in the dungeon, except in an area of 11x11 squares centered around the party (to make sure the player cannot actually see the thing disappear on screen) */ + if ((L0466_T_ProjectileThing = _vm->_dungeonMan->getUnusedThing(k14_ProjectileThingType)) == 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; } L0466_T_ProjectileThing = thingWithNewCell(L0466_T_ProjectileThing, cell); - L0467_ps_Projectile = (Projectile *)_vm->_dungeonMan->f156_getThingData(L0466_T_ProjectileThing); + L0467_ps_Projectile = (Projectile *)_vm->_dungeonMan->getThingData(L0466_T_ProjectileThing); L0467_ps_Projectile->_slot = thing; L0467_ps_Projectile->_kineticEnergy = MIN((int16)kineticEnergy, (int16)255); L0467_ps_Projectile->_attack = attack; - _vm->_dungeonMan->f163_linkThingToList(L0466_T_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 */ - setMapAndTime(L0468_s_Event._mapTime, _vm->_dungeonMan->_g272_currMapIndex, _vm->_gameTime + 1); + _vm->_dungeonMan->linkThingToList(L0466_T_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 */ + setMapAndTime(L0468_s_Event._mapTime, _vm->_dungeonMan->_currMapIndex, _vm->_gameTime + 1); if (_g365_createLanucherProjectile) { L0468_s_Event._type = k49_TMEventTypeMoveProjectile; /* Launcher projectiles can impact immediately */ } else { @@ -112,13 +112,13 @@ bool ProjExpl::f217_projectileHasImpactOccurred(int16 impactType, int16 mapXComb uint16 L0511_ui_CreatureType; uint16 L0512_ui_CreatureIndex; - L0490_ps_Projectile = (Projectile *)_vm->_dungeonMan->f156_getThingData(Thing(projectileThing)); + L0490_ps_Projectile = (Projectile *)_vm->_dungeonMan->getThingData(Thing(projectileThing)); L0501_i_MapXCombo = mapXCombo; L0502_i_MapYCombo = mapYCombo; L0509_B_RemovePotion = false; _g364_creatureDamageOutcome = k0_outcomeKilledNoCreaturesInGroup; if ((L0510_i_ProjectileAssociatedThingType = (L0486_T_ProjectileAssociatedThing = L0490_ps_Projectile->_slot).getType()) == k8_PotionThingType) { - L0491_ps_Group = (Group *)_vm->_dungeonMan->f156_getThingData(L0486_T_ProjectileAssociatedThing); + L0491_ps_Group = (Group *)_vm->_dungeonMan->getThingData(L0486_T_ProjectileAssociatedThing); switch (((Potion *)L0491_ps_Group)->getType()) { case k3_PotionTypeVen: L0498_T_ExplosionThing = Thing::_explPoisonCloud; @@ -148,8 +148,8 @@ T0217004: } switch (impactType) { case k4_DoorElemType: - AL0487_i_DoorState = Square(L0503_uc_Square = _vm->_dungeonMan->_g271_currMapData[AP0454_i_ProjectileTargetMapX][AP0455_i_ProjectileTargetMapY]).getDoorState(); - L0494_ps_Door = (Door *)_vm->_dungeonMan->f157_getSquareFirstThingData(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY); + AL0487_i_DoorState = Square(L0503_uc_Square = _vm->_dungeonMan->_currMapData[AP0454_i_ProjectileTargetMapX][AP0455_i_ProjectileTargetMapY]).getDoorState(); + L0494_ps_Door = (Door *)_vm->_dungeonMan->getSquareFirstThingData(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY); if ((AL0487_i_DoorState != k5_doorState_DESTROYED) && (L0486_T_ProjectileAssociatedThing == Thing::_explOpenDoor)) { if (L0494_ps_Door->hasButton()) { _vm->_moveSens->f268_addEvent(k10_TMEventTypeDoor, AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, 0, k2_SensorEffToggle, _vm->_gameTime + 1); @@ -158,11 +158,11 @@ T0217004: } if ((AL0487_i_DoorState == k5_doorState_DESTROYED) || (AL0487_i_DoorState <= k1_doorState_FOURTH) || - (getFlag(_vm->_dungeonMan->_g275_currMapDoorInfo[L0494_ps_Door->getType()]._attributes, k0x0002_MaskDoorInfo_ProjectilesCanPassThrough) && + (getFlag(_vm->_dungeonMan->_currMapDoorInfo[L0494_ps_Door->getType()]._attributes, k0x0002_MaskDoorInfo_ProjectilesCanPassThrough) && ((L0510_i_ProjectileAssociatedThingType == k15_ExplosionThingType) ? (L0486_T_ProjectileAssociatedThing.toUint16() >= Thing::_explHarmNonMaterial.toUint16()) : ((L0490_ps_Projectile->_attack > _vm->getRandomNumber(128)) && - getFlag(_vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(L0486_T_ProjectileAssociatedThing)].getAllowedSlots(), k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors) + getFlag(_vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->getObjectInfoIndex(L0486_T_ProjectileAssociatedThing)].getAllowedSlots(), k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors) && ((L0510_i_ProjectileAssociatedThingType != k10_JunkThingType) || ((AL0487_i_IconIndex = _vm->_objectMan->f33_getIconIndex(L0486_T_ProjectileAssociatedThing)) < 0) || (!((AL0487_i_IconIndex >= k176_IconIndiceJunkIronKey) && (AL0487_i_IconIndex <= k191_IconIndiceJunkMasterKey)))) @@ -179,7 +179,7 @@ T0217004: L0489_i_ChampionAttack = L0488_i_Attack = f216_projectileGetImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing); break; case kM1_CreatureElemType: - L0491_ps_Group = (Group *)_vm->_dungeonMan->f156_getThingData(_vm->_groupMan->f175_groupGetThing(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY)); + L0491_ps_Group = (Group *)_vm->_dungeonMan->getThingData(_vm->_groupMan->f175_groupGetThing(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY)); if (!(L0512_ui_CreatureIndex = _vm->_groupMan->f176_getCreatureOrdinalInCell(L0491_ps_Group, cell))) { return false; } @@ -203,7 +203,7 @@ T0217004: (AL0487_i_Outcome == k0_outcomeKilledNoCreaturesInGroup) && (L0510_i_ProjectileAssociatedThingType == k5_WeaponThingType) && getFlag(L0493_ps_CreatureInfo->_attributes, k0x0400_MaskCreatureInfo_keepThrownSharpWeapon)) { - L0495_ps_Weapon = (Weapon *)_vm->_dungeonMan->f156_getThingData(L0486_T_ProjectileAssociatedThing); + L0495_ps_Weapon = (Weapon *)_vm->_dungeonMan->getThingData(L0486_T_ProjectileAssociatedThing); AL0487_i_WeaponType = L0495_ps_Weapon->getType(); if ((AL0487_i_WeaponType == k8_WeaponTypeDagger) || (AL0487_i_WeaponType == k27_WeaponTypeArrow) || (AL0487_i_WeaponType == k28_WeaponTypeSlayer) || (AL0487_i_WeaponType == k31_WeaponTypePoisonDart) || (AL0487_i_WeaponType == k32_WeaponTypeThrowingStar)) { L0497_pT_GroupSlot = &L0491_ps_Group->_slot; @@ -242,7 +242,7 @@ T0217044: L0492_ps_Potion->_nextThing = Thing::_none; L0490_ps_Projectile->_slot = L0498_T_ExplosionThing; } - _vm->_dungeonMan->f164_unlinkThingFromList(projectileThing, Thing(0), L0499_i_ProjectileMapX, L0500_i_ProjectileMapY); + _vm->_dungeonMan->unlinkThingFromList(projectileThing, Thing(0), L0499_i_ProjectileMapX, L0500_i_ProjectileMapY); f215_projectileDelete(projectileThing, L0497_pT_GroupSlot, L0499_i_ProjectileMapX, L0500_i_ProjectileMapY); return true; } @@ -261,13 +261,13 @@ uint16 ProjExpl::f216_projectileGetImpactAttack(Projectile* projectile, Thing th L0484_ui_KineticEnergy = projectile->_kineticEnergy; if ((AL0483_ui_ThingType = thing.getType()) != k15_ExplosionThingType) { if (AL0483_ui_ThingType == k5_WeaponThingType) { - L0485_ps_WeaponInfo = _vm->_dungeonMan->f158_getWeaponInfo(thing); + L0485_ps_WeaponInfo = _vm->_dungeonMan->getWeaponInfo(thing); AL0483_ui_Attack = L0485_ps_WeaponInfo->_kineticEnergy; _g367_projectileAttackType = k3_attackType_BLUNT; } else { AL0483_ui_Attack = _vm->getRandomNumber(4); } - AL0483_ui_Attack += _vm->_dungeonMan->f140_getObjectWeight(thing) >> 1; + AL0483_ui_Attack += _vm->_dungeonMan->getObjectWeight(thing) >> 1; } else { if (thing == Thing::_explSlime) { AL0483_ui_Attack = _vm->getRandomNumber(16); @@ -299,12 +299,12 @@ uint16 ProjExpl::f216_projectileGetImpactAttack(Projectile* projectile, Thing th void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXCombo, uint16 mapYCombo, uint16 cell) { #define AP0443_ui_ProjectileMapX mapXCombo #define AP0444_ui_ProjectileMapY mapYCombo - Thing L0473_T_Thing = _vm->_dungeonMan->f166_getUnusedThing(k15_ExplosionThingType); + Thing L0473_T_Thing = _vm->_dungeonMan->getUnusedThing(k15_ExplosionThingType); if (L0473_T_Thing == Thing::_none) { return; } - Explosion *L0470_ps_Explosion = &((Explosion *)_vm->_dungeonMan->_g284_thingData[k15_ExplosionThingType])[(L0473_T_Thing).getIndex()]; + Explosion *L0470_ps_Explosion = &((Explosion *)_vm->_dungeonMan->_thingData[k15_ExplosionThingType])[(L0473_T_Thing).getIndex()]; int16 L0474_i_ProjectileTargetMapX; int16 L0475_i_ProjectileTargetMapY; if (mapXCombo <= 255) { @@ -332,9 +332,9 @@ void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXC _vm->_sound->f064_SOUND_RequestPlay_CPSD(k13_soundSPELL, AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY, k1_soundModePlayIfPrioritized); } } - _vm->_dungeonMan->f163_linkThingToList(L0473_T_Thing, Thing(0), AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY); + _vm->_dungeonMan->linkThingToList(L0473_T_Thing, Thing(0), AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY); TimelineEvent L0476_s_Event; - setMapAndTime(L0476_s_Event._mapTime, _vm->_dungeonMan->_g272_currMapIndex, _vm->_gameTime + ((explThing == Thing::_explRebirthStep1) ? 5 : 1)); + setMapAndTime(L0476_s_Event._mapTime, _vm->_dungeonMan->_currMapIndex, _vm->_gameTime + ((explThing == Thing::_explRebirthStep1) ? 5 : 1)); L0476_s_Event._type = k25_TMEventTypeExplosion; L0476_s_Event._priority = 0; L0476_s_Event._C._slot = L0473_T_Thing.toUint16(); @@ -347,11 +347,11 @@ void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXC attack = (attack >> 1) + 1; attack += _vm->getRandomNumber(attack) + 1; if ((explThing == Thing::_explFireBall) || (attack >>= 1)) { - if ((_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex) && (AP0443_ui_ProjectileMapX == _vm->_dungeonMan->_g306_partyMapX) && (AP0444_ui_ProjectileMapY == _vm->_dungeonMan->_g307_partyMapY)) { + if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (AP0443_ui_ProjectileMapX == _vm->_dungeonMan->_partyMapX) && (AP0444_ui_ProjectileMapY == _vm->_dungeonMan->_partyMapY)) { _vm->_championMan->getDamagedChampionCount(attack, k0x0001_ChampionWoundReadHand | k0x0002_ChampionWoundActionHand | k0x0004_ChampionWoundHead | k0x0008_ChampionWoundTorso | k0x0010_ChampionWoundLegs | k0x0020_ChampionWoundFeet, k1_attackType_FIRE); } else { if ((L0473_T_Thing = _vm->_groupMan->f175_groupGetThing(AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY)) != Thing::_endOfList) { /* ASSEMBLY_COMPILATION_DIFFERENCE jmp */ - Group *L0472_ps_Group = (Group *)_vm->_dungeonMan->f156_getThingData(L0473_T_Thing); + Group *L0472_ps_Group = (Group *)_vm->_dungeonMan->getThingData(L0473_T_Thing); CreatureInfo *L0471_ps_CreatureInfo = &g243_CreatureInfo[L0472_ps_Group->_type]; int16 L0469_i_CreatureFireResistance = L0471_ps_CreatureInfo->getFireResistance(); if (L0469_i_CreatureFireResistance != k15_immuneToFire) { @@ -376,7 +376,7 @@ int16 ProjExpl::f218_projectileGetImpactCount(int16 impactType, int16 mapX, int1 L0514_i_ImpactCount = 0; _g364_creatureDamageOutcome = k0_outcomeKilledNoCreaturesInGroup; T0218001: - L0513_T_Thing = _vm->_dungeonMan->f161_getSquareFirstThing(mapX, mapY); + L0513_T_Thing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); while (L0513_T_Thing != Thing::_endOfList) { if (((L0513_T_Thing).getType() == k14_ProjectileThingType) && ((L0513_T_Thing).getCell() == cell) && @@ -387,7 +387,7 @@ T0218001: break; goto T0218001; } - L0513_T_Thing = _vm->_dungeonMan->f159_getNextThing(L0513_T_Thing); + L0513_T_Thing = _vm->_dungeonMan->getNextThing(L0513_T_Thing); } return L0514_i_ImpactCount; } @@ -396,22 +396,22 @@ void ProjExpl::f214_projectileDeleteEvent(Thing thing) { Projectile* L0477_ps_Projectile; - L0477_ps_Projectile = (Projectile *)_vm->_dungeonMan->f156_getThingData(thing); + L0477_ps_Projectile = (Projectile *)_vm->_dungeonMan->getThingData(thing); _vm->_timeline->f237_deleteEvent(L0477_ps_Projectile->_eventIndex); } void ProjExpl::f215_projectileDelete(Thing projectileThing, Thing* groupSlot, int16 mapX, int16 mapY) { - Projectile *L0480_ps_Projectile = (Projectile *)_vm->_dungeonMan->f156_getThingData(projectileThing); + Projectile *L0480_ps_Projectile = (Projectile *)_vm->_dungeonMan->getThingData(projectileThing); Thing L0479_T_Thing = L0480_ps_Projectile->_slot; if (L0479_T_Thing.getType() != k15_ExplosionThingType) { if (groupSlot != NULL) { Thing L0478_T_PreviousThing = *groupSlot; if (L0478_T_PreviousThing == Thing::_endOfList) { - Thing *L0481_ps_Generic = (Thing *)_vm->_dungeonMan->f156_getThingData(L0479_T_Thing); + Thing *L0481_ps_Generic = (Thing *)_vm->_dungeonMan->getThingData(L0479_T_Thing); *L0481_ps_Generic = Thing::_endOfList; *groupSlot = L0479_T_Thing; } else { - _vm->_dungeonMan->f163_linkThingToList(L0479_T_Thing, L0478_T_PreviousThing, kM1_MapXNotOnASquare, 0); + _vm->_dungeonMan->linkThingToList(L0479_T_Thing, L0478_T_PreviousThing, kM1_MapXNotOnASquare, 0); } } else { _vm->_moveSens->f267_getMoveResult(Thing((L0479_T_Thing).getTypeAndIndex() | getFlag(projectileThing.toUint16(), 0xC)), -2, 0, mapX, mapY); @@ -440,21 +440,21 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) { L0527_s_Event = *event; L0519_ps_Event = &L0527_s_Event; - L0520_ps_Projectile = (Projectile*)_vm->_dungeonMan->f156_getThingData(L0521_T_ProjectileThing = L0515_T_ProjectileThingNewCell = Thing(L0519_ps_Event->_B._slot)); + L0520_ps_Projectile = (Projectile*)_vm->_dungeonMan->getThingData(L0521_T_ProjectileThing = L0515_T_ProjectileThingNewCell = Thing(L0519_ps_Event->_B._slot)); L0523_i_DestinationMapX = L0519_ps_Event->_C._projectile.getMapX(); L0524_i_DestinationMapY = L0519_ps_Event->_C._projectile.getMapY(); if (L0519_ps_Event->_type == k48_TMEventTypeMoveProjectileIgnoreImpacts) { L0519_ps_Event->_type = k49_TMEventTypeMoveProjectile; } else { L0518_ui_Cell = (L0515_T_ProjectileThingNewCell).getCell(); - if ((_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex) && (L0523_i_DestinationMapX == _vm->_dungeonMan->_g306_partyMapX) && (L0524_i_DestinationMapY == _vm->_dungeonMan->_g307_partyMapY) && f217_projectileHasImpactOccurred(kM2_ChampionElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0515_T_ProjectileThingNewCell)) { + if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (L0523_i_DestinationMapX == _vm->_dungeonMan->_partyMapX) && (L0524_i_DestinationMapY == _vm->_dungeonMan->_partyMapY) && f217_projectileHasImpactOccurred(kM2_ChampionElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0515_T_ProjectileThingNewCell)) { return; } if ((_vm->_groupMan->f175_groupGetThing(L0523_i_DestinationMapX, L0524_i_DestinationMapY) != Thing::_endOfList) && f217_projectileHasImpactOccurred(kM1_CreatureElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0521_T_ProjectileThing)) { return; } if (L0520_ps_Projectile->_kineticEnergy <= (AL0516_ui_StepEnergy = L0519_ps_Event->_C._projectile.getStepEnergy())) { - _vm->_dungeonMan->f164_unlinkThingFromList(L0515_T_ProjectileThingNewCell = L0521_T_ProjectileThing, Thing(0), L0523_i_DestinationMapX, L0524_i_DestinationMapY); + _vm->_dungeonMan->unlinkThingFromList(L0515_T_ProjectileThingNewCell = L0521_T_ProjectileThing, Thing(0), L0523_i_DestinationMapX, L0524_i_DestinationMapY); f215_projectileDelete(L0515_T_ProjectileThingNewCell, NULL, L0523_i_DestinationMapX, L0524_i_DestinationMapY); return; } @@ -473,10 +473,10 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) { L0525_i_SourceMapX = L0523_i_DestinationMapX; L0526_i_SourceMapY = L0524_i_DestinationMapY; L0523_i_DestinationMapX += _vm->_dirIntoStepCountEast[L0517_ui_ProjectileDirection], L0524_i_DestinationMapY += _vm->_dirIntoStepCountNorth[L0517_ui_ProjectileDirection]; - AL0516_ui_Square = _vm->_dungeonMan->f151_getSquare(L0523_i_DestinationMapX, L0524_i_DestinationMapY).toByte(); + AL0516_ui_Square = _vm->_dungeonMan->getSquare(L0523_i_DestinationMapX, L0524_i_DestinationMapY).toByte(); if ((Square(AL0516_ui_Square).getType() == k0_WallElemType) || ((Square(AL0516_ui_Square).getType() == k6_FakeWallElemType) && !getFlag(AL0516_ui_Square, (k0x0001_FakeWallImaginary | k0x0004_FakeWallOpen))) || - ((Square(AL0516_ui_Square).getType() == k3_StairsElemType) && (Square(_vm->_dungeonMan->_g271_currMapData[L0525_i_SourceMapX][L0526_i_SourceMapY]).getType() == k3_StairsElemType))) { + ((Square(AL0516_ui_Square).getType() == k3_StairsElemType) && (Square(_vm->_dungeonMan->_currMapData[L0525_i_SourceMapX][L0526_i_SourceMapY]).getType() == k3_StairsElemType))) { if (f217_projectileHasImpactOccurred(Square(AL0516_ui_Square).getType(), L0525_i_SourceMapX, L0526_i_SourceMapY, L0518_ui_Cell, L0515_T_ProjectileThingNewCell)) { return; } @@ -496,13 +496,13 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) { L0515_T_ProjectileThingNewCell = thingWithNewCell(L0515_T_ProjectileThingNewCell, _vm->_moveSens->_g401_moveResultCell); M31_setMap(L0519_ps_Event->_mapTime, _vm->_moveSens->_g399_moveResultMapIndex); } else { - if ((Square(_vm->_dungeonMan->f151_getSquare(L0523_i_DestinationMapX, L0524_i_DestinationMapY)).getType() == k4_DoorElemType) && f217_projectileHasImpactOccurred(k4_DoorElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0521_T_ProjectileThing)) { + if ((Square(_vm->_dungeonMan->getSquare(L0523_i_DestinationMapX, L0524_i_DestinationMapY)).getType() == k4_DoorElemType) && f217_projectileHasImpactOccurred(k4_DoorElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0521_T_ProjectileThing)) { return; } - _vm->_dungeonMan->f164_unlinkThingFromList(L0515_T_ProjectileThingNewCell, Thing(0), L0523_i_DestinationMapX, L0524_i_DestinationMapY); - _vm->_dungeonMan->f163_linkThingToList(L0515_T_ProjectileThingNewCell, Thing(0), L0523_i_DestinationMapX, L0524_i_DestinationMapY); + _vm->_dungeonMan->unlinkThingFromList(L0515_T_ProjectileThingNewCell, Thing(0), L0523_i_DestinationMapX, L0524_i_DestinationMapY); + _vm->_dungeonMan->linkThingToList(L0515_T_ProjectileThingNewCell, Thing(0), L0523_i_DestinationMapX, L0524_i_DestinationMapY); } - L0519_ps_Event->_mapTime += (_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex) ? 1 : 3; + L0519_ps_Event->_mapTime += (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) ? 1 : 3; //Strangerke: CHECKME: Maybe we should keep that piece of code too as it sounds like it's fixing a weird behavior of projectiles on different maps #ifdef COMPILE42_CSB20EN_CSB21EN /* CHANGE7_20_IMPROVEMENT Projectiles now move at the same speed on all maps instead of moving slower on maps other than the party map */ L0519_ps_Event->Map_Time++; @@ -531,11 +531,11 @@ void ProjExpl::f220_explosionProcessEvent25_explosion(TimelineEvent* event) { L0528_ui_MapX = event->_B._location._mapX; L0529_ui_MapY = event->_B._location._mapY; - L0532_ps_Explosion = &((Explosion*)_vm->_dungeonMan->_g284_thingData[k15_ExplosionThingType])[Thing((event->_C._slot)).getIndex()]; - AL0531_i_SquareType = Square(_vm->_dungeonMan->_g271_currMapData[L0528_ui_MapX][L0529_ui_MapY]).getType(); - L0538_B_ExplosionOnPartySquare = (_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex) && (L0528_ui_MapX == _vm->_dungeonMan->_g306_partyMapX) && (L0529_ui_MapY == _vm->_dungeonMan->_g307_partyMapY); + L0532_ps_Explosion = &((Explosion*)_vm->_dungeonMan->_thingData[k15_ExplosionThingType])[Thing((event->_C._slot)).getIndex()]; + AL0531_i_SquareType = Square(_vm->_dungeonMan->_currMapData[L0528_ui_MapX][L0529_ui_MapY]).getType(); + L0538_B_ExplosionOnPartySquare = (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (L0528_ui_MapX == _vm->_dungeonMan->_partyMapX) && (L0529_ui_MapY == _vm->_dungeonMan->_partyMapY); if ((L0535_T_GroupThing = _vm->_groupMan->f175_groupGetThing(L0528_ui_MapX, L0529_ui_MapY)) != Thing::_endOfList) { - L0533_ps_Group = (Group*)_vm->_dungeonMan->f156_getThingData(L0535_T_GroupThing); + L0533_ps_Group = (Group*)_vm->_dungeonMan->getThingData(L0535_T_GroupThing); L0534_ps_CreatureInfo = &g243_CreatureInfo[AL0537_ui_CreatureType = L0533_ps_Group->_type]; } if ((L0536_T_ExplosionThing = Thing(Thing::_firstExplosion.toUint16() + L0532_ps_Explosion->getType())) == Thing::_explPoisonCloud) { @@ -557,7 +557,7 @@ void ProjExpl::f220_explosionProcessEvent25_explosion(TimelineEvent* event) { break; case 0xFF83: if ((L0535_T_GroupThing != Thing::_endOfList) && getFlag(L0534_ps_CreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)) { - if ((AL0537_ui_CreatureType == k19_CreatureTypeMaterializerZytaz) && (_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex)) { /* ASSEMBLY_COMPILATION_DIFFERENCE jmp */ + if ((AL0537_ui_CreatureType == k19_CreatureTypeMaterializerZytaz) && (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex)) { /* ASSEMBLY_COMPILATION_DIFFERENCE jmp */ L0530_i_Attack -= (AL0537_ui_NonMaterialAdditionalAttack = L0530_i_Attack >> 3); AL0537_ui_NonMaterialAdditionalAttack <<= 1; AL0537_ui_NonMaterialAdditionalAttack++; @@ -599,7 +599,7 @@ T0220026: return; } } - _vm->_dungeonMan->f164_unlinkThingFromList(Thing(event->_C._slot), Thing(0), L0528_ui_MapX, L0529_ui_MapY); + _vm->_dungeonMan->unlinkThingFromList(Thing(event->_C._slot), Thing(0), L0528_ui_MapX, L0529_ui_MapY); L0532_ps_Explosion->setNextThing(Thing::_none); } } -- cgit v1.2.3 From 5c81e4f4fd2ea79255e9bc635eb8ef2a93aef60c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 25 Aug 2016 21:17:48 +0200 Subject: DM: Rename functions and class members of GroupMan --- engines/dm/projexpl.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 4fdda2ede0..8ef401313d 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -170,7 +170,7 @@ T0217004: return false; } L0488_i_Attack = f216_projectileGetImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing) + 1; - _vm->_groupMan->f232_groupIsDoorDestoryedByAttack(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, L0488_i_Attack + _vm->getRandomNumber(L0488_i_Attack), false, 0); + _vm->_groupMan->groupIsDoorDestoryedByAttack(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, L0488_i_Attack + _vm->getRandomNumber(L0488_i_Attack), false, 0); break; case kM2_ChampionElemType: if ((AP0456_i_ChampionIndex = _vm->_championMan->getIndexInCell(cell)) < 0) { @@ -179,8 +179,8 @@ T0217004: L0489_i_ChampionAttack = L0488_i_Attack = f216_projectileGetImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing); break; case kM1_CreatureElemType: - L0491_ps_Group = (Group *)_vm->_dungeonMan->getThingData(_vm->_groupMan->f175_groupGetThing(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY)); - if (!(L0512_ui_CreatureIndex = _vm->_groupMan->f176_getCreatureOrdinalInCell(L0491_ps_Group, cell))) { + L0491_ps_Group = (Group *)_vm->_dungeonMan->getThingData(_vm->_groupMan->groupGetThing(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY)); + if (!(L0512_ui_CreatureIndex = _vm->_groupMan->getCreatureOrdinalInCell(L0491_ps_Group, cell))) { return false; } L0512_ui_CreatureIndex--; @@ -195,8 +195,8 @@ T0217004: } L0488_i_Attack = (uint16)((unsigned long)f216_projectileGetImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing) << 6) / L0493_ps_CreatureInfo->_defense; if (L0488_i_Attack) { - if ((AL0487_i_Outcome = _vm->_groupMan->f190_groupGetDamageCreatureOutcome(L0491_ps_Group, L0512_ui_CreatureIndex, AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, L0488_i_Attack + _vm->_groupMan->f192_groupGetResistanceAdjustedPoisonAttack(L0511_ui_CreatureType, _g366_projectilePoisonAttack), true)) != k0_outcomeKilledNoCreaturesInGroup) { - _vm->_groupMan->f209_processEvents29to41(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, kM2_TMEventTypeCreateReactionEvent30HitByProjectile, 0); + if ((AL0487_i_Outcome = _vm->_groupMan->groupGetDamageCreatureOutcome(L0491_ps_Group, L0512_ui_CreatureIndex, AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, L0488_i_Attack + _vm->_groupMan->groupGetResistanceAdjustedPoisonAttack(L0511_ui_CreatureType, _g366_projectilePoisonAttack), true)) != k0_outcomeKilledNoCreaturesInGroup) { + _vm->_groupMan->processEvents29to41(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, kM2_TMEventTypeCreateReactionEvent30HitByProjectile, 0); } _g364_creatureDamageOutcome = AL0487_i_Outcome; if (!L0505_B_CreateExplosionOnImpact && @@ -350,7 +350,7 @@ void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXC if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (AP0443_ui_ProjectileMapX == _vm->_dungeonMan->_partyMapX) && (AP0444_ui_ProjectileMapY == _vm->_dungeonMan->_partyMapY)) { _vm->_championMan->getDamagedChampionCount(attack, k0x0001_ChampionWoundReadHand | k0x0002_ChampionWoundActionHand | k0x0004_ChampionWoundHead | k0x0008_ChampionWoundTorso | k0x0010_ChampionWoundLegs | k0x0020_ChampionWoundFeet, k1_attackType_FIRE); } else { - if ((L0473_T_Thing = _vm->_groupMan->f175_groupGetThing(AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY)) != Thing::_endOfList) { /* ASSEMBLY_COMPILATION_DIFFERENCE jmp */ + if ((L0473_T_Thing = _vm->_groupMan->groupGetThing(AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY)) != Thing::_endOfList) { /* ASSEMBLY_COMPILATION_DIFFERENCE jmp */ Group *L0472_ps_Group = (Group *)_vm->_dungeonMan->getThingData(L0473_T_Thing); CreatureInfo *L0471_ps_CreatureInfo = &g243_CreatureInfo[L0472_ps_Group->_type]; int16 L0469_i_CreatureFireResistance = L0471_ps_CreatureInfo->getFireResistance(); @@ -359,7 +359,7 @@ void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXC attack >>= 2; } if ((attack -= _vm->getRandomNumber((L0469_i_CreatureFireResistance << 1) + 1)) > 0) { - _g364_creatureDamageOutcome = _vm->_groupMan->f191_getDamageAllCreaturesOutcome(L0472_ps_Group, AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY, attack, true); + _g364_creatureDamageOutcome = _vm->_groupMan->getDamageAllCreaturesOutcome(L0472_ps_Group, AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY, attack, true); } } } @@ -450,7 +450,7 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) { if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (L0523_i_DestinationMapX == _vm->_dungeonMan->_partyMapX) && (L0524_i_DestinationMapY == _vm->_dungeonMan->_partyMapY) && f217_projectileHasImpactOccurred(kM2_ChampionElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0515_T_ProjectileThingNewCell)) { return; } - if ((_vm->_groupMan->f175_groupGetThing(L0523_i_DestinationMapX, L0524_i_DestinationMapY) != Thing::_endOfList) && f217_projectileHasImpactOccurred(kM1_CreatureElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0521_T_ProjectileThing)) { + if ((_vm->_groupMan->groupGetThing(L0523_i_DestinationMapX, L0524_i_DestinationMapY) != Thing::_endOfList) && f217_projectileHasImpactOccurred(kM1_CreatureElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0521_T_ProjectileThing)) { return; } if (L0520_ps_Projectile->_kineticEnergy <= (AL0516_ui_StepEnergy = L0519_ps_Event->_C._projectile.getStepEnergy())) { @@ -534,7 +534,7 @@ void ProjExpl::f220_explosionProcessEvent25_explosion(TimelineEvent* event) { L0532_ps_Explosion = &((Explosion*)_vm->_dungeonMan->_thingData[k15_ExplosionThingType])[Thing((event->_C._slot)).getIndex()]; AL0531_i_SquareType = Square(_vm->_dungeonMan->_currMapData[L0528_ui_MapX][L0529_ui_MapY]).getType(); L0538_B_ExplosionOnPartySquare = (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (L0528_ui_MapX == _vm->_dungeonMan->_partyMapX) && (L0529_ui_MapY == _vm->_dungeonMan->_partyMapY); - if ((L0535_T_GroupThing = _vm->_groupMan->f175_groupGetThing(L0528_ui_MapX, L0529_ui_MapY)) != Thing::_endOfList) { + if ((L0535_T_GroupThing = _vm->_groupMan->groupGetThing(L0528_ui_MapX, L0529_ui_MapY)) != Thing::_endOfList) { L0533_ps_Group = (Group*)_vm->_dungeonMan->getThingData(L0535_T_GroupThing); L0534_ps_CreatureInfo = &g243_CreatureInfo[AL0537_ui_CreatureType = L0533_ps_Group->_type]; } @@ -552,7 +552,7 @@ void ProjExpl::f220_explosionProcessEvent25_explosion(TimelineEvent* event) { break; case 0xFF80: if (AL0531_i_SquareType == k4_DoorElemType) { - _vm->_groupMan->f232_groupIsDoorDestoryedByAttack(L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack, true, 0); + _vm->_groupMan->groupIsDoorDestoryedByAttack(L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack, true, 0); } break; case 0xFF83: @@ -563,12 +563,12 @@ void ProjExpl::f220_explosionProcessEvent25_explosion(TimelineEvent* event) { AL0537_ui_NonMaterialAdditionalAttack++; AL0531_i_CreatureCount = L0533_ps_Group->getCount(); do { - if (getFlag(_vm->_groupMan->_g375_activeGroups[L0533_ps_Group->getActiveGroupIndex()]._aspect[AL0531_i_CreatureCount], k0x0080_MaskActiveGroupIsAttacking)) { /* Materializer / Zytaz can only be damaged while they are attacking */ - _vm->_groupMan->f190_groupGetDamageCreatureOutcome(L0533_ps_Group, AL0531_i_CreatureCount, L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack + _vm->getRandomNumber(AL0537_ui_NonMaterialAdditionalAttack) + _vm->getRandomNumber(4), true); + if (getFlag(_vm->_groupMan->_activeGroups[L0533_ps_Group->getActiveGroupIndex()]._aspect[AL0531_i_CreatureCount], k0x0080_MaskActiveGroupIsAttacking)) { /* Materializer / Zytaz can only be damaged while they are attacking */ + _vm->_groupMan->groupGetDamageCreatureOutcome(L0533_ps_Group, AL0531_i_CreatureCount, L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack + _vm->getRandomNumber(AL0537_ui_NonMaterialAdditionalAttack) + _vm->getRandomNumber(4), true); } } while (--AL0531_i_CreatureCount >= 0); } else { - _vm->_groupMan->f191_getDamageAllCreaturesOutcome(L0533_ps_Group, L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack, true); + _vm->_groupMan->getDamageAllCreaturesOutcome(L0533_ps_Group, L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack, true); } } break; @@ -586,8 +586,8 @@ void ProjExpl::f220_explosionProcessEvent25_explosion(TimelineEvent* event) { if (L0538_B_ExplosionOnPartySquare) { _vm->_championMan->getDamagedChampionCount(L0530_i_Attack, k0x0000_ChampionWoundNone, k0_attackType_NORMAL); } else { - if ((L0535_T_GroupThing != Thing::_endOfList) && (L0530_i_Attack = _vm->_groupMan->f192_groupGetResistanceAdjustedPoisonAttack(AL0537_ui_CreatureType, L0530_i_Attack)) && (_vm->_groupMan->f191_getDamageAllCreaturesOutcome(L0533_ps_Group, L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack, true) != k2_outcomeKilledAllCreaturesInGroup) && (L0530_i_Attack > 2)) { - _vm->_groupMan->f209_processEvents29to41(L0528_ui_MapX, L0529_ui_MapY, kM3_TMEventTypeCreateReactionEvent29DangerOnSquare, 0); + if ((L0535_T_GroupThing != Thing::_endOfList) && (L0530_i_Attack = _vm->_groupMan->groupGetResistanceAdjustedPoisonAttack(AL0537_ui_CreatureType, L0530_i_Attack)) && (_vm->_groupMan->getDamageAllCreaturesOutcome(L0533_ps_Group, L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack, true) != k2_outcomeKilledAllCreaturesInGroup) && (L0530_i_Attack > 2)) { + _vm->_groupMan->processEvents29to41(L0528_ui_MapX, L0529_ui_MapY, kM3_TMEventTypeCreateReactionEvent29DangerOnSquare, 0); } } if (L0532_ps_Explosion->getAttack() >= 6) { -- cgit v1.2.3 From 938b38a66a87e11bdb6719a22023c0dcede1b5bb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 25 Aug 2016 22:09:30 +0200 Subject: DM: Rename class members of MovesensMan --- engines/dm/projexpl.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 8ef401313d..591f17f120 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -152,7 +152,7 @@ T0217004: L0494_ps_Door = (Door *)_vm->_dungeonMan->getSquareFirstThingData(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY); if ((AL0487_i_DoorState != k5_doorState_DESTROYED) && (L0486_T_ProjectileAssociatedThing == Thing::_explOpenDoor)) { if (L0494_ps_Door->hasButton()) { - _vm->_moveSens->f268_addEvent(k10_TMEventTypeDoor, AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, 0, k2_SensorEffToggle, _vm->_gameTime + 1); + _vm->_moveSens->addEvent(k10_TMEventTypeDoor, AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, 0, k2_SensorEffToggle, _vm->_gameTime + 1); } break; } @@ -414,7 +414,7 @@ void ProjExpl::f215_projectileDelete(Thing projectileThing, Thing* groupSlot, in _vm->_dungeonMan->linkThingToList(L0479_T_Thing, L0478_T_PreviousThing, kM1_MapXNotOnASquare, 0); } } else { - _vm->_moveSens->f267_getMoveResult(Thing((L0479_T_Thing).getTypeAndIndex() | getFlag(projectileThing.toUint16(), 0xC)), -2, 0, mapX, mapY); + _vm->_moveSens->getMoveResult(Thing((L0479_T_Thing).getTypeAndIndex() | getFlag(projectileThing.toUint16(), 0xC)), -2, 0, mapX, mapY); } } L0480_ps_Projectile->_nextThing = Thing::_none; @@ -489,12 +489,12 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) { } L0515_T_ProjectileThingNewCell = thingWithNewCell(L0515_T_ProjectileThingNewCell, L0518_ui_Cell &= 0x0003); if (L0522_B_ProjectileMovesToOtherSquare) { - _vm->_moveSens->f267_getMoveResult(L0515_T_ProjectileThingNewCell, L0525_i_SourceMapX, L0526_i_SourceMapY, L0523_i_DestinationMapX, L0524_i_DestinationMapY); - L0519_ps_Event->_C._projectile.setMapX(_vm->_moveSens->_g397_moveResultMapX); - L0519_ps_Event->_C._projectile.setMapY(_vm->_moveSens->_g398_moveResultMapY); - L0519_ps_Event->_C._projectile.setDir((Direction)_vm->_moveSens->_g400_moveResultDir); - L0515_T_ProjectileThingNewCell = thingWithNewCell(L0515_T_ProjectileThingNewCell, _vm->_moveSens->_g401_moveResultCell); - M31_setMap(L0519_ps_Event->_mapTime, _vm->_moveSens->_g399_moveResultMapIndex); + _vm->_moveSens->getMoveResult(L0515_T_ProjectileThingNewCell, L0525_i_SourceMapX, L0526_i_SourceMapY, L0523_i_DestinationMapX, L0524_i_DestinationMapY); + L0519_ps_Event->_C._projectile.setMapX(_vm->_moveSens->_moveResultMapX); + L0519_ps_Event->_C._projectile.setMapY(_vm->_moveSens->_moveResultMapY); + L0519_ps_Event->_C._projectile.setDir((Direction)_vm->_moveSens->_moveResultDir); + L0515_T_ProjectileThingNewCell = thingWithNewCell(L0515_T_ProjectileThingNewCell, _vm->_moveSens->_moveResultCell); + M31_setMap(L0519_ps_Event->_mapTime, _vm->_moveSens->_moveResultMapIndex); } else { if ((Square(_vm->_dungeonMan->getSquare(L0523_i_DestinationMapX, L0524_i_DestinationMapY)).getType() == k4_DoorElemType) && f217_projectileHasImpactOccurred(k4_DoorElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0521_T_ProjectileThing)) { return; -- cgit v1.2.3 From 52170d39aef8f0a844831cdb6bd8572210a9bb29 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 25 Aug 2016 22:19:34 +0200 Subject: DM: Rename ObjectMan and ProjExpl members --- engines/dm/projexpl.cpp | 94 ++++++++++++++++++++++++------------------------- 1 file changed, 47 insertions(+), 47 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 591f17f120..aab6e7ca00 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -37,16 +37,16 @@ namespace DM { ProjExpl::ProjExpl(DMEngine* vm) : _vm(vm) { - _g364_creatureDamageOutcome = 0; - _g363_secondaryDirToOrFromParty = 0; - _g361_lastCreatureAttackTime = -200; - _g365_createLanucherProjectile = false; - _g366_projectilePoisonAttack = 0; - _g367_projectileAttackType = 0; - _g362_lastPartyMovementTime = 0; + _creatureDamageOutcome = 0; + _secondaryDirToOrFromParty = 0; + _lastCreatureAttackTime = -200; + _createLauncherProjectile = false; + _projectilePoisonAttack = 0; + _projectileAttackType = 0; + _lastPartyMovementTime = 0; } -void ProjExpl::f212_projectileCreate(Thing thing, int16 mapX, int16 mapY, uint16 cell, Direction dir, byte kineticEnergy, byte attack, byte stepEnergy) { +void ProjExpl::createProjectile(Thing thing, int16 mapX, int16 mapY, uint16 cell, Direction dir, byte kineticEnergy, byte attack, byte stepEnergy) { Thing L0466_T_ProjectileThing; Projectile* L0467_ps_Projectile; TimelineEvent L0468_s_Event; @@ -62,7 +62,7 @@ void ProjExpl::f212_projectileCreate(Thing thing, int16 mapX, int16 mapY, uint16 L0467_ps_Projectile->_attack = attack; _vm->_dungeonMan->linkThingToList(L0466_T_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 */ setMapAndTime(L0468_s_Event._mapTime, _vm->_dungeonMan->_currMapIndex, _vm->_gameTime + 1); - if (_g365_createLanucherProjectile) { + if (_createLauncherProjectile) { L0468_s_Event._type = k49_TMEventTypeMoveProjectile; /* Launcher projectiles can impact immediately */ } else { L0468_s_Event._type = k48_TMEventTypeMoveProjectileIgnoreImpacts; /* Projectiles created by champions or creatures ignore impacts on their first movement */ @@ -76,7 +76,7 @@ void ProjExpl::f212_projectileCreate(Thing thing, int16 mapX, int16 mapY, uint16 L0467_ps_Projectile->_eventIndex = _vm->_timeline->f238_addEventGetEventIndex(&L0468_s_Event); } -bool ProjExpl::f217_projectileHasImpactOccurred(int16 impactType, int16 mapXCombo, int16 mapYCombo, int16 cell, Thing projectileThing) { +bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, int16 mapYCombo, int16 cell, Thing projectileThing) { #define AP0454_i_ProjectileTargetMapX mapXCombo #define AP0455_i_ProjectileTargetMapY mapYCombo #define AP0456_i_ChampionIndex cell @@ -116,7 +116,7 @@ bool ProjExpl::f217_projectileHasImpactOccurred(int16 impactType, int16 mapXComb L0501_i_MapXCombo = mapXCombo; L0502_i_MapYCombo = mapYCombo; L0509_B_RemovePotion = false; - _g364_creatureDamageOutcome = k0_outcomeKilledNoCreaturesInGroup; + _creatureDamageOutcome = k0_outcomeKilledNoCreaturesInGroup; if ((L0510_i_ProjectileAssociatedThingType = (L0486_T_ProjectileAssociatedThing = L0490_ps_Projectile->_slot).getType()) == k8_PotionThingType) { L0491_ps_Group = (Group *)_vm->_dungeonMan->getThingData(L0486_T_ProjectileAssociatedThing); switch (((Potion *)L0491_ps_Group)->getType()) { @@ -164,19 +164,19 @@ T0217004: ((L0490_ps_Projectile->_attack > _vm->getRandomNumber(128)) && getFlag(_vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->getObjectInfoIndex(L0486_T_ProjectileAssociatedThing)].getAllowedSlots(), k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors) && ((L0510_i_ProjectileAssociatedThingType != k10_JunkThingType) || - ((AL0487_i_IconIndex = _vm->_objectMan->f33_getIconIndex(L0486_T_ProjectileAssociatedThing)) < 0) || + ((AL0487_i_IconIndex = _vm->_objectMan->getIconIndex(L0486_T_ProjectileAssociatedThing)) < 0) || (!((AL0487_i_IconIndex >= k176_IconIndiceJunkIronKey) && (AL0487_i_IconIndex <= k191_IconIndiceJunkMasterKey)))) )))) { /* ASSEMBLY_COMPILATION_DIFFERENCE jmp */ return false; } - L0488_i_Attack = f216_projectileGetImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing) + 1; + L0488_i_Attack = getProjectileImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing) + 1; _vm->_groupMan->groupIsDoorDestoryedByAttack(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, L0488_i_Attack + _vm->getRandomNumber(L0488_i_Attack), false, 0); break; case kM2_ChampionElemType: if ((AP0456_i_ChampionIndex = _vm->_championMan->getIndexInCell(cell)) < 0) { return false; } - L0489_i_ChampionAttack = L0488_i_Attack = f216_projectileGetImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing); + L0489_i_ChampionAttack = L0488_i_Attack = getProjectileImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing); break; case kM1_CreatureElemType: L0491_ps_Group = (Group *)_vm->_dungeonMan->getThingData(_vm->_groupMan->groupGetThing(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY)); @@ -187,18 +187,18 @@ T0217004: L0493_ps_CreatureInfo = &g243_CreatureInfo[L0511_ui_CreatureType = L0491_ps_Group->_type]; if ((L0486_T_ProjectileAssociatedThing == Thing::_explFireBall) && (L0511_ui_CreatureType == k11_CreatureTypeBlackFlame)) { L0496_pui_CreatureHealth = &L0491_ps_Group->_health[L0512_ui_CreatureIndex]; - *L0496_pui_CreatureHealth = MIN(1000, *L0496_pui_CreatureHealth + f216_projectileGetImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing)); + *L0496_pui_CreatureHealth = MIN(1000, *L0496_pui_CreatureHealth + getProjectileImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing)); goto T0217044; } if (getFlag(L0493_ps_CreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial) && (L0486_T_ProjectileAssociatedThing != Thing::_explHarmNonMaterial)) { return false; } - L0488_i_Attack = (uint16)((unsigned long)f216_projectileGetImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing) << 6) / L0493_ps_CreatureInfo->_defense; + L0488_i_Attack = (uint16)((unsigned long)getProjectileImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing) << 6) / L0493_ps_CreatureInfo->_defense; if (L0488_i_Attack) { - if ((AL0487_i_Outcome = _vm->_groupMan->groupGetDamageCreatureOutcome(L0491_ps_Group, L0512_ui_CreatureIndex, AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, L0488_i_Attack + _vm->_groupMan->groupGetResistanceAdjustedPoisonAttack(L0511_ui_CreatureType, _g366_projectilePoisonAttack), true)) != k0_outcomeKilledNoCreaturesInGroup) { + if ((AL0487_i_Outcome = _vm->_groupMan->groupGetDamageCreatureOutcome(L0491_ps_Group, L0512_ui_CreatureIndex, AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, L0488_i_Attack + _vm->_groupMan->groupGetResistanceAdjustedPoisonAttack(L0511_ui_CreatureType, _projectilePoisonAttack), true)) != k0_outcomeKilledNoCreaturesInGroup) { _vm->_groupMan->processEvents29to41(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, kM2_TMEventTypeCreateReactionEvent30HitByProjectile, 0); } - _g364_creatureDamageOutcome = AL0487_i_Outcome; + _creatureDamageOutcome = AL0487_i_Outcome; if (!L0505_B_CreateExplosionOnImpact && (AL0487_i_Outcome == k0_outcomeKilledNoCreaturesInGroup) && (L0510_i_ProjectileAssociatedThingType == k5_WeaponThingType) && @@ -211,8 +211,8 @@ T0217004: } } } - if (L0489_i_ChampionAttack && _vm->_championMan->addPendingDamageAndWounds_getDamage(AP0456_i_ChampionIndex, L0488_i_Attack, k0x0004_ChampionWoundHead | k0x0008_ChampionWoundTorso, _g367_projectileAttackType) && _g366_projectilePoisonAttack && _vm->getRandomNumber(2)) { - _vm->_championMan->championPoison(AP0456_i_ChampionIndex, _g366_projectilePoisonAttack); + if (L0489_i_ChampionAttack && _vm->_championMan->addPendingDamageAndWounds_getDamage(AP0456_i_ChampionIndex, L0488_i_Attack, k0x0004_ChampionWoundHead | k0x0008_ChampionWoundTorso, _projectileAttackType) && _projectilePoisonAttack && _vm->getRandomNumber(2)) { + _vm->_championMan->championPoison(AP0456_i_ChampionIndex, _projectilePoisonAttack); } if (L0505_B_CreateExplosionOnImpact || L0509_B_RemovePotion ) { @@ -224,7 +224,7 @@ T0217004: } if ((L0486_T_ProjectileAssociatedThing == Thing::_explLightningBolt) && !(AL0507_ui_ExplosionAttack >>= 1)) goto T0217044; - f213_explosionCreate(L0486_T_ProjectileAssociatedThing, AL0507_ui_ExplosionAttack, L0501_i_MapXCombo, L0502_i_MapYCombo, (L0486_T_ProjectileAssociatedThing == Thing::_explPoisonCloud) ? k255_CreatureTypeSingleCenteredCreature : cell); + createExplosion(L0486_T_ProjectileAssociatedThing, AL0507_ui_ExplosionAttack, L0501_i_MapXCombo, L0502_i_MapYCombo, (L0486_T_ProjectileAssociatedThing == Thing::_explPoisonCloud) ? k255_CreatureTypeSingleCenteredCreature : cell); } else { if ((L0486_T_ProjectileAssociatedThing).getType() == k5_WeaponThingType) { AL0507_ui_SoundIndex = k00_soundMETALLIC_THUD; @@ -243,11 +243,11 @@ T0217044: L0490_ps_Projectile->_slot = L0498_T_ExplosionThing; } _vm->_dungeonMan->unlinkThingFromList(projectileThing, Thing(0), L0499_i_ProjectileMapX, L0500_i_ProjectileMapY); - f215_projectileDelete(projectileThing, L0497_pT_GroupSlot, L0499_i_ProjectileMapX, L0500_i_ProjectileMapY); + projectileDelete(projectileThing, L0497_pT_GroupSlot, L0499_i_ProjectileMapX, L0500_i_ProjectileMapY); return true; } -uint16 ProjExpl::f216_projectileGetImpactAttack(Projectile* projectile, Thing thing) { +uint16 ProjExpl::getProjectileImpactAttack(Projectile* projectile, Thing thing) { WeaponInfo* L0485_ps_WeaponInfo; uint16 L0483_ui_Multiple; #define AL0483_ui_ThingType L0483_ui_Multiple @@ -255,15 +255,15 @@ uint16 ProjExpl::f216_projectileGetImpactAttack(Projectile* projectile, Thing th uint16 L0484_ui_KineticEnergy; - _g366_projectilePoisonAttack = 0; - _g367_projectileAttackType = k3_attackType_BLUNT; + _projectilePoisonAttack = 0; + _projectileAttackType = k3_attackType_BLUNT; L0484_ui_KineticEnergy = projectile->_kineticEnergy; if ((AL0483_ui_ThingType = thing.getType()) != k15_ExplosionThingType) { if (AL0483_ui_ThingType == k5_WeaponThingType) { L0485_ps_WeaponInfo = _vm->_dungeonMan->getWeaponInfo(thing); AL0483_ui_Attack = L0485_ps_WeaponInfo->_kineticEnergy; - _g367_projectileAttackType = k3_attackType_BLUNT; + _projectileAttackType = k3_attackType_BLUNT; } else { AL0483_ui_Attack = _vm->getRandomNumber(4); } @@ -271,21 +271,21 @@ uint16 ProjExpl::f216_projectileGetImpactAttack(Projectile* projectile, Thing th } else { if (thing == Thing::_explSlime) { AL0483_ui_Attack = _vm->getRandomNumber(16); - _g366_projectilePoisonAttack = AL0483_ui_Attack + 10; + _projectilePoisonAttack = AL0483_ui_Attack + 10; AL0483_ui_Attack += _vm->getRandomNumber(32); } else { if (thing.toUint16() >= Thing::_explHarmNonMaterial.toUint16()) { - _g367_projectileAttackType = k5_attackType_MAGIC; + _projectileAttackType = k5_attackType_MAGIC; if (thing == Thing::_explPoisonBolt) { - _g366_projectilePoisonAttack = L0484_ui_KineticEnergy; + _projectilePoisonAttack = L0484_ui_KineticEnergy; return 1; } return 0; } - _g367_projectileAttackType = k1_attackType_FIRE; + _projectileAttackType = k1_attackType_FIRE; AL0483_ui_Attack = _vm->getRandomNumber(16) + _vm->getRandomNumber(16) + 10; if (thing == Thing::_explLightningBolt) { - _g367_projectileAttackType = k7_attackType_LIGHTNING; + _projectileAttackType = k7_attackType_LIGHTNING; AL0483_ui_Attack *= 5; } } @@ -296,7 +296,7 @@ uint16 ProjExpl::f216_projectileGetImpactAttack(Projectile* projectile, Thing th return AL0483_ui_Attack; } -void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXCombo, uint16 mapYCombo, uint16 cell) { +void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo, uint16 mapYCombo, uint16 cell) { #define AP0443_ui_ProjectileMapX mapXCombo #define AP0444_ui_ProjectileMapY mapYCombo Thing L0473_T_Thing = _vm->_dungeonMan->getUnusedThing(k15_ExplosionThingType); @@ -359,7 +359,7 @@ void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXC attack >>= 2; } if ((attack -= _vm->getRandomNumber((L0469_i_CreatureFireResistance << 1) + 1)) > 0) { - _g364_creatureDamageOutcome = _vm->_groupMan->getDamageAllCreaturesOutcome(L0472_ps_Group, AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY, attack, true); + _creatureDamageOutcome = _vm->_groupMan->getDamageAllCreaturesOutcome(L0472_ps_Group, AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY, attack, true); } } } @@ -368,22 +368,22 @@ void ProjExpl::f213_explosionCreate(Thing explThing, uint16 attack, uint16 mapXC } } -int16 ProjExpl::f218_projectileGetImpactCount(int16 impactType, int16 mapX, int16 mapY, int16 cell) { +int16 ProjExpl::projectileGetImpactCount(int16 impactType, int16 mapX, int16 mapY, int16 cell) { Thing L0513_T_Thing; int16 L0514_i_ImpactCount; L0514_i_ImpactCount = 0; - _g364_creatureDamageOutcome = k0_outcomeKilledNoCreaturesInGroup; + _creatureDamageOutcome = k0_outcomeKilledNoCreaturesInGroup; T0218001: L0513_T_Thing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); while (L0513_T_Thing != Thing::_endOfList) { if (((L0513_T_Thing).getType() == k14_ProjectileThingType) && ((L0513_T_Thing).getCell() == cell) && - f217_projectileHasImpactOccurred(impactType, mapX, mapY, cell, L0513_T_Thing)) { - f214_projectileDeleteEvent(L0513_T_Thing); + hasProjectileImpactOccurred(impactType, mapX, mapY, cell, L0513_T_Thing)) { + projectileDeleteEvent(L0513_T_Thing); L0514_i_ImpactCount++; - if ((impactType == kM1_CreatureElemType) && (_g364_creatureDamageOutcome == k2_outcomeKilledAllCreaturesInGroup)) + if ((impactType == kM1_CreatureElemType) && (_creatureDamageOutcome == k2_outcomeKilledAllCreaturesInGroup)) break; goto T0218001; } @@ -392,7 +392,7 @@ T0218001: return L0514_i_ImpactCount; } -void ProjExpl::f214_projectileDeleteEvent(Thing thing) { +void ProjExpl::projectileDeleteEvent(Thing thing) { Projectile* L0477_ps_Projectile; @@ -400,7 +400,7 @@ void ProjExpl::f214_projectileDeleteEvent(Thing thing) { _vm->_timeline->f237_deleteEvent(L0477_ps_Projectile->_eventIndex); } -void ProjExpl::f215_projectileDelete(Thing projectileThing, Thing* groupSlot, int16 mapX, int16 mapY) { +void ProjExpl::projectileDelete(Thing projectileThing, Thing* groupSlot, int16 mapX, int16 mapY) { Projectile *L0480_ps_Projectile = (Projectile *)_vm->_dungeonMan->getThingData(projectileThing); Thing L0479_T_Thing = L0480_ps_Projectile->_slot; if (L0479_T_Thing.getType() != k15_ExplosionThingType) { @@ -420,7 +420,7 @@ void ProjExpl::f215_projectileDelete(Thing projectileThing, Thing* groupSlot, in L0480_ps_Projectile->_nextThing = Thing::_none; } -void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) { +void ProjExpl::processEvents48To49(TimelineEvent* event) { TimelineEvent* L0519_ps_Event; Projectile* L0520_ps_Projectile; Thing L0515_T_ProjectileThingNewCell; @@ -447,15 +447,15 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) { L0519_ps_Event->_type = k49_TMEventTypeMoveProjectile; } else { L0518_ui_Cell = (L0515_T_ProjectileThingNewCell).getCell(); - if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (L0523_i_DestinationMapX == _vm->_dungeonMan->_partyMapX) && (L0524_i_DestinationMapY == _vm->_dungeonMan->_partyMapY) && f217_projectileHasImpactOccurred(kM2_ChampionElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0515_T_ProjectileThingNewCell)) { + if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (L0523_i_DestinationMapX == _vm->_dungeonMan->_partyMapX) && (L0524_i_DestinationMapY == _vm->_dungeonMan->_partyMapY) && hasProjectileImpactOccurred(kM2_ChampionElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0515_T_ProjectileThingNewCell)) { return; } - if ((_vm->_groupMan->groupGetThing(L0523_i_DestinationMapX, L0524_i_DestinationMapY) != Thing::_endOfList) && f217_projectileHasImpactOccurred(kM1_CreatureElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0521_T_ProjectileThing)) { + if ((_vm->_groupMan->groupGetThing(L0523_i_DestinationMapX, L0524_i_DestinationMapY) != Thing::_endOfList) && hasProjectileImpactOccurred(kM1_CreatureElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0521_T_ProjectileThing)) { return; } if (L0520_ps_Projectile->_kineticEnergy <= (AL0516_ui_StepEnergy = L0519_ps_Event->_C._projectile.getStepEnergy())) { _vm->_dungeonMan->unlinkThingFromList(L0515_T_ProjectileThingNewCell = L0521_T_ProjectileThing, Thing(0), L0523_i_DestinationMapX, L0524_i_DestinationMapY); - f215_projectileDelete(L0515_T_ProjectileThingNewCell, NULL, L0523_i_DestinationMapX, L0524_i_DestinationMapY); + projectileDelete(L0515_T_ProjectileThingNewCell, NULL, L0523_i_DestinationMapX, L0524_i_DestinationMapY); return; } L0520_ps_Projectile->_kineticEnergy -= AL0516_ui_StepEnergy; @@ -477,7 +477,7 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) { if ((Square(AL0516_ui_Square).getType() == k0_WallElemType) || ((Square(AL0516_ui_Square).getType() == k6_FakeWallElemType) && !getFlag(AL0516_ui_Square, (k0x0001_FakeWallImaginary | k0x0004_FakeWallOpen))) || ((Square(AL0516_ui_Square).getType() == k3_StairsElemType) && (Square(_vm->_dungeonMan->_currMapData[L0525_i_SourceMapX][L0526_i_SourceMapY]).getType() == k3_StairsElemType))) { - if (f217_projectileHasImpactOccurred(Square(AL0516_ui_Square).getType(), L0525_i_SourceMapX, L0526_i_SourceMapY, L0518_ui_Cell, L0515_T_ProjectileThingNewCell)) { + if (hasProjectileImpactOccurred(Square(AL0516_ui_Square).getType(), L0525_i_SourceMapX, L0526_i_SourceMapY, L0518_ui_Cell, L0515_T_ProjectileThingNewCell)) { return; } } @@ -496,7 +496,7 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) { L0515_T_ProjectileThingNewCell = thingWithNewCell(L0515_T_ProjectileThingNewCell, _vm->_moveSens->_moveResultCell); M31_setMap(L0519_ps_Event->_mapTime, _vm->_moveSens->_moveResultMapIndex); } else { - if ((Square(_vm->_dungeonMan->getSquare(L0523_i_DestinationMapX, L0524_i_DestinationMapY)).getType() == k4_DoorElemType) && f217_projectileHasImpactOccurred(k4_DoorElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0521_T_ProjectileThing)) { + if ((Square(_vm->_dungeonMan->getSquare(L0523_i_DestinationMapX, L0524_i_DestinationMapY)).getType() == k4_DoorElemType) && hasProjectileImpactOccurred(k4_DoorElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0521_T_ProjectileThing)) { return; } _vm->_dungeonMan->unlinkThingFromList(L0515_T_ProjectileThingNewCell, Thing(0), L0523_i_DestinationMapX, L0524_i_DestinationMapY); @@ -511,7 +511,7 @@ void ProjExpl::f219_processEvents48To49_projectile(TimelineEvent* event) { L0520_ps_Projectile->_eventIndex = _vm->_timeline->f238_addEventGetEventIndex(L0519_ps_Event); } -void ProjExpl::f220_explosionProcessEvent25_explosion(TimelineEvent* event) { +void ProjExpl::processEvent25(TimelineEvent* event) { Explosion* L0532_ps_Explosion; Group* L0533_ps_Group = nullptr; CreatureInfo* L0534_ps_CreatureInfo = nullptr; -- cgit v1.2.3 From 42fea91d5de21501632b660adbec8fdbae461cf3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 25 Aug 2016 22:38:03 +0200 Subject: DM: Finish the renaming of class members --- engines/dm/projexpl.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index aab6e7ca00..bcaca84d01 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -73,7 +73,7 @@ void ProjExpl::createProjectile(Thing thing, int16 mapX, int16 mapY, uint16 cell L0468_s_Event._C._projectile.setMapY(mapY); L0468_s_Event._C._projectile.setStepEnergy(stepEnergy); L0468_s_Event._C._projectile.setDir(dir); - L0467_ps_Projectile->_eventIndex = _vm->_timeline->f238_addEventGetEventIndex(&L0468_s_Event); + L0467_ps_Projectile->_eventIndex = _vm->_timeline->addEventGetEventIndex(&L0468_s_Event); } bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, int16 mapYCombo, int16 cell, Thing projectileThing) { @@ -235,7 +235,7 @@ T0217004: AL0507_ui_SoundIndex = k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM; } } - _vm->_sound->f064_SOUND_RequestPlay_CPSD(AL0507_ui_SoundIndex, L0499_i_ProjectileMapX, L0500_i_ProjectileMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(AL0507_ui_SoundIndex, L0499_i_ProjectileMapX, L0500_i_ProjectileMapY, k1_soundModePlayIfPrioritized); } T0217044: if (L0509_B_RemovePotion) { @@ -326,10 +326,10 @@ void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo, L0470_ps_Explosion->setType(explThing.toUint16() - Thing::_firstExplosion.toUint16()); L0470_ps_Explosion->setAttack(attack); if (explThing.toUint16() < Thing::_explHarmNonMaterial.toUint16()) { - _vm->_sound->f064_SOUND_RequestPlay_CPSD((attack > 80) ? k05_soundSTRONG_EXPLOSION : k20_soundWEAK_EXPLOSION, AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay((attack > 80) ? k05_soundSTRONG_EXPLOSION : k20_soundWEAK_EXPLOSION, AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY, k1_soundModePlayIfPrioritized); } else { if (explThing != Thing::_explSmoke) { - _vm->_sound->f064_SOUND_RequestPlay_CPSD(k13_soundSPELL, AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(k13_soundSPELL, AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY, k1_soundModePlayIfPrioritized); } } _vm->_dungeonMan->linkThingToList(L0473_T_Thing, Thing(0), AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY); @@ -340,7 +340,7 @@ void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo, L0476_s_Event._C._slot = L0473_T_Thing.toUint16(); L0476_s_Event._B._location._mapX = AP0443_ui_ProjectileMapX; L0476_s_Event._B._location._mapY = AP0444_ui_ProjectileMapY; - _vm->_timeline->f238_addEventGetEventIndex(&L0476_s_Event); + _vm->_timeline->addEventGetEventIndex(&L0476_s_Event); if ((explThing == Thing::_explLightningBolt) || (explThing == Thing::_explFireBall)) { AP0443_ui_ProjectileMapX = L0474_i_ProjectileTargetMapX; AP0444_ui_ProjectileMapY = L0475_i_ProjectileTargetMapY; @@ -397,7 +397,7 @@ void ProjExpl::projectileDeleteEvent(Thing thing) { L0477_ps_Projectile = (Projectile *)_vm->_dungeonMan->getThingData(thing); - _vm->_timeline->f237_deleteEvent(L0477_ps_Projectile->_eventIndex); + _vm->_timeline->deleteEvent(L0477_ps_Projectile->_eventIndex); } void ProjExpl::projectileDelete(Thing projectileThing, Thing* groupSlot, int16 mapX, int16 mapY) { @@ -508,7 +508,7 @@ void ProjExpl::processEvents48To49(TimelineEvent* event) { L0519_ps_Event->Map_Time++; #endif L0519_ps_Event->_B._slot = L0515_T_ProjectileThingNewCell.toUint16(); - L0520_ps_Projectile->_eventIndex = _vm->_timeline->f238_addEventGetEventIndex(L0519_ps_Event); + L0520_ps_Projectile->_eventIndex = _vm->_timeline->addEventGetEventIndex(L0519_ps_Event); } void ProjExpl::processEvent25(TimelineEvent* event) { @@ -574,7 +574,7 @@ void ProjExpl::processEvent25(TimelineEvent* event) { break; case 0xFFE4: L0532_ps_Explosion->setType(L0532_ps_Explosion->getType() + 1); - _vm->_sound->f064_SOUND_RequestPlay_CPSD(k05_soundSTRONG_EXPLOSION, L0528_ui_MapX, L0529_ui_MapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(k05_soundSTRONG_EXPLOSION, L0528_ui_MapX, L0529_ui_MapY, k1_soundModePlayIfPrioritized); goto T0220026; case 0xFFA8: if (L0532_ps_Explosion->getAttack() > 55) { @@ -595,7 +595,7 @@ void ProjExpl::processEvent25(TimelineEvent* event) { T0220026: L0539_s_Event = *event; L0539_s_Event._mapTime++; - _vm->_timeline->f238_addEventGetEventIndex(&L0539_s_Event); + _vm->_timeline->addEventGetEventIndex(&L0539_s_Event); return; } } -- cgit v1.2.3 From 361722d459b1afff6b12ba722420e86703b06dea Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 27 Aug 2016 23:10:13 +0200 Subject: DM: More renaming in DungeonMan, move some arrays --- engines/dm/projexpl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index bcaca84d01..99fda6706d 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -162,7 +162,7 @@ T0217004: ((L0510_i_ProjectileAssociatedThingType == k15_ExplosionThingType) ? (L0486_T_ProjectileAssociatedThing.toUint16() >= Thing::_explHarmNonMaterial.toUint16()) : ((L0490_ps_Projectile->_attack > _vm->getRandomNumber(128)) && - getFlag(_vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->getObjectInfoIndex(L0486_T_ProjectileAssociatedThing)].getAllowedSlots(), k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors) + getFlag(_vm->_dungeonMan->_objectInfos[_vm->_dungeonMan->getObjectInfoIndex(L0486_T_ProjectileAssociatedThing)].getAllowedSlots(), k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors) && ((L0510_i_ProjectileAssociatedThingType != k10_JunkThingType) || ((AL0487_i_IconIndex = _vm->_objectMan->getIconIndex(L0486_T_ProjectileAssociatedThing)) < 0) || (!((AL0487_i_IconIndex >= k176_IconIndiceJunkIronKey) && (AL0487_i_IconIndex <= k191_IconIndiceJunkMasterKey)))) @@ -184,7 +184,7 @@ T0217004: return false; } L0512_ui_CreatureIndex--; - L0493_ps_CreatureInfo = &g243_CreatureInfo[L0511_ui_CreatureType = L0491_ps_Group->_type]; + L0493_ps_CreatureInfo = &_vm->_dungeonMan->_creatureInfos[L0511_ui_CreatureType = L0491_ps_Group->_type]; if ((L0486_T_ProjectileAssociatedThing == Thing::_explFireBall) && (L0511_ui_CreatureType == k11_CreatureTypeBlackFlame)) { L0496_pui_CreatureHealth = &L0491_ps_Group->_health[L0512_ui_CreatureIndex]; *L0496_pui_CreatureHealth = MIN(1000, *L0496_pui_CreatureHealth + getProjectileImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing)); @@ -352,7 +352,7 @@ void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo, } else { if ((L0473_T_Thing = _vm->_groupMan->groupGetThing(AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY)) != Thing::_endOfList) { /* ASSEMBLY_COMPILATION_DIFFERENCE jmp */ Group *L0472_ps_Group = (Group *)_vm->_dungeonMan->getThingData(L0473_T_Thing); - CreatureInfo *L0471_ps_CreatureInfo = &g243_CreatureInfo[L0472_ps_Group->_type]; + CreatureInfo *L0471_ps_CreatureInfo = &_vm->_dungeonMan->_creatureInfos[L0472_ps_Group->_type]; int16 L0469_i_CreatureFireResistance = L0471_ps_CreatureInfo->getFireResistance(); if (L0469_i_CreatureFireResistance != k15_immuneToFire) { if (getFlag(L0471_ps_CreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)) { @@ -536,7 +536,7 @@ void ProjExpl::processEvent25(TimelineEvent* event) { L0538_B_ExplosionOnPartySquare = (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (L0528_ui_MapX == _vm->_dungeonMan->_partyMapX) && (L0529_ui_MapY == _vm->_dungeonMan->_partyMapY); if ((L0535_T_GroupThing = _vm->_groupMan->groupGetThing(L0528_ui_MapX, L0529_ui_MapY)) != Thing::_endOfList) { L0533_ps_Group = (Group*)_vm->_dungeonMan->getThingData(L0535_T_GroupThing); - L0534_ps_CreatureInfo = &g243_CreatureInfo[AL0537_ui_CreatureType = L0533_ps_Group->_type]; + L0534_ps_CreatureInfo = &_vm->_dungeonMan->_creatureInfos[AL0537_ui_CreatureType = L0533_ps_Group->_type]; } if ((L0536_T_ExplosionThing = Thing(Thing::_firstExplosion.toUint16() + L0532_ps_Explosion->getType())) == Thing::_explPoisonCloud) { L0530_i_Attack = MAX(1, MIN(L0532_ps_Explosion->getAttack() >> 5, 4) + _vm->getRandomNumber(2)); /* Value between 1 and 5 */ -- cgit v1.2.3 From cd3b485952b71244392f594164e60b96a07fb23c Mon Sep 17 00:00:00 2001 From: Bendegúz Nagy Date: Sat, 3 Sep 2016 10:38:43 +0200 Subject: DM: Clean up includes Swap <> to "" with scummvm files Add dm/ prefix to dm files Reorder includes to system files, dm files --- engines/dm/projexpl.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 99fda6706d..aade217853 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -26,13 +26,13 @@ */ -#include "projexpl.h" -#include "dungeonman.h" -#include "timeline.h" -#include "group.h" -#include "objectman.h" -#include "movesens.h" -#include "sounds.h" +#include "dm/projexpl.h" +#include "dm/dungeonman.h" +#include "dm/timeline.h" +#include "dm/group.h" +#include "dm/objectman.h" +#include "dm/movesens.h" +#include "dm/sounds.h" namespace DM { -- cgit v1.2.3 From a4de5d0dd29dae16786a23d9a526dbf9b86aac7d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 6 Sep 2016 07:23:45 +0200 Subject: DM: First pass of refactoring in hasProjectileImpactOccurred --- engines/dm/projexpl.cpp | 263 ++++++++++++++++++++++-------------------------- 1 file changed, 121 insertions(+), 142 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index aade217853..87442f6647 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -25,7 +25,6 @@ * maintainer of the Dungeon Master Encyclopaedia (http://dmweb.free.fr/) */ - #include "dm/projexpl.h" #include "dm/dungeonman.h" #include "dm/timeline.h" @@ -47,203 +46,183 @@ 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 L0466_T_ProjectileThing; - Projectile* L0467_ps_Projectile; - TimelineEvent L0468_s_Event; + Thing projectileThing = _vm->_dungeonMan->getUnusedThing(k14_ProjectileThingType); + 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; + projectileThing = thingWithNewCell(projectileThing, cell); + Projectile *projectilePtr = (Projectile *)_vm->_dungeonMan->getThingData(projectileThing); + projectilePtr->_slot = thing; + projectilePtr->_kineticEnergy = MIN((int16)kineticEnergy, (int16)255); + 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; + setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_currMapIndex, _vm->_gameTime + 1); + if (_createLauncherProjectile) + newEvent._type = k49_TMEventTypeMoveProjectile; /* Launcher projectiles can impact immediately */ + else + newEvent._type = k48_TMEventTypeMoveProjectileIgnoreImpacts; /* Projectiles created by champions or creatures ignore impacts on their first movement */ - if ((L0466_T_ProjectileThing = _vm->_dungeonMan->getUnusedThing(k14_ProjectileThingType)) == 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; - } - L0466_T_ProjectileThing = thingWithNewCell(L0466_T_ProjectileThing, cell); - L0467_ps_Projectile = (Projectile *)_vm->_dungeonMan->getThingData(L0466_T_ProjectileThing); - L0467_ps_Projectile->_slot = thing; - L0467_ps_Projectile->_kineticEnergy = MIN((int16)kineticEnergy, (int16)255); - L0467_ps_Projectile->_attack = attack; - _vm->_dungeonMan->linkThingToList(L0466_T_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 */ - setMapAndTime(L0468_s_Event._mapTime, _vm->_dungeonMan->_currMapIndex, _vm->_gameTime + 1); - if (_createLauncherProjectile) { - L0468_s_Event._type = k49_TMEventTypeMoveProjectile; /* Launcher projectiles can impact immediately */ - } else { - L0468_s_Event._type = k48_TMEventTypeMoveProjectileIgnoreImpacts; /* Projectiles created by champions or creatures ignore impacts on their first movement */ - } - L0468_s_Event._priority = 0; - L0468_s_Event._B._slot = L0466_T_ProjectileThing.toUint16(); - L0468_s_Event._C._projectile.setMapX(mapX); - L0468_s_Event._C._projectile.setMapY(mapY); - L0468_s_Event._C._projectile.setStepEnergy(stepEnergy); - L0468_s_Event._C._projectile.setDir(dir); - L0467_ps_Projectile->_eventIndex = _vm->_timeline->addEventGetEventIndex(&L0468_s_Event); + newEvent._priority = 0; + newEvent._B._slot = projectileThing.toUint16(); + newEvent._C._projectile.setMapX(mapX); + newEvent._C._projectile.setMapY(mapY); + newEvent._C._projectile.setStepEnergy(stepEnergy); + newEvent._C._projectile.setDir(dir); + projectilePtr->_eventIndex = _vm->_timeline->addEventGetEventIndex(&newEvent); } bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, int16 mapYCombo, int16 cell, Thing projectileThing) { -#define AP0454_i_ProjectileTargetMapX mapXCombo -#define AP0455_i_ProjectileTargetMapY mapYCombo #define AP0456_i_ChampionIndex cell - Projectile* L0490_ps_Projectile; - Group* L0491_ps_Group; - Thing L0486_T_ProjectileAssociatedThing; int16 L0487_i_Multiple; #define AL0487_i_DoorState L0487_i_Multiple #define AL0487_i_IconIndex L0487_i_Multiple #define AL0487_i_Outcome L0487_i_Multiple #define AL0487_i_WeaponType L0487_i_Multiple - int16 L0488_i_Attack = 0; - Potion* L0492_ps_Potion = nullptr; - CreatureInfo* L0493_ps_CreatureInfo; - Door* L0494_ps_Door; - Weapon* L0495_ps_Weapon; - uint16* L0496_pui_CreatureHealth; - Thing* L0497_pT_GroupSlot; - Thing L0498_T_ExplosionThing; - int16 L0499_i_ProjectileMapX; - int16 L0500_i_ProjectileMapY; - int16 L0501_i_MapXCombo; - int16 L0502_i_MapYCombo; - byte L0503_uc_Square; - bool L0505_B_CreateExplosionOnImpact; - int16 L0489_i_ChampionAttack; uint16 L0507_ui_Multiple; #define AL0507_ui_ExplosionAttack L0507_ui_Multiple #define AL0507_ui_SoundIndex L0507_ui_Multiple - int16 L0508_i_PotionPower = 0; - bool L0509_B_RemovePotion; - int16 L0510_i_ProjectileAssociatedThingType; - uint16 L0511_ui_CreatureType; - uint16 L0512_ui_CreatureIndex; - - L0490_ps_Projectile = (Projectile *)_vm->_dungeonMan->getThingData(Thing(projectileThing)); - L0501_i_MapXCombo = mapXCombo; - L0502_i_MapYCombo = mapYCombo; - L0509_B_RemovePotion = false; + + Projectile *projectileThingData = (Projectile *)_vm->_dungeonMan->getThingData(Thing(projectileThing)); + bool removePotion = false; + int16 potionPower = 0; _creatureDamageOutcome = k0_outcomeKilledNoCreaturesInGroup; - if ((L0510_i_ProjectileAssociatedThingType = (L0486_T_ProjectileAssociatedThing = L0490_ps_Projectile->_slot).getType()) == k8_PotionThingType) { - L0491_ps_Group = (Group *)_vm->_dungeonMan->getThingData(L0486_T_ProjectileAssociatedThing); - switch (((Potion *)L0491_ps_Group)->getType()) { - case k3_PotionTypeVen: - L0498_T_ExplosionThing = Thing::_explPoisonCloud; - goto T0217004; - case k19_PotionTypeFulBomb: - L0498_T_ExplosionThing = Thing::_explFireBall; -T0217004: - L0509_B_RemovePotion = true; - L0508_i_PotionPower = ((Potion *)L0491_ps_Group)->getPower(); - L0492_ps_Potion = (Potion *)L0491_ps_Group; - break; - default: - break; + Thing projectileAssociatedThing = projectileThingData->_slot; + int16 projectileAssociatedThingType = projectileAssociatedThing.getType(); + Potion *potion = nullptr; + Thing explosionThing = Thing::_none; + if (projectileAssociatedThingType == k8_PotionThingType) { + Group *projectileAssociatedGroup = (Group *)_vm->_dungeonMan->getThingData(projectileAssociatedThing); + PotionType potionType = ((Potion *)projectileAssociatedGroup)->getType(); + if ((potionType == k3_PotionTypeVen) || (potionType == k19_PotionTypeFulBomb)) { + explosionThing = (potionType == k3_PotionTypeVen) ? Thing::_explPoisonCloud: Thing::_explFireBall; + removePotion = true; + potionPower = ((Potion *)projectileAssociatedGroup)->getPower(); + potion = (Potion *)projectileAssociatedGroup; } } - L0505_B_CreateExplosionOnImpact = (L0510_i_ProjectileAssociatedThingType == k15_ExplosionThingType) && (L0486_T_ProjectileAssociatedThing != Thing::_explSlime) && (L0486_T_ProjectileAssociatedThing != Thing::_explPoisonBolt); - L0497_pT_GroupSlot = NULL; - L0489_i_ChampionAttack = 0; + bool createExplosionOnImpact = (projectileAssociatedThingType == k15_ExplosionThingType) && (projectileAssociatedThing != Thing::_explSlime) && (projectileAssociatedThing != Thing::_explPoisonBolt); + Thing *curGroupSlot = nullptr; + int16 championAttack = 0; + int16 projectileMapX; + int16 projectileMapY; + int16 projectileTargetMapX = mapXCombo; + int16 projectileTargetMapY = mapYCombo; + if (mapXCombo <= 255) { - L0499_i_ProjectileMapX = mapXCombo; - L0500_i_ProjectileMapY = mapYCombo; + projectileMapX = mapXCombo; + projectileMapY = mapYCombo; } else { - L0499_i_ProjectileMapX = (mapXCombo >> 8) - 1; - L0500_i_ProjectileMapY = (mapYCombo >> 8); - AP0454_i_ProjectileTargetMapX &= 0x00FF; - AP0455_i_ProjectileTargetMapY &= 0x00FF; + projectileMapX = (mapXCombo >> 8) - 1; + projectileMapY = (mapYCombo >> 8); + projectileTargetMapX &= 0x00FF; + projectileTargetMapY &= 0x00FF; } + + int16 attack = 0; switch (impactType) { - case k4_DoorElemType: - AL0487_i_DoorState = Square(L0503_uc_Square = _vm->_dungeonMan->_currMapData[AP0454_i_ProjectileTargetMapX][AP0455_i_ProjectileTargetMapY]).getDoorState(); - L0494_ps_Door = (Door *)_vm->_dungeonMan->getSquareFirstThingData(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY); - if ((AL0487_i_DoorState != k5_doorState_DESTROYED) && (L0486_T_ProjectileAssociatedThing == Thing::_explOpenDoor)) { - if (L0494_ps_Door->hasButton()) { - _vm->_moveSens->addEvent(k10_TMEventTypeDoor, AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, 0, k2_SensorEffToggle, _vm->_gameTime + 1); - } + case k4_DoorElemType: { + byte curSquare = _vm->_dungeonMan->_currMapData[projectileTargetMapX][projectileTargetMapY]; + AL0487_i_DoorState = Square(curSquare).getDoorState(); + Door *curDoor = (Door *)_vm->_dungeonMan->getSquareFirstThingData(projectileTargetMapX, projectileTargetMapY); + if ((AL0487_i_DoorState != k5_doorState_DESTROYED) && (projectileAssociatedThing == Thing::_explOpenDoor)) { + if (curDoor->hasButton()) + _vm->_moveSens->addEvent(k10_TMEventTypeDoor, projectileTargetMapX, projectileTargetMapY, 0, k2_SensorEffToggle, _vm->_gameTime + 1); break; } if ((AL0487_i_DoorState == k5_doorState_DESTROYED) || (AL0487_i_DoorState <= k1_doorState_FOURTH) || - (getFlag(_vm->_dungeonMan->_currMapDoorInfo[L0494_ps_Door->getType()]._attributes, k0x0002_MaskDoorInfo_ProjectilesCanPassThrough) && - ((L0510_i_ProjectileAssociatedThingType == k15_ExplosionThingType) ? - (L0486_T_ProjectileAssociatedThing.toUint16() >= Thing::_explHarmNonMaterial.toUint16()) : - ((L0490_ps_Projectile->_attack > _vm->getRandomNumber(128)) && - getFlag(_vm->_dungeonMan->_objectInfos[_vm->_dungeonMan->getObjectInfoIndex(L0486_T_ProjectileAssociatedThing)].getAllowedSlots(), k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors) - && ((L0510_i_ProjectileAssociatedThingType != k10_JunkThingType) || - ((AL0487_i_IconIndex = _vm->_objectMan->getIconIndex(L0486_T_ProjectileAssociatedThing)) < 0) || + (getFlag(_vm->_dungeonMan->_currMapDoorInfo[curDoor->getType()]._attributes, k0x0002_MaskDoorInfo_ProjectilesCanPassThrough) && + ((projectileAssociatedThingType == k15_ExplosionThingType) ? + (projectileAssociatedThing.toUint16() >= Thing::_explHarmNonMaterial.toUint16()) : + ((projectileThingData->_attack > _vm->getRandomNumber(128)) && + getFlag(_vm->_dungeonMan->_objectInfos[_vm->_dungeonMan->getObjectInfoIndex(projectileAssociatedThing)].getAllowedSlots(), k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors) + && ((projectileAssociatedThingType != k10_JunkThingType) || + ((AL0487_i_IconIndex = _vm->_objectMan->getIconIndex(projectileAssociatedThing)) < 0) || (!((AL0487_i_IconIndex >= k176_IconIndiceJunkIronKey) && (AL0487_i_IconIndex <= k191_IconIndiceJunkMasterKey)))) )))) { /* ASSEMBLY_COMPILATION_DIFFERENCE jmp */ return false; } - L0488_i_Attack = getProjectileImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing) + 1; - _vm->_groupMan->groupIsDoorDestoryedByAttack(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, L0488_i_Attack + _vm->getRandomNumber(L0488_i_Attack), false, 0); + attack = getProjectileImpactAttack(projectileThingData, projectileAssociatedThing) + 1; + _vm->_groupMan->groupIsDoorDestoryedByAttack(projectileTargetMapX, projectileTargetMapY, attack + _vm->getRandomNumber(attack), false, 0); + } break; case kM2_ChampionElemType: - if ((AP0456_i_ChampionIndex = _vm->_championMan->getIndexInCell(cell)) < 0) { + if ((AP0456_i_ChampionIndex = _vm->_championMan->getIndexInCell(cell)) < 0) return false; - } - L0489_i_ChampionAttack = L0488_i_Attack = getProjectileImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing); + + championAttack = attack = getProjectileImpactAttack(projectileThingData, projectileAssociatedThing); break; - case kM1_CreatureElemType: - L0491_ps_Group = (Group *)_vm->_dungeonMan->getThingData(_vm->_groupMan->groupGetThing(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY)); - if (!(L0512_ui_CreatureIndex = _vm->_groupMan->getCreatureOrdinalInCell(L0491_ps_Group, cell))) { + case kM1_CreatureElemType: { + Group *curGroup = (Group *)_vm->_dungeonMan->getThingData(_vm->_groupMan->groupGetThing(projectileTargetMapX, projectileTargetMapY)); + uint16 curCreatureIndex = _vm->_groupMan->getCreatureOrdinalInCell(curGroup, cell); + if (!curCreatureIndex) return false; - } - L0512_ui_CreatureIndex--; - L0493_ps_CreatureInfo = &_vm->_dungeonMan->_creatureInfos[L0511_ui_CreatureType = L0491_ps_Group->_type]; - if ((L0486_T_ProjectileAssociatedThing == Thing::_explFireBall) && (L0511_ui_CreatureType == k11_CreatureTypeBlackFlame)) { - L0496_pui_CreatureHealth = &L0491_ps_Group->_health[L0512_ui_CreatureIndex]; - *L0496_pui_CreatureHealth = MIN(1000, *L0496_pui_CreatureHealth + getProjectileImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing)); + + curCreatureIndex--; + uint16 curCreatureType = curGroup->_type; + CreatureInfo *curCreatureInfo = &_vm->_dungeonMan->_creatureInfos[curCreatureType]; + if ((projectileAssociatedThing == Thing::_explFireBall) && (curCreatureType == k11_CreatureTypeBlackFlame)) { + uint16 *curCreatureHealth = &curGroup->_health[curCreatureIndex]; + *curCreatureHealth = MIN(1000, *curCreatureHealth + getProjectileImpactAttack(projectileThingData, projectileAssociatedThing)); goto T0217044; } - if (getFlag(L0493_ps_CreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial) && (L0486_T_ProjectileAssociatedThing != Thing::_explHarmNonMaterial)) { + if (getFlag(curCreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial) && (projectileAssociatedThing != Thing::_explHarmNonMaterial)) return false; - } - L0488_i_Attack = (uint16)((unsigned long)getProjectileImpactAttack(L0490_ps_Projectile, L0486_T_ProjectileAssociatedThing) << 6) / L0493_ps_CreatureInfo->_defense; - if (L0488_i_Attack) { - if ((AL0487_i_Outcome = _vm->_groupMan->groupGetDamageCreatureOutcome(L0491_ps_Group, L0512_ui_CreatureIndex, AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, L0488_i_Attack + _vm->_groupMan->groupGetResistanceAdjustedPoisonAttack(L0511_ui_CreatureType, _projectilePoisonAttack), true)) != k0_outcomeKilledNoCreaturesInGroup) { - _vm->_groupMan->processEvents29to41(AP0454_i_ProjectileTargetMapX, AP0455_i_ProjectileTargetMapY, kM2_TMEventTypeCreateReactionEvent30HitByProjectile, 0); - } + + attack = (uint16)((unsigned long)getProjectileImpactAttack(projectileThingData, projectileAssociatedThing) << 6) / curCreatureInfo->_defense; + if (attack) { + if ((AL0487_i_Outcome = _vm->_groupMan->groupGetDamageCreatureOutcome(curGroup, curCreatureIndex, projectileTargetMapX, projectileTargetMapY, attack + _vm->_groupMan->groupGetResistanceAdjustedPoisonAttack(curCreatureType, _projectilePoisonAttack), true)) != k0_outcomeKilledNoCreaturesInGroup) + _vm->_groupMan->processEvents29to41(projectileTargetMapX, projectileTargetMapY, kM2_TMEventTypeCreateReactionEvent30HitByProjectile, 0); + _creatureDamageOutcome = AL0487_i_Outcome; - if (!L0505_B_CreateExplosionOnImpact && - (AL0487_i_Outcome == k0_outcomeKilledNoCreaturesInGroup) && - (L0510_i_ProjectileAssociatedThingType == k5_WeaponThingType) && - getFlag(L0493_ps_CreatureInfo->_attributes, k0x0400_MaskCreatureInfo_keepThrownSharpWeapon)) { - L0495_ps_Weapon = (Weapon *)_vm->_dungeonMan->getThingData(L0486_T_ProjectileAssociatedThing); - AL0487_i_WeaponType = L0495_ps_Weapon->getType(); - if ((AL0487_i_WeaponType == k8_WeaponTypeDagger) || (AL0487_i_WeaponType == k27_WeaponTypeArrow) || (AL0487_i_WeaponType == k28_WeaponTypeSlayer) || (AL0487_i_WeaponType == k31_WeaponTypePoisonDart) || (AL0487_i_WeaponType == k32_WeaponTypeThrowingStar)) { - L0497_pT_GroupSlot = &L0491_ps_Group->_slot; - } + if (!createExplosionOnImpact && (AL0487_i_Outcome == k0_outcomeKilledNoCreaturesInGroup) + && (projectileAssociatedThingType == k5_WeaponThingType) + && getFlag(curCreatureInfo->_attributes, k0x0400_MaskCreatureInfo_keepThrownSharpWeapon)) { + Weapon *weapon = (Weapon *)_vm->_dungeonMan->getThingData(projectileAssociatedThing); + AL0487_i_WeaponType = weapon->getType(); + if ((AL0487_i_WeaponType == k8_WeaponTypeDagger) || (AL0487_i_WeaponType == k27_WeaponTypeArrow) + || (AL0487_i_WeaponType == k28_WeaponTypeSlayer) || (AL0487_i_WeaponType == k31_WeaponTypePoisonDart) + || (AL0487_i_WeaponType == k32_WeaponTypeThrowingStar)) + curGroupSlot = &curGroup->_slot; } } + } + break; } - if (L0489_i_ChampionAttack && _vm->_championMan->addPendingDamageAndWounds_getDamage(AP0456_i_ChampionIndex, L0488_i_Attack, k0x0004_ChampionWoundHead | k0x0008_ChampionWoundTorso, _projectileAttackType) && _projectilePoisonAttack && _vm->getRandomNumber(2)) { + if (championAttack && _projectilePoisonAttack && _vm->getRandomNumber(2) + && _vm->_championMan->addPendingDamageAndWounds_getDamage(AP0456_i_ChampionIndex, attack, k0x0004_ChampionWoundHead | k0x0008_ChampionWoundTorso, _projectileAttackType)) _vm->_championMan->championPoison(AP0456_i_ChampionIndex, _projectilePoisonAttack); - } - if (L0505_B_CreateExplosionOnImpact || L0509_B_RemovePotion - ) { - if (L0509_B_RemovePotion) { - L0486_T_ProjectileAssociatedThing = L0498_T_ExplosionThing; - AL0507_ui_ExplosionAttack = L0508_i_PotionPower; + + if (createExplosionOnImpact || removePotion) { + if (removePotion) { + projectileAssociatedThing = explosionThing; + AL0507_ui_ExplosionAttack = potionPower; } else { - AL0507_ui_ExplosionAttack = L0490_ps_Projectile->_kineticEnergy; + AL0507_ui_ExplosionAttack = projectileThingData->_kineticEnergy; } - if ((L0486_T_ProjectileAssociatedThing == Thing::_explLightningBolt) && !(AL0507_ui_ExplosionAttack >>= 1)) + if ((projectileAssociatedThing == Thing::_explLightningBolt) && !(AL0507_ui_ExplosionAttack >>= 1)) goto T0217044; - createExplosion(L0486_T_ProjectileAssociatedThing, AL0507_ui_ExplosionAttack, L0501_i_MapXCombo, L0502_i_MapYCombo, (L0486_T_ProjectileAssociatedThing == Thing::_explPoisonCloud) ? k255_CreatureTypeSingleCenteredCreature : cell); + createExplosion(projectileAssociatedThing, AL0507_ui_ExplosionAttack, mapXCombo, mapYCombo, (projectileAssociatedThing == Thing::_explPoisonCloud) ? k255_CreatureTypeSingleCenteredCreature : cell); } else { - if ((L0486_T_ProjectileAssociatedThing).getType() == k5_WeaponThingType) { + if ((projectileAssociatedThing).getType() == k5_WeaponThingType) { AL0507_ui_SoundIndex = k00_soundMETALLIC_THUD; } else { - if (L0486_T_ProjectileAssociatedThing == Thing::_explPoisonBolt) { + if (projectileAssociatedThing == Thing::_explPoisonBolt) { AL0507_ui_SoundIndex = k13_soundSPELL; } else { AL0507_ui_SoundIndex = k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM; } } - _vm->_sound->requestPlay(AL0507_ui_SoundIndex, L0499_i_ProjectileMapX, L0500_i_ProjectileMapY, k1_soundModePlayIfPrioritized); + _vm->_sound->requestPlay(AL0507_ui_SoundIndex, projectileMapX, projectileMapY, k1_soundModePlayIfPrioritized); } T0217044: - if (L0509_B_RemovePotion) { - L0492_ps_Potion->_nextThing = Thing::_none; - L0490_ps_Projectile->_slot = L0498_T_ExplosionThing; + if (removePotion) { + potion->_nextThing = Thing::_none; + projectileThingData->_slot = explosionThing; } - _vm->_dungeonMan->unlinkThingFromList(projectileThing, Thing(0), L0499_i_ProjectileMapX, L0500_i_ProjectileMapY); - projectileDelete(projectileThing, L0497_pT_GroupSlot, L0499_i_ProjectileMapX, L0500_i_ProjectileMapY); + _vm->_dungeonMan->unlinkThingFromList(projectileThing, Thing(0), projectileMapX, projectileMapY); + projectileDelete(projectileThing, curGroupSlot, projectileMapX, projectileMapY); return true; } -- cgit v1.2.3 From 46b41f9b2bc9eb5d592e11aaad61d208c26ae903 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 6 Sep 2016 20:39:05 +0200 Subject: DM: Split redefined variables in hasProjectileImpactOccurred() --- engines/dm/projexpl.cpp | 73 +++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 39 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 87442f6647..2a71e7b0e7 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -73,16 +73,6 @@ void ProjExpl::createProjectile(Thing thing, int16 mapX, int16 mapY, uint16 cell } bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, int16 mapYCombo, int16 cell, Thing projectileThing) { -#define AP0456_i_ChampionIndex cell - int16 L0487_i_Multiple; -#define AL0487_i_DoorState L0487_i_Multiple -#define AL0487_i_IconIndex L0487_i_Multiple -#define AL0487_i_Outcome L0487_i_Multiple -#define AL0487_i_WeaponType L0487_i_Multiple - uint16 L0507_ui_Multiple; -#define AL0507_ui_ExplosionAttack L0507_ui_Multiple -#define AL0507_ui_SoundIndex L0507_ui_Multiple - Projectile *projectileThingData = (Projectile *)_vm->_dungeonMan->getThingData(Thing(projectileThing)); bool removePotion = false; int16 potionPower = 0; @@ -103,7 +93,6 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in } bool createExplosionOnImpact = (projectileAssociatedThingType == k15_ExplosionThingType) && (projectileAssociatedThing != Thing::_explSlime) && (projectileAssociatedThing != Thing::_explPoisonBolt); Thing *curGroupSlot = nullptr; - int16 championAttack = 0; int16 projectileMapX; int16 projectileMapY; int16 projectileTargetMapX = mapXCombo; @@ -119,19 +108,23 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in projectileTargetMapY &= 0x00FF; } + int16 championAttack = 0; int16 attack = 0; + int16 championIndex = 0; switch (impactType) { case k4_DoorElemType: { byte curSquare = _vm->_dungeonMan->_currMapData[projectileTargetMapX][projectileTargetMapY]; - AL0487_i_DoorState = Square(curSquare).getDoorState(); + int16 curDoorState = Square(curSquare).getDoorState(); Door *curDoor = (Door *)_vm->_dungeonMan->getSquareFirstThingData(projectileTargetMapX, projectileTargetMapY); - if ((AL0487_i_DoorState != k5_doorState_DESTROYED) && (projectileAssociatedThing == Thing::_explOpenDoor)) { + if ((curDoorState != k5_doorState_DESTROYED) && (projectileAssociatedThing == Thing::_explOpenDoor)) { if (curDoor->hasButton()) _vm->_moveSens->addEvent(k10_TMEventTypeDoor, projectileTargetMapX, projectileTargetMapY, 0, k2_SensorEffToggle, _vm->_gameTime + 1); break; } - if ((AL0487_i_DoorState == k5_doorState_DESTROYED) || - (AL0487_i_DoorState <= k1_doorState_FOURTH) || + + int16 AL0487_i_IconIndex; + if ((curDoorState == k5_doorState_DESTROYED) || + (curDoorState <= k1_doorState_FOURTH) || (getFlag(_vm->_dungeonMan->_currMapDoorInfo[curDoor->getType()]._attributes, k0x0002_MaskDoorInfo_ProjectilesCanPassThrough) && ((projectileAssociatedThingType == k15_ExplosionThingType) ? (projectileAssociatedThing.toUint16() >= Thing::_explHarmNonMaterial.toUint16()) : @@ -148,7 +141,8 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in } break; case kM2_ChampionElemType: - if ((AP0456_i_ChampionIndex = _vm->_championMan->getIndexInCell(cell)) < 0) + championIndex = _vm->_championMan->getIndexInCell(cell); + if (championIndex < 0) return false; championAttack = attack = getProjectileImpactAttack(projectileThingData, projectileAssociatedThing); @@ -172,18 +166,19 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in attack = (uint16)((unsigned long)getProjectileImpactAttack(projectileThingData, projectileAssociatedThing) << 6) / curCreatureInfo->_defense; if (attack) { - if ((AL0487_i_Outcome = _vm->_groupMan->groupGetDamageCreatureOutcome(curGroup, curCreatureIndex, projectileTargetMapX, projectileTargetMapY, attack + _vm->_groupMan->groupGetResistanceAdjustedPoisonAttack(curCreatureType, _projectilePoisonAttack), true)) != k0_outcomeKilledNoCreaturesInGroup) + 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); - _creatureDamageOutcome = AL0487_i_Outcome; - if (!createExplosionOnImpact && (AL0487_i_Outcome == k0_outcomeKilledNoCreaturesInGroup) + _creatureDamageOutcome = outcome; + if (!createExplosionOnImpact && (outcome == k0_outcomeKilledNoCreaturesInGroup) && (projectileAssociatedThingType == k5_WeaponThingType) && getFlag(curCreatureInfo->_attributes, k0x0400_MaskCreatureInfo_keepThrownSharpWeapon)) { Weapon *weapon = (Weapon *)_vm->_dungeonMan->getThingData(projectileAssociatedThing); - AL0487_i_WeaponType = weapon->getType(); - if ((AL0487_i_WeaponType == k8_WeaponTypeDagger) || (AL0487_i_WeaponType == k27_WeaponTypeArrow) - || (AL0487_i_WeaponType == k28_WeaponTypeSlayer) || (AL0487_i_WeaponType == k31_WeaponTypePoisonDart) - || (AL0487_i_WeaponType == k32_WeaponTypeThrowingStar)) + WeaponType weaponType = weapon->getType(); + if ((weaponType == k8_WeaponTypeDagger) || (weaponType == k27_WeaponTypeArrow) + || (weaponType == k28_WeaponTypeSlayer) || (weaponType == k31_WeaponTypePoisonDart) + || (weaponType == k32_WeaponTypeThrowingStar)) curGroupSlot = &curGroup->_slot; } } @@ -191,30 +186,30 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in break; } if (championAttack && _projectilePoisonAttack && _vm->getRandomNumber(2) - && _vm->_championMan->addPendingDamageAndWounds_getDamage(AP0456_i_ChampionIndex, attack, k0x0004_ChampionWoundHead | k0x0008_ChampionWoundTorso, _projectileAttackType)) - _vm->_championMan->championPoison(AP0456_i_ChampionIndex, _projectilePoisonAttack); + && _vm->_championMan->addPendingDamageAndWounds_getDamage(championIndex, attack, k0x0004_ChampionWoundHead | k0x0008_ChampionWoundTorso, _projectileAttackType)) + _vm->_championMan->championPoison(championIndex, _projectilePoisonAttack); if (createExplosionOnImpact || removePotion) { + uint16 explosionAttack; if (removePotion) { projectileAssociatedThing = explosionThing; - AL0507_ui_ExplosionAttack = potionPower; + explosionAttack = potionPower; } else { - AL0507_ui_ExplosionAttack = projectileThingData->_kineticEnergy; + explosionAttack = projectileThingData->_kineticEnergy; } - if ((projectileAssociatedThing == Thing::_explLightningBolt) && !(AL0507_ui_ExplosionAttack >>= 1)) + if ((projectileAssociatedThing == Thing::_explLightningBolt) && !(explosionAttack >>= 1)) goto T0217044; - createExplosion(projectileAssociatedThing, AL0507_ui_ExplosionAttack, mapXCombo, mapYCombo, (projectileAssociatedThing == Thing::_explPoisonCloud) ? k255_CreatureTypeSingleCenteredCreature : cell); + createExplosion(projectileAssociatedThing, explosionAttack, mapXCombo, mapYCombo, (projectileAssociatedThing == Thing::_explPoisonCloud) ? k255_CreatureTypeSingleCenteredCreature : cell); } else { - if ((projectileAssociatedThing).getType() == k5_WeaponThingType) { - AL0507_ui_SoundIndex = k00_soundMETALLIC_THUD; - } else { - if (projectileAssociatedThing == Thing::_explPoisonBolt) { - AL0507_ui_SoundIndex = k13_soundSPELL; - } else { - AL0507_ui_SoundIndex = k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM; - } - } - _vm->_sound->requestPlay(AL0507_ui_SoundIndex, projectileMapX, projectileMapY, k1_soundModePlayIfPrioritized); + uint16 soundIndex; + if ((projectileAssociatedThing).getType() == k5_WeaponThingType) + soundIndex = k00_soundMETALLIC_THUD; + else if (projectileAssociatedThing == Thing::_explPoisonBolt) + soundIndex = k13_soundSPELL; + else + soundIndex = k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM; + + _vm->_sound->requestPlay(soundIndex, projectileMapX, projectileMapY, k1_soundModePlayIfPrioritized); } T0217044: if (removePotion) { -- cgit v1.2.3 From 92ca2ae87bd1702160853c8187ef8ef4adead950 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 6 Sep 2016 22:36:59 +0200 Subject: DM: Rework a if statement in hasProjectileImpactOccurred to make it readable --- engines/dm/projexpl.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 2a71e7b0e7..25e0b585d3 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -122,19 +122,24 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in break; } - int16 AL0487_i_IconIndex; - if ((curDoorState == k5_doorState_DESTROYED) || - (curDoorState <= k1_doorState_FOURTH) || - (getFlag(_vm->_dungeonMan->_currMapDoorInfo[curDoor->getType()]._attributes, k0x0002_MaskDoorInfo_ProjectilesCanPassThrough) && - ((projectileAssociatedThingType == k15_ExplosionThingType) ? - (projectileAssociatedThing.toUint16() >= Thing::_explHarmNonMaterial.toUint16()) : - ((projectileThingData->_attack > _vm->getRandomNumber(128)) && - getFlag(_vm->_dungeonMan->_objectInfos[_vm->_dungeonMan->getObjectInfoIndex(projectileAssociatedThing)].getAllowedSlots(), k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors) - && ((projectileAssociatedThingType != k10_JunkThingType) || - ((AL0487_i_IconIndex = _vm->_objectMan->getIconIndex(projectileAssociatedThing)) < 0) || - (!((AL0487_i_IconIndex >= k176_IconIndiceJunkIronKey) && (AL0487_i_IconIndex <= k191_IconIndiceJunkMasterKey)))) - )))) { /* ASSEMBLY_COMPILATION_DIFFERENCE jmp */ + if ((curDoorState == k5_doorState_DESTROYED) || (curDoorState <= k1_doorState_FOURTH)) return false; + + DoorInfo curDoorInfo = _vm->_dungeonMan->_currMapDoorInfo[curDoor->getType()]; + if (getFlag(curDoorInfo._attributes, k0x0002_MaskDoorInfo_ProjectilesCanPassThrough)) { + if (projectileAssociatedThingType == k15_ExplosionThingType) { + if (projectileAssociatedThing.toUint16() >= Thing::_explHarmNonMaterial.toUint16()) + return false; + } else { + int16 associatedThingIndex = _vm->_dungeonMan->getObjectInfoIndex(projectileAssociatedThing); + if ((projectileThingData->_attack > _vm->getRandomNumber(128)) + && getFlag(_vm->_dungeonMan->_objectInfos[associatedThingIndex].getAllowedSlots(), k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors)) { + + int16 iconIndex = _vm->_objectMan->getIconIndex(projectileAssociatedThing); + if ((projectileAssociatedThingType != k10_JunkThingType) || (iconIndex < k176_IconIndiceJunkIronKey) || (iconIndex > k191_IconIndiceJunkMasterKey)) + return false; + } + } } attack = getProjectileImpactAttack(projectileThingData, projectileAssociatedThing) + 1; _vm->_groupMan->groupIsDoorDestoryedByAttack(projectileTargetMapX, projectileTargetMapY, attack + _vm->getRandomNumber(attack), false, 0); -- cgit v1.2.3 From 78085dcd8d376e6f66f753fa40fc5537ba604d42 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 6 Sep 2016 22:52:58 +0200 Subject: DM: Take Dreammaster's suggestion into account to make it even more readable --- engines/dm/projexpl.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 25e0b585d3..3bcd3ca963 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -132,12 +132,16 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in return false; } else { int16 associatedThingIndex = _vm->_dungeonMan->getObjectInfoIndex(projectileAssociatedThing); - if ((projectileThingData->_attack > _vm->getRandomNumber(128)) - && getFlag(_vm->_dungeonMan->_objectInfos[associatedThingIndex].getAllowedSlots(), k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors)) { + uint16 associatedAllowedSlots = _vm->_dungeonMan->_objectInfos[associatedThingIndex].getAllowedSlots(); + int16 iconIndex = _vm->_objectMan->getIconIndex(projectileAssociatedThing); - int16 iconIndex = _vm->_objectMan->getIconIndex(projectileAssociatedThing); - if ((projectileAssociatedThingType != k10_JunkThingType) || (iconIndex < k176_IconIndiceJunkIronKey) || (iconIndex > k191_IconIndiceJunkMasterKey)) - return false; + if ((projectileThingData->_attack > _vm->getRandomNumber(128)) + && getFlag(associatedAllowedSlots, k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors) + && ( (projectileAssociatedThingType != k10_JunkThingType) + || (iconIndex < k176_IconIndiceJunkIronKey) + || (iconIndex > k191_IconIndiceJunkMasterKey) + )) { + return false; } } } -- cgit v1.2.3 From 6df9a20b8549196e20a79b6972edb338b1b22110 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 6 Sep 2016 23:45:56 +0200 Subject: DM: Renaming in ProjExpl --- engines/dm/projexpl.cpp | 237 +++++++++++++++++++++++------------------------- 1 file changed, 112 insertions(+), 125 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 3bcd3ca963..c87a4fba8a 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -230,120 +230,116 @@ T0217044: return true; } -uint16 ProjExpl::getProjectileImpactAttack(Projectile* projectile, Thing thing) { - WeaponInfo* L0485_ps_WeaponInfo; - uint16 L0483_ui_Multiple; -#define AL0483_ui_ThingType L0483_ui_Multiple -#define AL0483_ui_Attack L0483_ui_Multiple - uint16 L0484_ui_KineticEnergy; - - +uint16 ProjExpl::getProjectileImpactAttack(Projectile *projectile, Thing thing) { _projectilePoisonAttack = 0; _projectileAttackType = k3_attackType_BLUNT; - L0484_ui_KineticEnergy = projectile->_kineticEnergy; - if ((AL0483_ui_ThingType = thing.getType()) != k15_ExplosionThingType) { - if (AL0483_ui_ThingType == k5_WeaponThingType) { - L0485_ps_WeaponInfo = _vm->_dungeonMan->getWeaponInfo(thing); - AL0483_ui_Attack = L0485_ps_WeaponInfo->_kineticEnergy; + uint16 kineticEnergy = projectile->_kineticEnergy; + ThingType thingType = thing.getType(); + uint16 attack; + if (thingType != k15_ExplosionThingType) { + if (thingType == k5_WeaponThingType) { + WeaponInfo *weaponInfo = _vm->_dungeonMan->getWeaponInfo(thing); + attack = weaponInfo->_kineticEnergy; _projectileAttackType = k3_attackType_BLUNT; - } else { - AL0483_ui_Attack = _vm->getRandomNumber(4); - } - AL0483_ui_Attack += _vm->_dungeonMan->getObjectWeight(thing) >> 1; + } else + attack = _vm->getRandomNumber(4); + + attack += _vm->_dungeonMan->getObjectWeight(thing) >> 1; + } else if (thing == Thing::_explSlime) { + attack = _vm->getRandomNumber(16); + _projectilePoisonAttack = attack + 10; + attack += _vm->getRandomNumber(32); } else { - if (thing == Thing::_explSlime) { - AL0483_ui_Attack = _vm->getRandomNumber(16); - _projectilePoisonAttack = AL0483_ui_Attack + 10; - AL0483_ui_Attack += _vm->getRandomNumber(32); - } else { - if (thing.toUint16() >= Thing::_explHarmNonMaterial.toUint16()) { - _projectileAttackType = k5_attackType_MAGIC; - if (thing == Thing::_explPoisonBolt) { - _projectilePoisonAttack = L0484_ui_KineticEnergy; - return 1; - } - return 0; - } - _projectileAttackType = k1_attackType_FIRE; - AL0483_ui_Attack = _vm->getRandomNumber(16) + _vm->getRandomNumber(16) + 10; - if (thing == Thing::_explLightningBolt) { - _projectileAttackType = k7_attackType_LIGHTNING; - AL0483_ui_Attack *= 5; + if (thing.toUint16() >= Thing::_explHarmNonMaterial.toUint16()) { + _projectileAttackType = k5_attackType_MAGIC; + if (thing == Thing::_explPoisonBolt) { + _projectilePoisonAttack = kineticEnergy; + return 1; } + return 0; + } + _projectileAttackType = k1_attackType_FIRE; + attack = _vm->getRandomNumber(16) + _vm->getRandomNumber(16) + 10; + if (thing == Thing::_explLightningBolt) { + _projectileAttackType = k7_attackType_LIGHTNING; + attack *= 5; } } - AL0483_ui_Attack = ((AL0483_ui_Attack + L0484_ui_KineticEnergy) >> 4) + 1; - AL0483_ui_Attack += _vm->getRandomNumber((AL0483_ui_Attack >> 1) + 1) + _vm->getRandomNumber(4); - AL0483_ui_Attack = MAX(AL0483_ui_Attack >> 1, AL0483_ui_Attack - (32 - (projectile->_attack >> 3))); - return AL0483_ui_Attack; + attack = ((attack + kineticEnergy) >> 4) + 1; + attack += _vm->getRandomNumber((attack >> 1) + 1) + _vm->getRandomNumber(4); + attack = MAX(attack >> 1, attack - (32 - (projectile->_attack >> 3))); + return attack; } void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo, uint16 mapYCombo, uint16 cell) { -#define AP0443_ui_ProjectileMapX mapXCombo -#define AP0444_ui_ProjectileMapY mapYCombo - Thing L0473_T_Thing = _vm->_dungeonMan->getUnusedThing(k15_ExplosionThingType); - if (L0473_T_Thing == Thing::_none) { + Thing unusedThing = _vm->_dungeonMan->getUnusedThing(k15_ExplosionThingType); + if (unusedThing == Thing::_none) return; - } - Explosion *L0470_ps_Explosion = &((Explosion *)_vm->_dungeonMan->_thingData[k15_ExplosionThingType])[(L0473_T_Thing).getIndex()]; - int16 L0474_i_ProjectileTargetMapX; - int16 L0475_i_ProjectileTargetMapY; + Explosion *explosion = &((Explosion *)_vm->_dungeonMan->_thingData[k15_ExplosionThingType])[(unusedThing).getIndex()]; + int16 projectileTargetMapX; + int16 projectileTargetMapY; + uint16 projectileMapX = mapXCombo; + uint16 projectileMapY = mapYCombo; + if (mapXCombo <= 255) { - L0474_i_ProjectileTargetMapX = mapXCombo; - L0475_i_ProjectileTargetMapY = mapYCombo; + projectileTargetMapX = mapXCombo; + projectileTargetMapY = mapYCombo; } else { - L0474_i_ProjectileTargetMapX = mapXCombo & 0x00FF; - L0475_i_ProjectileTargetMapY = mapYCombo & 0x00FF; - AP0443_ui_ProjectileMapX >>= 8; - AP0443_ui_ProjectileMapX--; - AP0444_ui_ProjectileMapY >>= 8; + projectileTargetMapX = mapXCombo & 0x00FF; + projectileTargetMapY = mapYCombo & 0x00FF; + projectileMapX >>= 8; + projectileMapX--; + projectileMapY >>= 8; } - if (cell == k255_CreatureTypeSingleCenteredCreature) { - L0470_ps_Explosion->setCentered(true); - } else { - L0470_ps_Explosion->setCentered(false); - L0473_T_Thing = thingWithNewCell(L0473_T_Thing, cell); + + if (cell == k255_CreatureTypeSingleCenteredCreature) + explosion->setCentered(true); + else { + explosion->setCentered(false); + unusedThing = thingWithNewCell(unusedThing, cell); } - L0470_ps_Explosion->setType(explThing.toUint16() - Thing::_firstExplosion.toUint16()); - L0470_ps_Explosion->setAttack(attack); + + explosion->setType(explThing.toUint16() - Thing::_firstExplosion.toUint16()); + explosion->setAttack(attack); if (explThing.toUint16() < Thing::_explHarmNonMaterial.toUint16()) { - _vm->_sound->requestPlay((attack > 80) ? k05_soundSTRONG_EXPLOSION : k20_soundWEAK_EXPLOSION, AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY, k1_soundModePlayIfPrioritized); - } else { - if (explThing != Thing::_explSmoke) { - _vm->_sound->requestPlay(k13_soundSPELL, AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY, k1_soundModePlayIfPrioritized); - } - } - _vm->_dungeonMan->linkThingToList(L0473_T_Thing, Thing(0), AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY); - TimelineEvent L0476_s_Event; - setMapAndTime(L0476_s_Event._mapTime, _vm->_dungeonMan->_currMapIndex, _vm->_gameTime + ((explThing == Thing::_explRebirthStep1) ? 5 : 1)); - L0476_s_Event._type = k25_TMEventTypeExplosion; - L0476_s_Event._priority = 0; - L0476_s_Event._C._slot = L0473_T_Thing.toUint16(); - L0476_s_Event._B._location._mapX = AP0443_ui_ProjectileMapX; - L0476_s_Event._B._location._mapY = AP0444_ui_ProjectileMapY; - _vm->_timeline->addEventGetEventIndex(&L0476_s_Event); + uint16 soundIndex = (attack > 80) ? k05_soundSTRONG_EXPLOSION : k20_soundWEAK_EXPLOSION; + _vm->_sound->requestPlay(soundIndex, projectileMapX, projectileMapY, k1_soundModePlayIfPrioritized); + } else if (explThing != Thing::_explSmoke) + _vm->_sound->requestPlay(k13_soundSPELL, projectileMapX, projectileMapY, k1_soundModePlayIfPrioritized); + + _vm->_dungeonMan->linkThingToList(unusedThing, Thing(0), projectileMapX, projectileMapY); + TimelineEvent newEvent; + setMapAndTime(newEvent._mapTime, _vm->_dungeonMan->_currMapIndex, _vm->_gameTime + ((explThing == Thing::_explRebirthStep1) ? 5 : 1)); + newEvent._type = k25_TMEventTypeExplosion; + newEvent._priority = 0; + newEvent._C._slot = unusedThing.toUint16(); + newEvent._B._location._mapX = projectileMapX; + newEvent._B._location._mapY = projectileMapY; + _vm->_timeline->addEventGetEventIndex(&newEvent); if ((explThing == Thing::_explLightningBolt) || (explThing == Thing::_explFireBall)) { - AP0443_ui_ProjectileMapX = L0474_i_ProjectileTargetMapX; - AP0444_ui_ProjectileMapY = L0475_i_ProjectileTargetMapY; + projectileMapX = projectileTargetMapX; + projectileMapY = projectileTargetMapY; attack = (attack >> 1) + 1; attack += _vm->getRandomNumber(attack) + 1; if ((explThing == Thing::_explFireBall) || (attack >>= 1)) { - if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (AP0443_ui_ProjectileMapX == _vm->_dungeonMan->_partyMapX) && (AP0444_ui_ProjectileMapY == _vm->_dungeonMan->_partyMapY)) { - _vm->_championMan->getDamagedChampionCount(attack, k0x0001_ChampionWoundReadHand | k0x0002_ChampionWoundActionHand | k0x0004_ChampionWoundHead | k0x0008_ChampionWoundTorso | k0x0010_ChampionWoundLegs | k0x0020_ChampionWoundFeet, k1_attackType_FIRE); + if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (projectileMapX == _vm->_dungeonMan->_partyMapX) && (projectileMapY == _vm->_dungeonMan->_partyMapY)) { + int16 wounds = k0x0001_ChampionWoundReadHand | k0x0002_ChampionWoundActionHand | k0x0004_ChampionWoundHead | k0x0008_ChampionWoundTorso | k0x0010_ChampionWoundLegs | k0x0020_ChampionWoundFeet; + _vm->_championMan->getDamagedChampionCount(attack, wounds, k1_attackType_FIRE); } else { - if ((L0473_T_Thing = _vm->_groupMan->groupGetThing(AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY)) != Thing::_endOfList) { /* ASSEMBLY_COMPILATION_DIFFERENCE jmp */ - Group *L0472_ps_Group = (Group *)_vm->_dungeonMan->getThingData(L0473_T_Thing); - CreatureInfo *L0471_ps_CreatureInfo = &_vm->_dungeonMan->_creatureInfos[L0472_ps_Group->_type]; - int16 L0469_i_CreatureFireResistance = L0471_ps_CreatureInfo->getFireResistance(); - if (L0469_i_CreatureFireResistance != k15_immuneToFire) { - if (getFlag(L0471_ps_CreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)) { + unusedThing = _vm->_groupMan->groupGetThing(projectileMapX, projectileMapY); + if (unusedThing != Thing::_endOfList) { + Group *creatureGroup = (Group *)_vm->_dungeonMan->getThingData(unusedThing); + CreatureInfo *creatureInfo = &_vm->_dungeonMan->_creatureInfos[creatureGroup->_type]; + int16 creatureFireResistance = creatureInfo->getFireResistance(); + if (creatureFireResistance != k15_immuneToFire) { + if (getFlag(creatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)) attack >>= 2; - } - if ((attack -= _vm->getRandomNumber((L0469_i_CreatureFireResistance << 1) + 1)) > 0) { - _creatureDamageOutcome = _vm->_groupMan->getDamageAllCreaturesOutcome(L0472_ps_Group, AP0443_ui_ProjectileMapX, AP0444_ui_ProjectileMapY, attack, true); - } + + if ((attack -= _vm->getRandomNumber((creatureFireResistance << 1) + 1)) > 0) + _creatureDamageOutcome = _vm->_groupMan->getDamageAllCreaturesOutcome(creatureGroup, projectileMapX, projectileMapY, attack, true); + } } } @@ -352,55 +348,46 @@ void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo, } int16 ProjExpl::projectileGetImpactCount(int16 impactType, int16 mapX, int16 mapY, int16 cell) { - Thing L0513_T_Thing; - int16 L0514_i_ImpactCount; - - - L0514_i_ImpactCount = 0; + int16 impactCount = 0; _creatureDamageOutcome = k0_outcomeKilledNoCreaturesInGroup; T0218001: - L0513_T_Thing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); - while (L0513_T_Thing != Thing::_endOfList) { - if (((L0513_T_Thing).getType() == k14_ProjectileThingType) && - ((L0513_T_Thing).getCell() == cell) && - hasProjectileImpactOccurred(impactType, mapX, mapY, cell, L0513_T_Thing)) { - projectileDeleteEvent(L0513_T_Thing); - L0514_i_ImpactCount++; + Thing curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); + while (curThing != Thing::_endOfList) { + if (((curThing).getType() == k14_ProjectileThingType) && + ((curThing).getCell() == cell) && + hasProjectileImpactOccurred(impactType, mapX, mapY, cell, curThing)) { + projectileDeleteEvent(curThing); + impactCount++; if ((impactType == kM1_CreatureElemType) && (_creatureDamageOutcome == k2_outcomeKilledAllCreaturesInGroup)) break; goto T0218001; } - L0513_T_Thing = _vm->_dungeonMan->getNextThing(L0513_T_Thing); + curThing = _vm->_dungeonMan->getNextThing(curThing); } - return L0514_i_ImpactCount; + return impactCount; } void ProjExpl::projectileDeleteEvent(Thing thing) { - Projectile* L0477_ps_Projectile; - - - L0477_ps_Projectile = (Projectile *)_vm->_dungeonMan->getThingData(thing); - _vm->_timeline->deleteEvent(L0477_ps_Projectile->_eventIndex); + Projectile *projectile = (Projectile *)_vm->_dungeonMan->getThingData(thing); + _vm->_timeline->deleteEvent(projectile->_eventIndex); } -void ProjExpl::projectileDelete(Thing projectileThing, Thing* groupSlot, int16 mapX, int16 mapY) { - Projectile *L0480_ps_Projectile = (Projectile *)_vm->_dungeonMan->getThingData(projectileThing); - Thing L0479_T_Thing = L0480_ps_Projectile->_slot; - if (L0479_T_Thing.getType() != k15_ExplosionThingType) { +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 (groupSlot != NULL) { - Thing L0478_T_PreviousThing = *groupSlot; - if (L0478_T_PreviousThing == Thing::_endOfList) { - Thing *L0481_ps_Generic = (Thing *)_vm->_dungeonMan->getThingData(L0479_T_Thing); - *L0481_ps_Generic = Thing::_endOfList; - *groupSlot = L0479_T_Thing; - } else { - _vm->_dungeonMan->linkThingToList(L0479_T_Thing, L0478_T_PreviousThing, kM1_MapXNotOnASquare, 0); - } - } else { - _vm->_moveSens->getMoveResult(Thing((L0479_T_Thing).getTypeAndIndex() | getFlag(projectileThing.toUint16(), 0xC)), -2, 0, mapX, mapY); - } + Thing previousThing = *groupSlot; + if (previousThing == Thing::_endOfList) { + Thing *genericThing = (Thing *)_vm->_dungeonMan->getThingData(projectileSlotThing); + *genericThing = Thing::_endOfList; + *groupSlot = projectileSlotThing; + } else + _vm->_dungeonMan->linkThingToList(projectileSlotThing, previousThing, kM1_MapXNotOnASquare, 0); + } else + _vm->_moveSens->getMoveResult(Thing((projectileSlotThing).getTypeAndIndex() | getFlag(projectileThing.toUint16(), 0xC)), -2, 0, mapX, mapY); } - L0480_ps_Projectile->_nextThing = Thing::_none; + projectile->_nextThing = Thing::_none; } void ProjExpl::processEvents48To49(TimelineEvent* event) { -- cgit v1.2.3 From 8f33b469bef763e6603afe6b9818e2c3eee6999c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 7 Sep 2016 07:14:50 +0200 Subject: DM: Get rid of a GOTO in projectileGetImpactCount --- engines/dm/projexpl.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index c87a4fba8a..f5c0a71377 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -350,19 +350,18 @@ 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; -T0218001: - Thing curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); - while (curThing != Thing::_endOfList) { - if (((curThing).getType() == k14_ProjectileThingType) && - ((curThing).getCell() == cell) && + + for (Thing curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); curThing != Thing::_endOfList; ) { + if (((curThing).getType() == k14_ProjectileThingType) && ((curThing).getCell() == cell) && hasProjectileImpactOccurred(impactType, mapX, mapY, cell, curThing)) { projectileDeleteEvent(curThing); impactCount++; if ((impactType == kM1_CreatureElemType) && (_creatureDamageOutcome == k2_outcomeKilledAllCreaturesInGroup)) break; - goto T0218001; - } - curThing = _vm->_dungeonMan->getNextThing(curThing); + + Thing curThing = _vm->_dungeonMan->getSquareFirstThing(mapX, mapY); + } else + curThing = _vm->_dungeonMan->getNextThing(curThing); } return impactCount; } -- cgit v1.2.3 From 57d950b46fa7a926e6dfffd916606902e6c29308 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 7 Sep 2016 07:45:24 +0200 Subject: DM: Refactor processEvents48To49 --- engines/dm/projexpl.cpp | 141 ++++++++++++++++++++++-------------------------- 1 file changed, 65 insertions(+), 76 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index f5c0a71377..a24fb43b46 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -390,94 +390,83 @@ void ProjExpl::projectileDelete(Thing projectileThing, Thing *groupSlot, int16 m } void ProjExpl::processEvents48To49(TimelineEvent* event) { - TimelineEvent* L0519_ps_Event; - Projectile* L0520_ps_Projectile; - Thing L0515_T_ProjectileThingNewCell; - uint16 L0516_ui_Multiple; -#define AL0516_ui_StepEnergy L0516_ui_Multiple -#define AL0516_ui_Square L0516_ui_Multiple - Thing L0521_T_ProjectileThing; - uint16 L0517_ui_ProjectileDirection; - bool L0522_B_ProjectileMovesToOtherSquare; - int16 L0523_i_DestinationMapX; - int16 L0524_i_DestinationMapY; - uint16 L0518_ui_Cell; - int16 L0525_i_SourceMapX = -1; - int16 L0526_i_SourceMapY = -1; - TimelineEvent L0527_s_Event; - - - L0527_s_Event = *event; - L0519_ps_Event = &L0527_s_Event; - L0520_ps_Projectile = (Projectile*)_vm->_dungeonMan->getThingData(L0521_T_ProjectileThing = L0515_T_ProjectileThingNewCell = Thing(L0519_ps_Event->_B._slot)); - L0523_i_DestinationMapX = L0519_ps_Event->_C._projectile.getMapX(); - L0524_i_DestinationMapY = L0519_ps_Event->_C._projectile.getMapY(); - if (L0519_ps_Event->_type == k48_TMEventTypeMoveProjectileIgnoreImpacts) { - L0519_ps_Event->_type = k49_TMEventTypeMoveProjectile; - } else { - L0518_ui_Cell = (L0515_T_ProjectileThingNewCell).getCell(); - if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (L0523_i_DestinationMapX == _vm->_dungeonMan->_partyMapX) && (L0524_i_DestinationMapY == _vm->_dungeonMan->_partyMapY) && hasProjectileImpactOccurred(kM2_ChampionElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0515_T_ProjectileThingNewCell)) { + int16 sourceMapX = -1; + int16 sourceMapY = -1; + TimelineEvent firstEvent = *event; + TimelineEvent *curEvent = &firstEvent; + Thing projectileThingNewCell = Thing(curEvent->_B._slot); + Thing projectileThing = projectileThingNewCell; + Projectile *projectile = (Projectile*)_vm->_dungeonMan->getThingData(projectileThing); + int16 destinationMapX = curEvent->_C._projectile.getMapX(); + int16 destinationMapY = curEvent->_C._projectile.getMapY(); + + if (curEvent->_type == k48_TMEventTypeMoveProjectileIgnoreImpacts) + curEvent->_type = k49_TMEventTypeMoveProjectile; + else { + uint16 projectileCurCell = projectileThingNewCell.getCell(); + if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (destinationMapX == _vm->_dungeonMan->_partyMapX) && (destinationMapY == _vm->_dungeonMan->_partyMapY) && hasProjectileImpactOccurred(kM2_ChampionElemType, destinationMapX, destinationMapY, projectileCurCell, projectileThingNewCell)) return; - } - if ((_vm->_groupMan->groupGetThing(L0523_i_DestinationMapX, L0524_i_DestinationMapY) != Thing::_endOfList) && hasProjectileImpactOccurred(kM1_CreatureElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0521_T_ProjectileThing)) { + + if ((_vm->_groupMan->groupGetThing(destinationMapX, destinationMapY) != Thing::_endOfList) && hasProjectileImpactOccurred(kM1_CreatureElemType, destinationMapX, destinationMapY, projectileCurCell, projectileThing)) return; - } - if (L0520_ps_Projectile->_kineticEnergy <= (AL0516_ui_StepEnergy = L0519_ps_Event->_C._projectile.getStepEnergy())) { - _vm->_dungeonMan->unlinkThingFromList(L0515_T_ProjectileThingNewCell = L0521_T_ProjectileThing, Thing(0), L0523_i_DestinationMapX, L0524_i_DestinationMapY); - projectileDelete(L0515_T_ProjectileThingNewCell, NULL, L0523_i_DestinationMapX, L0524_i_DestinationMapY); + + uint16 stepEnergy = curEvent->_C._projectile.getStepEnergy(); + if (projectile->_kineticEnergy <= stepEnergy) { + _vm->_dungeonMan->unlinkThingFromList(projectileThingNewCell = projectileThing, Thing(0), destinationMapX, destinationMapY); + projectileDelete(projectileThingNewCell, NULL, destinationMapX, destinationMapY); return; } - L0520_ps_Projectile->_kineticEnergy -= AL0516_ui_StepEnergy; - if (L0520_ps_Projectile->_attack < AL0516_ui_StepEnergy) { - L0520_ps_Projectile->_attack = 0; - } else { - L0520_ps_Projectile->_attack -= AL0516_ui_StepEnergy; - } + projectile->_kineticEnergy -= stepEnergy; + if (projectile->_attack < stepEnergy) + projectile->_attack = 0; + else + projectile->_attack -= stepEnergy; } - L0517_ui_ProjectileDirection = L0519_ps_Event->_C._projectile.getDir(); - L0515_T_ProjectileThingNewCell = Thing(L0519_ps_Event->_B._slot); - L0518_ui_Cell = L0515_T_ProjectileThingNewCell.getCell(); - L0522_B_ProjectileMovesToOtherSquare = (L0517_ui_ProjectileDirection == L0518_ui_Cell) || (returnNextVal(L0517_ui_ProjectileDirection) == L0518_ui_Cell); - if (L0522_B_ProjectileMovesToOtherSquare) { - L0525_i_SourceMapX = L0523_i_DestinationMapX; - L0526_i_SourceMapY = L0524_i_DestinationMapY; - L0523_i_DestinationMapX += _vm->_dirIntoStepCountEast[L0517_ui_ProjectileDirection], L0524_i_DestinationMapY += _vm->_dirIntoStepCountNorth[L0517_ui_ProjectileDirection]; - AL0516_ui_Square = _vm->_dungeonMan->getSquare(L0523_i_DestinationMapX, L0524_i_DestinationMapY).toByte(); - if ((Square(AL0516_ui_Square).getType() == k0_WallElemType) || - ((Square(AL0516_ui_Square).getType() == k6_FakeWallElemType) && !getFlag(AL0516_ui_Square, (k0x0001_FakeWallImaginary | k0x0004_FakeWallOpen))) || - ((Square(AL0516_ui_Square).getType() == k3_StairsElemType) && (Square(_vm->_dungeonMan->_currMapData[L0525_i_SourceMapX][L0526_i_SourceMapY]).getType() == k3_StairsElemType))) { - if (hasProjectileImpactOccurred(Square(AL0516_ui_Square).getType(), L0525_i_SourceMapX, L0526_i_SourceMapY, L0518_ui_Cell, L0515_T_ProjectileThingNewCell)) { + uint16 projectileDirection = curEvent->_C._projectile.getDir(); + projectileThingNewCell = Thing(curEvent->_B._slot); + uint16 projectileNewCell = projectileThingNewCell.getCell(); + bool projectileMovesToOtherSquare = (projectileDirection == projectileNewCell) || (returnNextVal(projectileDirection) == projectileNewCell); + if (projectileMovesToOtherSquare) { + sourceMapX = destinationMapX; + sourceMapY = destinationMapY; + destinationMapX += _vm->_dirIntoStepCountEast[projectileDirection], destinationMapY += _vm->_dirIntoStepCountNorth[projectileDirection]; + Square destSquare = _vm->_dungeonMan->getSquare(destinationMapX, destinationMapY); + SquareType destSquareType = destSquare.getType(); + if ((destSquareType == k0_WallElemType) || + ((destSquareType == k6_FakeWallElemType) && !getFlag(destSquare.toByte(), (k0x0001_FakeWallImaginary | k0x0004_FakeWallOpen))) || + ((destSquareType == k3_StairsElemType) && (Square(_vm->_dungeonMan->_currMapData[sourceMapX][sourceMapY]).getType() == k3_StairsElemType))) { + if (hasProjectileImpactOccurred(destSquare.getType(), sourceMapX, sourceMapY, projectileNewCell, projectileThingNewCell)) { return; } } } - if ((L0517_ui_ProjectileDirection & 0x0001) == (L0518_ui_Cell & 0x0001)) { - L0518_ui_Cell--; - } else { - L0518_ui_Cell++; - } - L0515_T_ProjectileThingNewCell = thingWithNewCell(L0515_T_ProjectileThingNewCell, L0518_ui_Cell &= 0x0003); - if (L0522_B_ProjectileMovesToOtherSquare) { - _vm->_moveSens->getMoveResult(L0515_T_ProjectileThingNewCell, L0525_i_SourceMapX, L0526_i_SourceMapY, L0523_i_DestinationMapX, L0524_i_DestinationMapY); - L0519_ps_Event->_C._projectile.setMapX(_vm->_moveSens->_moveResultMapX); - L0519_ps_Event->_C._projectile.setMapY(_vm->_moveSens->_moveResultMapY); - L0519_ps_Event->_C._projectile.setDir((Direction)_vm->_moveSens->_moveResultDir); - L0515_T_ProjectileThingNewCell = thingWithNewCell(L0515_T_ProjectileThingNewCell, _vm->_moveSens->_moveResultCell); - M31_setMap(L0519_ps_Event->_mapTime, _vm->_moveSens->_moveResultMapIndex); + + if ((projectileDirection & 0x0001) == (projectileNewCell & 0x0001)) + projectileNewCell--; + else + projectileNewCell++; + + projectileThingNewCell = thingWithNewCell(projectileThingNewCell, projectileNewCell &= 0x0003); + if (projectileMovesToOtherSquare) { + _vm->_moveSens->getMoveResult(projectileThingNewCell, sourceMapX, sourceMapY, destinationMapX, destinationMapY); + curEvent->_C._projectile.setMapX(_vm->_moveSens->_moveResultMapX); + curEvent->_C._projectile.setMapY(_vm->_moveSens->_moveResultMapY); + curEvent->_C._projectile.setDir((Direction)_vm->_moveSens->_moveResultDir); + projectileThingNewCell = thingWithNewCell(projectileThingNewCell, _vm->_moveSens->_moveResultCell); + M31_setMap(curEvent->_mapTime, _vm->_moveSens->_moveResultMapIndex); } else { - if ((Square(_vm->_dungeonMan->getSquare(L0523_i_DestinationMapX, L0524_i_DestinationMapY)).getType() == k4_DoorElemType) && hasProjectileImpactOccurred(k4_DoorElemType, L0523_i_DestinationMapX, L0524_i_DestinationMapY, L0518_ui_Cell, L0521_T_ProjectileThing)) { + if ((Square(_vm->_dungeonMan->getSquare(destinationMapX, destinationMapY)).getType() == k4_DoorElemType) && hasProjectileImpactOccurred(k4_DoorElemType, destinationMapX, destinationMapY, projectileNewCell, projectileThing)) return; - } - _vm->_dungeonMan->unlinkThingFromList(L0515_T_ProjectileThingNewCell, Thing(0), L0523_i_DestinationMapX, L0524_i_DestinationMapY); - _vm->_dungeonMan->linkThingToList(L0515_T_ProjectileThingNewCell, Thing(0), L0523_i_DestinationMapX, L0524_i_DestinationMapY); + + _vm->_dungeonMan->unlinkThingFromList(projectileThingNewCell, Thing(0), destinationMapX, destinationMapY); + _vm->_dungeonMan->linkThingToList(projectileThingNewCell, Thing(0), destinationMapX, destinationMapY); } - L0519_ps_Event->_mapTime += (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) ? 1 : 3; - //Strangerke: CHECKME: Maybe we should keep that piece of code too as it sounds like it's fixing a weird behavior of projectiles on different maps -#ifdef COMPILE42_CSB20EN_CSB21EN /* CHANGE7_20_IMPROVEMENT Projectiles now move at the same speed on all maps instead of moving slower on maps other than the party map */ - L0519_ps_Event->Map_Time++; -#endif - L0519_ps_Event->_B._slot = L0515_T_ProjectileThingNewCell.toUint16(); - L0520_ps_Projectile->_eventIndex = _vm->_timeline->addEventGetEventIndex(L0519_ps_Event); + + // This code is from CSB20. The projectiles move at the same speed on all maps instead of moving slower on maps other than the party map */ + curEvent->_mapTime++; + + curEvent->_B._slot = projectileThingNewCell.toUint16(); + projectile->_eventIndex = _vm->_timeline->addEventGetEventIndex(curEvent); } void ProjExpl::processEvent25(TimelineEvent* event) { -- cgit v1.2.3 From 4a29167fd0cc04dcba639770c78bf6b5cc6317dc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 7 Sep 2016 08:04:10 +0200 Subject: DM: Refactor processEvent25 --- engines/dm/projexpl.cpp | 129 +++++++++++++++++++++++------------------------- 1 file changed, 61 insertions(+), 68 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index a24fb43b46..06f78adf90 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -389,7 +389,7 @@ void ProjExpl::projectileDelete(Thing projectileThing, Thing *groupSlot, int16 m projectile->_nextThing = Thing::_none; } -void ProjExpl::processEvents48To49(TimelineEvent* event) { +void ProjExpl::processEvents48To49(TimelineEvent *event) { int16 sourceMapX = -1; int16 sourceMapY = -1; TimelineEvent firstEvent = *event; @@ -469,95 +469,88 @@ void ProjExpl::processEvents48To49(TimelineEvent* event) { projectile->_eventIndex = _vm->_timeline->addEventGetEventIndex(curEvent); } -void ProjExpl::processEvent25(TimelineEvent* event) { - Explosion* L0532_ps_Explosion; - Group* L0533_ps_Group = nullptr; - CreatureInfo* L0534_ps_CreatureInfo = nullptr; - uint16 L0528_ui_MapX; - uint16 L0529_ui_MapY; - int16 L0530_i_Attack; - int16 L0531_i_Multiple; -#define AL0531_i_SquareType L0531_i_Multiple -#define AL0531_i_CreatureCount L0531_i_Multiple - Thing L0535_T_GroupThing; - Thing L0536_T_ExplosionThing; - uint16 L0537_ui_Multiple = 0; -#define AL0537_ui_CreatureType L0537_ui_Multiple -#define AL0537_ui_NonMaterialAdditionalAttack L0537_ui_Multiple - bool L0538_B_ExplosionOnPartySquare; - TimelineEvent L0539_s_Event; - - L0528_ui_MapX = event->_B._location._mapX; - L0529_ui_MapY = event->_B._location._mapY; - L0532_ps_Explosion = &((Explosion*)_vm->_dungeonMan->_thingData[k15_ExplosionThingType])[Thing((event->_C._slot)).getIndex()]; - AL0531_i_SquareType = Square(_vm->_dungeonMan->_currMapData[L0528_ui_MapX][L0529_ui_MapY]).getType(); - L0538_B_ExplosionOnPartySquare = (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (L0528_ui_MapX == _vm->_dungeonMan->_partyMapX) && (L0529_ui_MapY == _vm->_dungeonMan->_partyMapY); - if ((L0535_T_GroupThing = _vm->_groupMan->groupGetThing(L0528_ui_MapX, L0529_ui_MapY)) != Thing::_endOfList) { - L0533_ps_Group = (Group*)_vm->_dungeonMan->getThingData(L0535_T_GroupThing); - L0534_ps_CreatureInfo = &_vm->_dungeonMan->_creatureInfos[AL0537_ui_CreatureType = L0533_ps_Group->_type]; - } - if ((L0536_T_ExplosionThing = Thing(Thing::_firstExplosion.toUint16() + L0532_ps_Explosion->getType())) == Thing::_explPoisonCloud) { - L0530_i_Attack = MAX(1, MIN(L0532_ps_Explosion->getAttack() >> 5, 4) + _vm->getRandomNumber(2)); /* Value between 1 and 5 */ - } else { - L0530_i_Attack = (L0532_ps_Explosion->getAttack() >> 1) + 1; - L0530_i_Attack += _vm->getRandomNumber(L0530_i_Attack) + 1; +void ProjExpl::processEvent25(TimelineEvent *event) { + uint16 mapX = event->_B._location._mapX; + uint16 mapY = event->_B._location._mapY; + Explosion *explosion = &((Explosion*)_vm->_dungeonMan->_thingData[k15_ExplosionThingType])[Thing((event->_C._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); + + Group *group = nullptr; + CreatureInfo *creatureInfo = nullptr; + + uint16 creatureType = 0; + if (groupThing != Thing::_endOfList) { + group = (Group*)_vm->_dungeonMan->getThingData(groupThing); + creatureType = group->_type; + creatureInfo = &_vm->_dungeonMan->_creatureInfos[creatureType]; } + Thing explosionThing = Thing(Thing::_firstExplosion.toUint16() + explosion->getType()); + int16 attack; + if (explosionThing == Thing::_explPoisonCloud) + attack = MAX(1, MIN(explosion->getAttack() >> 5, 4) + _vm->getRandomNumber(2)); /* Value between 1 and 5 */ + else { + attack = (explosion->getAttack() >> 1) + 1; + attack += _vm->getRandomNumber(attack) + 1; + } - switch (L0536_T_ExplosionThing.toUint16()) { + switch (explosionThing.toUint16()) { case 0xFF82: - if (!(L0530_i_Attack >>= 1)) + if (!(attack >>= 1)) break; case 0xFF80: - if (AL0531_i_SquareType == k4_DoorElemType) { - _vm->_groupMan->groupIsDoorDestoryedByAttack(L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack, true, 0); - } + if (curSquareType == k4_DoorElemType) + _vm->_groupMan->groupIsDoorDestoryedByAttack(mapX, mapY, attack, true, 0); + break; case 0xFF83: - if ((L0535_T_GroupThing != Thing::_endOfList) && getFlag(L0534_ps_CreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)) { - if ((AL0537_ui_CreatureType == k19_CreatureTypeMaterializerZytaz) && (_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex)) { /* ASSEMBLY_COMPILATION_DIFFERENCE jmp */ - L0530_i_Attack -= (AL0537_ui_NonMaterialAdditionalAttack = L0530_i_Attack >> 3); - AL0537_ui_NonMaterialAdditionalAttack <<= 1; - AL0537_ui_NonMaterialAdditionalAttack++; - AL0531_i_CreatureCount = L0533_ps_Group->getCount(); + if ((groupThing != Thing::_endOfList) && getFlag(creatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial)) { + if ((creatureType == k19_CreatureTypeMaterializerZytaz) && (_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[L0533_ps_Group->getActiveGroupIndex()]._aspect[AL0531_i_CreatureCount], k0x0080_MaskActiveGroupIsAttacking)) { /* Materializer / Zytaz can only be damaged while they are attacking */ - _vm->_groupMan->groupGetDamageCreatureOutcome(L0533_ps_Group, AL0531_i_CreatureCount, L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack + _vm->getRandomNumber(AL0537_ui_NonMaterialAdditionalAttack) + _vm->getRandomNumber(4), true); - } - } while (--AL0531_i_CreatureCount >= 0); - } else { - _vm->_groupMan->getDamageAllCreaturesOutcome(L0533_ps_Group, L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack, true); - } + if (getFlag(_vm->_groupMan->_activeGroups[group->getActiveGroupIndex()]._aspect[creatureCount], k0x0080_MaskActiveGroupIsAttacking)) /* 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 + _vm->_groupMan->getDamageAllCreaturesOutcome(group, mapX, mapY, attack, true); } break; case 0xFFE4: - L0532_ps_Explosion->setType(L0532_ps_Explosion->getType() + 1); - _vm->_sound->requestPlay(k05_soundSTRONG_EXPLOSION, L0528_ui_MapX, L0529_ui_MapY, k1_soundModePlayIfPrioritized); + explosion->setType(explosion->getType() + 1); + _vm->_sound->requestPlay(k05_soundSTRONG_EXPLOSION, mapX, mapY, k1_soundModePlayIfPrioritized); goto T0220026; case 0xFFA8: - if (L0532_ps_Explosion->getAttack() > 55) { - L0532_ps_Explosion->setAttack(L0532_ps_Explosion->getAttack() - 40); + if (explosion->getAttack() > 55) { + explosion->setAttack(explosion->getAttack() - 40); goto T0220026; } break; case 0xFF87: - if (L0538_B_ExplosionOnPartySquare) { - _vm->_championMan->getDamagedChampionCount(L0530_i_Attack, k0x0000_ChampionWoundNone, k0_attackType_NORMAL); - } else { - if ((L0535_T_GroupThing != Thing::_endOfList) && (L0530_i_Attack = _vm->_groupMan->groupGetResistanceAdjustedPoisonAttack(AL0537_ui_CreatureType, L0530_i_Attack)) && (_vm->_groupMan->getDamageAllCreaturesOutcome(L0533_ps_Group, L0528_ui_MapX, L0529_ui_MapY, L0530_i_Attack, true) != k2_outcomeKilledAllCreaturesInGroup) && (L0530_i_Attack > 2)) { - _vm->_groupMan->processEvents29to41(L0528_ui_MapX, L0529_ui_MapY, kM3_TMEventTypeCreateReactionEvent29DangerOnSquare, 0); - } + if (explosionOnPartySquare) + _vm->_championMan->getDamagedChampionCount(attack, k0x0000_ChampionWoundNone, k0_attackType_NORMAL); + else if ((groupThing != Thing::_endOfList) + && (attack = _vm->_groupMan->groupGetResistanceAdjustedPoisonAttack(creatureType, attack)) + && (_vm->_groupMan->getDamageAllCreaturesOutcome(group, mapX, mapY, attack, true) != k2_outcomeKilledAllCreaturesInGroup) + && (attack > 2)) { + _vm->_groupMan->processEvents29to41(mapX, mapY, kM3_TMEventTypeCreateReactionEvent29DangerOnSquare, 0); } - if (L0532_ps_Explosion->getAttack() >= 6) { - L0532_ps_Explosion->setAttack(L0532_ps_Explosion->getAttack() - 3); + if (explosion->getAttack() >= 6) { + explosion->setAttack(explosion->getAttack() - 3); T0220026: - L0539_s_Event = *event; - L0539_s_Event._mapTime++; - _vm->_timeline->addEventGetEventIndex(&L0539_s_Event); + TimelineEvent newEvent; + newEvent = *event; + newEvent._mapTime++; + _vm->_timeline->addEventGetEventIndex(&newEvent); return; } } - _vm->_dungeonMan->unlinkThingFromList(Thing(event->_C._slot), Thing(0), L0528_ui_MapX, L0529_ui_MapY); - L0532_ps_Explosion->setNextThing(Thing::_none); + _vm->_dungeonMan->unlinkThingFromList(Thing(event->_C._slot), Thing(0), mapX, mapY); + explosion->setNextThing(Thing::_none); } } -- cgit v1.2.3 From 6e1a3d6217950776aa8d2b35f6f2de763750c4d8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 7 Sep 2016 08:07:29 +0200 Subject: DM: Remove the use of GOTO in processEvent25 --- engines/dm/projexpl.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 06f78adf90..e1a62d1836 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -496,6 +496,8 @@ void ProjExpl::processEvent25(TimelineEvent *event) { attack += _vm->getRandomNumber(attack) + 1; } + bool AddEventFl = false; + switch (explosionThing.toUint16()) { case 0xFF82: if (!(attack >>= 1)) @@ -524,11 +526,12 @@ void ProjExpl::processEvent25(TimelineEvent *event) { case 0xFFE4: explosion->setType(explosion->getType() + 1); _vm->_sound->requestPlay(k05_soundSTRONG_EXPLOSION, mapX, mapY, k1_soundModePlayIfPrioritized); - goto T0220026; + AddEventFl = true; + break; case 0xFFA8: if (explosion->getAttack() > 55) { explosion->setAttack(explosion->getAttack() - 40); - goto T0220026; + AddEventFl = true; } break; case 0xFF87: @@ -542,15 +545,18 @@ void ProjExpl::processEvent25(TimelineEvent *event) { } if (explosion->getAttack() >= 6) { explosion->setAttack(explosion->getAttack() - 3); -T0220026: - TimelineEvent newEvent; - newEvent = *event; - newEvent._mapTime++; - _vm->_timeline->addEventGetEventIndex(&newEvent); - return; + AddEventFl = true; } + break; + } + if (AddEventFl) { + TimelineEvent newEvent; + newEvent = *event; + newEvent._mapTime++; + _vm->_timeline->addEventGetEventIndex(&newEvent); + } else { + _vm->_dungeonMan->unlinkThingFromList(Thing(event->_C._slot), Thing(0), mapX, mapY); + explosion->setNextThing(Thing::_none); } - _vm->_dungeonMan->unlinkThingFromList(Thing(event->_C._slot), Thing(0), mapX, mapY); - explosion->setNextThing(Thing::_none); } } -- cgit v1.2.3 From 4414995c29a8de9228346f948f8d6bea5a099ecb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 7 Sep 2016 19:48:20 +0200 Subject: DM: Fix the style of some pointers in projexpl --- engines/dm/projexpl.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index e1a62d1836..7c4bc53337 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -35,7 +35,7 @@ namespace DM { -ProjExpl::ProjExpl(DMEngine* vm) : _vm(vm) { +ProjExpl::ProjExpl(DMEngine *vm) : _vm(vm) { _creatureDamageOutcome = 0; _secondaryDirToOrFromParty = 0; _lastCreatureAttackTime = -200; @@ -396,7 +396,7 @@ void ProjExpl::processEvents48To49(TimelineEvent *event) { TimelineEvent *curEvent = &firstEvent; Thing projectileThingNewCell = Thing(curEvent->_B._slot); Thing projectileThing = projectileThingNewCell; - Projectile *projectile = (Projectile*)_vm->_dungeonMan->getThingData(projectileThing); + Projectile *projectile = (Projectile *)_vm->_dungeonMan->getThingData(projectileThing); int16 destinationMapX = curEvent->_C._projectile.getMapX(); int16 destinationMapY = curEvent->_C._projectile.getMapY(); @@ -472,7 +472,7 @@ void ProjExpl::processEvents48To49(TimelineEvent *event) { void ProjExpl::processEvent25(TimelineEvent *event) { uint16 mapX = event->_B._location._mapX; uint16 mapY = event->_B._location._mapY; - Explosion *explosion = &((Explosion*)_vm->_dungeonMan->_thingData[k15_ExplosionThingType])[Thing((event->_C._slot)).getIndex()]; + Explosion *explosion = &((Explosion *)_vm->_dungeonMan->_thingData[k15_ExplosionThingType])[Thing((event->_C._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); @@ -482,7 +482,7 @@ void ProjExpl::processEvent25(TimelineEvent *event) { uint16 creatureType = 0; if (groupThing != Thing::_endOfList) { - group = (Group*)_vm->_dungeonMan->getThingData(groupThing); + group = (Group *)_vm->_dungeonMan->getThingData(groupThing); creatureType = group->_type; creatureInfo = &_vm->_dungeonMan->_creatureInfos[creatureType]; } -- cgit v1.2.3 From b365338293ab1bbad4deef5f2979639f360d77db Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 9 Sep 2016 01:09:25 +0200 Subject: DM: Rename IconIndice enum --- engines/dm/projexpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 7c4bc53337..15ccc52b3a 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -138,8 +138,8 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in if ((projectileThingData->_attack > _vm->getRandomNumber(128)) && getFlag(associatedAllowedSlots, k0x0100_ObjectAllowedSlotPouchPassAndThroughDoors) && ( (projectileAssociatedThingType != k10_JunkThingType) - || (iconIndex < k176_IconIndiceJunkIronKey) - || (iconIndex > k191_IconIndiceJunkMasterKey) + || (iconIndex < kDMIconIndiceJunkIronKey) + || (iconIndex > kDMIconIndiceJunkMasterKey) )) { return false; } -- cgit v1.2.3 From 1b482a1e129b2bf00f49a9c4ef5c8d84470be1af Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 9 Sep 2016 07:12:36 +0200 Subject: DM: Rename enums ChampionIndex, ChampionAttribute, ChampionWound, ChampionStatisticType, ChampionStatisticValue --- engines/dm/projexpl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 15ccc52b3a..48f122c03d 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -195,7 +195,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in break; } if (championAttack && _projectilePoisonAttack && _vm->getRandomNumber(2) - && _vm->_championMan->addPendingDamageAndWounds_getDamage(championIndex, attack, k0x0004_ChampionWoundHead | k0x0008_ChampionWoundTorso, _projectileAttackType)) + && _vm->_championMan->addPendingDamageAndWounds_getDamage(championIndex, attack, kDMChampionWoundHead | kDMChampionWoundTorso, _projectileAttackType)) _vm->_championMan->championPoison(championIndex, _projectilePoisonAttack); if (createExplosionOnImpact || removePotion) { @@ -325,7 +325,7 @@ void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo, attack += _vm->getRandomNumber(attack) + 1; if ((explThing == Thing::_explFireBall) || (attack >>= 1)) { if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (projectileMapX == _vm->_dungeonMan->_partyMapX) && (projectileMapY == _vm->_dungeonMan->_partyMapY)) { - int16 wounds = k0x0001_ChampionWoundReadHand | k0x0002_ChampionWoundActionHand | k0x0004_ChampionWoundHead | k0x0008_ChampionWoundTorso | k0x0010_ChampionWoundLegs | k0x0020_ChampionWoundFeet; + int16 wounds = kDMChampionWoundReadHand | kDMChampionWoundActionHand | kDMChampionWoundHead | kDMChampionWoundTorso | kDMChampionWoundLegs | kDMChampionWoundFeet; _vm->_championMan->getDamagedChampionCount(attack, wounds, k1_attackType_FIRE); } else { unusedThing = _vm->_groupMan->groupGetThing(projectileMapX, projectileMapY); @@ -536,7 +536,7 @@ void ProjExpl::processEvent25(TimelineEvent *event) { break; case 0xFF87: if (explosionOnPartySquare) - _vm->_championMan->getDamagedChampionCount(attack, k0x0000_ChampionWoundNone, k0_attackType_NORMAL); + _vm->_championMan->getDamagedChampionCount(attack, kDMChampionWoundNone, k0_attackType_NORMAL); else if ((groupThing != Thing::_endOfList) && (attack = _vm->_groupMan->groupGetResistanceAdjustedPoisonAttack(creatureType, attack)) && (_vm->_groupMan->getDamageAllCreaturesOutcome(group, mapX, mapY, attack, true) != k2_outcomeKilledAllCreaturesInGroup) -- cgit v1.2.3 From 93fb0efc0bd297be9399cd03b3523cb9f8117691 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 9 Sep 2016 07:32:32 +0200 Subject: DM: More renaming in champion.h --- engines/dm/projexpl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index 48f122c03d..cbf00852d8 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -195,7 +195,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in break; } if (championAttack && _projectilePoisonAttack && _vm->getRandomNumber(2) - && _vm->_championMan->addPendingDamageAndWounds_getDamage(championIndex, attack, kDMChampionWoundHead | kDMChampionWoundTorso, _projectileAttackType)) + && _vm->_championMan->addPendingDamageAndWounds_getDamage(championIndex, attack, kDMWoundHead | kDMWoundTorso, _projectileAttackType)) _vm->_championMan->championPoison(championIndex, _projectilePoisonAttack); if (createExplosionOnImpact || removePotion) { @@ -325,7 +325,7 @@ void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo, attack += _vm->getRandomNumber(attack) + 1; if ((explThing == Thing::_explFireBall) || (attack >>= 1)) { if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (projectileMapX == _vm->_dungeonMan->_partyMapX) && (projectileMapY == _vm->_dungeonMan->_partyMapY)) { - int16 wounds = kDMChampionWoundReadHand | kDMChampionWoundActionHand | kDMChampionWoundHead | kDMChampionWoundTorso | kDMChampionWoundLegs | kDMChampionWoundFeet; + int16 wounds = kDMWoundReadHand | kDMWoundActionHand | kDMWoundHead | kDMWoundTorso | kDMWoundLegs | kDMWoundFeet; _vm->_championMan->getDamagedChampionCount(attack, wounds, k1_attackType_FIRE); } else { unusedThing = _vm->_groupMan->groupGetThing(projectileMapX, projectileMapY); @@ -536,7 +536,7 @@ void ProjExpl::processEvent25(TimelineEvent *event) { break; case 0xFF87: if (explosionOnPartySquare) - _vm->_championMan->getDamagedChampionCount(attack, kDMChampionWoundNone, k0_attackType_NORMAL); + _vm->_championMan->getDamagedChampionCount(attack, kDMWoundNone, k0_attackType_NORMAL); else if ((groupThing != Thing::_endOfList) && (attack = _vm->_groupMan->groupGetResistanceAdjustedPoisonAttack(creatureType, attack)) && (_vm->_groupMan->getDamageAllCreaturesOutcome(group, mapX, mapY, attack, true) != k2_outcomeKilledAllCreaturesInGroup) -- cgit v1.2.3 From d2b0829476e6e045a1d322b94bde64b0fcb87234 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 10 Sep 2016 14:31:49 +0200 Subject: DM: Change constants into enums in champion.h, renaming --- engines/dm/projexpl.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'engines/dm/projexpl.cpp') diff --git a/engines/dm/projexpl.cpp b/engines/dm/projexpl.cpp index cbf00852d8..c9682a18e1 100644 --- a/engines/dm/projexpl.cpp +++ b/engines/dm/projexpl.cpp @@ -232,7 +232,7 @@ T0217044: uint16 ProjExpl::getProjectileImpactAttack(Projectile *projectile, Thing thing) { _projectilePoisonAttack = 0; - _projectileAttackType = k3_attackType_BLUNT; + _projectileAttackType = kDMAttackTypeBlunt; uint16 kineticEnergy = projectile->_kineticEnergy; ThingType thingType = thing.getType(); @@ -241,7 +241,7 @@ uint16 ProjExpl::getProjectileImpactAttack(Projectile *projectile, Thing thing) if (thingType == k5_WeaponThingType) { WeaponInfo *weaponInfo = _vm->_dungeonMan->getWeaponInfo(thing); attack = weaponInfo->_kineticEnergy; - _projectileAttackType = k3_attackType_BLUNT; + _projectileAttackType = kDMAttackTypeBlunt; } else attack = _vm->getRandomNumber(4); @@ -252,17 +252,17 @@ uint16 ProjExpl::getProjectileImpactAttack(Projectile *projectile, Thing thing) attack += _vm->getRandomNumber(32); } else { if (thing.toUint16() >= Thing::_explHarmNonMaterial.toUint16()) { - _projectileAttackType = k5_attackType_MAGIC; + _projectileAttackType = kDMAttackTypeMagic; if (thing == Thing::_explPoisonBolt) { _projectilePoisonAttack = kineticEnergy; return 1; } return 0; } - _projectileAttackType = k1_attackType_FIRE; + _projectileAttackType = kDMAttackTypeFire; attack = _vm->getRandomNumber(16) + _vm->getRandomNumber(16) + 10; if (thing == Thing::_explLightningBolt) { - _projectileAttackType = k7_attackType_LIGHTNING; + _projectileAttackType = kDMAttackTypeLightning; attack *= 5; } } @@ -326,7 +326,7 @@ void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo, if ((explThing == Thing::_explFireBall) || (attack >>= 1)) { if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (projectileMapX == _vm->_dungeonMan->_partyMapX) && (projectileMapY == _vm->_dungeonMan->_partyMapY)) { int16 wounds = kDMWoundReadHand | kDMWoundActionHand | kDMWoundHead | kDMWoundTorso | kDMWoundLegs | kDMWoundFeet; - _vm->_championMan->getDamagedChampionCount(attack, wounds, k1_attackType_FIRE); + _vm->_championMan->getDamagedChampionCount(attack, wounds, kDMAttackTypeFire); } else { unusedThing = _vm->_groupMan->groupGetThing(projectileMapX, projectileMapY); if (unusedThing != Thing::_endOfList) { @@ -536,7 +536,7 @@ void ProjExpl::processEvent25(TimelineEvent *event) { break; case 0xFF87: if (explosionOnPartySquare) - _vm->_championMan->getDamagedChampionCount(attack, kDMWoundNone, k0_attackType_NORMAL); + _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) -- cgit v1.2.3