diff options
-rw-r--r-- | engines/dm/champion.cpp | 670 | ||||
-rw-r--r-- | engines/dm/champion.h | 192 | ||||
-rw-r--r-- | engines/dm/console.cpp | 4 | ||||
-rw-r--r-- | engines/dm/dm.cpp | 36 | ||||
-rw-r--r-- | engines/dm/dungeonman.cpp | 4 | ||||
-rw-r--r-- | engines/dm/eventman.cpp | 170 | ||||
-rw-r--r-- | engines/dm/gfx.cpp | 8 | ||||
-rw-r--r-- | engines/dm/group.cpp | 60 | ||||
-rw-r--r-- | engines/dm/inventory.cpp | 82 | ||||
-rw-r--r-- | engines/dm/loadsave.cpp | 36 | ||||
-rw-r--r-- | engines/dm/menus.cpp | 208 | ||||
-rw-r--r-- | engines/dm/movesens.cpp | 90 | ||||
-rw-r--r-- | engines/dm/objectman.cpp | 4 | ||||
-rw-r--r-- | engines/dm/projexpl.cpp | 10 | ||||
-rw-r--r-- | engines/dm/timeline.cpp | 56 |
15 files changed, 817 insertions, 813 deletions
diff --git a/engines/dm/champion.cpp b/engines/dm/champion.cpp index 0a33c74af2..3ef072f7d9 100644 --- a/engines/dm/champion.cpp +++ b/engines/dm/champion.cpp @@ -41,6 +41,40 @@ namespace DM { +void Champion::resetToZero() { + for (int16 i = 0; i < 30; ++i) + _slots[i] = Thing::_none; + for (int16 i = 0; i < 20; ++i) + _skills[i].resetToZero(); + _attributes = _wounds = 0; + memset(_statistics, 0, 7 * 3); + memset(_name, '\0', 8); + memset(_title, '\0', 20); + _dir = kDirNorth; + _cell = k0_ViewCellFronLeft; + _actionIndex = k0_ChampionActionN; + _symbolStep = 0; + memset(_symbols, '\0', 5); + _directionMaximumDamageReceived = _maximumDamageReceived = _poisonEventCount = _enableActionEventIndex = 0; + _hideDamageReceivedIndex = _currHealth = _maxHealth = _currStamina = _maxStamina = _currMana = _maxMana = 0; + _actionDefense = _food = _water = _load = _shieldDefense = 0; + memset(_portrait, 0, 464); +} + +void Champion::setWoundsFlag(ChampionWound flag, bool value) { + if (value) + _wounds |= flag; + else + _wounds &= ~flag; +} + +void Champion::setAttributeFlag(ChampionAttribute flag, bool value) { + if (value) + _attributes |= flag; + else + _attributes &= ~flag; +} + void ChampionMan::initConstants() { static const char *g417_baseSkillName_EN_ANY[4] = {"FIGHTER", "NINJA", "PRIEST", "WIZARD"}; static const char *g417_baseSkillName_DE_DEU[4] = {"KAEMPFER", "NINJA", "PRIESTER", "MAGIER"}; @@ -128,64 +162,64 @@ void ChampionMan::initConstants() { ChampionMan::ChampionMan(DMEngine *vm) : _vm(vm) { for (uint16 i = 0; i < 4; ++i) { - _g409_championPendingDamage[i] = 0; - _g410_championPendingWounds[i] = 0; - _gK71_champions[i].resetToZero(); - } - _g305_partyChampionCount = 0; - _g303_partyDead = false; - _g414_leaderHandObject = Thing(0); - _g411_leaderIndex = kM1_ChampionNone; - _g299_candidateChampionOrdinal = 0; - _g300_partyIsSleeping = false; - _g506_actingChampionOrdinal = 0; - _g413_leaderHandObjectIconIndex = (IconIndice)0; - _g415_leaderEmptyHanded = false; - _g407_party.resetToZero(); - _g514_magicCasterChampionIndex = kM1_ChampionNone; - _g420_mousePointerHiddenToDrawChangedObjIconOnScreen = false; + _championPendingDamage[i] = 0; + _championPendingWounds[i] = 0; + _champions[i].resetToZero(); + } + _partyChampionCount = 0; + _partyDead = false; + _leaderHandObject = Thing(0); + _leaderIndex = kM1_ChampionNone; + _candidateChampionOrdinal = 0; + _partyIsSleeping = false; + _actingChampionOrdinal = 0; + _leaderHandObjectIconIndex = (IconIndice)0; + _leaderEmptyHanded = false; + _party.resetToZero(); + _magicCasterChampionIndex = kM1_ChampionNone; + _mousePointerHiddenToDrawChangedObjIconOnScreen = false; initConstants(); } -bool ChampionMan::f329_isLeaderHandObjectThrown(int16 side) { - if (_g411_leaderIndex == kM1_ChampionNone) +bool ChampionMan::isLeaderHandObjectThrown(int16 side) { + if (_leaderIndex == kM1_ChampionNone) return false; - return f328_isObjectThrown(_g411_leaderIndex, kM1_ChampionSlotLeaderHand, side); + return isObjectThrown(_leaderIndex, kM1_ChampionSlotLeaderHand, side); } -bool ChampionMan::f328_isObjectThrown(uint16 champIndex, int16 slotIndex, int16 side) { +bool ChampionMan::isObjectThrown(uint16 champIndex, int16 slotIndex, int16 side) { bool throwingLeaderHandObjectFl = false; Thing curThing; Champion *curChampion = nullptr; Thing actionHandThing; if (slotIndex < 0) { /* Throw object in leader hand, which is temporarily placed in action hand */ - if (_g415_leaderEmptyHanded) + if (_leaderEmptyHanded) return false; - curThing = f298_getObjectRemovedFromLeaderHand(); - curChampion = &_gK71_champions[champIndex]; + curThing = getObjectRemovedFromLeaderHand(); + curChampion = &_champions[champIndex]; actionHandThing = curChampion->getSlot(k1_ChampionSlotActionHand); curChampion->setSlot(k1_ChampionSlotActionHand, curThing); slotIndex = k1_ChampionSlotActionHand; throwingLeaderHandObjectFl = true; } - int16 kineticEnergy = f312_getStrength(champIndex, slotIndex); + int16 kineticEnergy = getStrength(champIndex, slotIndex); if (throwingLeaderHandObjectFl) { // In this case, curChampion and actionHandThing are set. curChampion->setSlot((ChampionSlot)slotIndex, actionHandThing); } else { - curThing = f300_getObjectRemovedFromSlot(champIndex, slotIndex); + curThing = getObjectRemovedFromSlot(champIndex, slotIndex); if (curThing == Thing::_none) return false; } _vm->_sound->f064_SOUND_RequestPlay_CPSD(k16_soundCOMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, k1_soundModePlayIfPrioritized); - f325_decrementStamina(champIndex, f305_getThrowingStaminaCost(curThing)); - f330_disableAction(champIndex, 4); + decrementStamina(champIndex, getThrowingStaminaCost(curThing)); + disableAction(champIndex, 4); int16 experience = 8; int16 weaponKineticEnergy = 1; if (curThing.getType() == k5_WeaponThingType) { @@ -196,9 +230,9 @@ bool ChampionMan::f328_isObjectThrown(uint16 champIndex, int16 slotIndex, int16 experience += weaponKineticEnergy >> 2; } } - f304_addSkillExperience(champIndex, k10_ChampionSkillThrow, experience); + addSkillExperience(champIndex, k10_ChampionSkillThrow, experience); kineticEnergy += weaponKineticEnergy; - int16 skillLevel = f303_getSkillLevel((ChampionIndex)champIndex, k10_ChampionSkillThrow); + int16 skillLevel = getSkillLevel((ChampionIndex)champIndex, k10_ChampionSkillThrow); kineticEnergy += _vm->getRandomNumber(16) + (kineticEnergy >> 1) + skillLevel; int16 attack = f26_getBoundedValue((uint16)40, (uint16)((skillLevel << 3) + _vm->getRandomNumber(32)), (uint16)200); int16 stepEnergy = MAX(5, 11 - skillLevel); @@ -207,19 +241,19 @@ bool ChampionMan::f328_isObjectThrown(uint16 champIndex, int16 slotIndex, int16 _vm->_dungeonMan->_g308_partyDir, kineticEnergy, attack, stepEnergy); _vm->_g311_projectileDisableMovementTicks = 4; _vm->_g312_lastProjectileDisabledMovementDirection = _vm->_dungeonMan->_g308_partyDir; - f292_drawChampionState((ChampionIndex)champIndex); + drawChampionState((ChampionIndex)champIndex); return true; } -uint16 ChampionMan::M27_getChampionPortraitX(uint16 index) { +uint16 ChampionMan::getChampionPortraitX(uint16 index) { return ((index) & 0x7) << 5; } -uint16 ChampionMan::M28_getChampionPortraitY(uint16 index) { +uint16 ChampionMan::getChampionPortraitY(uint16 index) { return ((index) >> 3) * 29; } -int16 ChampionMan::f279_getDecodedValue(char *string, uint16 characterCount) { +int16 ChampionMan::getDecodedValue(char *string, uint16 characterCount) { int val = 0; for (uint16 i = 0; i < characterCount; ++i) { val = (val << 4) + (string[i] - 'A'); @@ -227,20 +261,20 @@ int16 ChampionMan::f279_getDecodedValue(char *string, uint16 characterCount) { return val; } -void ChampionMan::f289_drawHealthOrStaminaOrManaValue(int16 posY, int16 currVal, int16 maxVal) { - Common::String tmp = f288_getStringFromInteger(currVal, true, 3); +void ChampionMan::drawHealthOrStaminaOrManaValue(int16 posY, int16 currVal, int16 maxVal) { + Common::String tmp = getStringFromInteger(currVal, true, 3); _vm->_textMan->f52_printToViewport(55, posY, k13_ColorLightestGray, tmp.c_str()); _vm->_textMan->f52_printToViewport(73, posY, k13_ColorLightestGray, "/"); - tmp = f288_getStringFromInteger(maxVal, true, 3); + tmp = getStringFromInteger(maxVal, true, 3); _vm->_textMan->f52_printToViewport(79, posY, k13_ColorLightestGray, tmp.c_str()); } -uint16 ChampionMan::M70_handSlotIndex(uint16 slotBoxIndex) { +uint16 ChampionMan::getHandSlotIndex(uint16 slotBoxIndex) { return slotBoxIndex & 0x1; } -Common::String ChampionMan::f288_getStringFromInteger(uint16 val, bool padding, uint16 paddingCharCount) { +Common::String ChampionMan::getStringFromInteger(uint16 val, bool padding, uint16 paddingCharCount) { Common::String valToStr = Common::String::format("%d", val); Common::String result; @@ -252,7 +286,7 @@ Common::String ChampionMan::f288_getStringFromInteger(uint16 val, bool padding, return result += valToStr; } -void ChampionMan::f299_applyModifiersToStatistics(Champion *champ, int16 slotIndex, int16 iconIndex, int16 modifierFactor, Thing thing) { +void ChampionMan::applyModifiersToStatistics(Champion *champ, int16 slotIndex, int16 iconIndex, int16 modifierFactor, Thing thing) { int16 statIndex = k0_ChampionStatLuck; int16 modifier = 0; ThingType thingType = thing.getType(); @@ -397,7 +431,7 @@ void ChampionMan::f299_applyModifiersToStatistics(Champion *champ, int16 slotInd } } -bool ChampionMan::f295_hasObjectIconInSlotBoxChanged(int16 slotBoxIndex, Thing thing) { +bool ChampionMan::hasObjectIconInSlotBoxChanged(int16 slotBoxIndex, Thing thing) { ObjectMan &objMan = *_vm->_objectMan; IconIndice currIconIndex = objMan.f39_getIconIndexInSlotBox(slotBoxIndex); @@ -406,8 +440,8 @@ bool ChampionMan::f295_hasObjectIconInSlotBoxChanged(int16 slotBoxIndex, Thing t || (currIconIndex == k195_IconIndicePotionEmptyFlask)) { IconIndice newIconIndex = objMan.f33_getIconIndex(thing); if (newIconIndex != currIconIndex) { - if ((slotBoxIndex < k8_SlotBoxInventoryFirstSlot) && !_g420_mousePointerHiddenToDrawChangedObjIconOnScreen) { - _g420_mousePointerHiddenToDrawChangedObjIconOnScreen = true; + if ((slotBoxIndex < k8_SlotBoxInventoryFirstSlot) && !_mousePointerHiddenToDrawChangedObjIconOnScreen) { + _mousePointerHiddenToDrawChangedObjIconOnScreen = true; _vm->_eventMan->f77_hideMouse(); } objMan.f38_drawIconInSlotBox(slotBoxIndex, newIconIndex); @@ -418,51 +452,51 @@ bool ChampionMan::f295_hasObjectIconInSlotBoxChanged(int16 slotBoxIndex, Thing t return false; } -void ChampionMan::f296_drawChangedObjectIcons() { +void ChampionMan::drawChangedObjectIcons() { InventoryMan &invMan = *_vm->_inventoryMan; ObjectMan &objMan = *_vm->_objectMan; MenuMan &menuMan = *_vm->_menuMan; uint16 invChampOrdinal = invMan._g432_inventoryChampionOrdinal; - if (_g299_candidateChampionOrdinal && !invChampOrdinal) + if (_candidateChampionOrdinal && !invChampOrdinal) return; - _g420_mousePointerHiddenToDrawChangedObjIconOnScreen = false; - IconIndice leaderHandObjIconIndex = _g413_leaderHandObjectIconIndex; + _mousePointerHiddenToDrawChangedObjIconOnScreen = false; + IconIndice leaderHandObjIconIndex = _leaderHandObjectIconIndex; if (((leaderHandObjIconIndex < k32_IconIndiceWeaponDagger) && (leaderHandObjIconIndex >= k0_IconIndiceJunkCompassNorth)) // < instead of <= is correct || ((leaderHandObjIconIndex >= k148_IconIndicePotionMaPotionMonPotion) && (leaderHandObjIconIndex <= k163_IconIndicePotionWaterFlask)) || (leaderHandObjIconIndex == k195_IconIndicePotionEmptyFlask)) { - IconIndice iconIndex = objMan.f33_getIconIndex(_g414_leaderHandObject); + IconIndice iconIndex = objMan.f33_getIconIndex(_leaderHandObject); if (iconIndex != leaderHandObjIconIndex) { - _g420_mousePointerHiddenToDrawChangedObjIconOnScreen = true; + _mousePointerHiddenToDrawChangedObjIconOnScreen = true; _vm->_eventMan->f77_hideMouse(); objMan.f36_extractIconFromBitmap(iconIndex, objMan._g412_objectIconForMousePointer); _vm->_eventMan->f68_setPointerToObject(_vm->_objectMan->_g412_objectIconForMousePointer); - _g413_leaderHandObjectIconIndex = iconIndex; - objMan.f34_drawLeaderObjectName(_g414_leaderHandObject); + _leaderHandObjectIconIndex = iconIndex; + objMan.f34_drawLeaderObjectName(_leaderHandObject); } } - for (uint16 slotBoxIndex = 0; slotBoxIndex < (_g305_partyChampionCount * 2); ++slotBoxIndex) { + for (uint16 slotBoxIndex = 0; slotBoxIndex < (_partyChampionCount * 2); ++slotBoxIndex) { int16 champIndex = slotBoxIndex >> 1; if (invChampOrdinal == _vm->M0_indexToOrdinal(champIndex)) continue; - if (f295_hasObjectIconInSlotBoxChanged(slotBoxIndex, _gK71_champions[champIndex].getSlot((ChampionSlot)M70_handSlotIndex(slotBoxIndex))) - && (M70_handSlotIndex(slotBoxIndex) == k1_ChampionSlotActionHand)) { + if (hasObjectIconInSlotBoxChanged(slotBoxIndex, _champions[champIndex].getSlot((ChampionSlot)getHandSlotIndex(slotBoxIndex))) + && (getHandSlotIndex(slotBoxIndex) == k1_ChampionSlotActionHand)) { menuMan.f386_drawActionIcon((ChampionIndex)champIndex); } } if (invChampOrdinal) { - Champion *champ = &_gK71_champions[_vm->M1_ordinalToIndex(invChampOrdinal)]; + Champion *champ = &_champions[_vm->M1_ordinalToIndex(invChampOrdinal)]; Thing *thing = &champ->getSlot(k0_ChampionSlotReadyHand); uint16 drawViewport = 0; for (uint16 slotIndex = k0_ChampionSlotReadyHand; slotIndex < k30_ChampionSlotChest_1; slotIndex++, thing++) { - uint16 objIconChanged = f295_hasObjectIconInSlotBoxChanged(slotIndex + k8_SlotBoxInventoryFirstSlot, *thing) ? 1 : 0; + uint16 objIconChanged = hasObjectIconInSlotBoxChanged(slotIndex + k8_SlotBoxInventoryFirstSlot, *thing) ? 1 : 0; drawViewport |= objIconChanged; if (objIconChanged && (slotIndex == k1_ChampionSlotActionHand)) { menuMan.f386_drawActionIcon((ChampionIndex)_vm->M1_ordinalToIndex(invChampOrdinal)); @@ -472,21 +506,21 @@ void ChampionMan::f296_drawChangedObjectIcons() { if (invMan._g424_panelContent == k4_PanelContentChest) { thing = invMan._g425_chestSlots; for (int16 slotIndex = 0; slotIndex < 8; ++slotIndex, thing++) { - drawViewport |= (f295_hasObjectIconInSlotBoxChanged(slotIndex + k38_SlotBoxChestFirstSlot, *thing) ? 1 : 0); + drawViewport |= (hasObjectIconInSlotBoxChanged(slotIndex + k38_SlotBoxChestFirstSlot, *thing) ? 1 : 0); } } if (drawViewport) { champ->setAttributeFlag(k0x4000_ChampionAttributeViewport, true); - f292_drawChampionState((ChampionIndex)_vm->M1_ordinalToIndex(invChampOrdinal)); + drawChampionState((ChampionIndex)_vm->M1_ordinalToIndex(invChampOrdinal)); } } - if (_g420_mousePointerHiddenToDrawChangedObjIconOnScreen) + if (_mousePointerHiddenToDrawChangedObjIconOnScreen) _vm->_eventMan->f78_showMouse(); } -void ChampionMan::f301_addObjectInSlot(ChampionIndex champIndex, Thing thing, ChampionSlot slotIndex) { +void ChampionMan::addObjectInSlot(ChampionIndex champIndex, Thing thing, ChampionSlot slotIndex) { InventoryMan &invMan = *_vm->_inventoryMan; DungeonMan &dunMan = *_vm->_dungeonMan; ObjectMan &objMan = *_vm->_objectMan; @@ -495,7 +529,7 @@ void ChampionMan::f301_addObjectInSlot(ChampionIndex champIndex, Thing thing, Ch if (thing == Thing::_none) return; - Champion *champ = &_gK71_champions[champIndex]; + Champion *champ = &_champions[champIndex]; if (slotIndex >= k30_ChampionSlotChest_1) { invMan._g425_chestSlots[slotIndex - k30_ChampionSlotChest_1] = thing; @@ -507,25 +541,25 @@ void ChampionMan::f301_addObjectInSlot(ChampionIndex champIndex, Thing thing, Ch champ->setAttributeFlag(k0x0200_ChampionAttributeLoad, true); IconIndice iconIndex = objMan.f33_getIconIndex(thing); bool isInventoryChampion = (_vm->M0_indexToOrdinal(champIndex) == invMan._g432_inventoryChampionOrdinal); - f299_applyModifiersToStatistics(champ, slotIndex, iconIndex, 1, thing); + applyModifiersToStatistics(champ, slotIndex, iconIndex, 1, thing); uint16 *rawObjPtr = dunMan.f156_getThingData(thing); if (slotIndex < k2_ChampionSlotHead) { if (slotIndex == k1_ChampionSlotActionHand) { champ->setAttributeFlag(k0x8000_ChampionAttributeActionHand, true); - if (_g506_actingChampionOrdinal == _vm->M0_indexToOrdinal(champIndex)) + if (_actingChampionOrdinal == _vm->M0_indexToOrdinal(champIndex)) menuMan.f388_clearActingChampion(); if ((iconIndex >= k30_IconIndiceScrollOpen) && (iconIndex <= k31_IconIndiceScrollClosed)) { ((Scroll *)rawObjPtr)->setClosed(false); - f296_drawChangedObjectIcons(); + drawChangedObjectIcons(); } } if (iconIndex == k4_IconIndiceWeaponTorchUnlit) { ((Weapon *)rawObjPtr)->setLit(true); _vm->_inventoryMan->f337_setDungeonViewPalette(); - f296_drawChangedObjectIcons(); + drawChangedObjectIcons(); } else if (isInventoryChampion && (slotIndex == k1_ChampionSlotActionHand) && ((iconIndex == k144_IconIndiceContainerChestClosed) || ((iconIndex >= k30_IconIndiceScrollOpen) && (iconIndex <= k31_IconIndiceScrollClosed)))) { champ->setAttributeFlag(k0x0800_ChampionAttributePanel, true); @@ -533,7 +567,7 @@ void ChampionMan::f301_addObjectInSlot(ChampionIndex champIndex, Thing thing, Ch } else if (slotIndex == k10_ChampionSlotNeck) { if ((iconIndex >= k12_IconIndiceJunkIllumuletUnequipped) && (iconIndex <= k13_IconIndiceJunkIllumuletEquipped)) { ((Junk *)rawObjPtr)->setChargeCount(1); - _g407_party._magicalLightAmount += _lightPowerToLightAmount[2]; + _party._magicalLightAmount += _lightPowerToLightAmount[2]; _vm->_inventoryMan->f337_setDungeonViewPalette(); iconIndex = (IconIndice)(iconIndex + 1); } else if ((iconIndex >= k10_IconIndiceJunkJewelSymalUnequipped) && (iconIndex <= k11_IconIndiceJunkJewelSymalEquipped)) { @@ -542,13 +576,13 @@ void ChampionMan::f301_addObjectInSlot(ChampionIndex champIndex, Thing thing, Ch } } - f291_drawSlot(champIndex, slotIndex); + drawSlot(champIndex, slotIndex); if (isInventoryChampion) champ->setAttributeFlag(k0x4000_ChampionAttributeViewport, true); } -int16 ChampionMan::f315_getScentOrdinal(int16 mapX, int16 mapY) { - int16 scentIndex = _g407_party._scentCount; +int16 ChampionMan::getScentOrdinal(int16 mapX, int16 mapY) { + int16 scentIndex = _party._scentCount; if (scentIndex) { Scent searchedScent; @@ -556,7 +590,7 @@ int16 ChampionMan::f315_getScentOrdinal(int16 mapX, int16 mapY) { searchedScent.setMapY(mapY); searchedScent.setMapIndex(_vm->_dungeonMan->_g272_currMapIndex); uint16 searchedScentRedEagle = searchedScent.toUint16(); - Scent *scent = &_g407_party._scents[scentIndex--]; + Scent *scent = &_party._scents[scentIndex--]; do { if ((*(--scent)).toUint16() == searchedScentRedEagle) { return _vm->M0_indexToOrdinal(scentIndex); @@ -566,32 +600,32 @@ int16 ChampionMan::f315_getScentOrdinal(int16 mapX, int16 mapY) { return 0; } -Thing ChampionMan::f298_getObjectRemovedFromLeaderHand() { - _g415_leaderEmptyHanded = true; - Thing leaderHandObject = _g414_leaderHandObject; +Thing ChampionMan::getObjectRemovedFromLeaderHand() { + _leaderEmptyHanded = true; + Thing leaderHandObject = _leaderHandObject; if (leaderHandObject != Thing::_none) { - _g414_leaderHandObject = Thing::_none; - _g413_leaderHandObjectIconIndex = kM1_IconIndiceNone; + _leaderHandObject = Thing::_none; + _leaderHandObjectIconIndex = kM1_IconIndiceNone; _vm->_eventMan->f78_showMouse(); _vm->_objectMan->f35_clearLeaderObjectName(); _vm->_eventMan->f69_setMousePointer(); _vm->_eventMan->f77_hideMouse(); - if (_g411_leaderIndex != kM1_ChampionNone) { - _gK71_champions[_g411_leaderIndex]._load -= _vm->_dungeonMan->f140_getObjectWeight(leaderHandObject); - setFlag(_gK71_champions[_g411_leaderIndex]._attributes, k0x0200_ChampionAttributeLoad); - f292_drawChampionState(_g411_leaderIndex); + if (_leaderIndex != kM1_ChampionNone) { + _champions[_leaderIndex]._load -= _vm->_dungeonMan->f140_getObjectWeight(leaderHandObject); + setFlag(_champions[_leaderIndex]._attributes, k0x0200_ChampionAttributeLoad); + drawChampionState(_leaderIndex); } } return leaderHandObject; } -uint16 ChampionMan::f312_getStrength(int16 champIndex, int16 slotIndex) { - Champion *curChampion = &_gK71_champions[champIndex]; +uint16 ChampionMan::getStrength(int16 champIndex, int16 slotIndex) { + Champion *curChampion = &_champions[champIndex]; int16 strength = _vm->getRandomNumber(16) + curChampion->_statistics[k1_ChampionStatStrength][k1_ChampionStatCurrent]; Thing curThing = curChampion->_slots[slotIndex]; uint16 objectWeight = _vm->_dungeonMan->f140_getObjectWeight(curThing); - uint16 oneSixteenthMaximumLoad = f309_getMaximumLoad(curChampion) >> 4; + uint16 oneSixteenthMaximumLoad = getMaximumLoad(curChampion) >> 4; if (objectWeight <= oneSixteenthMaximumLoad) { strength += objectWeight - 12; @@ -609,25 +643,25 @@ uint16 ChampionMan::f312_getStrength(int16 champIndex, int16 slotIndex) { uint16 skillLevel = 0; uint16 weaponClass = weaponInfo->_class; if ((weaponClass == k0_WeaponClassSwingWeapon) || (weaponClass == k2_WeaponClassDaggerAndAxes)) { - skillLevel = f303_getSkillLevel(champIndex, k4_ChampionSkillSwing); + skillLevel = getSkillLevel(champIndex, k4_ChampionSkillSwing); } if ((weaponClass != k0_WeaponClassSwingWeapon) && (weaponClass < k16_WeaponClassFirstBow)) { - skillLevel += f303_getSkillLevel(champIndex, k10_ChampionSkillThrow); + skillLevel += getSkillLevel(champIndex, k10_ChampionSkillThrow); } if ((weaponClass >= k16_WeaponClassFirstBow) && (weaponClass < k112_WeaponClassFirstMagicWeapon)) { - skillLevel += f303_getSkillLevel(champIndex, k11_ChampionSkillShoot); + skillLevel += getSkillLevel(champIndex, k11_ChampionSkillShoot); } strength += skillLevel << 1; } - strength = f306_getStaminaAdjustedValue(curChampion, strength); + strength = getStaminaAdjustedValue(curChampion, strength); if (getFlag(curChampion->_wounds, (slotIndex == k0_ChampionSlotReadyHand) ? k0x0001_ChampionWoundReadHand : k0x0002_ChampionWoundActionHand)) { strength >>= 1; } return f26_getBoundedValue(0, strength >> 1, 100); } -Thing ChampionMan::f300_getObjectRemovedFromSlot(uint16 champIndex, uint16 slotIndex) { - Champion *curChampion = &_gK71_champions[champIndex]; +Thing ChampionMan::getObjectRemovedFromSlot(uint16 champIndex, uint16 slotIndex) { + Champion *curChampion = &_champions[champIndex]; Thing curThing; if (slotIndex >= k30_ChampionSlotChest_1) { @@ -644,39 +678,39 @@ Thing ChampionMan::f300_getObjectRemovedFromSlot(uint16 champIndex, uint16 slotI bool isInventoryChampion = (_vm->M0_indexToOrdinal(champIndex) == _vm->_inventoryMan->_g432_inventoryChampionOrdinal); int16 curIconIndex = _vm->_objectMan->f33_getIconIndex(curThing); // Remove object modifiers - f299_applyModifiersToStatistics(curChampion, slotIndex, curIconIndex, -1, curThing); + applyModifiersToStatistics(curChampion, slotIndex, curIconIndex, -1, curThing); Weapon *curWeapon = (Weapon *)_vm->_dungeonMan->f156_getThingData(curThing); if (slotIndex == k10_ChampionSlotNeck) { if ((curIconIndex >= k12_IconIndiceJunkIllumuletUnequipped) && (curIconIndex <= k13_IconIndiceJunkIllumuletEquipped)) { ((Junk *)curWeapon)->setChargeCount(0); - _g407_party._magicalLightAmount -= _lightPowerToLightAmount[2]; + _party._magicalLightAmount -= _lightPowerToLightAmount[2]; _vm->_inventoryMan->f337_setDungeonViewPalette(); } else if ((curIconIndex >= k10_IconIndiceJunkJewelSymalUnequipped) && (curIconIndex <= k11_IconIndiceJunkJewelSymalEquipped)) { ((Junk *)curWeapon)->setChargeCount(0); } } - f291_drawSlot(champIndex, slotIndex); + drawSlot(champIndex, slotIndex); if (isInventoryChampion) setFlag(curChampion->_attributes, k0x4000_ChampionAttributeViewport); if (slotIndex < k2_ChampionSlotHead) { if (slotIndex == k1_ChampionSlotActionHand) { setFlag(curChampion->_attributes, k0x8000_ChampionAttributeActionHand); - if (_g506_actingChampionOrdinal == _vm->M0_indexToOrdinal(champIndex)) + if (_actingChampionOrdinal == _vm->M0_indexToOrdinal(champIndex)) _vm->_menuMan->f388_clearActingChampion(); if ((curIconIndex >= k30_IconIndiceScrollOpen) && (curIconIndex <= k31_IconIndiceScrollClosed)) { ((Scroll *)curWeapon)->setClosed(true); - f296_drawChangedObjectIcons(); + drawChangedObjectIcons(); } } if ((curIconIndex >= k4_IconIndiceWeaponTorchUnlit) && (curIconIndex <= k7_IconIndiceWeaponTorchLit)) { curWeapon->setLit(false); _vm->_inventoryMan->f337_setDungeonViewPalette(); - f296_drawChangedObjectIcons(); + drawChangedObjectIcons(); } if (isInventoryChampion && (slotIndex == k1_ChampionSlotActionHand)) { @@ -698,17 +732,17 @@ Thing ChampionMan::f300_getObjectRemovedFromSlot(uint16 champIndex, uint16 slotI return curThing; } -void ChampionMan::f325_decrementStamina(int16 championIndex, int16 decrement) { +void ChampionMan::decrementStamina(int16 championIndex, int16 decrement) { if (championIndex == kM1_ChampionNone) return; - Champion *curChampion = &_gK71_champions[championIndex]; + Champion *curChampion = &_champions[championIndex]; curChampion->_currStamina -= decrement; int16 stamina = curChampion->_currStamina; if (stamina <= 0) { curChampion->_currStamina = 0; - f321_addPendingDamageAndWounds_getDamage(championIndex, (-stamina) >> 1, k0x0000_ChampionWoundNone, k0_attackType_NORMAL); + addPendingDamageAndWounds_getDamage(championIndex, (-stamina) >> 1, k0x0000_ChampionWoundNone, k0_attackType_NORMAL); } else if (stamina > curChampion->_maxStamina) { curChampion->_currStamina = curChampion->_maxStamina; } @@ -716,11 +750,11 @@ void ChampionMan::f325_decrementStamina(int16 championIndex, int16 decrement) { setFlag(curChampion->_attributes, k0x0200_ChampionAttributeLoad | k0x0100_ChampionAttributeStatistics); } -int16 ChampionMan::f321_addPendingDamageAndWounds_getDamage(int16 champIndex, int16 attack, int16 allowedWounds, uint16 attackType) { +int16 ChampionMan::addPendingDamageAndWounds_getDamage(int16 champIndex, int16 attack, int16 allowedWounds, uint16 attackType) { if (attack <= 0) return 0; - Champion *curChampion = &_gK71_champions[champIndex]; + Champion *curChampion = &_champions[champIndex]; if (!curChampion->_currHealth) return 0; @@ -730,7 +764,7 @@ int16 ChampionMan::f321_addPendingDamageAndWounds_getDamage(int16 champIndex, in for (int16 woundIndex = k0_ChampionSlotReadyHand; woundIndex <= k5_ChampionSlotFeet; woundIndex++) { if (allowedWounds & (1 << woundIndex)) { woundCount++; - defense += f313_getWoundDefense(champIndex, woundIndex | ((attackType == k4_attackType_SHARP) ? k0x8000_maskUseSharpDefense : k0x0000_maskDoNotUseSharpDefense)); + defense += getWoundDefense(champIndex, woundIndex | ((attackType == k4_attackType_SHARP) ? k0x8000_maskUseSharpDefense : k0x0000_maskDoNotUseSharpDefense)); } } if (woundCount) @@ -751,13 +785,13 @@ int16 ChampionMan::f321_addPendingDamageAndWounds_getDamage(int16 champIndex, in } break; case k5_attackType_MAGIC: - attack = f307_getStatisticAdjustedAttack(curChampion, k5_ChampionStatAntimagic, attack); - attack -= _g407_party._spellShieldDefense; + attack = getStatisticAdjustedAttack(curChampion, k5_ChampionStatAntimagic, attack); + attack -= _party._spellShieldDefense; skipScaling = true; break; case k1_attackType_FIRE: - attack = f307_getStatisticAdjustedAttack(curChampion, k6_ChampionStatAntifire, attack); - attack -= _g407_party._fireShieldDefense; + attack = getStatisticAdjustedAttack(curChampion, k6_ChampionStatAntifire, attack); + attack -= _party._fireShieldDefense; break; case k2_attackType_SELF: defense >>= 1; @@ -784,7 +818,7 @@ int16 ChampionMan::f321_addPendingDamageAndWounds_getDamage(int16 champIndex, in if (attack <= 0) return 0; - int16 adjustedAttack = f307_getStatisticAdjustedAttack(curChampion, k4_ChampionStatVitality, _vm->getRandomNumber(128) + 10); + int16 adjustedAttack = getStatisticAdjustedAttack(curChampion, k4_ChampionStatVitality, _vm->getRandomNumber(128) + 10); if (attack > adjustedAttack) { /* BUG0_45 This bug is not perceptible because of BUG0_41 that ignores Vitality while determining the @@ -794,21 +828,21 @@ int16 ChampionMan::f321_addPendingDamageAndWounds_getDamage(int16 champIndex, in wounded (because of more iterations in the loop below) */ do { - setFlag(*(uint16 *)&_g410_championPendingWounds[champIndex], (1 << _vm->getRandomNumber(8)) & allowedWounds); + setFlag(*(uint16 *)&_championPendingWounds[champIndex], (1 << _vm->getRandomNumber(8)) & allowedWounds); } while ((attack > (adjustedAttack <<= 1)) && adjustedAttack); } - if (_g300_partyIsSleeping) - f314_wakeUp(); + if (_partyIsSleeping) + wakeUp(); } - _g409_championPendingDamage[champIndex] += attack; + _championPendingDamage[champIndex] += attack; return attack; } -int16 ChampionMan::f313_getWoundDefense(int16 champIndex, uint16 woundIndex) { +int16 ChampionMan::getWoundDefense(int16 champIndex, uint16 woundIndex) { static const byte woundDefenseFactor[6] = {5, 5, 4, 6, 3, 1}; // @ G0050_auc_Graphic562_WoundDefenseFactor - Champion *curChampion = &_gK71_champions[champIndex]; + Champion *curChampion = &_champions[champIndex]; bool useSharpDefense = getFlag(woundIndex, k0x8000_maskUseSharpDefense); if (useSharpDefense) clearFlag(woundIndex, k0x8000_maskUseSharpDefense); @@ -820,7 +854,7 @@ int16 ChampionMan::f313_getWoundDefense(int16 champIndex, uint16 woundIndex) { ArmourInfo *armorInfo = (ArmourInfo *)_vm->_dungeonMan->f156_getThingData(curThing); armorInfo = &_vm->_dungeonMan->_armourInfo[((Armour *)armorInfo)->getType()]; if (getFlag(armorInfo->_attributes, k0x0080_ArmourAttributeIsAShield)) - armorShieldDefense += ((f312_getStrength(champIndex, slotIndex) + _vm->_dungeonMan->f143_getArmourDefense(armorInfo, useSharpDefense)) * woundDefenseFactor[woundIndex]) >> ((slotIndex == woundIndex) ? 4 : 5); + armorShieldDefense += ((getStrength(champIndex, slotIndex) + _vm->_dungeonMan->f143_getArmourDefense(armorInfo, useSharpDefense)) * woundDefenseFactor[woundIndex]) >> ((slotIndex == woundIndex) ? 4 : 5); } } @@ -828,7 +862,7 @@ int16 ChampionMan::f313_getWoundDefense(int16 champIndex, uint16 woundIndex) { if (useSharpDefense) woundDefense >>= 1; - woundDefense += curChampion->_actionDefense + curChampion->_shieldDefense + _g407_party._shieldDefense + armorShieldDefense; + woundDefense += curChampion->_actionDefense + curChampion->_shieldDefense + _party._shieldDefense + armorShieldDefense; if (woundIndex > k1_ChampionSlotActionHand) { Thing curThing = curChampion->_slots[woundIndex]; if (curThing.getType() == k6_ArmourThingType) { @@ -840,13 +874,13 @@ int16 ChampionMan::f313_getWoundDefense(int16 champIndex, uint16 woundIndex) { if (getFlag(curChampion->_wounds, 1 << woundIndex)) woundDefense -= 8 + _vm->getRandomNumber(4); - if (_g300_partyIsSleeping) + if (_partyIsSleeping) woundDefense >>= 1; return f26_getBoundedValue(0, woundDefense >> 1, 100); } -uint16 ChampionMan::f307_getStatisticAdjustedAttack(Champion *champ, uint16 statIndex, uint16 attack) { +uint16 ChampionMan::getStatisticAdjustedAttack(Champion *champ, uint16 statIndex, uint16 attack) { int16 factor = 170 - champ->_statistics[statIndex][k1_ChampionStatCurrent]; /* BUG0_41 @@ -862,9 +896,9 @@ uint16 ChampionMan::f307_getStatisticAdjustedAttack(Champion *champ, uint16 stat return _vm->f30_getScaledProduct(attack, 7, factor); } -void ChampionMan::f314_wakeUp() { +void ChampionMan::wakeUp() { _vm->_g321_stopWaitingForPlayerInput = true; - _g300_partyIsSleeping = false; + _partyIsSleeping = false; _vm->_g318_waitForInputMaxVerticalBlankCount = 10; _vm->f22_delay(10); _vm->_displayMan->f98_drawFloorAndCeiling(); @@ -876,7 +910,7 @@ void ChampionMan::f314_wakeUp() { _vm->_menuMan->f457_drawEnabledMenus(); } -int16 ChampionMan::f305_getThrowingStaminaCost(Thing thing) { +int16 ChampionMan::getThrowingStaminaCost(Thing thing) { int16 weight = _vm->_dungeonMan->f140_getObjectWeight(thing) >> 1; int16 staminaCost = f26_getBoundedValue<int16>(1, weight, 10); @@ -886,8 +920,8 @@ int16 ChampionMan::f305_getThrowingStaminaCost(Thing thing) { return staminaCost; } -void ChampionMan::f330_disableAction(uint16 champIndex, uint16 ticks) { - Champion *curChampion = &_gK71_champions[champIndex]; +void ChampionMan::disableAction(uint16 champIndex, uint16 ticks) { + Champion *curChampion = &_champions[champIndex]; int32 updatedEnableActionEventTime = _vm->_g313_gameTime + ticks; TimelineEvent curEvent; @@ -906,13 +940,13 @@ void ChampionMan::f330_disableAction(uint16 champIndex, uint16 ticks) { _vm->_timeline->f237_deleteEvent(eventIndex); } else { setFlag(curChampion->_attributes, k0x8000_ChampionAttributeActionHand | k0x0008_ChampionAttributeDisableAction); - f292_drawChampionState((ChampionIndex)champIndex); + drawChampionState((ChampionIndex)champIndex); } M33_setMapAndTime(curEvent._mapTime, _vm->_dungeonMan->_g309_partyMapIndex, updatedEnableActionEventTime); curChampion->_enableActionEventIndex = _vm->_timeline->f238_addEventGetEventIndex(&curEvent); } -void ChampionMan::f304_addSkillExperience(uint16 champIndex, uint16 skillIndex, uint16 exp) { +void ChampionMan::addSkillExperience(uint16 champIndex, uint16 skillIndex, uint16 exp) { if ((skillIndex >= k4_ChampionSkillSwing) && (skillIndex <= k11_ChampionSkillShoot) && (_vm->_projexpl->_g361_lastCreatureAttackTime < _vm->_g313_gameTime - 150)) exp >>= 1; @@ -920,14 +954,14 @@ void ChampionMan::f304_addSkillExperience(uint16 champIndex, uint16 skillIndex, if (_vm->_dungeonMan->_g269_currMap->_difficulty) exp *= _vm->_dungeonMan->_g269_currMap->_difficulty; - Champion *curChampion = &_gK71_champions[champIndex]; + Champion *curChampion = &_champions[champIndex]; uint16 baseSkillIndex; if (skillIndex >= k4_ChampionSkillSwing) baseSkillIndex = (skillIndex - k4_ChampionSkillSwing) >> 2; else baseSkillIndex = skillIndex; - uint16 skillLevelBefore = f303_getSkillLevel(champIndex, baseSkillIndex | (k0x4000_IgnoreObjectModifiers | k0x8000_IgnoreTemporaryExperience)); + uint16 skillLevelBefore = getSkillLevel(champIndex, baseSkillIndex | (k0x4000_IgnoreObjectModifiers | k0x8000_IgnoreTemporaryExperience)); if ((skillIndex >= k4_ChampionSkillSwing) && (_vm->_projexpl->_g361_lastCreatureAttackTime > _vm->_g313_gameTime - 25)) exp <<= 1; @@ -941,7 +975,7 @@ void ChampionMan::f304_addSkillExperience(uint16 champIndex, uint16 skillIndex, if (skillIndex >= k4_ChampionSkillSwing) curSkill->_experience += exp; - uint16 skillLevelAfter = f303_getSkillLevel(champIndex, baseSkillIndex | (k0x4000_IgnoreObjectModifiers | k0x8000_IgnoreTemporaryExperience)); + uint16 skillLevelAfter = getSkillLevel(champIndex, baseSkillIndex | (k0x4000_IgnoreObjectModifiers | k0x8000_IgnoreTemporaryExperience)); if (skillLevelAfter > skillLevelBefore) { int16 newBaseSkillLevel = skillLevelAfter; int16 minorStatIncrease = _vm->getRandomNumber(2); @@ -996,7 +1030,7 @@ void ChampionMan::f304_addSkillExperience(uint16 champIndex, uint16 skillIndex, curChampion->_maxStamina = 9999; setFlag(curChampion->_attributes, k0x0100_ChampionAttributeStatistics); - f292_drawChampionState((ChampionIndex)champIndex); + drawChampionState((ChampionIndex)champIndex); _vm->_textMan->f51_messageAreaPrintLineFeed(); Color curChampionColor = _championColor[champIndex]; _vm->_textMan->f47_messageAreaPrintMessage(curChampionColor, curChampion->_name); @@ -1020,27 +1054,27 @@ void ChampionMan::f304_addSkillExperience(uint16 champIndex, uint16 skillIndex, } } -int16 ChampionMan::f324_damageAll_getDamagedChampionCount(uint16 attack, int16 wounds, int16 attackType) { +int16 ChampionMan::getDamagedChampionCount(uint16 attack, int16 wounds, int16 attackType) { int16 randomMax = (attack >> 3) + 1; uint16 reducedAttack = attack - randomMax; randomMax <<= 1; int16 damagedChampionCount = 0; - for (int16 championIndex = k0_ChampionFirst; championIndex < _g305_partyChampionCount; championIndex++) { + for (int16 championIndex = k0_ChampionFirst; championIndex < _partyChampionCount; championIndex++) { // Actual attack is attack +/- (attack / 8) - if (f321_addPendingDamageAndWounds_getDamage(championIndex, MAX(1, reducedAttack + _vm->getRandomNumber(randomMax)), wounds, attackType)) + if (addPendingDamageAndWounds_getDamage(championIndex, MAX(1, reducedAttack + _vm->getRandomNumber(randomMax)), wounds, attackType)) damagedChampionCount++; } return damagedChampionCount; } -int16 ChampionMan::f286_getTargetChampionIndex(int16 mapX, int16 mapY, uint16 cell) { - if (_g305_partyChampionCount && (M38_distance(mapX, mapY, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY) <= 1)) { +int16 ChampionMan::getTargetChampionIndex(int16 mapX, int16 mapY, uint16 cell) { + if (_partyChampionCount && (M38_distance(mapX, mapY, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY) <= 1)) { signed char orderedCellsToAttack[4]; _vm->_groupMan->f229_setOrderedCellsToAttack(orderedCellsToAttack, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, mapX, mapY, cell); for (uint16 i = 0; i < 4; i++) { - int16 championIndex = f285_getIndexInCell(orderedCellsToAttack[i]); + int16 championIndex = getIndexInCell(orderedCellsToAttack[i]); if (championIndex >= 0) return championIndex; } @@ -1048,16 +1082,16 @@ int16 ChampionMan::f286_getTargetChampionIndex(int16 mapX, int16 mapY, uint16 ce return kM1_ChampionNone; } -int16 ChampionMan::f311_getDexterity(Champion* champ) { +int16 ChampionMan::getDexterity(Champion* champ) { int16 dexterity = _vm->getRandomNumber(8) + champ->_statistics[k2_ChampionStatDexterity][k1_ChampionStatCurrent]; - dexterity -= ((int32)(dexterity >> 1) * (int32)champ->_load) / f309_getMaximumLoad(champ); - if (_g300_partyIsSleeping) + dexterity -= ((int32)(dexterity >> 1) * (int32)champ->_load) / getMaximumLoad(champ); + if (_partyIsSleeping) dexterity >>= 1; return f26_getBoundedValue(1 + _vm->getRandomNumber(8), dexterity >> 1, 100 - _vm->getRandomNumber(8)); } -bool ChampionMan::f308_isLucky(Champion* champ, uint16 percentage) { +bool ChampionMan::isLucky(Champion* champ, uint16 percentage) { if (_vm->getRandomNumber(2) && (_vm->getRandomNumber(100) > percentage)) return true; @@ -1067,12 +1101,12 @@ bool ChampionMan::f308_isLucky(Champion* champ, uint16 percentage) { return isLucky; } -void ChampionMan::f322_championPoison(int16 champIndex, uint16 attack) { - if ((champIndex == kM1_ChampionNone) || (_vm->M0_indexToOrdinal(champIndex) == _g299_candidateChampionOrdinal)) +void ChampionMan::championPoison(int16 champIndex, uint16 attack) { + if ((champIndex == kM1_ChampionNone) || (_vm->M0_indexToOrdinal(champIndex) == _candidateChampionOrdinal)) return; - Champion *curChampion = &_gK71_champions[champIndex]; - f321_addPendingDamageAndWounds_getDamage(champIndex, MAX(1, attack >> 6), k0x0000_ChampionWoundNone, k0_attackType_NORMAL); + Champion *curChampion = &_champions[champIndex]; + addPendingDamageAndWounds_getDamage(champIndex, MAX(1, attack >> 6), k0x0000_ChampionWoundNone, k0_attackType_NORMAL); setFlag(curChampion->_attributes, k0x0100_ChampionAttributeStatistics); if ((_vm->M0_indexToOrdinal(champIndex) == _vm->_inventoryMan->_g432_inventoryChampionOrdinal) && (_vm->_inventoryMan->_g424_panelContent == k0_PanelContentFoodWaterPoisoned)) { setFlag(curChampion->_attributes, k0x0800_ChampionAttributePanel); @@ -1088,10 +1122,10 @@ void ChampionMan::f322_championPoison(int16 champIndex, uint16 attack) { _vm->_timeline->f238_addEventGetEventIndex(&newEvent); } - f292_drawChampionState((ChampionIndex)champIndex); + drawChampionState((ChampionIndex)champIndex); } -void ChampionMan::f284_setPartyDirection(int16 dir) { +void ChampionMan::setPartyDirection(int16 dir) { if (dir == _vm->_dungeonMan->_g308_partyDir) return; @@ -1099,36 +1133,36 @@ void ChampionMan::f284_setPartyDirection(int16 dir) { if (L0834_i_Delta < 0) L0834_i_Delta += 4; - Champion *curChampion = _gK71_champions; - for (int16 i = k0_ChampionFirst; i < _g305_partyChampionCount; i++) { + Champion *curChampion = _champions; + for (int16 i = k0_ChampionFirst; i < _partyChampionCount; i++) { curChampion->_cell = (ViewCell)M21_normalizeModulo4(curChampion->_cell + L0834_i_Delta); curChampion->_dir = (Direction)M21_normalizeModulo4(curChampion->_dir + L0834_i_Delta); curChampion++; } _vm->_dungeonMan->_g308_partyDir = (Direction)dir; - f296_drawChangedObjectIcons(); + drawChangedObjectIcons(); } -void ChampionMan::f316_deleteScent(uint16 scentIndex) { - uint16 count = --_g407_party._scentCount - scentIndex; +void ChampionMan::deleteScent(uint16 scentIndex) { + uint16 count = --_party._scentCount - scentIndex; if (count) { for (uint16 i = 0; i < count; ++i) { - _g407_party._scents[scentIndex + i] = _g407_party._scents[scentIndex + i + 1]; - _g407_party._scentStrengths[scentIndex + i] = _g407_party._scentStrengths[scentIndex + i + 1]; + _party._scents[scentIndex + i] = _party._scents[scentIndex + i + 1]; + _party._scentStrengths[scentIndex + i] = _party._scentStrengths[scentIndex + i + 1]; } } - if (scentIndex < _g407_party._firstScentIndex) - _g407_party._firstScentIndex--; + if (scentIndex < _party._firstScentIndex) + _party._firstScentIndex--; - if (scentIndex < _g407_party._lastScentIndex) - _g407_party._lastScentIndex--; + if (scentIndex < _party._lastScentIndex) + _party._lastScentIndex--; } -void ChampionMan::f317_addScentStrength(int16 mapX, int16 mapY, int32 cycleCount) { - int16 scentIndex = _g407_party._scentCount; +void ChampionMan::addScentStrength(int16 mapX, int16 mapY, int32 cycleCount) { + int16 scentIndex = _party._scentCount; if (scentIndex) { bool mergeFl = getFlag(cycleCount, k0x8000_mergeCycles); if (mergeFl) @@ -1139,30 +1173,30 @@ void ChampionMan::f317_addScentStrength(int16 mapX, int16 mapY, int32 cycleCount newScent.setMapY(mapY); /* BUG0_00 Useless code */ newScent.setMapIndex(_vm->_dungeonMan->_g272_currMapIndex); /* BUG0_00 Useless code */ - Scent *curScent = _g407_party._scents; /* BUG0_00 Useless code */ + Scent *curScent = _party._scents; /* BUG0_00 Useless code */ bool cycleCountDefined = false; while (scentIndex--) { if (&*curScent++ == &newScent) { if (!cycleCountDefined) { cycleCountDefined = true; if (mergeFl) { - cycleCount = MAX<int32>(_g407_party._scentStrengths[scentIndex], cycleCount); + cycleCount = MAX<int32>(_party._scentStrengths[scentIndex], cycleCount); } else { - cycleCount = MIN<int32>(80, _g407_party._scentStrengths[scentIndex] + cycleCount); + cycleCount = MIN<int32>(80, _party._scentStrengths[scentIndex] + cycleCount); } } - _g407_party._scentStrengths[scentIndex] = cycleCount; + _party._scentStrengths[scentIndex] = cycleCount; } } } } -void ChampionMan::f297_putObjectInLeaderHand(Thing thing, bool setMousePointer) { +void ChampionMan::putObjectInLeaderHand(Thing thing, bool setMousePointer) { if (thing == Thing::_none) return; - _g415_leaderEmptyHanded = false; - _vm->_objectMan->f36_extractIconFromBitmap(_g413_leaderHandObjectIconIndex = _vm->_objectMan->f33_getIconIndex(_g414_leaderHandObject = thing), _vm->_objectMan->_g412_objectIconForMousePointer); + _leaderEmptyHanded = false; + _vm->_objectMan->f36_extractIconFromBitmap(_leaderHandObjectIconIndex = _vm->_objectMan->f33_getIconIndex(_leaderHandObject = thing), _vm->_objectMan->_g412_objectIconForMousePointer); _vm->_eventMan->f78_showMouse(); _vm->_objectMan->f34_drawLeaderObjectName(thing); @@ -1172,15 +1206,15 @@ void ChampionMan::f297_putObjectInLeaderHand(Thing thing, bool setMousePointer) _vm->_eventMan->f68_setPointerToObject(_vm->_objectMan->_g412_objectIconForMousePointer); _vm->_eventMan->f77_hideMouse(); - if (_g411_leaderIndex != kM1_ChampionNone) { - _gK71_champions[_g411_leaderIndex]._load += _vm->_dungeonMan->f140_getObjectWeight(thing); - setFlag(_gK71_champions[_g411_leaderIndex]._attributes, k0x0200_ChampionAttributeLoad); - f292_drawChampionState(_g411_leaderIndex); + if (_leaderIndex != kM1_ChampionNone) { + _champions[_leaderIndex]._load += _vm->_dungeonMan->f140_getObjectWeight(thing); + setFlag(_champions[_leaderIndex]._attributes, k0x0200_ChampionAttributeLoad); + drawChampionState(_leaderIndex); } } -int16 ChampionMan::f310_getMovementTicks(Champion *champ) { - uint16 maximumLoad = f309_getMaximumLoad(champ); +int16 ChampionMan::getMovementTicks(Champion *champ) { + uint16 maximumLoad = getMaximumLoad(champ); uint16 curLoad = champ->_load; uint16 woundTicks; int16 ticks; @@ -1210,8 +1244,8 @@ int16 ChampionMan::f310_getMovementTicks(Champion *champ) { return ticks; } -bool ChampionMan::f294_isAmmunitionCompatibleWithWeapon(uint16 champIndex, uint16 weaponSlotIndex, uint16 ammunitionSlotIndex) { - Champion *curChampion = &_gK71_champions[champIndex]; +bool ChampionMan::isAmmunitionCompatibleWithWeapon(uint16 champIndex, uint16 weaponSlotIndex, uint16 ammunitionSlotIndex) { + Champion *curChampion = &_champions[champIndex]; Thing curThing = curChampion->_slots[weaponSlotIndex]; if (curThing.getType() != k5_WeaponThingType) return false; @@ -1232,16 +1266,16 @@ bool ChampionMan::f294_isAmmunitionCompatibleWithWeapon(uint16 champIndex, uint1 return ((curThing.getType() == k5_WeaponThingType) && (weaponInfo->_class == weaponClass)); } -void ChampionMan::f293_drawAllChampionStates() { - for (int16 i = k0_ChampionFirst; i < _g305_partyChampionCount; i++) - f292_drawChampionState((ChampionIndex)i); +void ChampionMan::drawAllChampionStates() { + for (int16 i = k0_ChampionFirst; i < _partyChampionCount; i++) + drawChampionState((ChampionIndex)i); } -void ChampionMan::f283_viAltarRebirth(uint16 champIndex) { - Champion *curChampion = &_gK71_champions[champIndex]; - if (f285_getIndexInCell(curChampion->_cell) != kM1_ChampionNone) { +void ChampionMan::viAltarRebirth(uint16 champIndex) { + Champion *curChampion = &_champions[champIndex]; + if (getIndexInCell(curChampion->_cell) != kM1_ChampionNone) { uint16 numCell = k0_CellNorthWest; - while (f285_getIndexInCell(numCell) != kM1_ChampionNone) + while (getIndexInCell(numCell) != kM1_ChampionNone) numCell++; curChampion->_cell = (ViewCell)numCell; @@ -1250,36 +1284,36 @@ void ChampionMan::f283_viAltarRebirth(uint16 champIndex) { uint16 maximumHealth = curChampion->_maxHealth; curChampion->_maxHealth = MAX(25, maximumHealth - (maximumHealth >> 6) - 1); curChampion->_currHealth = curChampion->_maxHealth >> 1; - _vm->_menuMan->f393_drawSpellAreaControls(_g514_magicCasterChampionIndex); + _vm->_menuMan->f393_drawSpellAreaControls(_magicCasterChampionIndex); curChampion->_dir = _vm->_dungeonMan->_g308_partyDir; setFlag(curChampion->_attributes, k0x8000_ChampionAttributeActionHand | k0x1000_ChampionAttributeStatusBox | k0x0400_ChampionAttributeIcon); - f292_drawChampionState((ChampionIndex)champIndex); + drawChampionState((ChampionIndex)champIndex); } -void ChampionMan::f302_processCommands28to65_clickOnSlotBox(uint16 slotBoxIndex) { +void ChampionMan::clickOnSlotBox(uint16 slotBoxIndex) { uint16 champIndex; uint16 slotIndex; if (slotBoxIndex < k8_SlotBoxInventoryFirstSlot) { - if (_g299_candidateChampionOrdinal) + if (_candidateChampionOrdinal) return; champIndex = slotBoxIndex >> 1; - if ((champIndex >= _g305_partyChampionCount) || (_vm->M0_indexToOrdinal(champIndex) == _vm->_inventoryMan->_g432_inventoryChampionOrdinal) || !_gK71_champions[champIndex]._currHealth) + if ((champIndex >= _partyChampionCount) || (_vm->M0_indexToOrdinal(champIndex) == _vm->_inventoryMan->_g432_inventoryChampionOrdinal) || !_champions[champIndex]._currHealth) return; - slotIndex = M70_handSlotIndex(slotBoxIndex); + slotIndex = getHandSlotIndex(slotBoxIndex); } else { champIndex = _vm->M1_ordinalToIndex(_vm->_inventoryMan->_g432_inventoryChampionOrdinal); slotIndex = slotBoxIndex - k8_SlotBoxInventoryFirstSlot; } - Thing leaderHandObject = _g414_leaderHandObject; + Thing leaderHandObject = _leaderHandObject; Thing slotThing; if (slotIndex >= k30_ChampionSlotChest_1) { slotThing = _vm->_inventoryMan->_g425_chestSlots[slotIndex - k30_ChampionSlotChest_1]; } else { - slotThing = _gK71_champions[champIndex]._slots[slotIndex]; + slotThing = _champions[champIndex]._slots[slotIndex]; } if ((slotThing == Thing::_none) && (leaderHandObject == Thing::_none)) @@ -1290,22 +1324,22 @@ void ChampionMan::f302_processCommands28to65_clickOnSlotBox(uint16 slotBoxIndex) _vm->_eventMan->f78_showMouse(); if (leaderHandObject != Thing::_none) - f298_getObjectRemovedFromLeaderHand(); + getObjectRemovedFromLeaderHand(); if (slotThing != Thing::_none) { - f300_getObjectRemovedFromSlot(champIndex, slotIndex); - f297_putObjectInLeaderHand(slotThing, false); + getObjectRemovedFromSlot(champIndex, slotIndex); + putObjectInLeaderHand(slotThing, false); } if (leaderHandObject != Thing::_none) - f301_addObjectInSlot((ChampionIndex)champIndex, leaderHandObject, (ChampionSlot)slotIndex); + addObjectInSlot((ChampionIndex)champIndex, leaderHandObject, (ChampionSlot)slotIndex); - f292_drawChampionState((ChampionIndex)champIndex); + drawChampionState((ChampionIndex)champIndex); _vm->_eventMan->f77_hideMouse(); } -bool ChampionMan::f327_isProjectileSpellCast(uint16 champIndex, Thing thing, int16 kineticEnergy, uint16 requiredManaAmount) { - Champion *curChampion = &_gK71_champions[champIndex]; +bool ChampionMan::isProjectileSpellCast(uint16 champIndex, Thing thing, int16 kineticEnergy, uint16 requiredManaAmount) { + Champion *curChampion = &_champions[champIndex]; if (curChampion->_currMana < requiredManaAmount) return false; @@ -1317,28 +1351,28 @@ bool ChampionMan::f327_isProjectileSpellCast(uint16 champIndex, Thing thing, int stepEnergy--; } - f326_championShootProjectile(curChampion, thing, kineticEnergy, 90, stepEnergy); + championShootProjectile(curChampion, thing, kineticEnergy, 90, stepEnergy); return true; // fix BUG_01 } -void ChampionMan::f326_championShootProjectile(Champion* champ, Thing thing, int16 kineticEnergy, int16 attack, int16 stepEnergy) { +void ChampionMan::championShootProjectile(Champion* champ, Thing thing, int16 kineticEnergy, int16 attack, int16 stepEnergy) { Direction newDirection = champ->_dir; _vm->_projexpl->f212_projectileCreate(thing, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, M21_normalizeModulo4((((champ->_cell - newDirection + 1) & 0x0002) >> 1) + newDirection), newDirection, kineticEnergy, attack, stepEnergy); _vm->_g311_projectileDisableMovementTicks = 4; _vm->_g312_lastProjectileDisabledMovementDirection = newDirection; } -void ChampionMan::f320_applyAndDrawPendingDamageAndWounds() { - Champion *championPtr = _gK71_champions; - for (uint16 championIndex = k0_ChampionFirst; championIndex < _g305_partyChampionCount; championIndex++, championPtr++) { - int16 pendingWounds = _g410_championPendingWounds[championIndex]; +void ChampionMan::applyAndDrawPendingDamageAndWounds() { + Champion *championPtr = _champions; + for (uint16 championIndex = k0_ChampionFirst; championIndex < _partyChampionCount; championIndex++, championPtr++) { + int16 pendingWounds = _championPendingWounds[championIndex]; setFlag(championPtr->_wounds, pendingWounds); - _g410_championPendingWounds[championIndex] = 0; - uint16 pendingDamage = _g409_championPendingDamage[championIndex]; + _championPendingWounds[championIndex] = 0; + uint16 pendingDamage = _championPendingDamage[championIndex]; if (!pendingDamage) continue; - _g409_championPendingDamage[championIndex] = 0; + _championPendingDamage[championIndex] = 0; int16 curHealth = championPtr->_currHealth; if (!curHealth) continue; @@ -1348,7 +1382,7 @@ void ChampionMan::f320_applyAndDrawPendingDamageAndWounds() { curHealth -= pendingDamage; if (curHealth <= 0) { - f319_championKill(championIndex); + championKill(championIndex); } else { championPtr->_currHealth = curHealth; setFlag(championPtr->_attributes, k0x0100_ChampionAttributeStatistics); @@ -1392,7 +1426,7 @@ void ChampionMan::f320_applyAndDrawPendingDamageAndWounds() { textPosY = 5; } - _vm->_textMan->f53_printToLogicalScreen(textPosX, textPosY, k15_ColorWhite, k8_ColorRed, f288_getStringFromInteger(pendingDamage, false, 3).c_str()); + _vm->_textMan->f53_printToLogicalScreen(textPosX, textPosY, k15_ColorWhite, k8_ColorRed, getStringFromInteger(pendingDamage, false, 3).c_str()); int16 eventIndex = championPtr->_hideDamageReceivedIndex; if (eventIndex == -1) { @@ -1406,22 +1440,22 @@ void ChampionMan::f320_applyAndDrawPendingDamageAndWounds() { M33_setMapAndTime(curEvent->_mapTime, _vm->_dungeonMan->_g309_partyMapIndex, _vm->_g313_gameTime + 5); _vm->_timeline->f236_fixChronology(_vm->_timeline->f235_getIndex(eventIndex)); } - f292_drawChampionState((ChampionIndex)championIndex); + drawChampionState((ChampionIndex)championIndex); _vm->_eventMan->f77_hideMouse(); } } } -void ChampionMan::f319_championKill(uint16 champIndex) { - Champion *curChampion = &_gK71_champions[champIndex]; +void ChampionMan::championKill(uint16 champIndex) { + Champion *curChampion = &_champions[champIndex]; curChampion->_currHealth = 0; setFlag(curChampion->_attributes, k0x1000_ChampionAttributeStatusBox); if (_vm->M0_indexToOrdinal(champIndex) == _vm->_inventoryMan->_g432_inventoryChampionOrdinal) { if (_vm->_g331_pressingEye) { _vm->_g331_pressingEye = false; _vm->_eventMan->_g597_ignoreMouseMovements = false; - if (!_g415_leaderEmptyHanded) { - _vm->_objectMan->f34_drawLeaderObjectName(_g414_leaderHandObject); + if (!_leaderEmptyHanded) { + _vm->_objectMan->f34_drawLeaderObjectName(_leaderHandObject); } _vm->_eventMan->_g587_hideMousePointerRequestCount = 1; _vm->_eventMan->f77_hideMouse(); @@ -1433,7 +1467,7 @@ void ChampionMan::f319_championKill(uint16 champIndex) { } _vm->_inventoryMan->f355_toggleInventory(k4_ChampionCloseInventory); } - f318_dropAllObjects(champIndex); + dropAllObjects(champIndex); Thing unusedThing = _vm->_dungeonMan->f166_getUnusedThing(k0x8000_championBones | k10_JunkThingType); uint16 curCell = 0; if (unusedThing != Thing::_none) { @@ -1448,40 +1482,40 @@ void ChampionMan::f319_championKill(uint16 champIndex) { curChampion->_symbols[0] = '\0'; curChampion->_dir = _vm->_dungeonMan->_g308_partyDir; curChampion->_maximumDamageReceived = 0; - uint16 curChampionIconIndex = M26_championIconIndex(curCell, _vm->_dungeonMan->_g308_partyDir); + uint16 curChampionIconIndex = getChampionIconIndex(curCell, _vm->_dungeonMan->_g308_partyDir); if (_vm->M0_indexToOrdinal(curChampionIconIndex) == _vm->_eventMan->_g599_useChampionIconOrdinalAsMousePointerBitmap) { _vm->_eventMan->_g598_mousePointerBitmapUpdated = true; _vm->_eventMan->_g599_useChampionIconOrdinalAsMousePointerBitmap = _vm->M0_indexToOrdinal(kM1_ChampionNone); } if (curChampion->_poisonEventCount) - f323_unpoison(champIndex); + unpoison(champIndex); _vm->_displayMan->_g578_useByteBoxCoordinates = false; _vm->_displayMan->D24_fillScreenBox(_boxChampionIcons[curChampionIconIndex], k0_ColorBlack); - f292_drawChampionState((ChampionIndex)champIndex); + drawChampionState((ChampionIndex)champIndex); int16 aliveChampionIndex; - for (aliveChampionIndex = k0_ChampionFirst, curChampion = _gK71_champions; aliveChampionIndex < _g305_partyChampionCount; aliveChampionIndex++, curChampion++) { + for (aliveChampionIndex = k0_ChampionFirst, curChampion = _champions; aliveChampionIndex < _partyChampionCount; aliveChampionIndex++, curChampion++) { if (curChampion->_currHealth) break; } - if (aliveChampionIndex == _g305_partyChampionCount) { /* BUG0_43 The game does not end if the last living champion in the party is killed while looking at a candidate champion in a portrait. The condition to end the game when the whole party is killed is not true because the code considers the candidate champion as alive (in the loop above) */ - _g303_partyDead = true; + if (aliveChampionIndex == _partyChampionCount) { /* BUG0_43 The game does not end if the last living champion in the party is killed while looking at a candidate champion in a portrait. The condition to end the game when the whole party is killed is not true because the code considers the candidate champion as alive (in the loop above) */ + _partyDead = true; return; } - if (champIndex == _g411_leaderIndex) + if (champIndex == _leaderIndex) _vm->_eventMan->f368_commandSetLeader((ChampionIndex)aliveChampionIndex); - if (champIndex == _g514_magicCasterChampionIndex) + if (champIndex == _magicCasterChampionIndex) _vm->_menuMan->f394_setMagicCasterAndDrawSpellArea(aliveChampionIndex); else - _vm->_menuMan->f393_drawSpellAreaControls(_g514_magicCasterChampionIndex); + _vm->_menuMan->f393_drawSpellAreaControls(_magicCasterChampionIndex); } -void ChampionMan::f318_dropAllObjects(uint16 champIndex) { +void ChampionMan::dropAllObjects(uint16 champIndex) { static const int16 slotDropOrder[30] = { k5_ChampionSlotFeet, k4_ChampionSlotLegs, @@ -1515,15 +1549,15 @@ void ChampionMan::f318_dropAllObjects(uint16 champIndex) { k1_ChampionSlotActionHand }; - uint16 curCell = _gK71_champions[champIndex]._cell; + uint16 curCell = _champions[champIndex]._cell; for (uint16 slotIndex = k0_ChampionSlotReadyHand; slotIndex < k30_ChampionSlotChest_1; slotIndex++) { - Thing curThing = f300_getObjectRemovedFromSlot(champIndex, slotDropOrder[slotIndex]); + Thing curThing = getObjectRemovedFromSlot(champIndex, slotDropOrder[slotIndex]); if (curThing != Thing::_none) _vm->_moveSens->f267_getMoveResult(M15_thingWithNewCell(curThing, curCell), kM1_MapXNotOnASquare, 0, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY); } } -void ChampionMan::f323_unpoison(int16 champIndex) { +void ChampionMan::unpoison(int16 champIndex) { if (champIndex == kM1_ChampionNone) return; @@ -1532,11 +1566,11 @@ void ChampionMan::f323_unpoison(int16 champIndex) { if ((eventPtr->_type == k75_TMEventTypePoisonChampion) && (eventPtr->_priority == champIndex)) _vm->_timeline->f237_deleteEvent(eventIndex); } - _gK71_champions[champIndex]._poisonEventCount = 0; + _champions[champIndex]._poisonEventCount = 0; } -void ChampionMan::f331_applyTimeEffects() { - if (!_g305_partyChampionCount) +void ChampionMan::applyTimeEffects() { + if (!_partyChampionCount) return; Scent checkScent; @@ -1544,11 +1578,11 @@ void ChampionMan::f331_applyTimeEffects() { checkScent.setMapY(_vm->_dungeonMan->_g307_partyMapY); checkScent.setMapIndex(_vm->_dungeonMan->_g309_partyMapIndex); - for (byte loopScentIndex = 0; loopScentIndex + 1 < _g407_party._scentCount; loopScentIndex++) { - if (&_g407_party._scents[loopScentIndex] != &checkScent) { - _g407_party._scentStrengths[loopScentIndex] = MAX(0, _g407_party._scentStrengths[loopScentIndex] - 1); - if (!_g407_party._scentStrengths[loopScentIndex] && !loopScentIndex) { - f316_deleteScent(0); + for (byte loopScentIndex = 0; loopScentIndex + 1 < _party._scentCount; loopScentIndex++) { + if (&_party._scents[loopScentIndex] != &checkScent) { + _party._scentStrengths[loopScentIndex] = MAX(0, _party._scentStrengths[loopScentIndex] - 1); + if (!_party._scentStrengths[loopScentIndex] && !loopScentIndex) { + deleteScent(0); continue; } } @@ -1556,18 +1590,18 @@ void ChampionMan::f331_applyTimeEffects() { uint16 gameTime = _vm->_g313_gameTime & 0xFFFF; uint16 timeCriteria = (((gameTime & 0x0080) + ((gameTime & 0x0100) >> 2)) + ((gameTime & 0x0040) << 2)) >> 2; - Champion *championPtr = _gK71_champions; - for (uint16 championIndex = k0_ChampionFirst; championIndex < _g305_partyChampionCount; championIndex++, championPtr++) { - if (championPtr->_currHealth && (_vm->M0_indexToOrdinal(championIndex) != _g299_candidateChampionOrdinal)) { - uint16 wizardSkillLevel = f303_getSkillLevel(championIndex, k3_ChampionSkillWizard) + f303_getSkillLevel(championIndex, k2_ChampionSkillPriest); + Champion *championPtr = _champions; + for (uint16 championIndex = k0_ChampionFirst; championIndex < _partyChampionCount; championIndex++, championPtr++) { + if (championPtr->_currHealth && (_vm->M0_indexToOrdinal(championIndex) != _candidateChampionOrdinal)) { + uint16 wizardSkillLevel = getSkillLevel(championIndex, k3_ChampionSkillWizard) + getSkillLevel(championIndex, k2_ChampionSkillPriest); if ((championPtr->_currMana < championPtr->_maxMana) && (timeCriteria < championPtr->_statistics[k3_ChampionStatWisdom][k1_ChampionStatCurrent] + wizardSkillLevel)) { int16 manaGain = championPtr->_maxMana / 40; - if (_g300_partyIsSleeping) + if (_partyIsSleeping) manaGain <<= 1; manaGain++; - f325_decrementStamina(championIndex, manaGain * MAX(7, 16 - wizardSkillLevel)); + decrementStamina(championIndex, manaGain * MAX(7, 16 - wizardSkillLevel)); championPtr->_currMana += MIN<int16>(manaGain, championPtr->_maxMana - championPtr->_currMana); } else if (championPtr->_currMana > championPtr->_maxMana) championPtr->_currMana--; @@ -1583,7 +1617,7 @@ void ChampionMan::f331_applyTimeEffects() { int16 staminaLoss = 0; int16 staminaAmount = f26_getBoundedValue(1, (championPtr->_maxStamina >> 8) - 1, 6); - if (_g300_partyIsSleeping) + if (_partyIsSleeping) staminaAmount <<= 1; int32 compDelay = _vm->_g313_gameTime - _vm->_projexpl->_g362_lastPartyMovementTime; @@ -1617,7 +1651,7 @@ void ChampionMan::f331_applyTimeEffects() { championPtr->_water -= staminaAboveHalf ? 1 : staminaGainCycleCount >> 2; } } while (--staminaGainCycleCount && ((championPtr->_currStamina - staminaLoss) < championPtr->_maxStamina)); - f325_decrementStamina(championIndex, staminaLoss); + decrementStamina(championIndex, staminaLoss); if (championPtr->_food < -1024) championPtr->_food = -1024; @@ -1626,7 +1660,7 @@ void ChampionMan::f331_applyTimeEffects() { if ((championPtr->_currHealth < championPtr->_maxHealth) && (championPtr->_currStamina >= (championPtr->_maxStamina >> 2)) && (timeCriteria < (championPtr->_statistics[k4_ChampionStatVitality][k1_ChampionStatCurrent] + 12))) { int16 healthGain = (championPtr->_maxHealth >> 7) + 1; - if (_g300_partyIsSleeping) + if (_partyIsSleeping) healthGain <<= 1; if (_vm->_objectMan->f33_getIconIndex(championPtr->_slots[k10_ChampionSlotNeck]) == k121_IconIndiceJunkEkkhardCross) @@ -1634,7 +1668,7 @@ void ChampionMan::f331_applyTimeEffects() { championPtr->_currHealth += MIN(healthGain, (int16)(championPtr->_maxHealth - championPtr->_currHealth)); } - if (!((int)_vm->_g313_gameTime & (_g300_partyIsSleeping ? 63 : 255))) { + if (!((int)_vm->_g313_gameTime & (_partyIsSleeping ? 63 : 255))) { for (uint16 i = k0_ChampionStatLuck; i <= k6_ChampionStatAntifire; i++) { byte *curStatistic = championPtr->_statistics[i]; uint16 statisticMaximum = curStatistic[k0_ChampionStatMaximum]; @@ -1644,7 +1678,7 @@ void ChampionMan::f331_applyTimeEffects() { curStatistic[k1_ChampionStatCurrent] -= curStatistic[k1_ChampionStatCurrent] / statisticMaximum; } } - if (!_g300_partyIsSleeping && (championPtr->_dir != _vm->_dungeonMan->_g308_partyDir) && (_vm->_projexpl->_g361_lastCreatureAttackTime + 60 < _vm->_g313_gameTime)) { + if (!_partyIsSleeping && (championPtr->_dir != _vm->_dungeonMan->_g308_partyDir) && (_vm->_projexpl->_g361_lastCreatureAttackTime + 60 < _vm->_g313_gameTime)) { championPtr->_dir = _vm->_dungeonMan->_g308_partyDir; championPtr->_maximumDamageReceived = 0; setFlag(championPtr->_attributes, k0x0400_ChampionAttributeIcon); @@ -1657,12 +1691,12 @@ void ChampionMan::f331_applyTimeEffects() { } } } - f293_drawAllChampionStates(); + drawAllChampionStates(); } -void ChampionMan::save2_PartyPart(Common::OutSaveFile* file) { +void ChampionMan::savePartyPart2(Common::OutSaveFile* file) { for (uint16 i = 0; i < 4; ++i) { - Champion *champ = &_gK71_champions[i]; + Champion *champ = &_champions[i]; file->writeUint16BE(champ->_attributes); file->writeUint16BE(champ->_wounds); for (uint16 y = 0; y < 7; ++y) @@ -1704,7 +1738,7 @@ void ChampionMan::save2_PartyPart(Common::OutSaveFile* file) { file->writeByte(champ->_portrait[j]); } - Party &party = _g407_party; + Party &party = _party; file->writeSint16BE(party._magicalLightAmount); file->writeByte(party._event73Count_ThievesEye); file->writeByte(party._event79Count_Footprints); @@ -1722,9 +1756,9 @@ void ChampionMan::save2_PartyPart(Common::OutSaveFile* file) { file->writeByte(party._event71Count_Invisibility); } -void ChampionMan::load2_PartyPart(Common::InSaveFile* file) { +void ChampionMan::loadPartyPart2(Common::InSaveFile* file) { for (uint16 i = 0; i < 4; ++i) { - Champion *champ = &_gK71_champions[i]; + Champion *champ = &_champions[i]; champ->_attributes = file->readUint16BE(); champ->_wounds = file->readUint16BE(); for (uint16 y = 0; y < 7; ++y) @@ -1766,7 +1800,7 @@ void ChampionMan::load2_PartyPart(Common::InSaveFile* file) { champ->_portrait[j] = file->readByte(); } - Party &party = _g407_party; + Party &party = _party; party._magicalLightAmount = file->readSint16BE(); party._event73Count_ThievesEye = file->readByte(); party._event79Count_Footprints = file->readByte(); @@ -1784,67 +1818,67 @@ void ChampionMan::load2_PartyPart(Common::InSaveFile* file) { party._event71Count_Invisibility = file->readByte(); } -ChampionIndex ChampionMan::f285_getIndexInCell(int16 cell) { - for (uint16 i = 0; i < _g305_partyChampionCount; ++i) { - if ((_gK71_champions[i]._cell == cell) && _gK71_champions[i]._currHealth) +ChampionIndex ChampionMan::getIndexInCell(int16 cell) { + for (uint16 i = 0; i < _partyChampionCount; ++i) { + if ((_champions[i]._cell == cell) && _champions[i]._currHealth) return (ChampionIndex)i; } return kM1_ChampionNone; } -void ChampionMan::f278_resetDataToStartGame() { +void ChampionMan::resetDataToStartGame() { if (!_vm->_g298_newGame) { Thing L0787_T_Thing; - if ((L0787_T_Thing = _g414_leaderHandObject) == Thing::_none) { - _g415_leaderEmptyHanded = true; - _g413_leaderHandObjectIconIndex = kM1_IconIndiceNone; + if ((L0787_T_Thing = _leaderHandObject) == Thing::_none) { + _leaderEmptyHanded = true; + _leaderHandObjectIconIndex = kM1_IconIndiceNone; _vm->_eventMan->f69_setMousePointer(); } else { - f297_putObjectInLeaderHand(L0787_T_Thing, true); /* This call will add the weight of the leader hand object to the Load of the leader a first time */ + putObjectInLeaderHand(L0787_T_Thing, true); /* This call will add the weight of the leader hand object to the Load of the leader a first time */ } - Champion *L0788_ps_Champion = _gK71_champions; + Champion *L0788_ps_Champion = _champions; int16 L0785_i_ChampionIndex; - for (L0785_i_ChampionIndex = k0_ChampionFirst; L0785_i_ChampionIndex < _g305_partyChampionCount; L0785_i_ChampionIndex++, L0788_ps_Champion++) { + for (L0785_i_ChampionIndex = k0_ChampionFirst; L0785_i_ChampionIndex < _partyChampionCount; L0785_i_ChampionIndex++, L0788_ps_Champion++) { clearFlag(L0788_ps_Champion->_attributes, k0x0080_ChampionAttributeNameTitle | k0x0100_ChampionAttributeStatistics | k0x0200_ChampionAttributeLoad | k0x0400_ChampionAttributeIcon | k0x0800_ChampionAttributePanel | k0x1000_ChampionAttributeStatusBox | k0x2000_ChampionAttributeWounds | k0x4000_ChampionAttributeViewport | k0x8000_ChampionAttributeActionHand); setFlag(L0788_ps_Champion->_attributes, k0x8000_ChampionAttributeActionHand | k0x1000_ChampionAttributeStatusBox | k0x0400_ChampionAttributeIcon); } - f293_drawAllChampionStates(); - if ((L0785_i_ChampionIndex = _g411_leaderIndex) != kM1_ChampionNone) { - _g411_leaderIndex = kM1_ChampionNone; + drawAllChampionStates(); + if ((L0785_i_ChampionIndex = _leaderIndex) != kM1_ChampionNone) { + _leaderIndex = kM1_ChampionNone; _vm->_eventMan->f368_commandSetLeader((ChampionIndex)L0785_i_ChampionIndex); } - if ((L0785_i_ChampionIndex = _g514_magicCasterChampionIndex) != kM1_ChampionNone) { - _g514_magicCasterChampionIndex = kM1_ChampionNone; + if ((L0785_i_ChampionIndex = _magicCasterChampionIndex) != kM1_ChampionNone) { + _magicCasterChampionIndex = kM1_ChampionNone; _vm->_menuMan->f394_setMagicCasterAndDrawSpellArea(L0785_i_ChampionIndex); } return; } - _g414_leaderHandObject = Thing::_none; - _g413_leaderHandObjectIconIndex = kM1_IconIndiceNone; - _g415_leaderEmptyHanded = true; + _leaderHandObject = Thing::_none; + _leaderHandObjectIconIndex = kM1_IconIndiceNone; + _leaderEmptyHanded = true; } -void ChampionMan::f280_addCandidateChampionToParty(uint16 championPortraitIndex) { - if (!_g415_leaderEmptyHanded) +void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) { + if (!_leaderEmptyHanded) return; - if (_g305_partyChampionCount == 4) + if (_partyChampionCount == 4) return; - uint16 previousPartyChampionCount = _g305_partyChampionCount; - Champion *championPtr = &_gK71_champions[previousPartyChampionCount]; + uint16 previousPartyChampionCount = _partyChampionCount; + Champion *championPtr = &_champions[previousPartyChampionCount]; championPtr->resetToZero(); // Strangerke - TODO: Check if the new code is possible to run on the older version (example: the portraits could be missing in the data) _vm->_displayMan->_g578_useByteBoxCoordinates = true; - _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k26_ChampionPortraitsIndice), championPtr->_portrait, _boxChampionPortrait, M27_getChampionPortraitX(championPortraitIndex), M28_getChampionPortraitY(championPortraitIndex), k128_byteWidth, k16_byteWidth, kM1_ColorNoTransparency, 87, 29); + _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k26_ChampionPortraitsIndice), championPtr->_portrait, _boxChampionPortrait, getChampionPortraitX(championPortraitIndex), getChampionPortraitY(championPortraitIndex), k128_byteWidth, k16_byteWidth, kM1_ColorNoTransparency, 87, 29); championPtr->_actionIndex = k255_ChampionActionNone; championPtr->_enableActionEventIndex = -1; championPtr->_hideDamageReceivedIndex = -1; championPtr->_dir = _vm->_dungeonMan->_g308_partyDir; uint16 viewCell = k0_ViewCellFronLeft; - while (f285_getIndexInCell(M21_normalizeModulo4(viewCell + _vm->_dungeonMan->_g308_partyDir)) != kM1_ChampionNone) + while (getIndexInCell(M21_normalizeModulo4(viewCell + _vm->_dungeonMan->_g308_partyDir)) != kM1_ChampionNone) viewCell++; championPtr->_cell = (ViewCell)M21_normalizeModulo4(viewCell + _vm->_dungeonMan->_g308_partyDir); @@ -1885,16 +1919,16 @@ void ChampionMan::f280_addCandidateChampionToParty(uint16 championPortraitIndex) setFlag(championPtr->_attributes, k0x0010_ChampionAttributeMale); decodedStringPtr++; - championPtr->_currHealth = championPtr->_maxHealth = f279_getDecodedValue(decodedStringPtr, 4); + championPtr->_currHealth = championPtr->_maxHealth = getDecodedValue(decodedStringPtr, 4); decodedStringPtr += 4; - championPtr->_currStamina = championPtr->_maxStamina = f279_getDecodedValue(decodedStringPtr, 4); + championPtr->_currStamina = championPtr->_maxStamina = getDecodedValue(decodedStringPtr, 4); decodedStringPtr += 4; - championPtr->_currMana = championPtr->_maxMana = f279_getDecodedValue(decodedStringPtr, 4); + championPtr->_currMana = championPtr->_maxMana = getDecodedValue(decodedStringPtr, 4); decodedStringPtr += 4; decodedStringPtr++; for (int16 statIdx = k0_ChampionStatLuck; statIdx <= k6_ChampionStatAntifire; statIdx++) { championPtr->_statistics[statIdx][k2_ChampionStatMinimum] = 30; - championPtr->_statistics[statIdx][k1_ChampionStatCurrent] = championPtr->_statistics[statIdx][k0_ChampionStatMaximum] = f279_getDecodedValue(decodedStringPtr, 2); + championPtr->_statistics[statIdx][k1_ChampionStatCurrent] = championPtr->_statistics[statIdx][k0_ChampionStatMaximum] = getDecodedValue(decodedStringPtr, 2); decodedStringPtr += 2; } championPtr->_statistics[k0_ChampionStatLuck][k2_ChampionStatMinimum] = 10; @@ -1912,13 +1946,13 @@ void ChampionMan::f280_addCandidateChampionToParty(uint16 championPortraitIndex) championPtr->_skills[skillIdx]._experience = baseSkillExperience; } - _g299_candidateChampionOrdinal = previousPartyChampionCount + 1; - if (++_g305_partyChampionCount == 1) { + _candidateChampionOrdinal = previousPartyChampionCount + 1; + if (++_partyChampionCount == 1) { _vm->_eventMan->f368_commandSetLeader(k0_ChampionFirst); _vm->_menuMan->_g508_refreshActionArea = true; } else { _vm->_menuMan->f388_clearActingChampion(); - _vm->_menuMan->f386_drawActionIcon((ChampionIndex)(_g305_partyChampionCount - 1)); + _vm->_menuMan->f386_drawActionIcon((ChampionIndex)(_partyChampionCount - 1)); } int16 curMapX = _vm->_dungeonMan->_g306_partyMapX; @@ -1989,7 +2023,7 @@ void ChampionMan::f280_addCandidateChampionToParty(uint16 championPortraitIndex) else curSlotIndex = slotIdx++; } - f301_addObjectInSlot((ChampionIndex)previousPartyChampionCount, curThing, (ChampionSlot)curSlotIndex); + addObjectInSlot((ChampionIndex)previousPartyChampionCount, curThing, (ChampionSlot)curSlotIndex); } curThing = _vm->_dungeonMan->f159_getNextThing(curThing); } @@ -1997,9 +2031,9 @@ void ChampionMan::f280_addCandidateChampionToParty(uint16 championPortraitIndex) _vm->_menuMan->f456_drawDisabledMenu();; } -void ChampionMan::f287_drawChampionBarGraphs(ChampionIndex champIndex) { +void ChampionMan::drawChampionBarGraphs(ChampionIndex champIndex) { int16 barGraphHeights[3]; - Champion *champ = &_gK71_champions[champIndex]; + Champion *champ = &_champions[champIndex]; int16 barGraphIdx = 0; if (champ->_currHealth > 0) { int32 barGraphHeight = (((int32)champ->_currHealth << 10) * 25) / champ->_maxHealth; @@ -2050,7 +2084,7 @@ void ChampionMan::f287_drawChampionBarGraphs(ChampionIndex champIndex) { } -uint16 ChampionMan::f306_getStaminaAdjustedValue(Champion *champ, int16 val) { +uint16 ChampionMan::getStaminaAdjustedValue(Champion *champ, int16 val) { int16 currStamina = champ->_currStamina; int16 halfMaxStamina = champ->_maxStamina / 2; if (currStamina < halfMaxStamina) { @@ -2060,9 +2094,9 @@ uint16 ChampionMan::f306_getStaminaAdjustedValue(Champion *champ, int16 val) { return val; } -uint16 ChampionMan::f309_getMaximumLoad(Champion *champ) { +uint16 ChampionMan::getMaximumLoad(Champion *champ) { uint16 maximumLoad = champ->getStatistic(k1_ChampionStatStrength, k1_ChampionStatCurrent) * 8 + 100; - maximumLoad = f306_getStaminaAdjustedValue(champ, maximumLoad); + maximumLoad = getStaminaAdjustedValue(champ, maximumLoad); int16 wounds = champ->getWounds(); if (wounds) maximumLoad -= maximumLoad >> (champ->getWoundsFlag(k0x0010_ChampionWoundLegs) ? 2 : 3); @@ -2075,12 +2109,12 @@ uint16 ChampionMan::f309_getMaximumLoad(Champion *champ) { return maximumLoad; } -void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) { +void ChampionMan::drawChampionState(ChampionIndex champIndex) { static Box boxMouth = Box(55, 72, 12, 29); // @ G0048_s_Graphic562_Box_Mouth static Box boxEye = Box(11, 28, 12, 29); // @ G0049_s_Graphic562_Box_Eye int16 championStatusBoxX = champIndex * k69_ChampionStatusBoxSpacing; - Champion *curChampion = &_gK71_champions[champIndex]; + Champion *curChampion = &_champions[champIndex]; uint16 championAttributes = curChampion->_attributes; if (!getFlag(championAttributes, k0x0080_ChampionAttributeNameTitle | k0x0100_ChampionAttributeStatistics | k0x0200_ChampionAttributeLoad | k0x0400_ChampionAttributeIcon | k0x0800_ChampionAttributePanel | k0x1000_ChampionAttributeStatusBox | k0x2000_ChampionAttributeWounds | k0x4000_ChampionAttributeViewport | k0x8000_ChampionAttributeActionHand)) return; @@ -2101,13 +2135,13 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) { nativeBitmapIndices[i] = 0; uint16 borderCount = 0; - if (_g407_party._fireShieldDefense > 0) + if (_party._fireShieldDefense > 0) nativeBitmapIndices[borderCount++] = k38_BorderPartyFireshieldIndice; - if (_g407_party._spellShieldDefense > 0) + if (_party._spellShieldDefense > 0) nativeBitmapIndices[borderCount++] = k39_BorderPartySpellshieldIndice; - if ((_g407_party._shieldDefense > 0) || curChampion->_shieldDefense) + if ((_party._shieldDefense > 0) || curChampion->_shieldDefense) nativeBitmapIndices[borderCount++] = k37_BorderPartyShieldIndice; while (borderCount--) @@ -2135,7 +2169,7 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) { } if (getFlag(championAttributes, k0x0080_ChampionAttributeNameTitle)) { - Color nameColor = (champIndex == _g411_leaderIndex) ? k9_ColorGold : k13_ColorLightestGray; + Color nameColor = (champIndex == _leaderIndex) ? k9_ColorGold : k13_ColorLightestGray; if (isInventoryChampion) { char *championName = curChampion->_name; _vm->_textMan->f52_printToViewport(3, 7, nameColor, championName); @@ -2157,9 +2191,9 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) { } } if (getFlag(championAttributes, k0x0100_ChampionAttributeStatistics)) { - f287_drawChampionBarGraphs(champIndex); + drawChampionBarGraphs(champIndex); if (isInventoryChampion) { - f290_drawHealthStaminaManaValues(curChampion); + drawHealthStaminaManaValues(curChampion); int16 nativeBitmapIndex; if ((curChampion->_food < 0) || (curChampion->_water < 0) || (curChampion->_poisonEventCount)) nativeBitmapIndex = k34_SlotBoxWoundedIndice; @@ -2180,13 +2214,13 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) { } if (getFlag(championAttributes, k0x2000_ChampionAttributeWounds)) { for (int i = isInventoryChampion ? k5_ChampionSlotFeet : k1_ChampionSlotActionHand; i >= k0_ChampionSlotReadyHand; i--) - f291_drawSlot(champIndex, i); + drawSlot(champIndex, i); if (isInventoryChampion) setFlag(championAttributes, k0x4000_ChampionAttributeViewport); } if (getFlag(championAttributes, k0x0200_ChampionAttributeLoad) && isInventoryChampion) { - uint16 maxLoad = f309_getMaximumLoad(curChampion); + uint16 maxLoad = getMaximumLoad(curChampion); Color loadColor; if (curChampion->_load > maxLoad) loadColor = k8_ColorRed; @@ -2203,7 +2237,7 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) { } maxLoad = curChampion->_load / 10; - strcpy(_vm->_g353_stringBuildBuffer, f288_getStringFromInteger(maxLoad, true, 3).c_str()); + strcpy(_vm->_g353_stringBuildBuffer, getStringFromInteger(maxLoad, true, 3).c_str()); switch (_vm->getGameLanguage()) { // localized default: @@ -2213,24 +2247,24 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) { } maxLoad = curChampion->_load - (maxLoad * 10); - strcat(_vm->_g353_stringBuildBuffer, f288_getStringFromInteger(maxLoad, false, 1).c_str()); + strcat(_vm->_g353_stringBuildBuffer, getStringFromInteger(maxLoad, false, 1).c_str()); strcat(_vm->_g353_stringBuildBuffer, "/"); - maxLoad = (f309_getMaximumLoad(curChampion) + 5) / 10; - strcat(_vm->_g353_stringBuildBuffer, f288_getStringFromInteger(maxLoad, true, 3).c_str()); + maxLoad = (getMaximumLoad(curChampion) + 5) / 10; + strcat(_vm->_g353_stringBuildBuffer, getStringFromInteger(maxLoad, true, 3).c_str()); strcat(_vm->_g353_stringBuildBuffer, " KG"); _vm->_textMan->f52_printToViewport(148, 132, loadColor, _vm->_g353_stringBuildBuffer); setFlag(championAttributes, k0x4000_ChampionAttributeViewport); } - uint16 championIconIndex = M26_championIconIndex(curChampion->_cell, _vm->_dungeonMan->_g308_partyDir); + uint16 championIconIndex = getChampionIconIndex(curChampion->_cell, _vm->_dungeonMan->_g308_partyDir); if (getFlag(championAttributes, k0x0400_ChampionAttributeIcon) && (_vm->_eventMan->_g599_useChampionIconOrdinalAsMousePointerBitmap != _vm->M0_indexToOrdinal(championIconIndex))) { _vm->_displayMan->D24_fillScreenBox(_boxChampionIcons[championIconIndex], _championColor[champIndex]); - _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k28_ChampionIcons), _vm->_displayMan->_g348_bitmapScreen, _boxChampionIcons[championIconIndex], M26_championIconIndex(curChampion->_dir, _vm->_dungeonMan->_g308_partyDir) * 19, 0, k40_byteWidth, k160_byteWidthScreen, k12_ColorDarkestGray, 14, k200_heightScreen); + _vm->_displayMan->f132_blitToBitmap(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k28_ChampionIcons), _vm->_displayMan->_g348_bitmapScreen, _boxChampionIcons[championIconIndex], getChampionIconIndex(curChampion->_dir, _vm->_dungeonMan->_g308_partyDir) * 19, 0, k40_byteWidth, k160_byteWidthScreen, k12_ColorDarkestGray, 14, k200_heightScreen); } if (getFlag(championAttributes, k0x0800_ChampionAttributePanel) && isInventoryChampion) { if (_vm->_g333_pressingMouth) _vm->_inventoryMan->f345_drawPanelFoodWaterPoisoned(); else if (_vm->_g331_pressingEye) { - if (_g415_leaderEmptyHanded) + if (_leaderEmptyHanded) _vm->_inventoryMan->f351_drawChampionSkillsAndStatistics(); } else _vm->_inventoryMan->f347_drawPanel(); @@ -2238,7 +2272,7 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) { setFlag(championAttributes, k0x4000_ChampionAttributeViewport); } if (getFlag(championAttributes, k0x8000_ChampionAttributeActionHand)) { - f291_drawSlot(champIndex, k1_ChampionSlotActionHand); + drawSlot(champIndex, k1_ChampionSlotActionHand); _vm->_menuMan->f386_drawActionIcon(champIndex); if (isInventoryChampion) setFlag(championAttributes, k0x4000_ChampionAttributeViewport); @@ -2250,25 +2284,25 @@ void ChampionMan::f292_drawChampionState(ChampionIndex champIndex) { _vm->_eventMan->f77_hideMouse(); } -uint16 ChampionMan::M26_championIconIndex(int16 val, Direction dir) { +uint16 ChampionMan::getChampionIconIndex(int16 val, Direction dir) { return ((val + 4 - dir) & 0x3); } -void ChampionMan::f290_drawHealthStaminaManaValues(Champion* champ) { - f289_drawHealthOrStaminaOrManaValue(116, champ->_currHealth, champ->_maxHealth); - f289_drawHealthOrStaminaOrManaValue(124, champ->_currStamina, champ->_maxStamina); - f289_drawHealthOrStaminaOrManaValue(132, champ->_currMana, champ->_maxMana); +void ChampionMan::drawHealthStaminaManaValues(Champion* champ) { + drawHealthOrStaminaOrManaValue(116, champ->_currHealth, champ->_maxHealth); + drawHealthOrStaminaOrManaValue(124, champ->_currStamina, champ->_maxStamina); + drawHealthOrStaminaOrManaValue(132, champ->_currMana, champ->_maxMana); } -void ChampionMan::f291_drawSlot(uint16 champIndex, int16 slotIndex) { +void ChampionMan::drawSlot(uint16 champIndex, int16 slotIndex) { int16 nativeBitmapIndex = -1; - Champion *champ = &_gK71_champions[champIndex]; + Champion *champ = &_champions[champIndex]; bool isInventoryChamp = (_vm->_inventoryMan->_g432_inventoryChampionOrdinal == _vm->M0_indexToOrdinal(champIndex)); uint16 slotBoxIndex; if (!isInventoryChamp) { // If drawing a slot for a champion other than the champion whose inventory is open - if ((slotIndex > k1_ChampionSlotActionHand) || (_g299_candidateChampionOrdinal == _vm->M0_indexToOrdinal(champIndex))) + if ((slotIndex > k1_ChampionSlotActionHand) || (_candidateChampionOrdinal == _vm->M0_indexToOrdinal(champIndex))) return; slotBoxIndex = (champIndex << 1) + slotIndex; } else @@ -2318,7 +2352,7 @@ void ChampionMan::f291_drawSlot(uint16 champIndex, int16 slotIndex) { } } - if ((slotIndex == k1_ChampionSlotActionHand) && (_vm->M0_indexToOrdinal(champIndex) == _g506_actingChampionOrdinal)) + if ((slotIndex == k1_ChampionSlotActionHand) && (_vm->M0_indexToOrdinal(champIndex) == _actingChampionOrdinal)) nativeBitmapIndex = k35_SlotBoxActingHandIndice; if (nativeBitmapIndex != -1) { @@ -2340,7 +2374,7 @@ void ChampionMan::f291_drawSlot(uint16 champIndex, int16 slotIndex) { _vm->_eventMan->f78_showMouse(); } -void ChampionMan::f281_renameChampion(Champion* champ) { +void ChampionMan::renameChampion(Champion* champ) { #define k1_RENAME_CHAMPION_NAME 1 #define k2_RENAME_CHAMPION_TITLE 2 static const char underscoreCharacterString[2] = "_"; @@ -2402,8 +2436,8 @@ void ChampionMan::f281_renameChampion(Champion* champ) { renamedChampionString[curCharacterIndex] = '\0'; bool found = false; - for (uint16 idx = k0_ChampionFirst; idx < _g305_partyChampionCount - 1; idx++) { - if (!strcmp(_gK71_champions[idx]._name, renamedChampionString)) { + for (uint16 idx = k0_ChampionFirst; idx < _partyChampionCount - 1; idx++) { + if (!strcmp(_champions[idx]._name, renamedChampionString)) { // If an existing champion already has the specified name for the new champion found = true; break; @@ -2507,14 +2541,14 @@ void ChampionMan::f281_renameChampion(Champion* champ) { } } -uint16 ChampionMan::f303_getSkillLevel(int16 champIndex, uint16 skillIndex) { - if (_g300_partyIsSleeping) +uint16 ChampionMan::getSkillLevel(int16 champIndex, uint16 skillIndex) { + if (_partyIsSleeping) return 1; bool ignoreTmpExp = getFlag(skillIndex, k0x8000_IgnoreTemporaryExperience); bool ignoreObjModifiers = getFlag(skillIndex, k0x4000_IgnoreObjectModifiers); clearFlag(skillIndex, k0x8000_IgnoreTemporaryExperience | k0x4000_IgnoreObjectModifiers); - Champion *champ = &_gK71_champions[champIndex]; + Champion *champ = &_champions[champIndex]; Skill *skill = &champ->_skills[skillIndex]; int32 exp = skill->_experience; if (!ignoreTmpExp) diff --git a/engines/dm/champion.h b/engines/dm/champion.h index f7e9f1f013..82117e8ac2 100644 --- a/engines/dm/champion.h +++ b/engines/dm/champion.h @@ -400,48 +400,19 @@ public: uint16 getAttributes() { return _attributes; } uint16 getAttributes(ChampionAttribute flag) { return _attributes & flag; } - void setAttributeFlag(ChampionAttribute flag, bool value) { - if (value) { - _attributes |= flag; - } else { - _attributes &= ~flag; - } - } + void setAttributeFlag(ChampionAttribute flag, bool value); void clearAttributes(ChampionAttribute attribute = k0x0000_ChampionAttributNone) { _attributes = attribute; } uint16 getWounds() { return _wounds; } - void setWoundsFlag(ChampionWound flag, bool value) { - if (value) { - _wounds |= flag; - } else { - _wounds &= ~flag; - } - } + void setWoundsFlag(ChampionWound flag, bool value); uint16 getWoundsFlag(ChampionWound wound) { return _wounds & wound; } void clearWounds() { _wounds = k0x0000_ChampionWoundNone; } - void resetToZero() { // oh boy > . < - for (int16 i = 0; i < 30; ++i) - _slots[i] = Thing::_none; - for (int16 i = 0; i < 20; ++i) - _skills[i].resetToZero(); - _attributes = _wounds = 0; - memset(_statistics, 0, 7 * 3); - memset(_name, '\0', 8); - memset(_title, '\0', 20); - _dir = kDirNorth; - _cell = k0_ViewCellFronLeft; - _actionIndex = k0_ChampionActionN; - _symbolStep = 0; - memset(_symbols, '\0', 5); - _directionMaximumDamageReceived = _maximumDamageReceived = _poisonEventCount = _enableActionEventIndex = 0; - _hideDamageReceivedIndex = _currHealth = _maxHealth = _currStamina = _maxStamina = _currMana = _maxMana = 0; - _actionDefense = _food = _water = _load = _shieldDefense = 0; - memset(_portrait, 0, 464); - } void resetSkillsToZero() { for (int16 i = 0; i < 20; ++i) _skills[i].resetToZero(); } + void resetToZero(); + }; // @ CHAMPION_INCLUDING_PORTRAIT #define k0x0000_maskDoNotUseSharpDefense 0x0000 // @ MASK0x0000_DO_NOT_USE_SHARP_DEFENSE @@ -489,102 +460,101 @@ public: byte _skillIndex; uint16 _attributes; /* Bits 15-10: Duration, Bits 9-4: Type, Bits 3-0: Kind */ - uint16 M67_spellKind() { return _attributes & 0xF; } // @ M67_SPELL_KIND - uint16 M68_spellType() { return (_attributes >> 4) & 0x3F; } // @ M68_SPELL_TYPE - uint16 M69_spellDurration() { return (_attributes >> 10) & 0x3F; } // @ M69_SPELL_DURATION + uint16 getKind() { return _attributes & 0xF; } // @ M67_SPELL_KIND + uint16 getType() { return (_attributes >> 4) & 0x3F; } // @ M68_SPELL_TYPE + uint16 getDuration() { return (_attributes >> 10) & 0x3F; } // @ M69_SPELL_DURATION }; // @ SPELL class ChampionMan { DMEngine *_vm; - uint16 M27_getChampionPortraitX(uint16 index); // @ M27_PORTRAIT_X - uint16 M28_getChampionPortraitY(uint16 index); // @ M28_PORTRAIT_Y + uint16 getChampionPortraitX(uint16 index); // @ M27_PORTRAIT_X + uint16 getChampionPortraitY(uint16 index); // @ M28_PORTRAIT_Y - int16 f279_getDecodedValue(char *string, uint16 characterCount); // @ F0279_CHAMPION_GetDecodedValue - void f289_drawHealthOrStaminaOrManaValue(int16 posy, int16 currVal, int16 maxVal); // @ F0289_CHAMPION_DrawHealthOrStaminaOrManaValue - uint16 M70_handSlotIndex(uint16 slotBoxIndex);// @ M70_HAND_SLOT_INDEX - int16 _g410_championPendingWounds[4]; // @ G0410_ai_ChampionPendingWounds - int16 _g409_championPendingDamage[4]; // @ G0409_ai_ChampionPendingDamage + int16 getDecodedValue(char *string, uint16 characterCount); // @ F0279_CHAMPION_GetDecodedValue + void drawHealthOrStaminaOrManaValue(int16 posy, int16 currVal, int16 maxVal); // @ F0289_CHAMPION_DrawHealthOrStaminaOrManaValue + uint16 getHandSlotIndex(uint16 slotBoxIndex);// @ M70_HAND_SLOT_INDEX + int16 _championPendingWounds[4]; // @ G0410_ai_ChampionPendingWounds + int16 _championPendingDamage[4]; // @ G0409_ai_ChampionPendingDamage void initConstants(); public: - Champion _gK71_champions[4]; // @ K0071_as_Champions - uint16 _g305_partyChampionCount; // @ G0305_ui_PartyChampionCount - bool _g303_partyDead; // @ G0303_B_PartyDead - Thing _g414_leaderHandObject; // @ G0414_T_LeaderHandObject - ChampionIndex _g411_leaderIndex; // @ G0411_i_LeaderIndex - uint16 _g299_candidateChampionOrdinal; // @ G0299_ui_CandidateChampionOrdinal - bool _g300_partyIsSleeping; // @ G0300_B_PartyIsSleeping - uint16 _g506_actingChampionOrdinal; // @ G0506_ui_ActingChampionOrdinal - IconIndice _g413_leaderHandObjectIconIndex; // @ G0413_i_LeaderHandObjectIconIndex - bool _g415_leaderEmptyHanded; // @ G0415_B_LeaderEmptyHanded - Party _g407_party; // @ G0407_s_Party - ChampionIndex _g514_magicCasterChampionIndex; // @ G0514_i_MagicCasterChampionIndex - bool _g420_mousePointerHiddenToDrawChangedObjIconOnScreen; // @ G0420_B_MousePointerHiddenToDrawChangedObjectIconOnScreen + Champion _champions[4]; // @ K0071_as_Champions + uint16 _partyChampionCount; // @ G0305_ui_PartyChampionCount + bool _partyDead; // @ G0303_B_PartyDead + Thing _leaderHandObject; // @ G0414_T_LeaderHandObject + ChampionIndex _leaderIndex; // @ G0411_i_LeaderIndex + uint16 _candidateChampionOrdinal; // @ G0299_ui_CandidateChampionOrdinal + bool _partyIsSleeping; // @ G0300_B_PartyIsSleeping + uint16 _actingChampionOrdinal; // @ G0506_ui_ActingChampionOrdinal + IconIndice _leaderHandObjectIconIndex; // @ G0413_i_LeaderHandObjectIconIndex + bool _leaderEmptyHanded; // @ G0415_B_LeaderEmptyHanded + Party _party; // @ G0407_s_Party + ChampionIndex _magicCasterChampionIndex; // @ G0514_i_MagicCasterChampionIndex + bool _mousePointerHiddenToDrawChangedObjIconOnScreen; // @ G0420_B_MousePointerHiddenToDrawChangedObjectIconOnScreen explicit ChampionMan(DMEngine *vm); - ChampionIndex f285_getIndexInCell(int16 cell); // @ F0285_CHAMPION_GetIndexInCell - bool f329_isLeaderHandObjectThrown(int16 side); // @ F0329_CHAMPION_IsLeaderHandObjectThrown - bool f328_isObjectThrown(uint16 champIndex, int16 slotIndex, int16 side); // @ F0328_CHAMPION_IsObjectThrown - void f278_resetDataToStartGame(); // @ F0278_CHAMPION_ResetDataToStartGame - void f280_addCandidateChampionToParty(uint16 championPortraitIndex); // @ F0280_CHAMPION_AddCandidateChampionToParty - void f287_drawChampionBarGraphs(ChampionIndex champIndex); // @ F0287_CHAMPION_DrawBarGraphs - uint16 f306_getStaminaAdjustedValue(Champion *champ, int16 val); // @ F0306_CHAMPION_GetStaminaAdjustedValue - uint16 f309_getMaximumLoad(Champion *champ); // @ F0309_CHAMPION_GetMaximumLoad - void f292_drawChampionState(ChampionIndex champIndex); // @ F0292_CHAMPION_DrawState - uint16 M26_championIconIndex(int16 val, Direction dir); // @ M26_CHAMPION_ICON_INDEX - void f290_drawHealthStaminaManaValues(Champion *champ); // @ F0290_CHAMPION_DrawHealthStaminaManaValues - void f291_drawSlot(uint16 champIndex, int16 slotIndex); // @ F0291_CHAMPION_DrawSlot - void f281_renameChampion(Champion* champ); // @ F0281_CHAMPION_Rename - uint16 f303_getSkillLevel(int16 champIndex, uint16 skillIndex);// @ F0303_CHAMPION_GetSkillLevel - Common::String f288_getStringFromInteger(uint16 val, bool padding, uint16 paddingCharCount); // @ F0288_CHAMPION_GetStringFromInteger - void f299_applyModifiersToStatistics(Champion *champ, int16 slotIndex, int16 iconIndex, + ChampionIndex getIndexInCell(int16 cell); // @ F0285_CHAMPION_GetIndexInCell + bool isLeaderHandObjectThrown(int16 side); // @ F0329_CHAMPION_IsLeaderHandObjectThrown + bool isObjectThrown(uint16 champIndex, int16 slotIndex, int16 side); // @ F0328_CHAMPION_IsObjectThrown + void resetDataToStartGame(); // @ F0278_CHAMPION_ResetDataToStartGame + void addCandidateChampionToParty(uint16 championPortraitIndex); // @ F0280_CHAMPION_AddCandidateChampionToParty + void drawChampionBarGraphs(ChampionIndex champIndex); // @ F0287_CHAMPION_DrawBarGraphs + uint16 getStaminaAdjustedValue(Champion *champ, int16 val); // @ F0306_CHAMPION_GetStaminaAdjustedValue + uint16 getMaximumLoad(Champion *champ); // @ F0309_CHAMPION_GetMaximumLoad + void drawChampionState(ChampionIndex champIndex); // @ F0292_CHAMPION_DrawState + uint16 getChampionIconIndex(int16 val, Direction dir); // @ M26_CHAMPION_ICON_INDEX + void drawHealthStaminaManaValues(Champion *champ); // @ F0290_CHAMPION_DrawHealthStaminaManaValues + void drawSlot(uint16 champIndex, int16 slotIndex); // @ F0291_CHAMPION_DrawSlot + void renameChampion(Champion* champ); // @ F0281_CHAMPION_Rename + uint16 getSkillLevel(int16 champIndex, uint16 skillIndex);// @ F0303_CHAMPION_GetSkillLevel + Common::String getStringFromInteger(uint16 val, bool padding, uint16 paddingCharCount); // @ F0288_CHAMPION_GetStringFromInteger + void applyModifiersToStatistics(Champion *champ, int16 slotIndex, int16 iconIndex, int16 modifierFactor, Thing thing); // @ F0299_CHAMPION_ApplyObjectModifiersToStatistics - bool f295_hasObjectIconInSlotBoxChanged(int16 slotBoxIndex, Thing thing); // @ F0295_CHAMPION_HasObjectIconInSlotBoxChanged - void f296_drawChangedObjectIcons(); // @ F0296_CHAMPION_DrawChangedObjectIcons - void f301_addObjectInSlot(ChampionIndex champIndex, Thing thing, ChampionSlot slotIndex); // @ F0301_CHAMPION_AddObjectInSlot - int16 f315_getScentOrdinal(int16 mapX, int16 mapY); // @ F0315_CHAMPION_GetScentOrdinal - Thing f298_getObjectRemovedFromLeaderHand(); // @ F0298_CHAMPION_GetObjectRemovedFromLeaderHand - uint16 f312_getStrength(int16 champIndex, int16 slotIndex); // @ F0312_CHAMPION_GetStrength - Thing f300_getObjectRemovedFromSlot(uint16 champIndex, uint16 slotIndex); // @ F0300_CHAMPION_GetObjectRemovedFromSlot - void f325_decrementStamina(int16 championIndex, int16 decrement); // @ F0325_CHAMPION_DecrementStamina - int16 f321_addPendingDamageAndWounds_getDamage(int16 champIndex, int16 attack, int16 allowedWounds, + bool hasObjectIconInSlotBoxChanged(int16 slotBoxIndex, Thing thing); // @ F0295_CHAMPION_HasObjectIconInSlotBoxChanged + void drawChangedObjectIcons(); // @ F0296_CHAMPION_DrawChangedObjectIcons + void addObjectInSlot(ChampionIndex champIndex, Thing thing, ChampionSlot slotIndex); // @ F0301_CHAMPION_AddObjectInSlot + int16 getScentOrdinal(int16 mapX, int16 mapY); // @ F0315_CHAMPION_GetScentOrdinal + Thing getObjectRemovedFromLeaderHand(); // @ F0298_CHAMPION_GetObjectRemovedFromLeaderHand + uint16 getStrength(int16 champIndex, int16 slotIndex); // @ F0312_CHAMPION_GetStrength + Thing getObjectRemovedFromSlot(uint16 champIndex, uint16 slotIndex); // @ F0300_CHAMPION_GetObjectRemovedFromSlot + void decrementStamina(int16 championIndex, int16 decrement); // @ F0325_CHAMPION_DecrementStamina + int16 addPendingDamageAndWounds_getDamage(int16 champIndex, int16 attack, int16 allowedWounds, uint16 attackType); // @ F0321_CHAMPION_AddPendingDamageAndWounds_GetDamage - int16 f313_getWoundDefense(int16 champIndex, uint16 woundIndex); // @ F0313_CHAMPION_GetWoundDefense - uint16 f307_getStatisticAdjustedAttack(Champion *champ, uint16 statIndex, uint16 attack); // @ F0307_CHAMPION_GetStatisticAdjustedAttack - void f314_wakeUp(); // @ F0314_CHAMPION_WakeUp - int16 f305_getThrowingStaminaCost(Thing thing);// @ F0305_CHAMPION_GetThrowingStaminaCost - void f330_disableAction(uint16 champIndex, uint16 ticks); // @ F0330_CHAMPION_DisableAction - void f304_addSkillExperience(uint16 champIndex, uint16 skillIndex, uint16 exp);// @ F0304_CHAMPION_AddSkillExperience - int16 f324_damageAll_getDamagedChampionCount(uint16 attack, int16 wounds, + int16 getWoundDefense(int16 champIndex, uint16 woundIndex); // @ F0313_CHAMPION_GetWoundDefense + uint16 getStatisticAdjustedAttack(Champion *champ, uint16 statIndex, uint16 attack); // @ F0307_CHAMPION_GetStatisticAdjustedAttack + void wakeUp(); // @ F0314_CHAMPION_WakeUp + int16 getThrowingStaminaCost(Thing thing);// @ F0305_CHAMPION_GetThrowingStaminaCost + void disableAction(uint16 champIndex, uint16 ticks); // @ F0330_CHAMPION_DisableAction + void addSkillExperience(uint16 champIndex, uint16 skillIndex, uint16 exp);// @ F0304_CHAMPION_AddSkillExperience + int16 getDamagedChampionCount(uint16 attack, int16 wounds, int16 attackType); // @ F0324_CHAMPION_DamageAll_GetDamagedChampionCount - int16 f286_getTargetChampionIndex(int16 mapX, int16 mapY, uint16 cell); // @ F0286_CHAMPION_GetTargetChampionIndex - int16 f311_getDexterity(Champion *champ); // @ F0311_CHAMPION_GetDexterity - bool f308_isLucky(Champion *champ, uint16 percentage); // @ F0308_CHAMPION_IsLucky - void f322_championPoison(int16 championIndex, uint16 attack); // @ F0322_CHAMPION_Poison - void f284_setPartyDirection(int16 dir); // @ F0284_CHAMPION_SetPartyDirection - void f316_deleteScent(uint16 scentIndex); // @ F0316_CHAMPION_DeleteScent - void f317_addScentStrength(int16 mapX, int16 mapY, int32 cycleCount); // @ F0317_CHAMPION_AddScentStrength - void f297_putObjectInLeaderHand(Thing thing, bool setMousePointer); // @ F0297_CHAMPION_PutObjectInLeaderHand - int16 f310_getMovementTicks(Champion *champ); // @ F0310_CHAMPION_GetMovementTicks - bool f294_isAmmunitionCompatibleWithWeapon(uint16 champIndex, uint16 weaponSlotIndex, + int16 getTargetChampionIndex(int16 mapX, int16 mapY, uint16 cell); // @ F0286_CHAMPION_GetTargetChampionIndex + int16 getDexterity(Champion *champ); // @ F0311_CHAMPION_GetDexterity + bool isLucky(Champion *champ, uint16 percentage); // @ F0308_CHAMPION_IsLucky + void championPoison(int16 championIndex, uint16 attack); // @ F0322_CHAMPION_Poison + void setPartyDirection(int16 dir); // @ F0284_CHAMPION_SetPartyDirection + void deleteScent(uint16 scentIndex); // @ F0316_CHAMPION_DeleteScent + void addScentStrength(int16 mapX, int16 mapY, int32 cycleCount); // @ F0317_CHAMPION_AddScentStrength + void putObjectInLeaderHand(Thing thing, bool setMousePointer); // @ F0297_CHAMPION_PutObjectInLeaderHand + int16 getMovementTicks(Champion *champ); // @ F0310_CHAMPION_GetMovementTicks + bool isAmmunitionCompatibleWithWeapon(uint16 champIndex, uint16 weaponSlotIndex, uint16 ammunitionSlotIndex); // @ F0294_CHAMPION_IsAmmunitionCompatibleWithWeapon - void f293_drawAllChampionStates(); // @ F0293_CHAMPION_DrawAllChampionStates - void f283_viAltarRebirth(uint16 champIndex); // @ F0283_CHAMPION_ViAltarRebirth - void f302_processCommands28to65_clickOnSlotBox(uint16 slotBoxIndex); // @ F0302_CHAMPION_ProcessCommands28To65_ClickOnSlotBox - bool f327_isProjectileSpellCast(uint16 champIndex, Thing thing, int16 kineticEnergy, uint16 requiredManaAmount); // @ F0327_CHAMPION_IsProjectileSpellCast - void f326_championShootProjectile(Champion *champ, Thing thing, int16 kineticEnergy, + void drawAllChampionStates(); // @ F0293_CHAMPION_DrawAllChampionStates + void viAltarRebirth(uint16 champIndex); // @ F0283_CHAMPION_ViAltarRebirth + void clickOnSlotBox(uint16 slotBoxIndex); // @ F0302_CHAMPION_ProcessCommands28To65_ClickOnSlotBox + bool isProjectileSpellCast(uint16 champIndex, Thing thing, int16 kineticEnergy, uint16 requiredManaAmount); // @ F0327_CHAMPION_IsProjectileSpellCast + void championShootProjectile(Champion *champ, Thing thing, int16 kineticEnergy, int16 attack, int16 stepEnergy); // @ F0326_CHAMPION_ShootProjectile - void f320_applyAndDrawPendingDamageAndWounds(); // @ F0320_CHAMPION_ApplyAndDrawPendingDamageAndWounds - void f319_championKill(uint16 champIndex); // @ F0319_CHAMPION_Kill - void f318_dropAllObjects(uint16 champIndex); // @ F0318_CHAMPION_DropAllObjects - void f323_unpoison(int16 champIndex); // @ F0323_CHAMPION_Unpoison - void f331_applyTimeEffects(); // @ F0331_CHAMPION_ApplyTimeEffects_CPSF - void save2_PartyPart(Common::OutSaveFile *file); - void load2_PartyPart(Common::InSaveFile* file); - + void applyAndDrawPendingDamageAndWounds(); // @ F0320_CHAMPION_ApplyAndDrawPendingDamageAndWounds + void championKill(uint16 champIndex); // @ F0319_CHAMPION_Kill + void dropAllObjects(uint16 champIndex); // @ F0318_CHAMPION_DropAllObjects + void unpoison(int16 champIndex); // @ F0323_CHAMPION_Unpoison + void applyTimeEffects(); // @ F0331_CHAMPION_ApplyTimeEffects_CPSF + void savePartyPart2(Common::OutSaveFile *file); + void loadPartyPart2(Common::InSaveFile* file); Box _boxChampionIcons[4]; Color _championColor[4]; diff --git a/engines/dm/console.cpp b/engines/dm/console.cpp index 31a0e13679..a32bcb7055 100644 --- a/engines/dm/console.cpp +++ b/engines/dm/console.cpp @@ -184,7 +184,7 @@ bool Console::Cmd_map(int argc, const char** argv) { if (_vm->_g327_newPartyMapIndex == -1) _vm->_g327_newPartyMapIndex = index; _vm->_dungeonMan->f173_setCurrentMap(_vm->_g327_newPartyMapIndex); - _vm->_championMan->f284_setPartyDirection(_vm->_dungeonMan->f155_getStairsExitDirection(_vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY)); + _vm->_championMan->setPartyDirection(_vm->_dungeonMan->f155_getStairsExitDirection(_vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY)); _vm->_dungeonMan->f173_setCurrentMap(_vm->_dungeonMan->_g309_partyMapIndex); } else goto argumentError; @@ -268,7 +268,7 @@ bool Console::Cmd_gimme(int argc, const char** argv) { newThingData[thingCount * thingTypeSize + i] = newThingData[thingIndex * thingTypeSize + i]; _vm->_dungeonMan->_g278_dungeonFileHeader._thingCounts[thingType]++; _vm->_dungeonMan->_g284_thingData[thingType] = newThingData; - _vm->_championMan->f301_addObjectInSlot((ChampionIndex)0, dummyThing, (ChampionSlot)29); + _vm->_championMan->addObjectInSlot((ChampionIndex)0, dummyThing, (ChampionSlot)29); debugPrintf("Item gimmed to the first champion, last slot\n"); return true; } diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index ceb3ae5ef9..e4fa21050c 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -332,8 +332,8 @@ void DMEngine::f462_startGame() { _g334_stopPressingMouth = false; _g340_highlightBoxInversionRequested = false; _eventMan->_g341_highlightBoxEnabled = false; - _championMan->_g300_partyIsSleeping = false; - _championMan->_g506_actingChampionOrdinal = M0_indexToOrdinal(kM1_ChampionNone); + _championMan->_partyIsSleeping = false; + _championMan->_actingChampionOrdinal = M0_indexToOrdinal(kM1_ChampionNone); _menuMan->_g509_actionAreaContainsIcons = true; _eventMan->_g599_useChampionIconOrdinalAsMousePointerBitmap = M0_indexToOrdinal(kM1_ChampionNone); @@ -360,7 +360,7 @@ void DMEngine::f462_startGame() { _displayMan->f508_buildPaletteChangeCopperList(_displayMan->_palDungeonView[0], _displayMan->_g347_paletteTopAndBottomScreen); _menuMan->f395_drawMovementArrows(); - _championMan->f278_resetDataToStartGame(); + _championMan->resetDataToStartGame(); _g301_gameTimeTicking = true; } @@ -402,7 +402,7 @@ Common::Error DMEngine::run() { return Common::kNoError; if (_loadSaveSlotAtRuntime == -1) - f444_endGame(_championMan->_g303_partyDead); + f444_endGame(_championMan->_partyDead); else { loadGameState(_loadSaveSlotAtRuntime); _menuMan->f457_drawEnabledMenus(); @@ -424,8 +424,8 @@ void DMEngine::f2_gameloop() { } // DEBUG CODE - for (int16 i = 0; i < _championMan->_g305_partyChampionCount; ++i) { - Champion &champ = _championMan->_gK71_champions[i]; + for (int16 i = 0; i < _championMan->_partyChampionCount; ++i) { + Champion &champ = _championMan->_champions[i]; if (_console->_debugGodmodeHP) champ._currHealth = champ._maxHealth; if (_console->_debugGodmodeMana) @@ -449,7 +449,7 @@ void DMEngine::f2_gameloop() { break; } - if (!_inventoryMan->_g432_inventoryChampionOrdinal && !_championMan->_g300_partyIsSleeping) { + if (!_inventoryMan->_g432_inventoryChampionOrdinal && !_championMan->_partyIsSleeping) { Box box(0, 223, 0, 135); _displayMan->f135_fillBoxBitmap(_displayMan->_g296_bitmapViewport, box, k0_ColorBlack, k112_byteWidthViewport, k136_heightViewport); // (possibly dummy code) _displayMan->f128_drawDungeon(_dungeonMan->_g308_partyDir, _dungeonMan->_g306_partyMapX, _dungeonMan->_g307_partyMapY); @@ -469,8 +469,8 @@ void DMEngine::f2_gameloop() { } _eventMan->f363_highlightBoxDisable(); _sound->f65_playPendingSound(); - _championMan->f320_applyAndDrawPendingDamageAndWounds(); - if (_championMan->_g303_partyDead) + _championMan->applyAndDrawPendingDamageAndWounds(); + if (_championMan->_partyDead) break; _g313_gameTime++; @@ -478,13 +478,13 @@ void DMEngine::f2_gameloop() { if (!(_g313_gameTime & 511)) _inventoryMan->f338_decreaseTorchesLightPower(); - if (_championMan->_g407_party._freezeLifeTicks) - _championMan->_g407_party._freezeLifeTicks -= 1; + if (_championMan->_party._freezeLifeTicks) + _championMan->_party._freezeLifeTicks -= 1; _menuMan->f390_refreshActionAreaAndSetChampDirMaxDamageReceived(); - if (!(_g313_gameTime & (_championMan->_g300_partyIsSleeping ? 15 : 63))) - _championMan->f331_applyTimeEffects(); + if (!(_g313_gameTime & (_championMan->_partyIsSleeping ? 15 : 63))) + _championMan->applyTimeEffects(); if (_g310_disabledMovementTicks) _g310_disabledMovementTicks--; @@ -661,9 +661,9 @@ void DMEngine::f444_endGame(bool doNotDrawCreditsOnly) { if (_g302_gameWon) { // Strangerke: Related to portraits. Game data could be missing for earlier versions of the game. _displayMan->fillScreen(k12_ColorDarkestGray); - for (int16 championIndex = k0_ChampionFirst; championIndex < _championMan->_g305_partyChampionCount; championIndex++) { + for (int16 championIndex = k0_ChampionFirst; championIndex < _championMan->_partyChampionCount; championIndex++) { int16 textPosY = championIndex * 48; - Champion *curChampion = &_championMan->_gK71_champions[championIndex]; + Champion *curChampion = &_championMan->_champions[championIndex]; _displayMan->f21_blitToScreen(_displayMan->f489_getNativeBitmapOrGraphic(k208_wallOrn_43_champMirror), &championMirrorBox, k32_byteWidth, k10_ColorFlesh, 43); _displayMan->f21_blitToScreen(curChampion->_portrait, &championPortraitBox, k16_byteWidth, k1_ColorDarkGary, 29); _textMan->f443_endgamePrintString(87, textPosY += 14, k9_ColorGold, curChampion->_name); @@ -674,7 +674,7 @@ void DMEngine::f444_endGame(bool doNotDrawCreditsOnly) { _textMan->f443_endgamePrintString(textPosX, textPosY++, k9_ColorGold, curChampion->_title); for (int16 idx = k0_ChampionSkillFighter; idx <= k3_ChampionSkillWizard; idx++) { - uint16 skillLevel = MIN<uint16>(16, _championMan->f303_getSkillLevel(championIndex, idx | (k0x4000_IgnoreObjectModifiers | k0x8000_IgnoreTemporaryExperience))); + uint16 skillLevel = MIN<uint16>(16, _championMan->getSkillLevel(championIndex, idx | (k0x4000_IgnoreObjectModifiers | k0x8000_IgnoreTemporaryExperience))); if (skillLevel == 1) continue; @@ -964,9 +964,9 @@ void DMEngine::f446_STARTEND_fuseSequnce() { _inventoryMan->f355_toggleInventory(k4_ChampionCloseInventory); } _eventMan->f363_highlightBoxDisable(); - _championMan->_g407_party._magicalLightAmount = 200; + _championMan->_party._magicalLightAmount = 200; _inventoryMan->f337_setDungeonViewPalette(); - _championMan->_g407_party._fireShieldDefense = _championMan->_g407_party._spellShieldDefense = _championMan->_g407_party._shieldDefense = 100; + _championMan->_party._fireShieldDefense = _championMan->_party._spellShieldDefense = _championMan->_party._shieldDefense = 100; _timeline->f260_timelineRefreshAllChampionStatusBoxes(); f445_STARTEND_fuseSequenceUpdate(); L1431_i_LordChaosMapX = _dungeonMan->_g306_partyMapX; diff --git a/engines/dm/dungeonman.cpp b/engines/dm/dungeonman.cpp index 287c454456..f9d649a858 100644 --- a/engines/dm/dungeonman.cpp +++ b/engines/dm/dungeonman.cpp @@ -949,7 +949,7 @@ T0172010_ClosedFakeWall: curThing = f159_getNextThing(curThing); } - if (AL0307_uc_FootprintsAllowed && (AL0307_uc_ScentOrdinal = _vm->_championMan->f315_getScentOrdinal(mapX, mapY)) && (--AL0307_uc_ScentOrdinal >= _vm->_championMan->_g407_party._firstScentIndex) && (AL0307_uc_ScentOrdinal < _vm->_championMan->_g407_party._lastScentIndex)) + if (AL0307_uc_FootprintsAllowed && (AL0307_uc_ScentOrdinal = _vm->_championMan->getScentOrdinal(mapX, mapY)) && (--AL0307_uc_ScentOrdinal >= _vm->_championMan->_party._firstScentIndex) && (AL0307_uc_ScentOrdinal < _vm->_championMan->_party._lastScentIndex)) setFlag(aspectArray[k4_FloorOrnOrdAspect], k0x8000_FootprintsAspect); break; @@ -973,7 +973,7 @@ T0172010_ClosedFakeWall: while ((curThing != Thing::_endOfList) && (curThing.getType() <= k3_SensorThingType)) curThing = f159_getNextThing(curThing); - if (AL0307_uc_FootprintsAllowed && (AL0307_uc_ScentOrdinal = _vm->_championMan->f315_getScentOrdinal(mapX, mapY)) && (--AL0307_uc_ScentOrdinal >= _vm->_championMan->_g407_party._firstScentIndex) && (AL0307_uc_ScentOrdinal < _vm->_championMan->_g407_party._lastScentIndex)) + if (AL0307_uc_FootprintsAllowed && (AL0307_uc_ScentOrdinal = _vm->_championMan->getScentOrdinal(mapX, mapY)) && (--AL0307_uc_ScentOrdinal >= _vm->_championMan->_party._firstScentIndex) && (AL0307_uc_ScentOrdinal < _vm->_championMan->_party._lastScentIndex)) setFlag(aspectArray[k4_FloorOrnOrdAspect], k0x8000_FootprintsAspect); break; } diff --git a/engines/dm/eventman.cpp b/engines/dm/eventman.cpp index 8ad7971fe2..c152876909 100644 --- a/engines/dm/eventman.cpp +++ b/engines/dm/eventman.cpp @@ -533,7 +533,7 @@ void EventManager::f73_buildpointerScreenArea(int16 mousePosX, int16 mousePosY) else if (mousePosY <= 28) { uint16 championIdx = mousePosX / 69; uint16 xOverChampionStatusBox = mousePosX % 69; - if (championIdx >= _vm->_championMan->_g305_partyChampionCount) + if (championIdx >= _vm->_championMan->_partyChampionCount) _gK104_mousePointerType = k4_pointerTypeAutoselect; else if (xOverChampionStatusBox > 42) _gK104_mousePointerType = k4_pointerTypeAutoselect; @@ -576,8 +576,8 @@ void EventManager::f73_buildpointerScreenArea(int16 mousePosX, int16 mousePosY) } void EventManager::f69_setMousePointer() { - if (_vm->_championMan->_g415_leaderEmptyHanded) - f67_setMousePointerToNormal((_vm->_championMan->_g411_leaderIndex == kM1_ChampionNone) ? k0_pointerArrow : k1_pointerHand); + if (_vm->_championMan->_leaderEmptyHanded) + f67_setMousePointerToNormal((_vm->_championMan->_leaderIndex == kM1_ChampionNone) ? k0_pointerArrow : k1_pointerHand); else f68_setPointerToObject(_vm->_objectMan->_g412_objectIconForMousePointer); } @@ -750,7 +750,7 @@ void EventManager::f380_processCommandQueue() { if ((cmdType >= k12_CommandClickInChampion_0_StatusBox) && (cmdType <= k15_CommandClickInChampion_3_StatusBox)) { int16 championIdx = cmdType - k12_CommandClickInChampion_0_StatusBox; - if ((championIdx < _vm->_championMan->_g305_partyChampionCount) && !_vm->_championMan->_g299_candidateChampionOrdinal) + if ((championIdx < _vm->_championMan->_partyChampionCount) && !_vm->_championMan->_candidateChampionOrdinal) f367_commandProcessTypes12to27_clickInChampionStatusBox(championIdx, commandX, commandY); return; @@ -763,8 +763,8 @@ void EventManager::f380_processCommandQueue() { } if ((cmdType >= k28_CommandClickOnSlotBoxInventoryReadyHand) && (cmdType < (k65_CommandClickOnSlotBoxChest_8 + 1))) { - if (_vm->_championMan->_g411_leaderIndex != kM1_ChampionNone) - _vm->_championMan->f302_processCommands28to65_clickOnSlotBox(cmdType - k20_CommandClickOnSlotBoxChampion_0_StatusBoxReadyHand); + if (_vm->_championMan->_leaderIndex != kM1_ChampionNone) + _vm->_championMan->clickOnSlotBox(cmdType - k20_CommandClickOnSlotBoxChampion_0_StatusBoxReadyHand); return; } @@ -779,28 +779,28 @@ void EventManager::f380_processCommandQueue() { } int16 championIndex = cmdType - k7_CommandToggleInventoryChampion_0; - if (((championIndex == k4_ChampionCloseInventory) || (championIndex < _vm->_championMan->_g305_partyChampionCount)) && !_vm->_championMan->_g299_candidateChampionOrdinal) + if (((championIndex == k4_ChampionCloseInventory) || (championIndex < _vm->_championMan->_partyChampionCount)) && !_vm->_championMan->_candidateChampionOrdinal) _vm->_inventoryMan->f355_toggleInventory((ChampionIndex)championIndex); return; } if (cmdType == k83_CommandToggleInventoryLeader) { - if (_vm->_championMan->_g411_leaderIndex != kM1_ChampionNone) - _vm->_inventoryMan->f355_toggleInventory(_vm->_championMan->_g411_leaderIndex); + if (_vm->_championMan->_leaderIndex != kM1_ChampionNone) + _vm->_inventoryMan->f355_toggleInventory(_vm->_championMan->_leaderIndex); return; } if (cmdType == k100_CommandClickInSpellArea) { - if ((!_vm->_championMan->_g299_candidateChampionOrdinal) && (_vm->_championMan->_g514_magicCasterChampionIndex != kM1_ChampionNone)) + if ((!_vm->_championMan->_candidateChampionOrdinal) && (_vm->_championMan->_magicCasterChampionIndex != kM1_ChampionNone)) f370_commandProcessType100_clickInSpellArea(commandX, commandY); return; } if (cmdType == k111_CommandClickInActionArea) { - if (!_vm->_championMan->_g299_candidateChampionOrdinal) + if (!_vm->_championMan->_candidateChampionOrdinal) f371_commandProcessType111To115_ClickInActionArea(commandX, commandY); return; @@ -829,12 +829,12 @@ void EventManager::f380_processCommandQueue() { return; if (cmdType == k145_CommandSleep) { - if (!_vm->_championMan->_g299_candidateChampionOrdinal) { + if (!_vm->_championMan->_candidateChampionOrdinal) { if (_vm->_inventoryMan->_g432_inventoryChampionOrdinal) _vm->_inventoryMan->f355_toggleInventory(k4_ChampionCloseInventory); _vm->_menuMan->f456_drawDisabledMenu(); - _vm->_championMan->_g300_partyIsSleeping = true; + _vm->_championMan->_partyIsSleeping = true; f379_drawSleepScreen(); _vm->_displayMan->f97_drawViewport(k2_viewportAsBeforeSleepOrFreezeGame); _vm->_g318_waitForInputMaxVerticalBlankCount = 0; @@ -848,12 +848,12 @@ void EventManager::f380_processCommandQueue() { } if (cmdType == k146_CommandWakeUp) { - _vm->_championMan->f314_wakeUp(); + _vm->_championMan->wakeUp(); return; } if (cmdType == k140_CommandSaveGame) { - if ((_vm->_championMan->_g305_partyChampionCount > 0) && !_vm->_championMan->_g299_candidateChampionOrdinal) + if ((_vm->_championMan->_partyChampionCount > 0) && !_vm->_championMan->_candidateChampionOrdinal) _vm->f433_processCommand140_saveGame(); return; @@ -941,7 +941,7 @@ void EventManager::f365_commandTurnParty(CommandType cmdType) { } _vm->_moveSens->f276_sensorProcessThingAdditionOrRemoval(_vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, Thing::_party, true, false); - _vm->_championMan->f284_setPartyDirection(M21_normalizeModulo4(_vm->_dungeonMan->_g308_partyDir + ((cmdType == k2_CommandTurnRight) ? 1 : 3))); + _vm->_championMan->setPartyDirection(M21_normalizeModulo4(_vm->_dungeonMan->_g308_partyDir + ((cmdType == k2_CommandTurnRight) ? 1 : 3))); _vm->_moveSens->f276_sensorProcessThingAdditionOrRemoval(_vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, Thing::_party, true, true); } @@ -969,9 +969,9 @@ void EventManager::f366_commandMoveParty(CommandType cmdType) { }; _vm->_g321_stopWaitingForPlayerInput = true; - Champion *championsPtr = _vm->_championMan->_gK71_champions; - for (uint16 idx = k0_ChampionFirst; idx < _vm->_championMan->_g305_partyChampionCount; idx++) { - _vm->_championMan->f325_decrementStamina(idx, ((championsPtr->_load * 3) / _vm->_championMan->f309_getMaximumLoad(championsPtr)) + 1); /* BUG0_50 When a champion is brought back to life at a Vi Altar, his current stamina is lower than what it was before dying. Each time the party moves the current stamina of all champions is decreased, including for dead champions, by an amount that depends on the current load of the champion. For a dead champion the load before he died is used */ + Champion *championsPtr = _vm->_championMan->_champions; + for (uint16 idx = k0_ChampionFirst; idx < _vm->_championMan->_partyChampionCount; idx++) { + _vm->_championMan->decrementStamina(idx, ((championsPtr->_load * 3) / _vm->_championMan->getMaximumLoad(championsPtr)) + 1); /* BUG0_50 When a champion is brought back to life at a Vi Altar, his current stamina is lower than what it was before dying. Each time the party moves the current stamina of all champions is decreased, including for dead champions, by an amount that depends on the current load of the champion. For a dead champion the load before he died is used */ championsPtr++; } uint16 movementArrowIdx = cmdType - k3_CommandMoveForward; @@ -1004,14 +1004,14 @@ void EventManager::f366_commandMoveParty(CommandType cmdType) { } else if (partySquareType == k6_ElementTypeFakeWall) isMovementBlocked = (!getFlag(AL1115_ui_Square, k0x0004_FakeWallOpen) && !getFlag(AL1115_ui_Square, k0x0001_FakeWallImaginary)); - if (_vm->_championMan->_g305_partyChampionCount) { + if (_vm->_championMan->_partyChampionCount) { if (isMovementBlocked) { movementArrowIdx += (_vm->_dungeonMan->_g308_partyDir + 2); - int16 L1124_i_FirstDamagedChampionIndex = _vm->_championMan->f286_getTargetChampionIndex(partyMapX, partyMapY, M21_normalizeModulo4(movementArrowIdx)); - int16 L1125_i_SecondDamagedChampionIndex = _vm->_championMan->f286_getTargetChampionIndex(partyMapX, partyMapY, returnNextVal(movementArrowIdx)); - int16 damage = _vm->_championMan->f321_addPendingDamageAndWounds_getDamage(L1124_i_FirstDamagedChampionIndex, 1, k0x0008_ChampionWoundTorso | k0x0010_ChampionWoundLegs, k2_attackType_SELF); + int16 L1124_i_FirstDamagedChampionIndex = _vm->_championMan->getTargetChampionIndex(partyMapX, partyMapY, M21_normalizeModulo4(movementArrowIdx)); + int16 L1125_i_SecondDamagedChampionIndex = _vm->_championMan->getTargetChampionIndex(partyMapX, partyMapY, returnNextVal(movementArrowIdx)); + int16 damage = _vm->_championMan->addPendingDamageAndWounds_getDamage(L1124_i_FirstDamagedChampionIndex, 1, k0x0008_ChampionWoundTorso | k0x0010_ChampionWoundLegs, k2_attackType_SELF); if (L1124_i_FirstDamagedChampionIndex != L1125_i_SecondDamagedChampionIndex) - damage |= _vm->_championMan->f321_addPendingDamageAndWounds_getDamage(L1125_i_SecondDamagedChampionIndex, 1, k0x0008_ChampionWoundTorso | k0x0010_ChampionWoundLegs, k2_attackType_SELF); + damage |= _vm->_championMan->addPendingDamageAndWounds_getDamage(L1125_i_SecondDamagedChampionIndex, 1, k0x0008_ChampionWoundTorso | k0x0010_ChampionWoundLegs, k2_attackType_SELF); if (damage) _vm->_sound->f064_SOUND_RequestPlay_CPSD(k18_soundPARTY_DAMAGED, partyMapX, partyMapY, k0_soundModePlayImmediately); @@ -1035,10 +1035,10 @@ void EventManager::f366_commandMoveParty(CommandType cmdType) { _vm->_moveSens->f267_getMoveResult(Thing::_party, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, partyMapX, partyMapY); uint16 disabledMovtTicks = 1; - championsPtr = _vm->_championMan->_gK71_champions; - for (uint16 idx = k0_ChampionFirst; idx < _vm->_championMan->_g305_partyChampionCount; idx++) { + championsPtr = _vm->_championMan->_champions; + for (uint16 idx = k0_ChampionFirst; idx < _vm->_championMan->_partyChampionCount; idx++) { if (championsPtr->_currHealth) - disabledMovtTicks = MAX((int32)disabledMovtTicks, (int32)_vm->_championMan->f310_getMovementTicks(championsPtr)); + disabledMovtTicks = MAX((int32)disabledMovtTicks, (int32)_vm->_championMan->getMovementTicks(championsPtr)); championsPtr++; } @@ -1062,7 +1062,7 @@ bool EventManager::f375_processType80_clickDungeonView_isLeaderHandObjThrown(int return false; // Strangerke: Only present in CSB2.1... But it fixes a bug so we keep it - objectThrownFl = _vm->_championMan->f329_isLeaderHandObjectThrown(k0_sideLeft); + objectThrownFl = _vm->_championMan->isLeaderHandObjectThrown(k0_sideLeft); } else { if (_vm->_dungeonMan->_g285_squareAheadElement == k17_ElementTypeDoorFront) { if (posX > 163) @@ -1070,7 +1070,7 @@ bool EventManager::f375_processType80_clickDungeonView_isLeaderHandObjThrown(int } else if (posX > 191) return false; - objectThrownFl = _vm->_championMan->f329_isLeaderHandObjectThrown(k1_sideRight); + objectThrownFl = _vm->_championMan->isLeaderHandObjectThrown(k1_sideRight); } if (objectThrownFl) @@ -1105,29 +1105,29 @@ void EventManager::f368_commandSetLeader(ChampionIndex champIndex) { ChampionMan &cm = *_vm->_championMan; ChampionIndex leaderIndex; - if ((cm._g411_leaderIndex == champIndex) || ((champIndex != kM1_ChampionNone) && !cm._gK71_champions[champIndex]._currHealth)) + if ((cm._leaderIndex == champIndex) || ((champIndex != kM1_ChampionNone) && !cm._champions[champIndex]._currHealth)) return; - if (cm._g411_leaderIndex != kM1_ChampionNone) { - leaderIndex = cm._g411_leaderIndex; - cm._gK71_champions[leaderIndex].setAttributeFlag(k0x0200_ChampionAttributeLoad, true); - cm._gK71_champions[leaderIndex].setAttributeFlag(k0x0080_ChampionAttributeNameTitle, true); - cm._gK71_champions[leaderIndex]._load -= _vm->_dungeonMan->f140_getObjectWeight(cm._g414_leaderHandObject); - cm._g411_leaderIndex = kM1_ChampionNone; - cm.f292_drawChampionState(leaderIndex); + if (cm._leaderIndex != kM1_ChampionNone) { + leaderIndex = cm._leaderIndex; + cm._champions[leaderIndex].setAttributeFlag(k0x0200_ChampionAttributeLoad, true); + cm._champions[leaderIndex].setAttributeFlag(k0x0080_ChampionAttributeNameTitle, true); + cm._champions[leaderIndex]._load -= _vm->_dungeonMan->f140_getObjectWeight(cm._leaderHandObject); + cm._leaderIndex = kM1_ChampionNone; + cm.drawChampionState(leaderIndex); } if (champIndex == kM1_ChampionNone) { - cm._g411_leaderIndex = kM1_ChampionNone; + cm._leaderIndex = kM1_ChampionNone; return; } - cm._g411_leaderIndex = champIndex; - Champion *champion = &cm._gK71_champions[cm._g411_leaderIndex]; + cm._leaderIndex = champIndex; + Champion *champion = &cm._champions[cm._leaderIndex]; champion->_dir = _vm->_dungeonMan->_g308_partyDir; - cm._gK71_champions[champIndex]._load += _vm->_dungeonMan->f140_getObjectWeight(cm._g414_leaderHandObject); - if (_vm->M0_indexToOrdinal(champIndex) != cm._g299_candidateChampionOrdinal) { + cm._champions[champIndex]._load += _vm->_dungeonMan->f140_getObjectWeight(cm._leaderHandObject); + if (_vm->M0_indexToOrdinal(champIndex) != cm._candidateChampionOrdinal) { champion->setAttributeFlag(k0x0400_ChampionAttributeIcon, true); champion->setAttributeFlag(k0x0080_ChampionAttributeNameTitle, true); - cm.f292_drawChampionState(champIndex); + cm.drawChampionState(champIndex); } } @@ -1150,13 +1150,13 @@ void EventManager::f377_commandProcessType80ClickInDungeonView(int16 posX, int16 }; if (_vm->_dungeonMan->_g285_squareAheadElement == k17_ElementTypeDoorFront) { - if (_vm->_championMan->_g411_leaderIndex == kM1_ChampionNone) + if (_vm->_championMan->_leaderIndex == kM1_ChampionNone) return; int16 L1155_i_MapX = _vm->_dungeonMan->_g306_partyMapX + _vm->_dirIntoStepCountEast[_vm->_dungeonMan->_g308_partyDir]; int16 L1156_i_MapY = _vm->_dungeonMan->_g307_partyMapY + _vm->_dirIntoStepCountNorth[_vm->_dungeonMan->_g308_partyDir]; - if (_vm->_championMan->_g415_leaderEmptyHanded) { + if (_vm->_championMan->_leaderEmptyHanded) { Junk *junkPtr = (Junk*)_vm->_dungeonMan->f157_getSquareFirstThingData(L1155_i_MapX, L1156_i_MapY); if ((((Door*)junkPtr)->hasButton()) && _vm->_dungeonMan->_g291_dungeonViewClickableBoxes[k5_ViewCellDoorButtonOrWallOrn].isPointInside(posX, posY - 33)) { _vm->_g321_stopWaitingForPlayerInput = true; @@ -1168,7 +1168,7 @@ void EventManager::f377_commandProcessType80ClickInDungeonView(int16 posX, int16 return; } - if (_vm->_championMan->_g415_leaderEmptyHanded) { + if (_vm->_championMan->_leaderEmptyHanded) { for (uint16 currViewCell = k0_ViewCellFronLeft; currViewCell < k5_ViewCellDoorButtonOrWallOrn + 1; currViewCell++) { if (_vm->_dungeonMan->_g291_dungeonViewClickableBoxes[currViewCell].isPointInside(posX, posY - 33)) { if (currViewCell == k5_ViewCellDoorButtonOrWallOrn) { @@ -1181,7 +1181,7 @@ void EventManager::f377_commandProcessType80ClickInDungeonView(int16 posX, int16 } } } else { - Thing thingHandObject = _vm->_championMan->_g414_leaderHandObject; + Thing thingHandObject = _vm->_championMan->_leaderHandObject; Junk *junkPtr = (Junk*)_vm->_dungeonMan->f156_getThingData(thingHandObject); if (_vm->_dungeonMan->_g285_squareAheadElement == k0_ElementTypeWall) { for (uint16 currViewCell = k0_ViewCellFronLeft; currViewCell < k1_ViewCellFrontRight + 1; currViewCell++) { @@ -1205,8 +1205,8 @@ void EventManager::f377_commandProcessType80ClickInDungeonView(int16 posX, int16 f372_commandProcessType80ClickInDungeonViewTouchFrontWall(); return; } - _vm->_championMan->f296_drawChangedObjectIcons(); - _vm->_championMan->_gK71_champions[_vm->_championMan->_g411_leaderIndex]._load += _vm->_dungeonMan->f140_getObjectWeight(thingHandObject) - weight; + _vm->_championMan->drawChangedObjectIcons(); + _vm->_championMan->_champions[_vm->_championMan->_leaderIndex]._load += _vm->_dungeonMan->f140_getObjectWeight(thingHandObject) - weight; } f372_commandProcessType80ClickInDungeonViewTouchFrontWall(); } @@ -1231,15 +1231,15 @@ void EventManager::f282_commandProcessCommands160To162ClickInResurrectReincarnat DisplayMan &dispMan = *_vm->_displayMan; DungeonMan &dunMan = *_vm->_dungeonMan; - uint16 championIndex = champMan._g305_partyChampionCount - 1; - Champion *champ = &champMan._gK71_champions[championIndex]; + uint16 championIndex = champMan._partyChampionCount - 1; + Champion *champ = &champMan._champions[championIndex]; if (commandType == k162_CommandClickInPanelCancel) { invMan.f355_toggleInventory(k4_ChampionCloseInventory); - champMan._g299_candidateChampionOrdinal = _vm->M0_indexToOrdinal(kM1_ChampionNone); - if (champMan._g305_partyChampionCount == 1) { + champMan._candidateChampionOrdinal = _vm->M0_indexToOrdinal(kM1_ChampionNone); + if (champMan._partyChampionCount == 1) { f368_commandSetLeader(kM1_ChampionNone); } - champMan._g305_partyChampionCount--; + champMan._partyChampionCount--; Box box; box._y1 = 0; box._y2 = 28; @@ -1247,13 +1247,13 @@ void EventManager::f282_commandProcessCommands160To162ClickInResurrectReincarnat box._x2 = box._x1 + 66; dispMan._g578_useByteBoxCoordinates = false; dispMan.D24_fillScreenBox(box, k0_ColorBlack); - dispMan.D24_fillScreenBox(_vm->_championMan->_boxChampionIcons[champMan.M26_championIconIndex(champ->_cell, dunMan._g308_partyDir) * 2], k0_ColorBlack); + dispMan.D24_fillScreenBox(_vm->_championMan->_boxChampionIcons[champMan.getChampionIconIndex(champ->_cell, dunMan._g308_partyDir) * 2], k0_ColorBlack); _vm->_menuMan->f457_drawEnabledMenus(); f78_showMouse(); return; } - champMan._g299_candidateChampionOrdinal = _vm->M0_indexToOrdinal(kM1_ChampionNone); + champMan._candidateChampionOrdinal = _vm->M0_indexToOrdinal(kM1_ChampionNone); int16 mapX = dunMan._g306_partyMapX + _vm->_dirIntoStepCountEast[dunMan._g308_partyDir]; int16 mapY = dunMan._g307_partyMapY + _vm->_dirIntoStepCountNorth[dunMan._g308_partyDir]; @@ -1273,7 +1273,7 @@ void EventManager::f282_commandProcessCommands160To162ClickInResurrectReincarnat } if (commandType == k161_CommandClickInPanelReincarnate) { - champMan.f281_renameChampion(champ); + champMan.renameChampion(champ); if (_vm->_engineShouldQuit) return; champ->resetSkillsToZero(); @@ -1285,12 +1285,12 @@ void EventManager::f282_commandProcessCommands160To162ClickInResurrectReincarnat } } - if (champMan._g305_partyChampionCount == 1) { + if (champMan._partyChampionCount == 1) { _vm->_projexpl->_g362_lastPartyMovementTime = _vm->_g313_gameTime; f368_commandSetLeader(k0_ChampionFirst); _vm->_menuMan->f394_setMagicCasterAndDrawSpellArea(k0_ChampionFirst); } else - _vm->_menuMan->f393_drawSpellAreaControls(champMan._g514_magicCasterChampionIndex); + _vm->_menuMan->f393_drawSpellAreaControls(champMan._magicCasterChampionIndex); _vm->_textMan->f51_messageAreaPrintLineFeed(); Color champColor = _vm->_championMan->_championColor[championIndex]; @@ -1311,7 +1311,7 @@ void EventManager::f282_commandProcessCommands160To162ClickInResurrectReincarnat invMan.f355_toggleInventory(k4_ChampionCloseInventory); _vm->_menuMan->f457_drawEnabledMenus(); - f67_setMousePointerToNormal((_vm->_championMan->_g411_leaderIndex == kM1_ChampionNone) ? k0_pointerArrow : k1_pointerHand); + f67_setMousePointerToNormal((_vm->_championMan->_leaderIndex == kM1_ChampionNone) ? k0_pointerArrow : k1_pointerHand); } void EventManager::f378_commandProcess81ClickInPanel(int16 x, int16 y) { @@ -1321,14 +1321,14 @@ void EventManager::f378_commandProcess81ClickInPanel(int16 x, int16 y) { CommandType commandType; switch (invMan._g424_panelContent) { case k4_PanelContentChest: - if (champMan._g411_leaderIndex == kM1_ChampionNone) // if no leader + if (champMan._leaderIndex == kM1_ChampionNone) // if no leader return; commandType = f358_getCommandTypeFromMouseInput(_mouseInputPanelChest, Common::Point(x, y), k1_LeftMouseButton); if (commandType != k0_CommandNone) - _vm->_championMan->f302_processCommands28to65_clickOnSlotBox(commandType - k20_CommandClickOnSlotBoxChampion_0_StatusBoxReadyHand); + _vm->_championMan->clickOnSlotBox(commandType - k20_CommandClickOnSlotBoxChampion_0_StatusBoxReadyHand); break; case k5_PanelContentResurrectReincarnate: - if (!champMan._g415_leaderEmptyHanded) + if (!champMan._leaderEmptyHanded) break; commandType = f358_getCommandTypeFromMouseInput(_mouseInputPanelResurrectReincarnateCancel, Common::Point(x, y), k1_LeftMouseButton); if (commandType != k0_CommandNone) @@ -1340,7 +1340,7 @@ void EventManager::f378_commandProcess81ClickInPanel(int16 x, int16 y) { } void EventManager::f373_processType80_clickInDungeonView_grabLeaderHandObject(uint16 viewCell) { - if (_vm->_championMan->_g411_leaderIndex == kM1_ChampionNone) + if (_vm->_championMan->_leaderIndex == kM1_ChampionNone) return; int16 mapX = _vm->_dungeonMan->_g306_partyMapX; @@ -1358,14 +1358,14 @@ void EventManager::f373_processType80_clickInDungeonView_grabLeaderHandObject(ui Thing topPileThing = _vm->_dungeonMan->_g292_pileTopObject[viewCell]; if (_vm->_objectMan->f33_getIconIndex(topPileThing) != kM1_IconIndiceNone) { _vm->_moveSens->f267_getMoveResult(topPileThing, mapX, mapY, kM1_MapXNotOnASquare, 0); - _vm->_championMan->f297_putObjectInLeaderHand(topPileThing, true); + _vm->_championMan->putObjectInLeaderHand(topPileThing, true); } _vm->_g321_stopWaitingForPlayerInput = true; } void EventManager::f374_processType80_clickInDungeonViewDropLeaderHandObject(uint16 viewCell) { - if (_vm->_championMan->_g411_leaderIndex == kM1_ChampionNone) + if (_vm->_championMan->_leaderIndex == kM1_ChampionNone) return; int16 mapX = _vm->_dungeonMan->_g306_partyMapX; @@ -1378,7 +1378,7 @@ void EventManager::f374_processType80_clickInDungeonViewDropLeaderHandObject(uin mapX += _vm->_dirIntoStepCountEast[_vm->_dungeonMan->_g308_partyDir], mapY += _vm->_dirIntoStepCountNorth[_vm->_dungeonMan->_g308_partyDir]; uint16 currCell = M21_normalizeModulo4(_vm->_dungeonMan->_g308_partyDir + viewCell); - Thing removedThing = _vm->_championMan->f298_getObjectRemovedFromLeaderHand(); + Thing removedThing = _vm->_championMan->getObjectRemovedFromLeaderHand(); _vm->_moveSens->f267_getMoveResult(M15_thingWithNewCell(removedThing, currCell), kM1_MapXNotOnASquare, 0, mapX, mapY); if (droppingIntoAnAlcove && _vm->_dungeonMan->_g287_isFacingViAltar && (_vm->_objectMan->f33_getIconIndex(removedThing) == k147_IconIndiceJunkChampionBones)) { Junk *removedJunk = (Junk*)_vm->_dungeonMan->f156_getThingData(removedThing); @@ -1431,7 +1431,7 @@ void EventManager::f364_commandTakeStairs(bool stairsGoDown) { _vm->_moveSens->f267_getMoveResult(Thing::_party, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, kM1_MapXNotOnASquare, 0); _vm->_g327_newPartyMapIndex = _vm->_dungeonMan->f154_getLocationAfterLevelChange(_vm->_dungeonMan->_g309_partyMapIndex, stairsGoDown ? -1 : 1, &_vm->_dungeonMan->_g306_partyMapX, &_vm->_dungeonMan->_g307_partyMapY); _vm->_dungeonMan->f173_setCurrentMap(_vm->_g327_newPartyMapIndex); - _vm->_championMan->f284_setPartyDirection(_vm->_dungeonMan->f155_getStairsExitDirection(_vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY)); + _vm->_championMan->setPartyDirection(_vm->_dungeonMan->f155_getStairsExitDirection(_vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY)); _vm->_dungeonMan->f173_setCurrentMap(_vm->_dungeonMan->_g309_partyMapIndex); } @@ -1443,7 +1443,7 @@ void EventManager::f367_commandProcessTypes12to27_clickInChampionStatusBox(uint1 if ((commandType >= k16_CommandSetLeaderChampion_0) && (commandType <= k19_CommandSetLeaderChampion_3)) f368_commandSetLeader((ChampionIndex)(commandType - k16_CommandSetLeaderChampion_0)); else if ((commandType >= k20_CommandClickOnSlotBoxChampion_0_StatusBoxReadyHand) && (commandType <= k27_CommandClickOnSlotBoxChampion_3_StatusBoxActionHand)) - _vm->_championMan->f302_processCommands28to65_clickOnSlotBox(commandType - k20_CommandClickOnSlotBoxChampion_0_StatusBoxReadyHand); + _vm->_championMan->clickOnSlotBox(commandType - k20_CommandClickOnSlotBoxChampion_0_StatusBoxReadyHand); } } @@ -1454,7 +1454,7 @@ void EventManager::f70_mouseProcessCommands125To128_clickOnChampionIcon(uint16 c _gK100_preventBuildPointerScreenArea = true; if (!_g599_useChampionIconOrdinalAsMousePointerBitmap) { - if (_vm->_championMan->f285_getIndexInCell(M21_normalizeModulo4(champIconIndex + _vm->_dungeonMan->_g308_partyDir)) == kM1_ChampionNone) { + if (_vm->_championMan->getIndexInCell(M21_normalizeModulo4(champIconIndex + _vm->_dungeonMan->_g308_partyDir)) == kM1_ChampionNone) { _gK100_preventBuildPointerScreenArea = false; return; } @@ -1474,22 +1474,22 @@ void EventManager::f70_mouseProcessCommands125To128_clickOnChampionIcon(uint16 c _g598_mousePointerBitmapUpdated = true; uint16 championIconIndex = _vm->M1_ordinalToIndex(_g599_useChampionIconOrdinalAsMousePointerBitmap); _g599_useChampionIconOrdinalAsMousePointerBitmap = _vm->M0_indexToOrdinal(kM1_ChampionNone); - int16 championCellIndex = _vm->_championMan->f285_getIndexInCell(M21_normalizeModulo4(championIconIndex + _vm->_dungeonMan->_g308_partyDir)); + int16 championCellIndex = _vm->_championMan->getIndexInCell(M21_normalizeModulo4(championIconIndex + _vm->_dungeonMan->_g308_partyDir)); if (championIconIndex == champIconIndex) { - setFlag(_vm->_championMan->_gK71_champions[championCellIndex]._attributes, k0x0400_ChampionAttributeIcon); - _vm->_championMan->f292_drawChampionState((ChampionIndex)championCellIndex); + setFlag(_vm->_championMan->_champions[championCellIndex]._attributes, k0x0400_ChampionAttributeIcon); + _vm->_championMan->drawChampionState((ChampionIndex)championCellIndex); } else { - int16 championIndex = _vm->_championMan->f285_getIndexInCell(M21_normalizeModulo4(champIconIndex + _vm->_dungeonMan->_g308_partyDir)); + int16 championIndex = _vm->_championMan->getIndexInCell(M21_normalizeModulo4(champIconIndex + _vm->_dungeonMan->_g308_partyDir)); if (championIndex >= 0) { - _vm->_championMan->_gK71_champions[championIndex]._cell = (ViewCell)M21_normalizeModulo4(championIconIndex + _vm->_dungeonMan->_g308_partyDir); - setFlag(_vm->_championMan->_gK71_champions[championIndex]._attributes, k0x0400_ChampionAttributeIcon); - _vm->_championMan->f292_drawChampionState((ChampionIndex)championIndex); + _vm->_championMan->_champions[championIndex]._cell = (ViewCell)M21_normalizeModulo4(championIconIndex + _vm->_dungeonMan->_g308_partyDir); + setFlag(_vm->_championMan->_champions[championIndex]._attributes, k0x0400_ChampionAttributeIcon); + _vm->_championMan->drawChampionState((ChampionIndex)championIndex); } else _vm->_displayMan->D24_fillScreenBox(_vm->_championMan->_boxChampionIcons[championIconIndex], k0_ColorBlack); - _vm->_championMan->_gK71_champions[championCellIndex]._cell = (ViewCell)M21_normalizeModulo4(champIconIndex + _vm->_dungeonMan->_g308_partyDir); - setFlag(_vm->_championMan->_gK71_champions[championCellIndex]._attributes, k0x0400_ChampionAttributeIcon); - _vm->_championMan->f292_drawChampionState((ChampionIndex)championCellIndex); + _vm->_championMan->_champions[championCellIndex]._cell = (ViewCell)M21_normalizeModulo4(champIconIndex + _vm->_dungeonMan->_g308_partyDir); + setFlag(_vm->_championMan->_champions[championCellIndex]._attributes, k0x0400_ChampionAttributeIcon); + _vm->_championMan->drawChampionState((ChampionIndex)championCellIndex); } } _gK100_preventBuildPointerScreenArea = false; @@ -1499,7 +1499,7 @@ void EventManager::f70_mouseProcessCommands125To128_clickOnChampionIcon(uint16 c void EventManager::f370_commandProcessType100_clickInSpellArea(uint16 posX, uint16 posY) { int16 championIndex = kM1_ChampionNone; if (posY <= 48) { - switch (_vm->_championMan->_g514_magicCasterChampionIndex) { + switch (_vm->_championMan->_magicCasterChampionIndex) { case 0: if ((posX >= 280) && (posX <= 291)) championIndex = 1; @@ -1539,7 +1539,7 @@ void EventManager::f370_commandProcessType100_clickInSpellArea(uint16 posX, uint break; } - if ((championIndex != kM1_ChampionNone) && (championIndex < _vm->_championMan->_g305_partyChampionCount)) + if ((championIndex != kM1_ChampionNone) && (championIndex < _vm->_championMan->_partyChampionCount)) _vm->_menuMan->f394_setMagicCasterAndDrawSpellArea(championIndex); return; @@ -1562,7 +1562,7 @@ void EventManager::f369_commandProcessTypes101To108_clickInSpellSymbolsArea(Comm Box(305, 318, 63, 73)}; /* Delete */ if (cmdType == k108_CommandClickInSpeallAreaCastSpell) { - if (_vm->_championMan->_gK71_champions[_vm->_championMan->_g514_magicCasterChampionIndex]._symbols[0] == '\0') + if (_vm->_championMan->_champions[_vm->_championMan->_magicCasterChampionIndex]._symbols[0] == '\0') return; f362_commandHighlightBoxEnable(234, 303, 63, 73); @@ -1583,7 +1583,7 @@ void EventManager::f369_commandProcessTypes101To108_clickInSpellSymbolsArea(Comm } void EventManager::f371_commandProcessType111To115_ClickInActionArea(int16 posX, int16 posY) { - if (_vm->_championMan->_g506_actingChampionOrdinal) { + if (_vm->_championMan->_actingChampionOrdinal) { uint16 mouseCommand = f358_getCommandTypeFromMouseInput(_mouseInputActionAreaNames, Common::Point(posX, posY), k1_LeftMouseButton); if (mouseCommand != k0_CommandNone) { if (mouseCommand == k112_CommandClickInActionAreaPass) { @@ -1604,7 +1604,7 @@ void EventManager::f371_commandProcessType111To115_ClickInActionArea(int16 posX, uint16 mouseCommand = f358_getCommandTypeFromMouseInput(_mouseInputActionAreaIcons, Common::Point(posX, posY), k1_LeftMouseButton); if (mouseCommand != k0_CommandNone) { mouseCommand -= k116_CommandClickInActionAreaChampion_0_Action; - if (mouseCommand < _vm->_championMan->_g305_partyChampionCount) + if (mouseCommand < _vm->_championMan->_partyChampionCount) _vm->_menuMan->f389_processCommands116To119_setActingChampion(mouseCommand); } } diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index 5c4bb7e2a8..10baee8646 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -1068,7 +1068,7 @@ void DisplayMan::f111_drawDoor(uint16 doorThingIndex, uint16 doorState, int16* d f131_flipVertical(_g74_tmpBitmap, doorFramesTemp->_closedOrDestroyed._srcByteWidth, doorFramesTemp->_closedOrDestroyed._srcHeight); } - if ((doorFramesTemp == _doorFrameD1C) && _vm->_championMan->_g407_party._event73Count_ThievesEye) + if ((doorFramesTemp == _doorFrameD1C) && _vm->_championMan->_party._event73Count_ThievesEye) f109_drawDoorOrnament(_vm->M0_indexToOrdinal(k16_DoorOrnThivesEyeMask), k2_ViewDoorOrnament_D1LCR); if (doorState == k4_doorState_CLOSED) @@ -1887,7 +1887,7 @@ void DisplayMan::f124_drawSquareD1C(Direction dir, int16 posX, int16 posY) { _vm->_dungeonMan->_g286_isFacingAlcove = false; _vm->_dungeonMan->_g287_isFacingViAltar = false; _vm->_dungeonMan->_g288_isFacingFountain = false; - if (_vm->_championMan->_g407_party._event73Count_ThievesEye) { + if (_vm->_championMan->_party._event73Count_ThievesEye) { f491_isDerivedBitmapInCache(k1_DerivedBitmapThievesEyeVisibleArea); f132_blitToBitmap(_g296_bitmapViewport, f492_getDerivedBitmap(k1_DerivedBitmapThievesEyeVisibleArea), boxThievesEyeVisibleArea, _boxThievesEyeViewPortVisibleArea._x1, _boxThievesEyeViewPortVisibleArea._y1, @@ -1900,7 +1900,7 @@ void DisplayMan::f124_drawSquareD1C(Direction dir, int16 posX, int16 posY) { if (f107_isDrawnWallOrnAnAlcove(squareAspect[k3_FrontWallOrnOrdAspect], k12_ViewWall_D1C_FRONT)) f115_cthulhu(Thing(squareAspect[k1_FirstGroupOrObjectAspect]), dir, posX, posY, k6_ViewSquare_D1C, k0x0000_CellOrder_Alcove); - if (_vm->_championMan->_g407_party._event73Count_ThievesEye) { + if (_vm->_championMan->_party._event73Count_ThievesEye) { f132_blitToBitmap(f492_getDerivedBitmap(k1_DerivedBitmapThievesEyeVisibleArea), _g296_bitmapViewport, _boxThievesEyeViewPortVisibleArea, 0, 0, 48, k112_byteWidthViewport, k9_ColorGold, 95, k136_heightViewport); /* BUG0_74 */ @@ -2018,7 +2018,7 @@ void DisplayMan::f127_drawSquareD0C(Direction dir, int16 posX, int16 posY) { _vm->_dungeonMan->f172_setSquareAspect(squareAspect, dir, posX, posY); switch (squareAspect[k0_ElementAspect]) { case k16_DoorSideElemType: - if (_vm->_championMan->_g407_party._event73Count_ThievesEye) { + if (_vm->_championMan->_party._event73Count_ThievesEye) { memmove(_g74_tmpBitmap, _g709_bitmapWallSet_DoorFrameFront, 32 * 123); f132_blitToBitmap(f489_getNativeBitmapOrGraphic(k41_holeInWall_GraphicIndice), _g74_tmpBitmap, boxThievesEyeHoleInDoorFrame, doorFrameD0C._box._x1 - _boxThievesEyeViewPortVisibleArea._x1, diff --git a/engines/dm/group.cpp b/engines/dm/group.cpp index c9f7e30958..4b30d2f99c 100644 --- a/engines/dm/group.cpp +++ b/engines/dm/group.cpp @@ -686,7 +686,7 @@ T0209005_AddEventAndReturn: if (L0461_i_MovementTicks == k255_immobile) L0461_i_MovementTicks = 100; - if (_vm->_championMan->_g407_party._freezeLifeTicks && !L0463_B_Archenemy) { /* If life is frozen and the creature is not Lord Chaos (Lord Chaos is immune to Freeze Life) then reschedule the event later (except for reactions which are ignored when life if frozen) */ + if (_vm->_championMan->_party._freezeLifeTicks && !L0463_B_Archenemy) { /* If life is frozen and the creature is not Lord Chaos (Lord Chaos is immune to Freeze Life) then reschedule the event later (except for reactions which are ignored when life if frozen) */ if (eventType < 0) goto T0209139_Return; L0465_s_NextEvent._type = eventType; @@ -1180,7 +1180,7 @@ int16 GroupMan::f200_groupGetDistanceToVisibleParty(Group *group, int16 creature L0424_ps_CreatureInfo = &g243_CreatureInfo[group->_type]; - if (_vm->_championMan->_g407_party._event71Count_Invisibility && !getFlag(L0424_ps_CreatureInfo->_attributes, k0x0800_MaskCreatureInfo_seeInvisible)) { + if (_vm->_championMan->_party._event71Count_Invisibility && !getFlag(L0424_ps_CreatureInfo->_attributes, k0x0800_MaskCreatureInfo_seeInvisible)) { return 0; } if (getFlag(L0424_ps_CreatureInfo->_attributes, k0x0004_MaskCreatureInfo_sideAttack)) /* If creature can see in all directions */ @@ -1402,8 +1402,8 @@ int16 GroupMan::f201_getSmelledPartyPrimaryDirOrdinal(CreatureInfo *creatureInfo _vm->_projexpl->_g363_secondaryDirToOrFromParty = _g383_currGroupSecondaryDirToParty; return _vm->M0_indexToOrdinal(_g382_currGroupPrimaryDirToParty); } - if ((L0427_i_ScentOrdinal = _vm->_championMan->f315_getScentOrdinal(mapY, mapX)) && ((_vm->_championMan->_g407_party._scentStrengths[_vm->M1_ordinalToIndex(L0427_i_ScentOrdinal)] + _vm->getRandomNumber(4)) > (30 - (L0426_ui_SmellRange << 1)))) { /* If there is a fresh enough party scent on the group square */ - return _vm->M0_indexToOrdinal(f228_getDirsWhereDestIsVisibleFromSource(mapY, mapX, _vm->_championMan->_g407_party._scents[L0427_i_ScentOrdinal].getMapX(), _vm->_championMan->_g407_party._scents[L0427_i_ScentOrdinal].getMapY())); + if ((L0427_i_ScentOrdinal = _vm->_championMan->getScentOrdinal(mapY, mapX)) && ((_vm->_championMan->_party._scentStrengths[_vm->M1_ordinalToIndex(L0427_i_ScentOrdinal)] + _vm->getRandomNumber(4)) > (30 - (L0426_ui_SmellRange << 1)))) { /* If there is a fresh enough party scent on the group square */ + return _vm->M0_indexToOrdinal(f228_getDirsWhereDestIsVisibleFromSource(mapY, mapX, _vm->_championMan->_party._scents[L0427_i_ScentOrdinal].getMapX(), _vm->_championMan->_party._scents[L0427_i_ScentOrdinal].getMapY())); } return 0; } @@ -1531,14 +1531,14 @@ bool GroupMan::f207_isCreatureAttacking(Group *group, int16 mapX, int16 mapY, ui } else { if (getFlag(L0441_ps_CreatureInfo->_attributes, k0x0010_MaskCreatureInfo_attackAnyChamp)) { AL0439_i_ChampionIndex = _vm->getRandomNumber(4); - for (AL0440_i_Counter = 0; (AL0440_i_Counter < 4) && !_vm->_championMan->_gK71_champions[AL0439_i_ChampionIndex]._currHealth; AL0440_i_Counter++) { + for (AL0440_i_Counter = 0; (AL0440_i_Counter < 4) && !_vm->_championMan->_champions[AL0439_i_ChampionIndex]._currHealth; AL0440_i_Counter++) { AL0439_i_ChampionIndex = returnNextVal(AL0439_i_ChampionIndex); } if (AL0440_i_Counter == 4) { return false; } } else { - if ((AL0439_i_ChampionIndex = _vm->_championMan->f286_getTargetChampionIndex(mapX, mapY, AL0439_i_TargetCell)) < 0) { + if ((AL0439_i_ChampionIndex = _vm->_championMan->getTargetChampionIndex(mapX, mapY, AL0439_i_TargetCell)) < 0) { return false; } } @@ -1546,7 +1546,7 @@ bool GroupMan::f207_isCreatureAttacking(Group *group, int16 mapX, int16 mapY, ui f193_stealFromChampion(group, AL0439_i_ChampionIndex); } else { AL0440_i_Damage = f230_getChampionDamage(group, AL0439_i_ChampionIndex) + 1; - Champion *L0442_ps_Champion = &_vm->_championMan->_gK71_champions[AL0439_i_ChampionIndex]; + Champion *L0442_ps_Champion = &_vm->_championMan->_champions[AL0439_i_ChampionIndex]; if (AL0440_i_Damage > L0442_ps_Champion->_maximumDamageReceived) { L0442_ps_Champion->_maximumDamageReceived = AL0440_i_Damage; L0442_ps_Champion->_directionMaximumDamageReceived = returnOppositeDir((Direction)L0438_ui_PrimaryDirectionToParty); @@ -1592,15 +1592,15 @@ void GroupMan::f193_stealFromChampion(Group *group, uint16 championIndex) { L0396_B_ObjectStolen = false; - L0391_i_Percentage = 100 - _vm->_championMan->f311_getDexterity(L0395_ps_Champion = &_vm->_championMan->_gK71_champions[championIndex]); + L0391_i_Percentage = 100 - _vm->_championMan->getDexterity(L0395_ps_Champion = &_vm->_championMan->_champions[championIndex]); L0393_ui_Counter = _vm->getRandomNumber(8); - while ((L0391_i_Percentage > 0) && !_vm->_championMan->f308_isLucky(L0395_ps_Champion, L0391_i_Percentage)) { + while ((L0391_i_Percentage > 0) && !_vm->_championMan->isLucky(L0395_ps_Champion, L0391_i_Percentage)) { if ((L0392_ui_StealFromSlotIndex = G0394_auc_StealFromSlotIndices[L0393_ui_Counter]) == k13_ChampionSlotBackpackLine_1_1) { L0392_ui_StealFromSlotIndex += _vm->getRandomNumber(17); /* Select a random slot in the backpack */ } if (((L0394_T_Thing = L0395_ps_Champion->_slots[L0392_ui_StealFromSlotIndex]) != Thing::_none)) { L0396_B_ObjectStolen = true; - L0394_T_Thing = _vm->_championMan->f300_getObjectRemovedFromSlot(championIndex, L0392_ui_StealFromSlotIndex); + L0394_T_Thing = _vm->_championMan->getObjectRemovedFromSlot(championIndex, L0392_ui_StealFromSlotIndex); if (group->_slot == Thing::_endOfList) { group->_slot = L0394_T_Thing; /* BUG0_12 An object is cloned and appears at two different locations in the dungeon and/or inventory. The game may crash when interacting with this object. If a Giggler with no possessions steals an object that was previously in a chest and was not the last object in the chest then the objects that followed it are cloned. In the chest, the object is part of a linked list of objects that is not reset when the object is removed from the chest and placed in the inventory (but not in the dungeon), nor when it is stolen and added as the first Giggler possession. If the Giggler already has a possession before stealing the object then this does not create a cloned object. The following statement is missing: L0394_T_Thing->Next = Thing::_endOfList; @@ -1608,7 +1608,7 @@ void GroupMan::f193_stealFromChampion(Group *group, uint16 championIndex) { } else { _vm->_dungeonMan->f163_linkThingToList(L0394_T_Thing, group->_slot, kM1_MapXNotOnASquare, 0); } - _vm->_championMan->f292_drawChampionState((ChampionIndex)championIndex); + _vm->_championMan->drawChampionState((ChampionIndex)championIndex); } ++L0393_ui_Counter; L0393_ui_Counter &= 0x0007; @@ -1639,20 +1639,20 @@ int16 GroupMan::f230_getChampionDamage(Group *group, uint16 champIndex) { CreatureInfo L0564_s_CreatureInfo; - L0562_ps_Champion = &_vm->_championMan->_gK71_champions[champIndex]; - if (champIndex >= _vm->_championMan->_g305_partyChampionCount) { + L0562_ps_Champion = &_vm->_championMan->_champions[champIndex]; + if (champIndex >= _vm->_championMan->_partyChampionCount) { return 0; } if (!L0562_ps_Champion->_currHealth) { return 0; } - if (_vm->_championMan->_g300_partyIsSleeping) { - _vm->_championMan->f314_wakeUp(); + if (_vm->_championMan->_partyIsSleeping) { + _vm->_championMan->wakeUp(); } L0563_i_DoubledMapDifficulty = _vm->_dungeonMan->_g269_currMap->_difficulty << 1; L0564_s_CreatureInfo = g243_CreatureInfo[group->_type]; - _vm->_championMan->f304_addSkillExperience(champIndex, k7_ChampionSkillParry, L0564_s_CreatureInfo.M58_getExperience()); - if (_vm->_championMan->_g300_partyIsSleeping || (((_vm->_championMan->f311_getDexterity(L0562_ps_Champion) < (_vm->getRandomNumber(32) + L0564_s_CreatureInfo._dexterity + L0563_i_DoubledMapDifficulty - 16)) || !_vm->getRandomNumber(4)) && !_vm->_championMan->f308_isLucky(L0562_ps_Champion, 60))) { + _vm->_championMan->addSkillExperience(champIndex, k7_ChampionSkillParry, L0564_s_CreatureInfo.M58_getExperience()); + if (_vm->_championMan->_partyIsSleeping || (((_vm->_championMan->getDexterity(L0562_ps_Champion) < (_vm->getRandomNumber(32) + L0564_s_CreatureInfo._dexterity + L0563_i_DoubledMapDifficulty - 16)) || !_vm->getRandomNumber(4)) && !_vm->_championMan->isLucky(L0562_ps_Champion, 60))) { if ((AL0559_ui_WoundTest = _vm->getRandomNumber(65536)) & 0x0070) { AL0559_ui_WoundTest &= 0x000F; L0560_ui_WoundProbabilities = L0564_s_CreatureInfo._woundProbabilities; @@ -1663,7 +1663,7 @@ int16 GroupMan::f230_getChampionDamage(Group *group, uint16 champIndex) { } else { AL0561_ui_AllowedWound = AL0559_ui_WoundTest & 0x0001; /* 0 (Ready hand) or 1 (action hand) */ } - if ((AL0558_i_Attack = (_vm->getRandomNumber(16) + L0564_s_CreatureInfo._attack + L0563_i_DoubledMapDifficulty) - (_vm->_championMan->f303_getSkillLevel(champIndex, k7_ChampionSkillParry) << 1)) <= 1) { + if ((AL0558_i_Attack = (_vm->getRandomNumber(16) + L0564_s_CreatureInfo._attack + L0563_i_DoubledMapDifficulty) - (_vm->_championMan->getSkillLevel(champIndex, k7_ChampionSkillParry) << 1)) <= 1) { if (_vm->getRandomNumber(2)) { goto T0230014; } @@ -1677,15 +1677,15 @@ int16 GroupMan::f230_getChampionDamage(Group *group, uint16 champIndex) { if (_vm->getRandomNumber(2)) AL0558_i_Attack -= _vm->getRandomNumber((AL0558_i_Attack >> 1) + 1) - 1; - AL0558_i_Damage = _vm->_championMan->f321_addPendingDamageAndWounds_getDamage(champIndex, AL0558_i_Attack, AL0561_ui_AllowedWound, L0564_s_CreatureInfo._attackType); + AL0558_i_Damage = _vm->_championMan->addPendingDamageAndWounds_getDamage(champIndex, AL0558_i_Attack, AL0561_ui_AllowedWound, L0564_s_CreatureInfo._attackType); if (AL0558_i_Damage) { _vm->_sound->f064_SOUND_RequestPlay_CPSD(k09_soundCHAMPION_0_DAMAGED + champIndex, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, k2_soundModePlayOneTickLater); AL0559_ui_PoisonAttack = L0564_s_CreatureInfo._poisonAttack; if (AL0559_ui_PoisonAttack && _vm->getRandomNumber(2)) { - AL0559_ui_PoisonAttack = _vm->_championMan->f307_getStatisticAdjustedAttack(L0562_ps_Champion, k4_ChampionStatVitality, AL0559_ui_PoisonAttack); + AL0559_ui_PoisonAttack = _vm->_championMan->getStatisticAdjustedAttack(L0562_ps_Champion, k4_ChampionStatVitality, AL0559_ui_PoisonAttack); if (AL0559_ui_PoisonAttack >= 0) - _vm->_championMan->f322_championPoison(champIndex, AL0559_ui_PoisonAttack); + _vm->_championMan->championPoison(champIndex, AL0559_ui_PoisonAttack); } return AL0558_i_Damage; } @@ -1897,7 +1897,7 @@ int16 GroupMan::f231_getMeleeActionDamage(Champion* champ, int16 champIndex, Gro int16 L0571_i_ActionHandObjectIconIndex; CreatureInfo* L0572_ps_CreatureInfo; - if (champIndex >= _vm->_championMan->_g305_partyChampionCount) { + if (champIndex >= _vm->_championMan->_partyChampionCount) { return 0; } if (!champ->_currHealth) { @@ -1911,11 +1911,11 @@ int16 GroupMan::f231_getMeleeActionDamage(Champion* champ, int16 champIndex, Gro clearFlag(actionHitProbability, k0x8000_hitNonMaterialCreatures); if ((!getFlag(L0572_ps_CreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial) || L0570_B_ActionHitsNonMaterialCreatures) && - ((_vm->_championMan->f311_getDexterity(champ) > (_vm->getRandomNumber(32) + L0572_ps_CreatureInfo->_dexterity + L0567_i_DoubledMapDifficulty - 16)) || + ((_vm->_championMan->getDexterity(champ) > (_vm->getRandomNumber(32) + L0572_ps_CreatureInfo->_dexterity + L0567_i_DoubledMapDifficulty - 16)) || (!_vm->getRandomNumber(4)) || - (_vm->_championMan->f308_isLucky(champ, 75 - actionHitProbability)))) { + (_vm->_championMan->isLucky(champ, 75 - actionHitProbability)))) { - L0565_i_Damage = _vm->_championMan->f312_getStrength(champIndex, k1_ChampionSlotActionHand); + L0565_i_Damage = _vm->_championMan->getStrength(champIndex, k1_ChampionSlotActionHand); if (!(L0565_i_Damage)) goto T0231009; @@ -1950,20 +1950,20 @@ T0231009: L0565_i_Damage += _vm->getRandomNumber(4) + 1; if ((L0571_i_ActionHandObjectIconIndex == k40_IconIndiceWeaponVorpalBlade) && !getFlag(L0572_ps_CreatureInfo->_attributes, k0x0040_MaskCreatureInfo_nonMaterial) && !(L0565_i_Damage >>= 1)) goto T0231015; - if (_vm->getRandomNumber(64) < _vm->_championMan->f303_getSkillLevel(champIndex, skillIndex)) { + if (_vm->getRandomNumber(64) < _vm->_championMan->getSkillLevel(champIndex, skillIndex)) { L0565_i_Damage += L0565_i_Damage + 10; } L0569_i_Outcome = f190_groupGetDamageCreatureOutcome(group, creatureIndex, mapX, mapY, L0565_i_Damage, true); - _vm->_championMan->f304_addSkillExperience(champIndex, skillIndex, (L0565_i_Damage * L0572_ps_CreatureInfo->M58_getExperience() >> 4) + 3); - _vm->_championMan->f325_decrementStamina(champIndex, _vm->getRandomNumber(4) + 4); + _vm->_championMan->addSkillExperience(champIndex, skillIndex, (L0565_i_Damage * L0572_ps_CreatureInfo->M58_getExperience() >> 4) + 3); + _vm->_championMan->decrementStamina(champIndex, _vm->getRandomNumber(4) + 4); goto T0231016; } T0231015: L0565_i_Damage = 0; L0569_i_Outcome = k0_outcomeKilledNoCreaturesInGroup; - _vm->_championMan->f325_decrementStamina(champIndex, _vm->getRandomNumber(2) + 2); + _vm->_championMan->decrementStamina(champIndex, _vm->getRandomNumber(2) + 2); T0231016: - _vm->_championMan->f292_drawChampionState((ChampionIndex)champIndex); + _vm->_championMan->drawChampionState((ChampionIndex)champIndex); if (L0569_i_Outcome != k2_outcomeKilledAllCreaturesInGroup) { f209_processEvents29to41(mapX, mapY, kM1_TMEventTypeCreateReactionEvent31ParyIsAdjacent, 0); } diff --git a/engines/dm/inventory.cpp b/engines/dm/inventory.cpp index 78dc28a63d..2c10ded1cf 100644 --- a/engines/dm/inventory.cpp +++ b/engines/dm/inventory.cpp @@ -93,7 +93,7 @@ void InventoryMan::f355_toggleInventory(ChampionIndex championIndex) { Champion* L1103_ps_Champion; - if ((championIndex != k4_ChampionCloseInventory) && !_vm->_championMan->_gK71_champions[championIndex]._currHealth) { + if ((championIndex != k4_ChampionCloseInventory) && !_vm->_championMan->_champions[championIndex]._currHealth) { return; } if (_vm->_g333_pressingMouth || _vm->_g331_pressingEye) { @@ -108,12 +108,12 @@ void InventoryMan::f355_toggleInventory(ChampionIndex championIndex) { if (AL1102_ui_InventoryChampionOrdinal) { _g432_inventoryChampionOrdinal = _vm->M0_indexToOrdinal(kM1_ChampionNone); f334_closeChest(); - L1103_ps_Champion = &_vm->_championMan->_gK71_champions[_vm->M1_ordinalToIndex(AL1102_ui_InventoryChampionOrdinal)]; - if (L1103_ps_Champion->_currHealth && !_vm->_championMan->_g299_candidateChampionOrdinal) { + L1103_ps_Champion = &_vm->_championMan->_champions[_vm->M1_ordinalToIndex(AL1102_ui_InventoryChampionOrdinal)]; + if (L1103_ps_Champion->_currHealth && !_vm->_championMan->_candidateChampionOrdinal) { setFlag(L1103_ps_Champion->_attributes, k0x1000_ChampionAttributeStatusBox); - _vm->_championMan->f292_drawChampionState((ChampionIndex)_vm->M1_ordinalToIndex(AL1102_ui_InventoryChampionOrdinal)); + _vm->_championMan->drawChampionState((ChampionIndex)_vm->M1_ordinalToIndex(AL1102_ui_InventoryChampionOrdinal)); } - if (_vm->_championMan->_g300_partyIsSleeping) { + if (_vm->_championMan->_partyIsSleeping) { _vm->_eventMan->f77_hideMouse(); return; } @@ -133,9 +133,9 @@ void InventoryMan::f355_toggleInventory(ChampionIndex championIndex) { if (!AL1102_ui_InventoryChampionOrdinal) { _vm->_displayMan->f136_shadeScreenBox(&_vm->_displayMan->_boxMovementArrows, k0_ColorBlack); } - L1103_ps_Champion = &_vm->_championMan->_gK71_champions[championIndex]; + L1103_ps_Champion = &_vm->_championMan->_champions[championIndex]; _vm->_displayMan->f466_loadIntoBitmap(k17_InventoryGraphicIndice, _vm->_displayMan->_g296_bitmapViewport); - if (_vm->_championMan->_g299_candidateChampionOrdinal) { + if (_vm->_championMan->_candidateChampionOrdinal) { _vm->_displayMan->f135_fillBoxBitmap(_vm->_displayMan->_g296_bitmapViewport, g41_BoxFloppyZzzCross, k12_ColorDarkestGray, k112_byteWidthViewport, k136_heightViewport); } @@ -157,10 +157,10 @@ void InventoryMan::f355_toggleInventory(ChampionIndex championIndex) { _vm->_textMan->f52_printToViewport(5, 132, k13_ColorLightestGray, "MANA"); for (AL1102_ui_SlotIndex = k0_ChampionSlotReadyHand; AL1102_ui_SlotIndex < k30_ChampionSlotChest_1; AL1102_ui_SlotIndex++) { - _vm->_championMan->f291_drawSlot(championIndex, AL1102_ui_SlotIndex); + _vm->_championMan->drawSlot(championIndex, AL1102_ui_SlotIndex); } setFlag(L1103_ps_Champion->_attributes, k0x4000_ChampionAttributeViewport | k0x1000_ChampionAttributeStatusBox | k0x0800_ChampionAttributePanel | k0x0200_ChampionAttributeLoad | k0x0100_ChampionAttributeStatistics | k0x0080_ChampionAttributeNameTitle); - _vm->_championMan->f292_drawChampionState(championIndex); + _vm->_championMan->drawChampionState(championIndex); _vm->_eventMan->_g598_mousePointerBitmapUpdated = true; _vm->_eventMan->f77_hideMouse(); _vm->_eventMan->_g442_secondaryMouseInput = _vm->_eventMan->_secondaryMouseInputChampionInventory; @@ -176,7 +176,7 @@ void InventoryMan::f354_drawStatusBoxPortrait(ChampionIndex championIndex) { box._y2 = 28; box._x1 = championIndex * k69_ChampionStatusBoxSpacing + 7; box._x2 = box._x1 + 31; - dispMan.f21_blitToScreen(_vm->_championMan->_gK71_champions[championIndex]._portrait, &box, k16_byteWidth, kM1_ColorNoTransparency, 29); + dispMan.f21_blitToScreen(_vm->_championMan->_champions[championIndex]._portrait, &box, k16_byteWidth, kM1_ColorNoTransparency, 29); } void InventoryMan::f343_drawPanelHorizontalBar(int16 x, int16 y, int16 pixelWidth, Color color) { @@ -210,7 +210,7 @@ void InventoryMan::f345_drawPanelFoodWaterPoisoned() { static Box g36_BoxWater(112, 159, 83, 91); // @ G0036_s_Graphic562_Box_Water static Box g37_BoxPoisoned(112, 207, 105, 119); // @ G0037_s_Graphic562_Box_Poisoned - Champion &champ = _vm->_championMan->_gK71_champions[_g432_inventoryChampionOrdinal]; + Champion &champ = _vm->_championMan->_champions[_g432_inventoryChampionOrdinal]; f334_closeChest(); DisplayMan &dispMan = *_vm->_displayMan; dispMan.f20_blitToViewport(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k20_PanelEmptyIndice), g32_BoxPanel, k72_byteWidth, k8_ColorRed, 73); @@ -249,12 +249,12 @@ void InventoryMan::f347_drawPanel() { f334_closeChest(); ChampionMan &cm = *_vm->_championMan; - if (cm._g299_candidateChampionOrdinal) { + if (cm._candidateChampionOrdinal) { f346_drawPanelResurrectReincarnate(); return; } - Thing thing = cm._gK71_champions[_vm->M1_ordinalToIndex(_g432_inventoryChampionOrdinal)].getSlot(k1_ChampionSlotActionHand); + Thing thing = cm._champions[_vm->M1_ordinalToIndex(_g432_inventoryChampionOrdinal)].getSlot(k1_ChampionSlotActionHand); _g424_panelContent = k0_PanelContentFoodWaterPoisoned; switch (thing.getType()) { @@ -523,21 +523,21 @@ void InventoryMan::f342_drawPanelObject(Thing thingToDraw, bool pressingEye) { default: case Common::EN_ANY: case Common::DE_DEU: // german and english versions are the same - strcpy(str, champMan._gK71_champions[((Junk *)rawThingPtr)->getChargeCount()]._name); + strcpy(str, champMan._champions[((Junk *)rawThingPtr)->getChargeCount()]._name); strcat(str, " "); strcat(str, objMan._g352_objectNames[iconIndex]); break; case Common::FR_FRA: strcat(str, objMan._g352_objectNames[iconIndex]); strcat(str, " "); - strcpy(str, champMan._gK71_champions[((Junk *)rawThingPtr)->getChargeCount()]._name); + strcpy(str, champMan._champions[((Junk *)rawThingPtr)->getChargeCount()]._name); break; } descString = str; } else if ((thingType == k8_PotionThingType) && (iconIndex != k163_IconIndicePotionWaterFlask) - && (champMan.f303_getSkillLevel((ChampionIndex)_vm->M1_ordinalToIndex(_g432_inventoryChampionOrdinal), k2_ChampionSkillPriest) > 1)) { + && (champMan.getSkillLevel((ChampionIndex)_vm->M1_ordinalToIndex(_g432_inventoryChampionOrdinal), k2_ChampionSkillPriest) > 1)) { str[0] = '_' + ((Potion *)rawThingPtr)->getPower() / 40; str[1] = ' '; str[2] = '\0'; @@ -672,7 +672,7 @@ void InventoryMan::f342_drawPanelObject(Thing thingToDraw, bool pressingEye) { uint16 weight = dunMan.f140_getObjectWeight(thingToDraw); - strcat(str, champMan.f288_getStringFromInteger(weight / 10, false, 3).c_str()); + strcat(str, champMan.getStringFromInteger(weight / 10, false, 3).c_str()); switch (_vm->getGameLanguage()) { // localized default: @@ -682,7 +682,7 @@ void InventoryMan::f342_drawPanelObject(Thing thingToDraw, bool pressingEye) { } weight -= (weight / 10) * 10; - strcat(str, champMan.f288_getStringFromInteger(weight, false, 1).c_str()); + strcat(str, champMan.getStringFromInteger(weight, false, 1).c_str()); switch (_vm->getGameLanguage()) { // localized default: @@ -704,7 +704,7 @@ void InventoryMan::f337_setDungeonViewPalette() { } else { /* Get torch light power from both hands of each champion in the party */ int16 L1038_i_Counter = 4; /* BUG0_01 Coding error without consequence. The hands of four champions are inspected even if there are less champions in the party. No consequence as the data in unused champions is set to 0 and _vm->_objectMan->f32_getObjectType then returns -1 */ - Champion *L1043_ps_Champion = _vm->_championMan->_gK71_champions; + Champion *L1043_ps_Champion = _vm->_championMan->_champions; int16 L1045_ai_TorchesLightPower[8]; int16 *AL1040_pi_TorchLightPower = L1045_ai_TorchesLightPower; while (L1038_i_Counter--) { @@ -751,7 +751,7 @@ void InventoryMan::f337_setDungeonViewPalette() { } AL1040_pi_TorchLightPower++; } - L1036_i_TotalLightAmount += _vm->_championMan->_g407_party._magicalLightAmount; + L1036_i_TotalLightAmount += _vm->_championMan->_party._magicalLightAmount; /* Select palette corresponding to the total light amount */ const int16 *AL1040_pi_LightAmount = g40_palIndexToLightAmmount; int16 AL1039_ui_PaletteIndex; @@ -771,11 +771,11 @@ void InventoryMan::f337_setDungeonViewPalette() { void InventoryMan::f338_decreaseTorchesLightPower() { bool L1048_B_TorchChargeCountChanged = false; - int16 L1046_i_ChampionCount = _vm->_championMan->_g305_partyChampionCount; - if (_vm->_championMan->_g299_candidateChampionOrdinal) { + int16 L1046_i_ChampionCount = _vm->_championMan->_partyChampionCount; + if (_vm->_championMan->_candidateChampionOrdinal) { L1046_i_ChampionCount--; } - Champion *L1050_ps_Champion = _vm->_championMan->_gK71_champions; + Champion *L1050_ps_Champion = _vm->_championMan->_champions; while (L1046_i_ChampionCount--) { int16 L1047_i_SlotIndex = k1_ChampionSlotActionHand + 1; while (L1047_i_SlotIndex--) { @@ -794,7 +794,7 @@ void InventoryMan::f338_decreaseTorchesLightPower() { } if (L1048_B_TorchChargeCountChanged) { f337_setDungeonViewPalette(); - _vm->_championMan->f296_drawChangedObjectIcons(); + _vm->_championMan->drawChangedObjectIcons(); } } @@ -825,11 +825,11 @@ void InventoryMan::f351_drawChampionSkillsAndStatistics() { } f334_closeChest(); - L1094_ps_Champion = &_vm->_championMan->_gK71_champions[L1093_ui_ChampionIndex = _vm->M1_ordinalToIndex(_g432_inventoryChampionOrdinal)]; + L1094_ps_Champion = &_vm->_championMan->_champions[L1093_ui_ChampionIndex = _vm->M1_ordinalToIndex(_g432_inventoryChampionOrdinal)]; _vm->_displayMan->f20_blitToViewport(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k20_PanelEmptyIndice), g32_BoxPanel, k72_byteWidth, k8_ColorRed, 73); L1091_i_Y = 58; for (AL1090_ui_SkillIndex = k0_ChampionSkillFighter; AL1090_ui_SkillIndex <= k3_ChampionSkillWizard; AL1090_ui_SkillIndex++) { - AL1092_i_SkillLevel = MIN((uint16)16, _vm->_championMan->f303_getSkillLevel(L1093_ui_ChampionIndex, AL1090_ui_SkillIndex | k0x8000_IgnoreTemporaryExperience)); + AL1092_i_SkillLevel = MIN((uint16)16, _vm->_championMan->getSkillLevel(L1093_ui_ChampionIndex, AL1090_ui_SkillIndex | k0x8000_IgnoreTemporaryExperience)); if (AL1092_i_SkillLevel == 1) continue; @@ -864,9 +864,9 @@ void InventoryMan::f351_drawChampionSkillsAndStatistics() { L1095_i_StatisticColor = k13_ColorLightestGray; } } - _vm->_textMan->f52_printToViewport(174, L1091_i_Y, (Color)L1095_i_StatisticColor, _vm->_championMan->f288_getStringFromInteger(AL1092_i_StatisticCurrentValue, true, 3).c_str()); + _vm->_textMan->f52_printToViewport(174, L1091_i_Y, (Color)L1095_i_StatisticColor, _vm->_championMan->getStringFromInteger(AL1092_i_StatisticCurrentValue, true, 3).c_str()); strcpy(L1097_ac_String, "/"); - strcat(L1097_ac_String, _vm->_championMan->f288_getStringFromInteger(L1096_ui_StatisticMaximumValue, true, 3).c_str()); + strcat(L1097_ac_String, _vm->_championMan->getStringFromInteger(L1096_ui_StatisticMaximumValue, true, 3).c_str()); _vm->_textMan->f52_printToViewport(192, L1091_i_Y, k13_ColorLightestGray, L1097_ac_String); L1091_i_Y += 7; } @@ -887,7 +887,7 @@ void InventoryMan::f353_drawStopPressingEye() { f332_drawIconToViewport(k202_IconIndiceEyeNotLooking, 12, 13); f347_drawPanel(); _vm->_displayMan->f97_drawViewport(k0_viewportNotDungeonView); - if ((L1100_T_LeaderHandObject = _vm->_championMan->_g414_leaderHandObject) != Thing::_none) { + if ((L1100_T_LeaderHandObject = _vm->_championMan->_leaderHandObject) != Thing::_none) { _vm->_objectMan->f34_drawLeaderObjectName(L1100_T_LeaderHandObject); } _vm->_eventMan->f78_showMouse(); @@ -926,7 +926,7 @@ void InventoryMan::f349_processCommand70_clickOnMouth() { uint16 L1089_ui_Weight; - if (_vm->_championMan->_g415_leaderEmptyHanded) { + if (_vm->_championMan->_leaderEmptyHanded) { if (_g424_panelContent == k0_PanelContentFoodWaterPoisoned) { return; } @@ -944,16 +944,16 @@ void InventoryMan::f349_processCommand70_clickOnMouth() { } return; } - if (_vm->_championMan->_g299_candidateChampionOrdinal) { + if (_vm->_championMan->_candidateChampionOrdinal) { return; } - if (!getFlag(_vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(L1078_T_Thing = _vm->_championMan->_g414_leaderHandObject)]._allowedSlots, k0x0001_ObjectAllowedSlotMouth)) { + if (!getFlag(_vm->_dungeonMan->_objectInfo[_vm->_dungeonMan->f141_getObjectInfoIndex(L1078_T_Thing = _vm->_championMan->_leaderHandObject)]._allowedSlots, k0x0001_ObjectAllowedSlotMouth)) { return; } L1079_ui_IconIndex = _vm->_objectMan->f33_getIconIndex(L1078_T_Thing); AL1088_ui_ThingType = L1078_T_Thing.getType(); L1089_ui_Weight = _vm->_dungeonMan->f140_getObjectWeight(L1078_T_Thing); - L1083_ps_Champion = &_vm->_championMan->_gK71_champions[L1080_ui_ChampionIndex = _vm->M1_ordinalToIndex(_g432_inventoryChampionOrdinal)]; + L1083_ps_Champion = &_vm->_championMan->_champions[L1080_ui_ChampionIndex = _vm->M1_ordinalToIndex(_g432_inventoryChampionOrdinal)]; L1082_ps_Junk = (Junk*)_vm->_dungeonMan->f156_getThingData(L1078_T_Thing); if ((L1079_ui_IconIndex >= k8_IconIndiceJunkWater) && (L1079_ui_IconIndex <= k9_IconIndiceJunkWaterSkin)) { if (!(L1082_ps_Junk->getChargeCount())) { @@ -972,7 +972,7 @@ void InventoryMan::f349_processCommand70_clickOnMouth() { } _vm->_eventMan->f78_showMouse(); if (L1081_B_RemoveObjectFromLeaderHand) { - _vm->_championMan->f298_getObjectRemovedFromLeaderHand(); + _vm->_championMan->getObjectRemovedFromLeaderHand(); } if (AL1088_ui_ThingType == k8_PotionThingType) { AL1085_ui_PotionPower = ((Potion*)L1082_ps_Junk)->getPower(); @@ -992,7 +992,7 @@ void InventoryMan::f349_processCommand70_clickOnMouth() { f348_adjustStatisticCurrentValue(L1083_ps_Champion, k4_ChampionStatVitality, AL1085_ui_AdjustedPotionPower); break; case k10_PotionTypeAntivenin: - _vm->_championMan->f323_unpoison(L1080_ui_ChampionIndex); + _vm->_championMan->unpoison(L1080_ui_ChampionIndex); break; case k11_PotionTypeMon: L1083_ps_Champion->_currStamina += MIN(L1083_ps_Champion->_maxStamina - L1083_ps_Champion->_currStamina, L1083_ps_Champion->_maxStamina / L1086_ui_Counter); @@ -1058,16 +1058,16 @@ void InventoryMan::f349_processCommand70_clickOnMouth() { _vm->_displayMan->updateScreen(); } } else { - _vm->_championMan->f296_drawChangedObjectIcons(); - _vm->_championMan->_gK71_champions[_vm->_championMan->_g411_leaderIndex]._load += _vm->_dungeonMan->f140_getObjectWeight(L1078_T_Thing) - L1089_ui_Weight; - setFlag(_vm->_championMan->_gK71_champions[_vm->_championMan->_g411_leaderIndex]._attributes, k0x0200_ChampionAttributeLoad); + _vm->_championMan->drawChangedObjectIcons(); + _vm->_championMan->_champions[_vm->_championMan->_leaderIndex]._load += _vm->_dungeonMan->f140_getObjectWeight(L1078_T_Thing) - L1089_ui_Weight; + setFlag(_vm->_championMan->_champions[_vm->_championMan->_leaderIndex]._attributes, k0x0200_ChampionAttributeLoad); } _vm->_sound->f064_SOUND_RequestPlay_CPSD(k08_soundSWALLOW, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, k0_soundModePlayImmediately); setFlag(L1083_ps_Champion->_attributes, k0x0100_ChampionAttributeStatistics); if (_g424_panelContent == k0_PanelContentFoodWaterPoisoned) { setFlag(L1083_ps_Champion->_attributes, k0x0800_ChampionAttributePanel); } - _vm->_championMan->f292_drawChampionState((ChampionIndex)L1080_ui_ChampionIndex); + _vm->_championMan->drawChampionState((ChampionIndex)L1080_ui_ChampionIndex); _vm->_eventMan->f77_hideMouse(); } @@ -1106,11 +1106,11 @@ void InventoryMan::f352_processCommand71_clickOnEye() { _vm->_eventMan->f77_hideMouse(); _vm->f22_delay(8); f332_drawIconToViewport(k203_IconIndiceEyeLooking, 12, 13); - if (_vm->_championMan->_g415_leaderEmptyHanded) { + if (_vm->_championMan->_leaderEmptyHanded) { f351_drawChampionSkillsAndStatistics(); } else { _vm->_objectMan->f35_clearLeaderObjectName(); - f342_drawPanelObject(_vm->_championMan->_g414_leaderHandObject, true); + f342_drawPanelObject(_vm->_championMan->_leaderHandObject, true); } _vm->_displayMan->f97_drawViewport(k0_viewportNotDungeonView); diff --git a/engines/dm/loadsave.cpp b/engines/dm/loadsave.cpp index 4d486cfbd6..a3910a908c 100644 --- a/engines/dm/loadsave.cpp +++ b/engines/dm/loadsave.cpp @@ -71,8 +71,8 @@ LoadgameResponse DMEngine::f435_loadgame(int16 slot) { if (_g298_newGame) { //L1366_B_FadePalette = !F0428_DIALOG_RequireGameDiskInDrive_NoDialogDrawn(C0_DO_NOT_FORCE_DIALOG_DM_CSB, true); _g524_restartGameAllowed = false; - _championMan->_g305_partyChampionCount = 0; - _championMan->_g414_leaderHandObject = Thing::_none; + _championMan->_partyChampionCount = 0; + _championMan->_leaderHandObject = Thing::_none; _g525_gameId = ((int32)getRandomNumber(65536)) * getRandomNumber(65536); } else { SaveGameHeader header; @@ -92,13 +92,13 @@ LoadgameResponse DMEngine::f435_loadgame(int16 slot) { _g313_gameTime = file->readSint32BE(); // G0349_ul_LastRandomNumber = L1371_s_GlobalData.LastRandomNumber; - _championMan->_g305_partyChampionCount = file->readUint16BE(); + _championMan->_partyChampionCount = file->readUint16BE(); _dungeonMan->_g306_partyMapX = file->readSint16BE(); _dungeonMan->_g307_partyMapY = file->readSint16BE(); _dungeonMan->_g308_partyDir = (Direction)file->readUint16BE(); _dungeonMan->_g309_partyMapIndex = file->readByte(); - _championMan->_g411_leaderIndex = (ChampionIndex)file->readSint16BE(); - _championMan->_g514_magicCasterChampionIndex = (ChampionIndex)file->readSint16BE(); + _championMan->_leaderIndex = (ChampionIndex)file->readSint16BE(); + _championMan->_magicCasterChampionIndex = (ChampionIndex)file->readSint16BE(); _timeline->_g372_eventCount = file->readUint16BE(); _timeline->_g373_firstUnusedEventIndex = file->readUint16BE(); _timeline->_g369_eventMaxCount = file->readUint16BE(); @@ -108,7 +108,7 @@ LoadgameResponse DMEngine::f435_loadgame(int16 slot) { _g310_disabledMovementTicks = file->readSint16BE(); _g311_projectileDisableMovementTicks = file->readSint16BE(); _g312_lastProjectileDisabledMovementDirection = file->readSint16BE(); - _championMan->_g414_leaderHandObject = Thing(file->readUint16BE()); + _championMan->_leaderHandObject = Thing(file->readUint16BE()); _groupMan->_g376_maxActiveGroupCount = file->readUint16BE(); if (!_g523_restartGameRequest) { _timeline->f233_initTimeline(); @@ -116,7 +116,7 @@ LoadgameResponse DMEngine::f435_loadgame(int16 slot) { } _groupMan->load1_ActiveGroupPart(file); - _championMan->load2_PartyPart(file); + _championMan->loadPartyPart2(file); _timeline->load3_eventsPart(file); _timeline->load4_timelinePart(file); @@ -157,7 +157,7 @@ LoadgameResponse DMEngine::f435_loadgame(int16 slot) { } } - _championMan->_g303_partyDead = false; + _championMan->_partyDead = false; return k1_LoadgameSuccess; } @@ -223,9 +223,9 @@ void DMEngine::f433_processCommand140_saveGame() { } uint16 champHandObjWeight = 0; - if (!_championMan->_g415_leaderEmptyHanded) { - champHandObjWeight = _dungeonMan->f140_getObjectWeight(_championMan->_g414_leaderHandObject); - _championMan->_gK71_champions[_championMan->_g411_leaderIndex]._load -= champHandObjWeight; + if (!_championMan->_leaderEmptyHanded) { + champHandObjWeight = _dungeonMan->f140_getObjectWeight(_championMan->_leaderHandObject); + _championMan->_champions[_championMan->_leaderIndex]._load -= champHandObjWeight; } if (!writeCompleteSaveFile(saveSlot, saveDescription, saveAndPlayChoice)) { @@ -233,8 +233,8 @@ void DMEngine::f433_processCommand140_saveGame() { _dialog->f424_dialogGetChoice(1, k0_DIALOG_SET_VIEWPORT, 0, k0_DIALOG_CHOICE_NONE); } - if (!_championMan->_g415_leaderEmptyHanded) { - _championMan->_gK71_champions[_championMan->_g411_leaderIndex]._load += champHandObjWeight; + if (!_championMan->_leaderEmptyHanded) { + _championMan->_champions[_championMan->_leaderIndex]._load += champHandObjWeight; } } else saveAndPlayChoice = kCancel; @@ -308,13 +308,13 @@ bool DMEngine::writeCompleteSaveFile(int16 saveSlot, Common::String& saveDescrip // write C0_SAVE_PART_GLOBAL_DATA part file->writeSint32BE(_g313_gameTime); //L1348_s_GlobalData.LastRandomNumber = G0349_ul_LastRandomNumber; - file->writeUint16BE(_championMan->_g305_partyChampionCount); + file->writeUint16BE(_championMan->_partyChampionCount); file->writeSint16BE(_dungeonMan->_g306_partyMapX); file->writeSint16BE(_dungeonMan->_g307_partyMapY); file->writeUint16BE(_dungeonMan->_g308_partyDir); file->writeByte(_dungeonMan->_g309_partyMapIndex); - file->writeSint16BE(_championMan->_g411_leaderIndex); - file->writeSint16BE(_championMan->_g514_magicCasterChampionIndex); + file->writeSint16BE(_championMan->_leaderIndex); + file->writeSint16BE(_championMan->_magicCasterChampionIndex); file->writeUint16BE(_timeline->_g372_eventCount); file->writeUint16BE(_timeline->_g373_firstUnusedEventIndex); file->writeUint16BE(_timeline->_g369_eventMaxCount); @@ -324,13 +324,13 @@ bool DMEngine::writeCompleteSaveFile(int16 saveSlot, Common::String& saveDescrip file->writeSint16BE(_g310_disabledMovementTicks); file->writeSint16BE(_g311_projectileDisableMovementTicks); file->writeSint16BE(_g312_lastProjectileDisabledMovementDirection); - file->writeUint16BE(_championMan->_g414_leaderHandObject.toUint16()); + file->writeUint16BE(_championMan->_leaderHandObject.toUint16()); file->writeUint16BE(_groupMan->_g376_maxActiveGroupCount); // write C1_SAVE_PART_ACTIVE_GROUP part _groupMan->save1_ActiveGroupPart(file); // write C2_SAVE_PART_PARTY part - _championMan->save2_PartyPart(file); + _championMan->savePartyPart2(file); // write C3_SAVE_PART_EVENTS part _timeline->save3_eventsPart(file); // write C4_SAVE_PART_TIMELINE part diff --git a/engines/dm/menus.cpp b/engines/dm/menus.cpp index 3134bbb2a4..5a7c9f1a31 100644 --- a/engines/dm/menus.cpp +++ b/engines/dm/menus.cpp @@ -125,11 +125,11 @@ void MenuMan::f395_drawMovementArrows() { } void MenuMan::f388_clearActingChampion() { ChampionMan &cm = *_vm->_championMan; - if (cm._g506_actingChampionOrdinal) { - cm._g506_actingChampionOrdinal--; - cm._gK71_champions[cm._g506_actingChampionOrdinal].setAttributeFlag(k0x8000_ChampionAttributeActionHand, true); - cm.f292_drawChampionState((ChampionIndex)cm._g506_actingChampionOrdinal); - cm._g506_actingChampionOrdinal = _vm->M0_indexToOrdinal(kM1_ChampionNone); + if (cm._actingChampionOrdinal) { + cm._actingChampionOrdinal--; + cm._champions[cm._actingChampionOrdinal].setAttributeFlag(k0x8000_ChampionAttributeActionHand, true); + cm.drawChampionState((ChampionIndex)cm._actingChampionOrdinal); + cm._actingChampionOrdinal = _vm->M0_indexToOrdinal(kM1_ChampionNone); _g508_refreshActionArea = true; } } @@ -140,7 +140,7 @@ void MenuMan::f386_drawActionIcon(ChampionIndex championIndex) { if (!_g509_actionAreaContainsIcons) return; DisplayMan &dm = *_vm->_displayMan; - Champion &champion = _vm->_championMan->_gK71_champions[championIndex]; + Champion &champion = _vm->_championMan->_champions[championIndex]; Box box; box._x1 = championIndex * 22 + 233; @@ -173,13 +173,13 @@ T0386006: box2._y1 = 95; box2._y2 = 110; dm.f21_blitToScreen(bitmapIcon, &box2, k8_byteWidth, kM1_ColorNoTransparency, 16); - if (champion.getAttributes(k0x0008_ChampionAttributeDisableAction) || _vm->_championMan->_g299_candidateChampionOrdinal || _vm->_championMan->_g300_partyIsSleeping) { + if (champion.getAttributes(k0x0008_ChampionAttributeDisableAction) || _vm->_championMan->_candidateChampionOrdinal || _vm->_championMan->_partyIsSleeping) { _vm->_displayMan->f136_shadeScreenBox(&box, k0_ColorBlack); } } void MenuMan::f456_drawDisabledMenu() { - if (!_vm->_championMan->_g300_partyIsSleeping) { + if (!_vm->_championMan->_partyIsSleeping) { _vm->_eventMan->f363_highlightBoxDisable(); _vm->_displayMan->_g578_useByteBoxCoordinates = false; if (_vm->_inventoryMan->_g432_inventoryChampionOrdinal) { @@ -198,39 +198,39 @@ void MenuMan::f456_drawDisabledMenu() { void MenuMan::f390_refreshActionAreaAndSetChampDirMaxDamageReceived() { ChampionMan &champMan = *_vm->_championMan; - if (!champMan._g305_partyChampionCount) + if (!champMan._partyChampionCount) return; Champion *champ = nullptr; - if (champMan._g300_partyIsSleeping || champMan._g299_candidateChampionOrdinal) { - if (champMan._g506_actingChampionOrdinal) { + if (champMan._partyIsSleeping || champMan._candidateChampionOrdinal) { + if (champMan._actingChampionOrdinal) { f388_clearActingChampion(); return; } - if (!champMan._g299_candidateChampionOrdinal) + if (!champMan._candidateChampionOrdinal) return; } else { - champ = champMan._gK71_champions; + champ = champMan._champions; int16 champIndex = k0_ChampionFirst; do { - if ((champIndex != champMan._g411_leaderIndex) - && (_vm->M0_indexToOrdinal(champIndex) != champMan._g506_actingChampionOrdinal) + if ((champIndex != champMan._leaderIndex) + && (_vm->M0_indexToOrdinal(champIndex) != champMan._actingChampionOrdinal) && (champ->_maximumDamageReceived) && (champ->_dir != champ->_directionMaximumDamageReceived)) { champ->_dir = (Direction)champ->_directionMaximumDamageReceived; champ->setAttributeFlag(k0x0400_ChampionAttributeIcon, true); - champMan.f292_drawChampionState((ChampionIndex)champIndex); + champMan.drawChampionState((ChampionIndex)champIndex); } champ->_maximumDamageReceived = 0; champ++; champIndex++; - } while (champIndex < champMan._g305_partyChampionCount); + } while (champIndex < champMan._partyChampionCount); } if (_g508_refreshActionArea) { - if (!champMan._g506_actingChampionOrdinal) { + if (!champMan._actingChampionOrdinal) { if (_g513_actionDamage) { f385_drawActionDamage(_g513_actionDamage); _g513_actionDamage = 0; @@ -241,7 +241,7 @@ void MenuMan::f390_refreshActionAreaAndSetChampDirMaxDamageReceived() { } else { _g509_actionAreaContainsIcons = false; champ->setAttributeFlag(k0x8000_ChampionAttributeActionHand, true); - champMan.f292_drawChampionState((ChampionIndex)_vm->M1_ordinalToIndex(champMan._g506_actingChampionOrdinal)); + champMan.drawChampionState((ChampionIndex)_vm->M1_ordinalToIndex(champMan._actingChampionOrdinal)); f387_drawActionArea(); } } @@ -259,9 +259,9 @@ void MenuMan::f387_drawActionArea() { dispMan._g578_useByteBoxCoordinates = false; dispMan.D24_fillScreenBox(boxActionArea, k0_ColorBlack); if (_g509_actionAreaContainsIcons) { - for (uint16 champIndex = k0_ChampionFirst; champIndex < champMan._g305_partyChampionCount; ++champIndex) + for (uint16 champIndex = k0_ChampionFirst; champIndex < champMan._partyChampionCount; ++champIndex) f386_drawActionIcon((ChampionIndex)champIndex); - } else if (champMan._g506_actingChampionOrdinal) { + } else if (champMan._actingChampionOrdinal) { Box box = boxActionArea3ActionMenu; if (_g713_actionList._actionIndices[2] == k255_ChampionActionNone) box = boxActionArea2ActionMenu; @@ -270,7 +270,7 @@ void MenuMan::f387_drawActionArea() { dispMan.f21_blitToScreen(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k10_MenuActionAreaIndice), &box, k48_byteWidth, kM1_ColorNoTransparency, 45); textMan.f41_printWithTrailingSpaces(dispMan._g348_bitmapScreen, k160_byteWidthScreen, - 235, 83, k0_ColorBlack, k4_ColorCyan, champMan._gK71_champions[_vm->M1_ordinalToIndex(champMan._g506_actingChampionOrdinal)]._name, + 235, 83, k0_ColorBlack, k4_ColorCyan, champMan._champions[_vm->M1_ordinalToIndex(champMan._actingChampionOrdinal)]._name, k7_ChampionNameMaximumLength, k200_heightScreen); for (uint16 actionListIndex = 0; actionListIndex < 3; actionListIndex++) { textMan.f41_printWithTrailingSpaces(dispMan._g348_bitmapScreen, k160_byteWidthScreen, 241, 93 + actionListIndex * 12, k4_ColorCyan, k0_ColorBlack, @@ -302,29 +302,29 @@ Box g504_BoxSpellAreaControls = Box(233, 319, 42, 49); // @ G0504_s_Graphic560_B void MenuMan::f393_drawSpellAreaControls(ChampionIndex champIndex) { - Champion *champ = &_vm->_championMan->_gK71_champions[champIndex]; + Champion *champ = &_vm->_championMan->_champions[champIndex]; _vm->_displayMan->_g578_useByteBoxCoordinates = false; - int16 champHP0 = _vm->_championMan->_gK71_champions[0]._currHealth; - int16 champHP1 = _vm->_championMan->_gK71_champions[1]._currHealth; - int16 champHP2 = _vm->_championMan->_gK71_champions[2]._currHealth; - int16 champHP3 = _vm->_championMan->_gK71_champions[3]._currHealth; + int16 champHP0 = _vm->_championMan->_champions[0]._currHealth; + int16 champHP1 = _vm->_championMan->_champions[1]._currHealth; + int16 champHP2 = _vm->_championMan->_champions[2]._currHealth; + int16 champHP3 = _vm->_championMan->_champions[3]._currHealth; _vm->_eventMan->f78_showMouse(); _vm->_displayMan->D24_fillScreenBox(g504_BoxSpellAreaControls, k0_ColorBlack); switch (champIndex) { case 0: _vm->_eventMan->f6_highlightScreenBox(233, 277, 42, 49); _vm->_textMan->f53_printToLogicalScreen(235, 48, k0_ColorBlack, k4_ColorCyan, champ->_name); - if (_vm->_championMan->_g305_partyChampionCount > 1) { + if (_vm->_championMan->_partyChampionCount > 1) { if (champHP1) { _vm->_eventMan->f6_highlightScreenBox(280, 291, 42, 48); } T0393002: - if (_vm->_championMan->_g305_partyChampionCount > 2) { + if (_vm->_championMan->_partyChampionCount > 2) { if (champHP2) { _vm->_eventMan->f6_highlightScreenBox(294, 305, 42, 48); } T0393003: - if (_vm->_championMan->_g305_partyChampionCount > 3) { + if (_vm->_championMan->_partyChampionCount > 3) { if (champHP3) { _vm->_eventMan->f6_highlightScreenBox(308, 319, 42, 48); } @@ -372,7 +372,7 @@ void MenuMan::f392_buildSpellAreaLine(int16 spellAreaBitmapLine) { static Box boxSpellAreaLine(0, 95, 0, 11); // @ K0074_s_Box_SpellAreaLine char L1204_ac_SpellSymbolString[2] = {'\0', '\0'}; - Champion *L1203_ps_Champion = &_vm->_championMan->_gK71_champions[_vm->_championMan->_g514_magicCasterChampionIndex]; + Champion *L1203_ps_Champion = &_vm->_championMan->_champions[_vm->_championMan->_magicCasterChampionIndex]; if (spellAreaBitmapLine == k2_SpellAreaAvailableSymbols) { _vm->_displayMan->_g578_useByteBoxCoordinates = false; _vm->_displayMan->f132_blitToBitmap(_gK73_bitmapSpellAreaLines, _gK72_bitmapSpellAreaLine, boxSpellAreaLine, 0, 12, k48_byteWidth, k48_byteWidth, kM1_ColorNoTransparency, 36, 12); @@ -400,23 +400,23 @@ void MenuMan::f394_setMagicCasterAndDrawSpellArea(int16 champIndex) { Champion* L1213_ps_Champion; - if ((champIndex == _vm->_championMan->_g514_magicCasterChampionIndex) || ((champIndex != kM1_ChampionNone) && !_vm->_championMan->_gK71_champions[champIndex]._currHealth)) { + if ((champIndex == _vm->_championMan->_magicCasterChampionIndex) || ((champIndex != kM1_ChampionNone) && !_vm->_championMan->_champions[champIndex]._currHealth)) { return; } - if (_vm->_championMan->_g514_magicCasterChampionIndex == kM1_ChampionNone) { + if (_vm->_championMan->_magicCasterChampionIndex == kM1_ChampionNone) { _vm->_eventMan->f78_showMouse(); _vm->_displayMan->f21_blitToScreen(_vm->_displayMan->f489_getNativeBitmapOrGraphic(k9_MenuSpellAreaBackground), &boxSpellArea, k48_byteWidth, kM1_ColorNoTransparency, 33); _vm->_eventMan->f77_hideMouse(); } if (champIndex == kM1_ChampionNone) { - _vm->_championMan->_g514_magicCasterChampionIndex = kM1_ChampionNone; + _vm->_championMan->_magicCasterChampionIndex = kM1_ChampionNone; _vm->_eventMan->f78_showMouse(); _vm->_displayMan->_g578_useByteBoxCoordinates = false; _vm->_displayMan->D24_fillScreenBox(boxSpellArea, k0_ColorBlack); _vm->_eventMan->f77_hideMouse(); return; } - L1213_ps_Champion = &_vm->_championMan->_gK71_champions[_vm->_championMan->_g514_magicCasterChampionIndex = (ChampionIndex)champIndex]; + L1213_ps_Champion = &_vm->_championMan->_champions[_vm->_championMan->_magicCasterChampionIndex = (ChampionIndex)champIndex]; f392_buildSpellAreaLine(k2_SpellAreaAvailableSymbols); _vm->_eventMan->f78_showMouse(); f393_drawSpellAreaControls((ChampionIndex)champIndex); @@ -432,14 +432,14 @@ void MenuMan::f457_drawEnabledMenus() { #define AL1462_i_InventoryChampionOrdinal L1462_i_Multiple - if (_vm->_championMan->_g300_partyIsSleeping) { + if (_vm->_championMan->_partyIsSleeping) { _vm->_eventMan->f379_drawSleepScreen(); _vm->_displayMan->f97_drawViewport(k0_viewportNotDungeonView); } else { - AL1462_i_MagicCasterChampionIndex = _vm->_championMan->_g514_magicCasterChampionIndex; - _vm->_championMan->_g514_magicCasterChampionIndex = kM1_ChampionNone; /* Force next function to draw the spell area */ + AL1462_i_MagicCasterChampionIndex = _vm->_championMan->_magicCasterChampionIndex; + _vm->_championMan->_magicCasterChampionIndex = kM1_ChampionNone; /* Force next function to draw the spell area */ f394_setMagicCasterAndDrawSpellArea(AL1462_i_MagicCasterChampionIndex); - if (!_vm->_championMan->_g506_actingChampionOrdinal) { + if (!_vm->_championMan->_actingChampionOrdinal) { _g509_actionAreaContainsIcons = true; } f387_drawActionArea(); @@ -459,10 +459,10 @@ int16 MenuMan::f408_getClickOnSpellCastResult() { Champion* L1260_ps_Champion; - L1260_ps_Champion = &_vm->_championMan->_gK71_champions[_vm->_championMan->_g514_magicCasterChampionIndex]; + L1260_ps_Champion = &_vm->_championMan->_champions[_vm->_championMan->_magicCasterChampionIndex]; _vm->_eventMan->f78_showMouse(); _vm->_eventMan->f363_highlightBoxDisable(); - if ((L1259_i_SpellCastResult = f412_getChampionSpellCastResult(_vm->_championMan->_g514_magicCasterChampionIndex)) != k3_spellCastFailureNeedsFlask) { + if ((L1259_i_SpellCastResult = f412_getChampionSpellCastResult(_vm->_championMan->_magicCasterChampionIndex)) != k3_spellCastFailureNeedsFlask) { L1260_ps_Champion->_symbols[0] = '\0'; f397_drawAvailableSymbols(L1260_ps_Champion->_symbolStep = 0); f398_drawChampionSymbols(L1260_ps_Champion); @@ -494,10 +494,10 @@ int16 MenuMan::f412_getChampionSpellCastResult(uint16 champIndex) { Junk* L1277_ps_Junk; - if (champIndex >= _vm->_championMan->_g305_partyChampionCount) { + if (champIndex >= _vm->_championMan->_partyChampionCount) { return k0_spellCastFailure; } - L1270_ps_Champion = &_vm->_championMan->_gK71_champions[champIndex]; + L1270_ps_Champion = &_vm->_championMan->_champions[champIndex]; if (!(L1270_ps_Champion->_currHealth)) { return k0_spellCastFailure; } @@ -507,48 +507,48 @@ int16 MenuMan::f412_getChampionSpellCastResult(uint16 champIndex) { } L1268_i_PowerSymbolOrdinal = L1270_ps_Champion->_symbols[0] - '_'; /* Values 1 to 6 */ L1273_ui_Experience = _vm->getRandomNumber(8) + ((AL1269_ui_RequiredSkillLevel = L1271_ps_Spell->_baseRequiredSkillLevel + L1268_i_PowerSymbolOrdinal) << 4) + ((_vm->M1_ordinalToIndex(L1268_i_PowerSymbolOrdinal) * L1271_ps_Spell->_baseRequiredSkillLevel) << 3) + (AL1269_ui_RequiredSkillLevel * AL1269_ui_RequiredSkillLevel); - AL1267_ui_SkillLevel = _vm->_championMan->f303_getSkillLevel(champIndex, L1271_ps_Spell->_skillIndex); + AL1267_ui_SkillLevel = _vm->_championMan->getSkillLevel(champIndex, L1271_ps_Spell->_skillIndex); if (AL1267_ui_SkillLevel < AL1269_ui_RequiredSkillLevel) { L1274_i_MissingSkillLevelCount = AL1269_ui_RequiredSkillLevel - AL1267_ui_SkillLevel; while (L1274_i_MissingSkillLevelCount--) { if (_vm->getRandomNumber(128) > MIN(L1270_ps_Champion->_statistics[k3_ChampionStatWisdom][k1_ChampionStatCurrent] + 15, 115)) { - _vm->_championMan->f304_addSkillExperience(champIndex, L1271_ps_Spell->_skillIndex, L1273_ui_Experience >> (AL1269_ui_RequiredSkillLevel - AL1267_ui_SkillLevel)); + _vm->_championMan->addSkillExperience(champIndex, L1271_ps_Spell->_skillIndex, L1273_ui_Experience >> (AL1269_ui_RequiredSkillLevel - AL1267_ui_SkillLevel)); f410_menusPrintSpellFailureMessage(L1270_ps_Champion, k0_failureNeedsMorePractice, L1271_ps_Spell->_skillIndex); return k0_spellCastFailure; } } } - switch (L1271_ps_Spell->M67_spellKind()) { + switch (L1271_ps_Spell->getKind()) { case k1_spellKindPotion: if ((L1275_ps_Potion = f411_getEmptyFlaskInHand(L1270_ps_Champion, &L1272_T_Object)) == NULL) { f410_menusPrintSpellFailureMessage(L1270_ps_Champion, k10_failureNeedsFlaskInHand, 0); return k3_spellCastFailureNeedsFlask; } AL1269_ui_EmptyFlaskWeight = _vm->_dungeonMan->f140_getObjectWeight(L1272_T_Object); - L1275_ps_Potion->setType((PotionType)L1271_ps_Spell->M68_spellType()); + L1275_ps_Potion->setType((PotionType)L1271_ps_Spell->getType()); L1275_ps_Potion->setPower(_vm->getRandomNumber(16) + (L1268_i_PowerSymbolOrdinal * 40)); L1270_ps_Champion->_load += _vm->_dungeonMan->f140_getObjectWeight(L1272_T_Object) - AL1269_ui_EmptyFlaskWeight; - _vm->_championMan->f296_drawChangedObjectIcons(); + _vm->_championMan->drawChangedObjectIcons(); if (_vm->_inventoryMan->_g432_inventoryChampionOrdinal == _vm->M0_indexToOrdinal(champIndex)) { setFlag(L1270_ps_Champion->_attributes, k0x0200_ChampionAttributeLoad); - _vm->_championMan->f292_drawChampionState((ChampionIndex)champIndex); + _vm->_championMan->drawChampionState((ChampionIndex)champIndex); } break; case k2_spellKindProjectile: if (L1270_ps_Champion->_dir != _vm->_dungeonMan->_g308_partyDir) { L1270_ps_Champion->_dir = _vm->_dungeonMan->_g308_partyDir; setFlag(L1270_ps_Champion->_attributes, k0x0400_ChampionAttributeIcon); - _vm->_championMan->f292_drawChampionState((ChampionIndex)champIndex); + _vm->_championMan->drawChampionState((ChampionIndex)champIndex); } - if (L1271_ps_Spell->M68_spellType() == k4_spellType_projectileOpenDoor) { + if (L1271_ps_Spell->getType() == k4_spellType_projectileOpenDoor) { AL1267_ui_SkillLevel <<= 1; } - _vm->_championMan->f327_isProjectileSpellCast(champIndex, Thing(L1271_ps_Spell->M68_spellType() + Thing::_firstExplosion.toUint16()), f26_getBoundedValue(21, (L1268_i_PowerSymbolOrdinal + 2) * (4 + (AL1267_ui_SkillLevel << 1)), 255), 0); + _vm->_championMan->isProjectileSpellCast(champIndex, Thing(L1271_ps_Spell->getType() + Thing::_firstExplosion.toUint16()), f26_getBoundedValue(21, (L1268_i_PowerSymbolOrdinal + 2) * (4 + (AL1267_ui_SkillLevel << 1)), 255), 0); break; case k3_spellKindOther: L1276_s_Event._priority = 0; AL1267_ui_SpellPower = (L1268_i_PowerSymbolOrdinal + 1) << 2; - switch (L1271_ps_Spell->M68_spellType()) { + switch (L1271_ps_Spell->getType()) { case k0_spellType_otherLight: AL1269_ui_Ticks = 10000 + ((AL1267_ui_SpellPower - 8) << 9); AL1267_ui_LightPower = (AL1267_ui_SpellPower >> 1); @@ -559,40 +559,40 @@ int16 MenuMan::f412_getChampionSpellCastResult(uint16 champIndex) { AL1267_ui_LightPower = (AL1267_ui_SpellPower >> 2); AL1267_ui_LightPower++; T0412019: - _vm->_championMan->_g407_party._magicalLightAmount += _vm->_championMan->_lightPowerToLightAmount[AL1267_ui_LightPower]; + _vm->_championMan->_party._magicalLightAmount += _vm->_championMan->_lightPowerToLightAmount[AL1267_ui_LightPower]; f404_createEvent70_light(-AL1267_ui_LightPower, AL1269_ui_Ticks); break; case k1_spellType_otherDarkness: AL1267_ui_LightPower = (AL1267_ui_SpellPower >> 2); - _vm->_championMan->_g407_party._magicalLightAmount -= _vm->_championMan->_lightPowerToLightAmount[AL1267_ui_LightPower]; + _vm->_championMan->_party._magicalLightAmount -= _vm->_championMan->_lightPowerToLightAmount[AL1267_ui_LightPower]; f404_createEvent70_light(AL1267_ui_LightPower, 98); break; case k2_spellType_otherThievesEye: L1276_s_Event._type = k73_TMEventTypeThievesEye; - _vm->_championMan->_g407_party._event73Count_ThievesEye++; + _vm->_championMan->_party._event73Count_ThievesEye++; AL1267_ui_SpellPower = (AL1267_ui_SpellPower >> 1); goto T0412032; case k3_spellType_otherInvisibility: L1276_s_Event._type = k71_TMEventTypeInvisibility; - _vm->_championMan->_g407_party._event71Count_Invisibility++; + _vm->_championMan->_party._event71Count_Invisibility++; goto T0412033; case k4_spellType_otherPartyShield: L1276_s_Event._type = k74_TMEventTypePartyShield; L1276_s_Event._B._defense = AL1267_ui_SpellPower; - if (_vm->_championMan->_g407_party._shieldDefense > 50) { + if (_vm->_championMan->_party._shieldDefense > 50) { L1276_s_Event._B._defense >>= 2; } - _vm->_championMan->_g407_party._shieldDefense += L1276_s_Event._B._defense; + _vm->_championMan->_party._shieldDefense += L1276_s_Event._B._defense; _vm->_timeline->f260_timelineRefreshAllChampionStatusBoxes(); goto T0412032; case k6_spellType_otherFootprints: L1276_s_Event._type = k79_TMEventTypeFootprints; - _vm->_championMan->_g407_party._event79Count_Footprints++; - _vm->_championMan->_g407_party._firstScentIndex = _vm->_championMan->_g407_party._scentCount; + _vm->_championMan->_party._event79Count_Footprints++; + _vm->_championMan->_party._firstScentIndex = _vm->_championMan->_party._scentCount; if (L1268_i_PowerSymbolOrdinal < 3) { - _vm->_championMan->_g407_party._lastScentIndex = _vm->_championMan->_g407_party._firstScentIndex; + _vm->_championMan->_party._lastScentIndex = _vm->_championMan->_party._firstScentIndex; } else { - _vm->_championMan->_g407_party._lastScentIndex = 0; + _vm->_championMan->_party._lastScentIndex = 0; } T0412032: AL1267_ui_Ticks = AL1267_ui_SpellPower * AL1267_ui_SpellPower; @@ -616,8 +616,8 @@ T0412033: } } if ((AL1267_ui_SlotIndex == k0_ChampionSlotReadyHand) || (AL1267_ui_SlotIndex == k1_ChampionSlotActionHand)) { - _vm->_championMan->f301_addObjectInSlot((ChampionIndex)champIndex, L1272_T_Object, AL1267_ui_SlotIndex); - _vm->_championMan->f292_drawChampionState((ChampionIndex)champIndex); + _vm->_championMan->addObjectInSlot((ChampionIndex)champIndex, L1272_T_Object, AL1267_ui_SlotIndex); + _vm->_championMan->drawChampionState((ChampionIndex)champIndex); } else { _vm->_moveSens->f267_getMoveResult(L1272_T_Object, kM1_MapXNotOnASquare, 0, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY); } @@ -626,8 +626,8 @@ T0412033: f403_isPartySpellOrFireShieldSuccessful(L1270_ps_Champion, false, (AL1267_ui_SpellPower * AL1267_ui_SpellPower) + 100, false); } } - _vm->_championMan->f304_addSkillExperience(champIndex, L1271_ps_Spell->_skillIndex, L1273_ui_Experience); - _vm->_championMan->f330_disableAction(champIndex, L1271_ps_Spell->M69_spellDurration()); + _vm->_championMan->addSkillExperience(champIndex, L1271_ps_Spell->_skillIndex, L1273_ui_Experience); + _vm->_championMan->disableAction(champIndex, L1271_ps_Spell->getDuration()); return k1_spellCastSuccess; } @@ -775,16 +775,16 @@ bool MenuMan::f403_isPartySpellOrFireShieldSuccessful(Champion* champ, bool spel L1240_s_Event._B._defense = ticks >> 5; if (spellShield) { L1240_s_Event._type = k77_TMEventTypeSpellShield; - if (_vm->_championMan->_g407_party._spellShieldDefense > 50) { + if (_vm->_championMan->_party._spellShieldDefense > 50) { L1240_s_Event._B._defense >>= 2; } - _vm->_championMan->_g407_party._spellShieldDefense += L1240_s_Event._B._defense; + _vm->_championMan->_party._spellShieldDefense += L1240_s_Event._B._defense; } else { L1240_s_Event._type = k78_TMEventTypeFireShield; - if (_vm->_championMan->_g407_party._fireShieldDefense > 50) { + if (_vm->_championMan->_party._fireShieldDefense > 50) { L1240_s_Event._B._defense >>= 2; } - _vm->_championMan->_g407_party._fireShieldDefense += L1240_s_Event._B._defense; + _vm->_championMan->_party._fireShieldDefense += L1240_s_Event._B._defense; } L1240_s_Event._priority = 0; M33_setMapAndTime(L1240_s_Event._mapTime, _vm->_dungeonMan->_g309_partyMapIndex, _vm->_g313_gameTime + ticks); @@ -841,7 +841,7 @@ void MenuMan::f399_addChampionSymbol(int16 symbolIndex) { uint16 L1224_ui_SymbolIndex; Champion* L1225_ps_Champion; - L1225_ps_Champion = &_vm->_championMan->_gK71_champions[_vm->_championMan->_g514_magicCasterChampionIndex]; + L1225_ps_Champion = &_vm->_championMan->_champions[_vm->_championMan->_magicCasterChampionIndex]; L1222_ui_SymbolStep = L1225_ps_Champion->_symbolStep; L1223_ui_ManaCost = G0485_aauc_Graphic560_SymbolBaseManaCost[L1222_ui_SymbolStep][symbolIndex]; if (L1222_ui_SymbolStep) { @@ -856,7 +856,7 @@ void MenuMan::f399_addChampionSymbol(int16 symbolIndex) { _vm->_eventMan->f78_showMouse(); f397_drawAvailableSymbols(L1222_ui_SymbolStep); f398_drawChampionSymbols(L1225_ps_Champion); - _vm->_championMan->f292_drawChampionState(_vm->_championMan->_g514_magicCasterChampionIndex); + _vm->_championMan->drawChampionState(_vm->_championMan->_magicCasterChampionIndex); _vm->_eventMan->f77_hideMouse(); } } @@ -865,7 +865,7 @@ void MenuMan::f400_deleteChampionSymbol() { int16 L1226_ui_SymbolStep; Champion* L1228_ps_Champion; - L1228_ps_Champion = &_vm->_championMan->_gK71_champions[_vm->_championMan->_g514_magicCasterChampionIndex]; + L1228_ps_Champion = &_vm->_championMan->_champions[_vm->_championMan->_magicCasterChampionIndex]; if (!strlen(L1228_ps_Champion->_symbols)) { return; } @@ -884,10 +884,10 @@ bool MenuMan::f391_didClickTriggerAction(int16 actionListIndex) { Champion* L1199_ps_Champion; - if (!_vm->_championMan->_g506_actingChampionOrdinal || (actionListIndex != -1 && (_g713_actionList._actionIndices[actionListIndex] == k255_ChampionActionNone))) + if (!_vm->_championMan->_actingChampionOrdinal || (actionListIndex != -1 && (_g713_actionList._actionIndices[actionListIndex] == k255_ChampionActionNone))) return false; - L1199_ps_Champion = &_vm->_championMan->_gK71_champions[L1196_ui_ChampionIndex = _vm->M1_ordinalToIndex(_vm->_championMan->_g506_actingChampionOrdinal)]; + L1199_ps_Champion = &_vm->_championMan->_champions[L1196_ui_ChampionIndex = _vm->M1_ordinalToIndex(_vm->_championMan->_actingChampionOrdinal)]; if (actionListIndex == -1) { // L1198_B_ClickTriggeredAction is set to -1 since booleans are stored in int16 in the original L1198_B_ClickTriggeredAction = true; @@ -1070,10 +1070,10 @@ bool MenuMan::f407_isActionPerformed(uint16 champIndex, int16 actionIndex) { TimelineEvent L1258_s_Event; - if (champIndex >= _vm->_championMan->_g305_partyChampionCount) { + if (champIndex >= _vm->_championMan->_partyChampionCount) { return false; } - L1247_ps_Champion = &_vm->_championMan->_gK71_champions[champIndex]; + L1247_ps_Champion = &_vm->_championMan->_champions[champIndex]; L1248_ps_Weapon = (Weapon*)_vm->_dungeonMan->f156_getThingData(L1247_ps_Champion->_slots[k1_ChampionSlotActionHand]); if (!L1247_ps_Champion->_currHealth) { return false; @@ -1089,7 +1089,7 @@ bool MenuMan::f407_isActionPerformed(uint16 champIndex, int16 actionIndex) { AL1244_ui_TargetSquare = _vm->_dungeonMan->f151_getSquare(L1251_i_MapX, L1252_i_MapY).toByte(); AL1245_B_ActionPerformed = true; if (((L1254_i_ActionSkillIndex >= k16_ChampionSkillFire) && (L1254_i_ActionSkillIndex <= k19_ChampionSkillWater)) || (L1254_i_ActionSkillIndex == k3_ChampionSkillWizard)) { - AL1246_i_RequiredManaAmount = 7 - MIN((uint16)6, _vm->_championMan->f303_getSkillLevel(champIndex, L1254_i_ActionSkillIndex)); + AL1246_i_RequiredManaAmount = 7 - MIN((uint16)6, _vm->_championMan->getSkillLevel(champIndex, L1254_i_ActionSkillIndex)); } switch (actionIndex) { case k23_ChampionActionLightning: @@ -1113,7 +1113,7 @@ T0407014: AL1250_i_KineticEnergy = MAX(2, L1247_ps_Champion->_currMana * AL1250_i_KineticEnergy / AL1246_i_RequiredManaAmount); AL1246_i_RequiredManaAmount = L1247_ps_Champion->_currMana; } - if (!(AL1245_B_ActionPerformed = _vm->_championMan->f327_isProjectileSpellCast(champIndex, Thing(AL1245_T_ExplosionThing), AL1250_i_KineticEnergy, AL1246_i_RequiredManaAmount))) { + if (!(AL1245_B_ActionPerformed = _vm->_championMan->isProjectileSpellCast(champIndex, Thing(AL1245_T_ExplosionThing), AL1250_i_KineticEnergy, AL1246_i_RequiredManaAmount))) { L1255_i_ActionExperienceGain >>= 1; } f405_decrementCharges(L1247_ps_Champion); @@ -1127,7 +1127,7 @@ T0407014: if ((Square(AL1244_ui_TargetSquare).getType() == k4_DoorElemType) && (Square(AL1244_ui_TargetSquare).getDoorState() == k4_doorState_CLOSED)) { _vm->_sound->f064_SOUND_RequestPlay_CPSD(k16_soundCOMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, k1_soundModePlayIfPrioritized); L1249_ui_ActionDisabledTicks = 6; - _vm->_groupMan->f232_groupIsDoorDestoryedByAttack(L1251_i_MapX, L1252_i_MapY, _vm->_championMan->f312_getStrength(champIndex, k1_ChampionSlotActionHand), false, 2); + _vm->_groupMan->f232_groupIsDoorDestoryedByAttack(L1251_i_MapX, L1252_i_MapY, _vm->_championMan->getStrength(champIndex, k1_ChampionSlotActionHand), false, 2); _vm->_sound->f064_SOUND_RequestPlay_CPSD(k04_soundWOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, k2_soundModePlayOneTickLater); break; } @@ -1186,9 +1186,9 @@ T0407032: } f406_setChampionDirectionToPartyDirection(L1247_ps_Champion); { // so gotos won't skip init - Thing AL1250_T_Object = _vm->_championMan->f300_getObjectRemovedFromSlot(champIndex, k0_ChampionSlotReadyHand); + Thing AL1250_T_Object = _vm->_championMan->getObjectRemovedFromSlot(champIndex, k0_ChampionSlotReadyHand); _vm->_sound->f064_SOUND_RequestPlay_CPSD(k16_soundCOMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, k1_soundModePlayIfPrioritized); - _vm->_championMan->f326_championShootProjectile(L1247_ps_Champion, AL1250_T_Object, L1256_ps_WeaponInfoActionHand->_kineticEnergy + L1257_ps_WeaponInfoReadyHand->_kineticEnergy, (L1256_ps_WeaponInfoActionHand->getShootAttack() + _vm->_championMan->f303_getSkillLevel(champIndex, k11_ChampionSkillShoot)) << 1, AL1246_i_StepEnergy); + _vm->_championMan->championShootProjectile(L1247_ps_Champion, AL1250_T_Object, L1256_ps_WeaponInfoActionHand->_kineticEnergy + L1257_ps_WeaponInfoReadyHand->_kineticEnergy, (L1256_ps_WeaponInfoActionHand->getShootAttack() + _vm->_championMan->getSkillLevel(champIndex, k11_ChampionSkillShoot)) << 1, AL1246_i_StepEnergy); } break; case k5_ChampionActionFlip: { @@ -1251,7 +1251,7 @@ T0407032: Mana cost is 2 * heal cycle count Experience gain is 2 + 2 * heal cycle count */ if (((AL1250_i_MissingHealth = L1247_ps_Champion->_maxHealth - L1247_ps_Champion->_currHealth) > 0) && L1247_ps_Champion->_currMana) { - AL1246_i_HealingCapability = MIN((uint16)10, _vm->_championMan->f303_getSkillLevel(champIndex, k13_ChampionSkillHeal)); + AL1246_i_HealingCapability = MIN((uint16)10, _vm->_championMan->getSkillLevel(champIndex, k13_ChampionSkillHeal)); L1255_i_ActionExperienceGain = 2; do { AL1244_ui_HealingAmount = MIN(AL1250_i_MissingHealth, AL1246_i_HealingCapability); @@ -1266,12 +1266,12 @@ T0407032: } break; case k39_ChampionActionWindow: - AL1246_i_Ticks = _vm->getRandomNumber(_vm->_championMan->f303_getSkillLevel(champIndex, L1254_i_ActionSkillIndex) + 8) + 5; + AL1246_i_Ticks = _vm->getRandomNumber(_vm->_championMan->getSkillLevel(champIndex, L1254_i_ActionSkillIndex) + 8) + 5; L1258_s_Event._priority = 0; L1258_s_Event._type = k73_TMEventTypeThievesEye; M33_setMapAndTime(L1258_s_Event._mapTime, _vm->_dungeonMan->_g309_partyMapIndex, _vm->_g313_gameTime + AL1246_i_Ticks); _vm->_timeline->f238_addEventGetEventIndex(&L1258_s_Event); - _vm->_championMan->_g407_party._event73Count_ThievesEye++; + _vm->_championMan->_party._event73Count_ThievesEye++; goto T0407076; case k10_ChampionActionClimbDown: L1251_i_MapX = _vm->_dungeonMan->_g306_partyMapX; @@ -1295,36 +1295,36 @@ T0407032: if (L1248_ps_Weapon->getType() == k43_JunkTypeMagicalBoxGreen) { AL1246_i_Ticks = 125; T0407071: - _vm->_championMan->f300_getObjectRemovedFromSlot(champIndex, k1_ChampionSlotActionHand); + _vm->_championMan->getObjectRemovedFromSlot(champIndex, k1_ChampionSlotActionHand); L1248_ps_Weapon->setNextThing(Thing::_none); } else { AL1246_i_Ticks = 70; f405_decrementCharges(L1247_ps_Champion); } - _vm->_championMan->_g407_party._freezeLifeTicks = MIN(200, _vm->_championMan->_g407_party._freezeLifeTicks + AL1246_i_Ticks); + _vm->_championMan->_party._freezeLifeTicks = MIN(200, _vm->_championMan->_party._freezeLifeTicks + AL1246_i_Ticks); break; case k38_ChampionActionLight: - _vm->_championMan->_g407_party._magicalLightAmount += _vm->_championMan->_lightPowerToLightAmount[2]; + _vm->_championMan->_party._magicalLightAmount += _vm->_championMan->_lightPowerToLightAmount[2]; f404_createEvent70_light(-2, 2500); T0407076: f405_decrementCharges(L1247_ps_Champion); break; case k42_ChampionActionThrow: f406_setChampionDirectionToPartyDirection(L1247_ps_Champion); - if (AL1245_B_ActionPerformed = _vm->_championMan->f328_isObjectThrown(champIndex, k1_ChampionSlotActionHand, (L1247_ps_Champion->_cell == returnNextVal(_vm->_dungeonMan->_g308_partyDir)) || (L1247_ps_Champion->_cell == returnOppositeDir(_vm->_dungeonMan->_g308_partyDir)))) { + if (AL1245_B_ActionPerformed = _vm->_championMan->isObjectThrown(champIndex, k1_ChampionSlotActionHand, (L1247_ps_Champion->_cell == returnNextVal(_vm->_dungeonMan->_g308_partyDir)) || (L1247_ps_Champion->_cell == returnOppositeDir(_vm->_dungeonMan->_g308_partyDir)))) { _vm->_timeline->_g370_events[L1247_ps_Champion->_enableActionEventIndex]._B._slotOrdinal = _vm->M0_indexToOrdinal(k1_ChampionSlotActionHand); } } if (L1249_ui_ActionDisabledTicks) { - _vm->_championMan->f330_disableAction(champIndex, L1249_ui_ActionDisabledTicks); + _vm->_championMan->disableAction(champIndex, L1249_ui_ActionDisabledTicks); } if (L1253_i_ActionStamina) { - _vm->_championMan->f325_decrementStamina(champIndex, L1253_i_ActionStamina); + _vm->_championMan->decrementStamina(champIndex, L1253_i_ActionStamina); } if (L1255_i_ActionExperienceGain) { - _vm->_championMan->f304_addSkillExperience(champIndex, L1254_i_ActionSkillIndex, L1255_i_ActionExperienceGain); + _vm->_championMan->addSkillExperience(champIndex, L1254_i_ActionSkillIndex, L1255_i_ActionExperienceGain); } - _vm->_championMan->f292_drawChampionState((ChampionIndex)champIndex); + _vm->_championMan->drawChampionState((ChampionIndex)champIndex); return AL1245_B_ActionPerformed; } @@ -1356,7 +1356,7 @@ void MenuMan::f405_decrementCharges(Champion* champ) { L1243_ps_Junk->setChargeCount(L1243_ps_Junk->getChargeCount() - 1); } } - _vm->_championMan->f296_drawChangedObjectIcons(); + _vm->_championMan->drawChangedObjectIcons(); } bool MenuMan::f402_isMeleeActionPerformed(int16 champIndex, Champion* champ, int16 actionIndex, int16 targetMapX, int16 targetMapY, int16 skillIndex) { @@ -1471,7 +1471,7 @@ bool MenuMan::f402_isMeleeActionPerformed(int16 champIndex, Champion* champ, int case k3_ViewCellBackLeft: /* Champion is on the back left of the square and tries to attack a creature in the front left of its square */ AL1237_ui_CellDelta = 1; T0402005: /* Check if there is another champion in front */ - if (_vm->_championMan->f285_getIndexInCell(M21_normalizeModulo4(AL1236_ui_ChampionCell + AL1237_ui_CellDelta)) != kM1_ChampionNone) { + if (_vm->_championMan->getIndexInCell(M21_normalizeModulo4(AL1236_ui_ChampionCell + AL1237_ui_CellDelta)) != kM1_ChampionNone) { _g513_actionDamage = kM1_damageCantReach; goto T0402010; } @@ -1524,7 +1524,7 @@ bool MenuMan::f401_isGroupFrightenedByAction(int16 champIndex, uint16 actionInde L1229_i_FrightAmount = 12; L1231_ui_Experience = 45; } - L1229_i_FrightAmount += _vm->_championMan->f303_getSkillLevel(champIndex, k14_ChampionSkillInfluence); + L1229_i_FrightAmount += _vm->_championMan->getSkillLevel(champIndex, k14_ChampionSkillInfluence); L1233_ps_Group = (Group*)_vm->_dungeonMan->f156_getThingData(_g517_actionTargetGroupThing); L1234_ps_CreatureInfo = &g243_CreatureInfo[L1233_ps_Group->_type]; if (((L1230_ui_FearResistance = L1234_ps_CreatureInfo->M57_getFearResistance()) > _vm->getRandomNumber(L1229_i_FrightAmount)) || (L1230_ui_FearResistance == k15_immuneToFear)) { @@ -1539,7 +1539,7 @@ bool MenuMan::f401_isGroupFrightenedByAction(int16 champIndex, uint16 actionInde L1235_ps_ActiveGroup->_delayFleeingFromTarget = ((16 - L1230_ui_FearResistance) << 2) / L1234_ps_CreatureInfo->_movementTicks; L1232_B_IsGroupFrightenedByAction = true; } - _vm->_championMan->f304_addSkillExperience(champIndex, k14_ChampionSkillInfluence, L1231_ui_Experience); + _vm->_championMan->addSkillExperience(champIndex, k14_ChampionSkillInfluence, L1231_ui_Experience); T0401016: return L1232_B_IsGroupFrightenedByAction; } @@ -1560,7 +1560,7 @@ void MenuMan::f381_printMessageAfterReplacements(const char* str) { } switch (*str) { case 'p': /* '@p' in the source string is replaced by the champion name followed by a space */ - L1165_pc_ReplacementString = _vm->_championMan->_gK71_champions[_vm->M1_ordinalToIndex(_vm->_championMan->_g506_actingChampionOrdinal)]._name; + L1165_pc_ReplacementString = _vm->_championMan->_champions[_vm->M1_ordinalToIndex(_vm->_championMan->_actingChampionOrdinal)]._name; } *L1164_pc_Character = '\0'; strcat(L1166_ac_OutputString, L1165_pc_ReplacementString); @@ -1629,7 +1629,7 @@ void MenuMan::f389_processCommands116To119_setActingChampion(uint16 champIndex) ActionSet* L1191_ps_ActionSet; - L1190_ps_Champion = &_vm->_championMan->_gK71_champions[champIndex]; + L1190_ps_Champion = &_vm->_championMan->_champions[champIndex]; if (getFlag(L1190_ps_Champion->_attributes, k0x0008_ChampionAttributeDisableAction) || !L1190_ps_Champion->_currHealth) { return; } @@ -1639,11 +1639,11 @@ void MenuMan::f389_processCommands116To119_setActingChampion(uint16 champIndex) return; } L1191_ps_ActionSet = &G0489_as_Graphic560_ActionSets[L1188_ui_ActionSetIndex]; - _vm->_championMan->_g506_actingChampionOrdinal = _vm->M0_indexToOrdinal(champIndex); + _vm->_championMan->_actingChampionOrdinal = _vm->M0_indexToOrdinal(champIndex); f383_setActionList(L1191_ps_ActionSet); _g509_actionAreaContainsIcons = false; setFlag(L1190_ps_Champion->_attributes, k0x8000_ChampionAttributeActionHand); - _vm->_championMan->f292_drawChampionState((ChampionIndex)champIndex); + _vm->_championMan->drawChampionState((ChampionIndex)champIndex); f387_drawActionArea(); f387_drawActionArea(); } @@ -1666,7 +1666,7 @@ void MenuMan::f383_setActionList(ActionSet* actionSet) { if (getFlag(L1172_ui_MinimumSkillLevel = actionSet->_actionProperties[L1169_ui_ActionListIndex - 1], k0x0080_actionRequiresCharge) && !f382_getActionObjectChargeCount()) continue; clearFlag(L1172_ui_MinimumSkillLevel, k0x0080_actionRequiresCharge); - if (_vm->_championMan->f303_getSkillLevel(_vm->M1_ordinalToIndex(_vm->_championMan->_g506_actingChampionOrdinal), g496_ActionSkillIndex[L1171_ui_ActionIndex]) >= L1172_ui_MinimumSkillLevel) { + if (_vm->_championMan->getSkillLevel(_vm->M1_ordinalToIndex(_vm->_championMan->_actingChampionOrdinal), g496_ActionSkillIndex[L1171_ui_ActionIndex]) >= L1172_ui_MinimumSkillLevel) { _g713_actionList._actionIndices[L1170_ui_NextAvailableActionListIndex] = (ChampionAction)L1171_ui_ActionIndex; _g713_actionList._minimumSkillLevel[L1170_ui_NextAvailableActionListIndex] = L1172_ui_MinimumSkillLevel; L1170_ui_NextAvailableActionListIndex++; @@ -1683,7 +1683,7 @@ int16 MenuMan::f382_getActionObjectChargeCount() { Junk* L1168_ps_Junk; - L1168_ps_Junk = (Junk*)_vm->_dungeonMan->f156_getThingData(L1167_T_Thing = _vm->_championMan->_gK71_champions[_vm->M1_ordinalToIndex(_vm->_championMan->_g506_actingChampionOrdinal)]._slots[k1_ChampionSlotActionHand]); + L1168_ps_Junk = (Junk*)_vm->_dungeonMan->f156_getThingData(L1167_T_Thing = _vm->_championMan->_champions[_vm->M1_ordinalToIndex(_vm->_championMan->_actingChampionOrdinal)]._slots[k1_ChampionSlotActionHand]); switch (L1167_T_Thing.getType()) { case k5_WeaponThingType: return ((Weapon*)L1168_ps_Junk)->getChargeCount(); diff --git a/engines/dm/movesens.cpp b/engines/dm/movesens.cpp index e961ecaab9..416b48c442 100644 --- a/engines/dm/movesens.cpp +++ b/engines/dm/movesens.cpp @@ -73,7 +73,7 @@ bool MovesensMan::f275_sensorIsTriggeredByClickOnWall(int16 mapX, int16 mapY, ui L0759_B_AtLeastOneSensorWasTriggered = false; - L0761_T_LeaderHandObject = _vm->_championMan->_g414_leaderHandObject; + L0761_T_LeaderHandObject = _vm->_championMan->_leaderHandObject; for (L0752_ui_Cell = k0_CellNorthWest; L0752_ui_Cell < k3_CellSouthWest + 1; L0752_ui_Cell++) { L0760_ai_SensorCountToProcessPerCell[L0752_ui_Cell] = 0; } @@ -94,7 +94,7 @@ bool MovesensMan::f275_sensorIsTriggeredByClickOnWall(int16 mapX, int16 mapY, ui L0755_ps_Sensor = (Sensor *)_vm->_dungeonMan->f156_getThingData(L0750_T_ThingBeingProcessed); if ((L0757_ui_SensorType = (L0755_ps_Sensor)->getType()) == k0_SensorDisabled) goto T0275058_ProceedToNextThing; - if ((_vm->_championMan->_g411_leaderIndex == kM1_ChampionNone) && (L0757_ui_SensorType != k127_SensorWallChampionPortrait)) + if ((_vm->_championMan->_leaderIndex == kM1_ChampionNone) && (L0757_ui_SensorType != k127_SensorWallChampionPortrait)) goto T0275058_ProceedToNextThing; if (L0752_ui_Cell != cellParam) goto T0275058_ProceedToNextThing; @@ -108,7 +108,7 @@ bool MovesensMan::f275_sensorIsTriggeredByClickOnWall(int16 mapX, int16 mapY, ui } break; case k2_SensorWallOrnClickWithAnyObj: - L0753_B_DoNotTriggerSensor = (_vm->_championMan->_g415_leaderEmptyHanded != L0755_ps_Sensor->getRevertEffectA()); + L0753_B_DoNotTriggerSensor = (_vm->_championMan->_leaderEmptyHanded != L0755_ps_Sensor->getRevertEffectA()); break; case k17_SensorWallOrnClickWithSpecObjRemovedSensor: case k11_SensorWallOrnClickWithSpecObjRemovedRotateSensors: @@ -132,26 +132,26 @@ bool MovesensMan::f275_sensorIsTriggeredByClickOnWall(int16 mapX, int16 mapY, ui case k12_SensorWallObjGeneratorRotateSensors: if (L0760_ai_SensorCountToProcessPerCell[L0752_ui_Cell]) /* If the sensor is not the last one of its type on the cell */ goto T0275058_ProceedToNextThing; - L0753_B_DoNotTriggerSensor = !_vm->_championMan->_g415_leaderEmptyHanded; + L0753_B_DoNotTriggerSensor = !_vm->_championMan->_leaderEmptyHanded; if (!L0753_B_DoNotTriggerSensor) { f270_sensorTriggetLocalEffect(k2_SensorEffToggle, mapX, mapY, L0752_ui_Cell); /* This will cause a rotation of the sensors at the specified cell on the specified square after all sensors have been processed */ } break; case k13_SensorWallSingleObjStorageRotateSensors: - if (_vm->_championMan->_g415_leaderEmptyHanded) { + if (_vm->_championMan->_leaderEmptyHanded) { if ((L0761_T_LeaderHandObject = f273_sensorGetObjectOfTypeInCell(mapX, mapY, L0752_ui_Cell, L0758_i_SensorData)) == Thing::_none) goto T0275058_ProceedToNextThing; _vm->_dungeonMan->f164_unlinkThingFromList(L0761_T_LeaderHandObject, Thing(0), mapX, mapY); - _vm->_championMan->f297_putObjectInLeaderHand(L0761_T_LeaderHandObject, true); + _vm->_championMan->putObjectInLeaderHand(L0761_T_LeaderHandObject, true); } else { if ((_vm->_objectMan->f32_getObjectType(L0761_T_LeaderHandObject) != L0758_i_SensorData) || (f273_sensorGetObjectOfTypeInCell(mapX, mapY, L0752_ui_Cell, L0758_i_SensorData) != Thing::_none)) goto T0275058_ProceedToNextThing; - _vm->_championMan->f298_getObjectRemovedFromLeaderHand(); + _vm->_championMan->getObjectRemovedFromLeaderHand(); _vm->_dungeonMan->f163_linkThingToList(M15_thingWithNewCell(L0761_T_LeaderHandObject, L0752_ui_Cell), Thing(0), mapX, mapY); L0761_T_LeaderHandObject = Thing::_none; } f270_sensorTriggetLocalEffect(k2_SensorEffToggle, mapX, mapY, L0752_ui_Cell); /* This will cause a rotation of the sensors at the specified cell on the specified square after all sensors have been processed */ - if ((L0756_i_SensorEffect == k3_SensorEffHold) && !_vm->_championMan->_g415_leaderEmptyHanded) { + if ((L0756_i_SensorEffect == k3_SensorEffHold) && !_vm->_championMan->_leaderEmptyHanded) { L0753_B_DoNotTriggerSensor = true; } else { L0753_B_DoNotTriggerSensor = false; @@ -164,13 +164,13 @@ bool MovesensMan::f275_sensorIsTriggeredByClickOnWall(int16 mapX, int16 mapY, ui if ((_vm->_objectMan->f32_getObjectType(L0761_T_LeaderHandObject) != L0758_i_SensorData) || (L0762_T_ThingOnSquare == Thing::_none)) goto T0275058_ProceedToNextThing; _vm->_dungeonMan->f164_unlinkThingFromList(L0762_T_ThingOnSquare, Thing(0), mapX, mapY); - _vm->_championMan->f298_getObjectRemovedFromLeaderHand(); + _vm->_championMan->getObjectRemovedFromLeaderHand(); _vm->_dungeonMan->f163_linkThingToList(M15_thingWithNewCell(L0761_T_LeaderHandObject, L0752_ui_Cell), Thing(0), mapX, mapY); - _vm->_championMan->f297_putObjectInLeaderHand(L0762_T_ThingOnSquare, true); + _vm->_championMan->putObjectInLeaderHand(L0762_T_ThingOnSquare, true); L0753_B_DoNotTriggerSensor = false; break; case k127_SensorWallChampionPortrait: - _vm->_championMan->f280_addCandidateChampionToParty(L0758_i_SensorData); + _vm->_championMan->addCandidateChampionToParty(L0758_i_SensorData); goto T0275058_ProceedToNextThing; default: goto T0275058_ProceedToNextThing; @@ -184,16 +184,16 @@ bool MovesensMan::f275_sensorIsTriggeredByClickOnWall(int16 mapX, int16 mapY, ui if (L0755_ps_Sensor->getAudibleA()) { _vm->_sound->f064_SOUND_RequestPlay_CPSD(k01_soundSWITCH, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, k1_soundModePlayIfPrioritized); } - if (!_vm->_championMan->_g415_leaderEmptyHanded && ((L0757_ui_SensorType == k4_SensorWallOrnClickWithSpecObjRemoved) || (L0757_ui_SensorType == k11_SensorWallOrnClickWithSpecObjRemovedRotateSensors) || (L0757_ui_SensorType == k17_SensorWallOrnClickWithSpecObjRemovedSensor))) { + if (!_vm->_championMan->_leaderEmptyHanded && ((L0757_ui_SensorType == k4_SensorWallOrnClickWithSpecObjRemoved) || (L0757_ui_SensorType == k11_SensorWallOrnClickWithSpecObjRemovedRotateSensors) || (L0757_ui_SensorType == k17_SensorWallOrnClickWithSpecObjRemovedSensor))) { L0754_ps_Generic = (Thing *)_vm->_dungeonMan->f156_getThingData(L0761_T_LeaderHandObject); *L0754_ps_Generic = Thing::_none; - _vm->_championMan->f298_getObjectRemovedFromLeaderHand(); + _vm->_championMan->getObjectRemovedFromLeaderHand(); L0761_T_LeaderHandObject = Thing::_none; } else { - if (_vm->_championMan->_g415_leaderEmptyHanded && + if (_vm->_championMan->_leaderEmptyHanded && (L0757_ui_SensorType == k12_SensorWallObjGeneratorRotateSensors) && ((L0761_T_LeaderHandObject = _vm->_dungeonMan->f167_getObjForProjectileLaucherOrObjGen(L0758_i_SensorData)) != Thing::_none)) { - _vm->_championMan->f297_putObjectInLeaderHand(L0761_T_LeaderHandObject, true); + _vm->_championMan->putObjectInLeaderHand(L0761_T_LeaderHandObject, true); } } f272_sensorTriggerEffect(L0755_ps_Sensor, L0756_i_SensorEffect, mapX, mapY, L0752_ui_Cell); @@ -268,7 +268,7 @@ bool MovesensMan::f267_getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 _vm->_dungeonMan->_g306_partyMapX = destMapX; _vm->_dungeonMan->_g307_partyMapY = destMapY; L0718_i_RequiredTeleporterScope = k0x0002_TelepScopeObjOrParty; - L0723_B_DrawDungeonViewWhileFalling = !_vm->_inventoryMan->_g432_inventoryChampionOrdinal && !_vm->_championMan->_g300_partyIsSleeping; + L0723_B_DrawDungeonViewWhileFalling = !_vm->_inventoryMan->_g432_inventoryChampionOrdinal && !_vm->_championMan->_partyIsSleeping; L0716_ui_Direction = _vm->_dungeonMan->_g308_partyDir; } else { if (L0710_i_ThingType == k4_GroupThingType) { @@ -304,9 +304,9 @@ bool MovesensMan::f267_getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 } L0723_B_DrawDungeonViewWhileFalling = true; if (L0712_ps_Teleporter->getAbsoluteRotation()) { - _vm->_championMan->f284_setPartyDirection(L0712_ps_Teleporter->getRotation()); + _vm->_championMan->setPartyDirection(L0712_ps_Teleporter->getRotation()); } else { - _vm->_championMan->f284_setPartyDirection(M21_normalizeModulo4(_vm->_dungeonMan->_g308_partyDir + L0712_ps_Teleporter->getRotation())); + _vm->_championMan->setPartyDirection(M21_normalizeModulo4(_vm->_dungeonMan->_g308_partyDir + L0712_ps_Teleporter->getRotation())); } } else { if (L0710_i_ThingType == k4_GroupThingType) { @@ -344,15 +344,15 @@ bool MovesensMan::f267_getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 if (thing == Thing::_party) { _vm->_dungeonMan->_g306_partyMapX = destMapX; _vm->_dungeonMan->_g307_partyMapY = destMapY; - if (_vm->_championMan->_g305_partyChampionCount > 0) { + if (_vm->_championMan->_partyChampionCount > 0) { if (_g402_useRopeToClimbDownPit) { - for (AL0709_i_ChampionIndex = k0_ChampionFirst, L0711_ps_Champion = _vm->_championMan->_gK71_champions; AL0709_i_ChampionIndex < _vm->_championMan->_g305_partyChampionCount; AL0709_i_ChampionIndex++, L0711_ps_Champion++) { + for (AL0709_i_ChampionIndex = k0_ChampionFirst, L0711_ps_Champion = _vm->_championMan->_champions; AL0709_i_ChampionIndex < _vm->_championMan->_partyChampionCount; AL0709_i_ChampionIndex++, L0711_ps_Champion++) { if (L0711_ps_Champion->_currHealth) { - _vm->_championMan->f325_decrementStamina(AL0709_i_ChampionIndex, ((L0711_ps_Champion->_load * 25) / _vm->_championMan->f309_getMaximumLoad(L0711_ps_Champion)) + 1); + _vm->_championMan->decrementStamina(AL0709_i_ChampionIndex, ((L0711_ps_Champion->_load * 25) / _vm->_championMan->getMaximumLoad(L0711_ps_Champion)) + 1); } } } else { - if (_vm->_championMan->f324_damageAll_getDamagedChampionCount(20, k0x0010_ChampionWoundLegs | k0x0020_ChampionWoundFeet, k2_attackType_SELF)) { + if (_vm->_championMan->getDamagedChampionCount(20, k0x0010_ChampionWoundLegs | k0x0020_ChampionWoundFeet, k2_attackType_SELF)) { _vm->_sound->f064_SOUND_RequestPlay_CPSD(k06_soundSCREAM, _vm->_dungeonMan->_g306_partyMapX, _vm->_dungeonMan->_g307_partyMapY, k0_soundModePlayImmediately); } } @@ -412,26 +412,26 @@ bool MovesensMan::f267_getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 } } } else { - if ((thing == Thing::_party) && _vm->_championMan->_g305_partyChampionCount) { + if ((thing == Thing::_party) && _vm->_championMan->_partyChampionCount) { AL0727_ui_Backup = AL0708_i_DestinationSquare; - AL0708_i_ScentIndex = _vm->_championMan->_g407_party._scentCount; + AL0708_i_ScentIndex = _vm->_championMan->_party._scentCount; while (AL0708_i_ScentIndex >= 24) { - _vm->_championMan->f316_deleteScent(0); + _vm->_championMan->deleteScent(0); AL0708_i_ScentIndex--; } if (AL0708_i_ScentIndex) { - _vm->_championMan->f317_addScentStrength(mapX, mapY, (int)(_vm->_g313_gameTime - _vm->_projexpl->_g362_lastPartyMovementTime)); + _vm->_championMan->addScentStrength(mapX, mapY, (int)(_vm->_g313_gameTime - _vm->_projexpl->_g362_lastPartyMovementTime)); } _vm->_projexpl->_g362_lastPartyMovementTime = _vm->_g313_gameTime; - _vm->_championMan->_g407_party._scentCount++; - if (_vm->_championMan->_g407_party._event79Count_Footprints) { - _vm->_championMan->_g407_party._lastScentIndex = _vm->_championMan->_g407_party._scentCount; + _vm->_championMan->_party._scentCount++; + if (_vm->_championMan->_party._event79Count_Footprints) { + _vm->_championMan->_party._lastScentIndex = _vm->_championMan->_party._scentCount; } - _vm->_championMan->_g407_party._scents[AL0708_i_ScentIndex].setMapX(destMapX); - _vm->_championMan->_g407_party._scents[AL0708_i_ScentIndex].setMapY(destMapY); - _vm->_championMan->_g407_party._scents[AL0708_i_ScentIndex].setMapIndex(L0715_ui_MapIndexDestination); - _vm->_championMan->_g407_party._scentStrengths[AL0708_i_ScentIndex] = 0; - _vm->_championMan->f317_addScentStrength(destMapX, destMapY, k0x8000_mergeCycles | 24); + _vm->_championMan->_party._scents[AL0708_i_ScentIndex].setMapX(destMapX); + _vm->_championMan->_party._scents[AL0708_i_ScentIndex].setMapY(destMapY); + _vm->_championMan->_party._scents[AL0708_i_ScentIndex].setMapIndex(L0715_ui_MapIndexDestination); + _vm->_championMan->_party._scentStrengths[AL0708_i_ScentIndex] = 0; + _vm->_championMan->addScentStrength(destMapX, destMapY, k0x8000_mergeCycles | 24); AL0708_i_DestinationSquare = AL0727_ui_Backup; } if (L0715_ui_MapIndexDestination != L0714_ui_MapIndexSource) { @@ -565,7 +565,7 @@ bool MovesensMan::f266_moveIsKilledByProjectileImpact(int16 srcMapX, int16 srcMa if (thing == Thing::_party) { L0702_i_ImpactType = kM2_ChampionElemType; for (AL0699_ui_Cell = k0_CellNorthWest; AL0699_ui_Cell < k3_CellSouthWest + 1; AL0699_ui_Cell++) { - if (_vm->_championMan->f285_getIndexInCell((ViewCell)AL0699_ui_Cell) >= 0) { + if (_vm->_championMan->getIndexInCell((ViewCell)AL0699_ui_Cell) >= 0) { L0707_auc_ChampionOrCreatureOrdinalInCell[AL0699_ui_Cell] = _vm->M0_indexToOrdinal(AL0699_ui_Cell); } } @@ -645,7 +645,7 @@ void MovesensMan::f268_addEvent(byte type, byte mapX, byte mapY, byte cell, byte } int16 MovesensMan::f514_getSound(byte creatureType) { - if (_vm->_championMan->_g300_partyIsSleeping) { + if (_vm->_championMan->_partyIsSleeping) { return 35; } @@ -839,7 +839,7 @@ void MovesensMan::f276_sensorProcessThingAdditionOrRemoval(uint16 mapX, uint16 m goto T0276079; break; case k3_SensorFloorParty: - if ((L0767_i_ThingType != kM1_PartyThingType) || (_vm->_championMan->_g305_partyChampionCount == 0)) + if ((L0767_i_ThingType != kM1_PartyThingType) || (_vm->_championMan->_partyChampionCount == 0)) goto T0276079; if (L0779_i_SensorData == 0) { if (partySquare) @@ -933,7 +933,7 @@ bool MovesensMan::f274_sensorIsObjcetInPartyPossession(int16 objectType) { L0748_B_LeaderHandObjectProcessed = false; - for (L0742_i_ChampionIndex = k0_ChampionFirst, L0745_ps_Champion = _vm->_championMan->_gK71_champions; L0742_i_ChampionIndex < _vm->_championMan->_g305_partyChampionCount; L0742_i_ChampionIndex++, L0745_ps_Champion++) { + for (L0742_i_ChampionIndex = k0_ChampionFirst, L0745_ps_Champion = _vm->_championMan->_champions; L0742_i_ChampionIndex < _vm->_championMan->_partyChampionCount; L0742_i_ChampionIndex++, L0745_ps_Champion++) { if (L0745_ps_Champion->_currHealth) { L0746_pT_Thing = L0745_ps_Champion->_slots; for (L0743_ui_SlotIndex = k0_ChampionSlotReadyHand; (L0743_ui_SlotIndex < k30_ChampionSlotChest_1) && !L0748_B_LeaderHandObjectProcessed; L0743_ui_SlotIndex++) { @@ -957,7 +957,7 @@ T0274003: } if (!L0748_B_LeaderHandObjectProcessed) { L0748_B_LeaderHandObjectProcessed = true; - L0744_T_Thing = _vm->_championMan->_g414_leaderHandObject; + L0744_T_Thing = _vm->_championMan->_leaderHandObject; goto T0274003; } return false; @@ -1013,15 +1013,15 @@ void MovesensMan::f270_sensorTriggetLocalEffect(int16 localEffect, int16 effX, i void MovesensMan::f269_sensorAddSkillExperience(int16 skillIndex, uint16 exp, bool leaderOnly) { if (leaderOnly) { - if (_vm->_championMan->_g411_leaderIndex != kM1_ChampionNone) { - _vm->_championMan->f304_addSkillExperience(_vm->_championMan->_g411_leaderIndex, skillIndex, exp); + if (_vm->_championMan->_leaderIndex != kM1_ChampionNone) { + _vm->_championMan->addSkillExperience(_vm->_championMan->_leaderIndex, skillIndex, exp); } } else { - exp /= _vm->_championMan->_g305_partyChampionCount; - Champion *L0731_ps_Champion = _vm->_championMan->_gK71_champions; - for (int16 L0730_i_ChampionIndex = k0_ChampionFirst; L0730_i_ChampionIndex < _vm->_championMan->_g305_partyChampionCount; L0730_i_ChampionIndex++, L0731_ps_Champion++) { + exp /= _vm->_championMan->_partyChampionCount; + Champion *L0731_ps_Champion = _vm->_championMan->_champions; + for (int16 L0730_i_ChampionIndex = k0_ChampionFirst; L0730_i_ChampionIndex < _vm->_championMan->_partyChampionCount; L0730_i_ChampionIndex++, L0731_ps_Champion++) { if (L0731_ps_Champion->_currHealth) { - _vm->_championMan->f304_addSkillExperience(L0730_i_ChampionIndex, skillIndex, exp); + _vm->_championMan->addSkillExperience(L0730_i_ChampionIndex, skillIndex, exp); } } } diff --git a/engines/dm/objectman.cpp b/engines/dm/objectman.cpp index debf94811a..fe5737d9d6 100644 --- a/engines/dm/objectman.cpp +++ b/engines/dm/objectman.cpp @@ -246,12 +246,12 @@ void ObjectMan::f34_drawLeaderObjectName(Thing thing) { default: case Common::EN_ANY: case Common::DE_DEU: // english and german version are the same - strcpy(champBonesName, _vm->_championMan->_gK71_champions[junk->getChargeCount()]._name); + strcpy(champBonesName, _vm->_championMan->_champions[junk->getChargeCount()]._name); strcat(champBonesName, _g352_objectNames[L0007_i_IconIndex]); break; case Common::FR_FRA: strcat(champBonesName, _g352_objectNames[L0007_i_IconIndex]); - strcpy(champBonesName, _vm->_championMan->_gK71_champions[junk->getChargeCount()]._name); + strcpy(champBonesName, _vm->_championMan->_champions[junk->getChargeCount()]._name); break; } 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); diff --git a/engines/dm/timeline.cpp b/engines/dm/timeline.cpp index 4ada95fe2a..27f58c9731 100644 --- a/engines/dm/timeline.cpp +++ b/engines/dm/timeline.cpp @@ -343,37 +343,37 @@ void Timeline::f261_processTimeline() { _vm->_inventoryMan->f337_setDungeonViewPalette(); break; case k71_TMEventTypeInvisibility: - _vm->_championMan->_g407_party._event71Count_Invisibility--; + _vm->_championMan->_party._event71Count_Invisibility--; break; case k72_TMEventTypeChampionShield: - _vm->_championMan->_gK71_champions[L0682_s_Event._priority]._shieldDefense -= L0682_s_Event._B._defense; - setFlag(_vm->_championMan->_gK71_champions[L0682_s_Event._priority]._attributes, k0x1000_ChampionAttributeStatusBox); + _vm->_championMan->_champions[L0682_s_Event._priority]._shieldDefense -= L0682_s_Event._B._defense; + setFlag(_vm->_championMan->_champions[L0682_s_Event._priority]._attributes, k0x1000_ChampionAttributeStatusBox); T0261048: - _vm->_championMan->f292_drawChampionState((ChampionIndex)L0682_s_Event._priority); + _vm->_championMan->drawChampionState((ChampionIndex)L0682_s_Event._priority); break; case k73_TMEventTypeThievesEye: - _vm->_championMan->_g407_party._event73Count_ThievesEye--; + _vm->_championMan->_party._event73Count_ThievesEye--; break; case k74_TMEventTypePartyShield: - _vm->_championMan->_g407_party._shieldDefense -= L0682_s_Event._B._defense; + _vm->_championMan->_party._shieldDefense -= L0682_s_Event._B._defense; T0261053: f260_timelineRefreshAllChampionStatusBoxes(); break; case k77_TMEventTypeSpellShield: - _vm->_championMan->_g407_party._spellShieldDefense -= L0682_s_Event._B._defense; + _vm->_championMan->_party._spellShieldDefense -= L0682_s_Event._B._defense; goto T0261053; case k78_TMEventTypeFireShield: - _vm->_championMan->_g407_party._fireShieldDefense -= L0682_s_Event._B._defense; + _vm->_championMan->_party._fireShieldDefense -= L0682_s_Event._B._defense; goto T0261053; case k75_TMEventTypePoisonChampion: - _vm->_championMan->_gK71_champions[AL0680_ui_ChampionIndex = L0682_s_Event._priority]._poisonEventCount--; - _vm->_championMan->f322_championPoison(AL0680_ui_ChampionIndex, L0682_s_Event._B._attack); + _vm->_championMan->_champions[AL0680_ui_ChampionIndex = L0682_s_Event._priority]._poisonEventCount--; + _vm->_championMan->championPoison(AL0680_ui_ChampionIndex, L0682_s_Event._B._attack); break; case k13_TMEventTypeViAltarRebirth: f255_timelineProcessEvent13_ViAltarRebirth(L0681_ps_Event); break; case k79_TMEventTypeFootprints: - _vm->_championMan->_g407_party._event79Count_Footprints--; + _vm->_championMan->_party._event79Count_Footprints--; } } _vm->_dungeonMan->f173_setCurrentMap(_vm->_dungeonMan->_g309_partyMapIndex); @@ -414,13 +414,13 @@ void Timeline::f241_timelineProcessEvent1_doorAnimation(TimelineEvent* event) { L0598_ps_Door = (Door*)_vm->_dungeonMan->f157_getSquareFirstThingData(L0593_ui_MapX, L0594_ui_MapY); AL0602_ui_VerticalDoor = L0598_ps_Door->opensVertically(); if ((_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex) && (L0593_ui_MapX == _vm->_dungeonMan->_g306_partyMapX) && (L0594_ui_MapY == _vm->_dungeonMan->_g307_partyMapY) && (L0596_i_DoorState != k0_doorState_OPEN)) { - if (_vm->_championMan->_g305_partyChampionCount > 0) { + if (_vm->_championMan->_partyChampionCount > 0) { L0597_puc_Square->setDoorState(k0_doorState_OPEN); // Strangerke // Original bug fixed - A closing horizontal door wounds champions to the head instead of to the hands. Missing parenthesis in the condition cause all doors to wound the head in addition to the torso // See BUG0_78 - if (_vm->_championMan->f324_damageAll_getDamagedChampionCount(5, k0x0008_ChampionWoundTorso | (AL0602_ui_VerticalDoor ? k0x0004_ChampionWoundHead : k0x0001_ChampionWoundReadHand | k0x0002_ChampionWoundActionHand), k2_attackType_SELF)) { + if (_vm->_championMan->getDamagedChampionCount(5, k0x0008_ChampionWoundTorso | (AL0602_ui_VerticalDoor ? k0x0004_ChampionWoundHead : k0x0001_ChampionWoundReadHand | k0x0002_ChampionWoundActionHand), k2_attackType_SELF)) { _vm->_sound->f064_SOUND_RequestPlay_CPSD(k18_soundPARTY_DAMAGED, L0593_ui_MapX, L0594_ui_MapY, k1_soundModePlayIfPrioritized); } } @@ -555,7 +555,7 @@ void Timeline::f249_moveTeleporterOrPitSquareThings(uint16 mapX, uint16 mapY) { if ((_vm->_dungeonMan->_g272_currMapIndex == _vm->_dungeonMan->_g309_partyMapIndex) && (mapX == _vm->_dungeonMan->_g306_partyMapX) && (mapY == _vm->_dungeonMan->_g307_partyMapY)) { _vm->_moveSens->f267_getMoveResult(Thing::_party, mapX, mapY, mapX, mapY); - _vm->_championMan->f296_drawChangedObjectIcons(); + _vm->_championMan->drawChangedObjectIcons(); } if ((L0645_T_Thing = _vm->_groupMan->f175_groupGetThing(mapX, mapY)) != Thing::_endOfList) { _vm->_moveSens->f267_getMoveResult(L0645_T_Thing, mapX, mapY, mapX, mapY); @@ -932,7 +932,7 @@ void Timeline::f253_timelineProcessEvent11Part1_enableChampionAction(uint16 cham int16 L0661_i_QuiverSlotIndex; Champion* L0662_ps_Champion; - L0662_ps_Champion = &_vm->_championMan->_gK71_champions[champIndex]; + L0662_ps_Champion = &_vm->_championMan->_champions[champIndex]; L0662_ps_Champion->_enableActionEventIndex = -1; clearFlag(L0662_ps_Champion->_attributes, k0x0008_ChampionAttributeDisableAction); if (L0662_ps_Champion->_actionIndex != k255_ChampionActionNone) { @@ -940,18 +940,18 @@ void Timeline::f253_timelineProcessEvent11Part1_enableChampionAction(uint16 cham } if (L0662_ps_Champion->_currHealth) { if ((L0662_ps_Champion->_actionIndex == k32_ChampionActionShoot) && (L0662_ps_Champion->_slots[k0_ChampionSlotReadyHand] == Thing::_none)) { - if (_vm->_championMan->f294_isAmmunitionCompatibleWithWeapon(champIndex, k1_ChampionSlotActionHand, L0660_i_SlotIndex = k12_ChampionSlotQuiverLine_1_1)) { + if (_vm->_championMan->isAmmunitionCompatibleWithWeapon(champIndex, k1_ChampionSlotActionHand, L0660_i_SlotIndex = k12_ChampionSlotQuiverLine_1_1)) { T0253002: - _vm->_championMan->f301_addObjectInSlot((ChampionIndex)champIndex, _vm->_championMan->f300_getObjectRemovedFromSlot(champIndex, L0660_i_SlotIndex), k0_ChampionSlotReadyHand); + _vm->_championMan->addObjectInSlot((ChampionIndex)champIndex, _vm->_championMan->getObjectRemovedFromSlot(champIndex, L0660_i_SlotIndex), k0_ChampionSlotReadyHand); } else { for (L0661_i_QuiverSlotIndex = 0; L0661_i_QuiverSlotIndex < 3; L0661_i_QuiverSlotIndex++) { - if (_vm->_championMan->f294_isAmmunitionCompatibleWithWeapon(champIndex, k1_ChampionSlotActionHand, L0660_i_SlotIndex = L0661_i_QuiverSlotIndex + k7_ChampionSlotQuiverLine_2_1)) + if (_vm->_championMan->isAmmunitionCompatibleWithWeapon(champIndex, k1_ChampionSlotActionHand, L0660_i_SlotIndex = L0661_i_QuiverSlotIndex + k7_ChampionSlotQuiverLine_2_1)) goto T0253002; } } } setFlag(L0662_ps_Champion->_attributes, k0x8000_ChampionAttributeActionHand); - _vm->_championMan->f292_drawChampionState((ChampionIndex)champIndex); + _vm->_championMan->drawChampionState((ChampionIndex)champIndex); } L0662_ps_Champion->_actionIndex = k255_ChampionActionNone; } @@ -960,7 +960,7 @@ void Timeline::f259_timelineProcessEvent11Part2_moveWeaponFromQuiverToSlot(uint1 uint16 L0677_ui_SlotIndex; Champion* L0678_ps_Champion; - L0678_ps_Champion = &_vm->_championMan->_gK71_champions[champIndex]; + L0678_ps_Champion = &_vm->_championMan->_champions[champIndex]; if (L0678_ps_Champion->_slots[slotIndex] != Thing::_none) { return; } @@ -975,7 +975,7 @@ void Timeline::f259_timelineProcessEvent11Part2_moveWeaponFromQuiverToSlot(uint1 bool Timeline::f258_timelineHasWeaponMovedSlot(int16 champIndex, Champion* champ, uint16 sourceSlotIndex, int16 destSlotIndex) { if (Thing(champ->_slots[sourceSlotIndex]).getType() == k5_WeaponThingType) { - _vm->_championMan->f301_addObjectInSlot((ChampionIndex)champIndex, _vm->_championMan->f300_getObjectRemovedFromSlot(champIndex, sourceSlotIndex), + _vm->_championMan->addObjectInSlot((ChampionIndex)champIndex, _vm->_championMan->getObjectRemovedFromSlot(champIndex, sourceSlotIndex), (ChampionSlot)destSlotIndex); return true; } @@ -986,7 +986,7 @@ void Timeline::f254_timelineProcessEvent12_hideDamageReceived(uint16 champIndex) Champion* L0663_ps_Champion; - L0663_ps_Champion = &_vm->_championMan->_gK71_champions[champIndex]; + L0663_ps_Champion = &_vm->_championMan->_champions[champIndex]; L0663_ps_Champion->_hideDamageReceivedIndex = -1; if (!L0663_ps_Champion->_currHealth) { return; @@ -997,7 +997,7 @@ void Timeline::f254_timelineProcessEvent12_hideDamageReceived(uint16 champIndex) _vm->_eventMan->f77_hideMouse(); } else { setFlag(L0663_ps_Champion->_attributes, k0x0080_ChampionAttributeNameTitle); - _vm->_championMan->f292_drawChampionState((ChampionIndex)champIndex); + _vm->_championMan->drawChampionState((ChampionIndex)champIndex); } } @@ -1025,7 +1025,7 @@ void Timeline::f257_timelineProcessEvent70_light(TimelineEvent* event) { AL0674_i_LightAmount = -AL0674_i_LightAmount; L0673_i_WeakerLightPower = -L0673_i_WeakerLightPower; } - _vm->_championMan->_g407_party._magicalLightAmount += AL0674_i_LightAmount; + _vm->_championMan->_party._magicalLightAmount += AL0674_i_LightAmount; if (L0673_i_WeakerLightPower) { L0676_s_Event._type = k70_TMEventTypeLight; L0676_s_Event._B._lightPower = L0673_i_WeakerLightPower; @@ -1038,10 +1038,10 @@ void Timeline::f257_timelineProcessEvent70_light(TimelineEvent* event) { void Timeline::f260_timelineRefreshAllChampionStatusBoxes() { uint16 L0679_ui_ChampionIndex; - for (L0679_ui_ChampionIndex = k0_ChampionFirst; L0679_ui_ChampionIndex < _vm->_championMan->_g305_partyChampionCount; L0679_ui_ChampionIndex++) { - setFlag(_vm->_championMan->_gK71_champions[L0679_ui_ChampionIndex]._attributes, k0x1000_ChampionAttributeStatusBox); + for (L0679_ui_ChampionIndex = k0_ChampionFirst; L0679_ui_ChampionIndex < _vm->_championMan->_partyChampionCount; L0679_ui_ChampionIndex++) { + setFlag(_vm->_championMan->_champions[L0679_ui_ChampionIndex]._attributes, k0x1000_ChampionAttributeStatusBox); } - _vm->_championMan->f293_drawAllChampionStates(); + _vm->_championMan->drawAllChampionStates(); } void Timeline::f255_timelineProcessEvent13_ViAltarRebirth(TimelineEvent* event) { @@ -1088,7 +1088,7 @@ T0255002: } break; case 0: - _vm->_championMan->f283_viAltarRebirth(event->_priority); + _vm->_championMan->viAltarRebirth(event->_priority); } } |