DM: More renaming in champion.h

This commit is contained in:
Strangerke 2016-09-09 07:32:32 +02:00
parent 1b482a1e12
commit 93fb0efc0b
10 changed files with 287 additions and 288 deletions

View File

@ -230,9 +230,9 @@ bool ChampionMan::isObjectThrown(uint16 champIndex, int16 slotIndex, int16 side)
experience += weaponKineticEnergy >> 2; experience += weaponKineticEnergy >> 2;
} }
} }
addSkillExperience(champIndex, k10_ChampionSkillThrow, experience); addSkillExperience(champIndex, kDMSkillThrow, experience);
kineticEnergy += weaponKineticEnergy; kineticEnergy += weaponKineticEnergy;
int16 skillLevel = getSkillLevel((ChampionIndex)champIndex, k10_ChampionSkillThrow); int16 skillLevel = getSkillLevel((ChampionIndex)champIndex, kDMSkillThrow);
kineticEnergy += _vm->getRandomNumber(16) + (kineticEnergy >> 1) + skillLevel; kineticEnergy += _vm->getRandomNumber(16) + (kineticEnergy >> 1) + skillLevel;
int16 attack = getBoundedValue((uint16)40, (uint16)((skillLevel << 3) + _vm->getRandomNumber(32)), (uint16)200); int16 attack = getBoundedValue((uint16)40, (uint16)((skillLevel << 3) + _vm->getRandomNumber(32)), (uint16)200);
int16 stepEnergy = MAX(5, 11 - skillLevel); int16 stepEnergy = MAX(5, 11 - skillLevel);
@ -287,7 +287,7 @@ Common::String ChampionMan::getStringFromInteger(uint16 val, bool padding, uint1
} }
void ChampionMan::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 = kDMChampionStatLuck; int16 statIndex = kDMStatLuck;
int16 modifier = 0; int16 modifier = 0;
ThingType thingType = thing.getType(); ThingType thingType = thing.getType();
@ -304,23 +304,23 @@ void ChampionMan::applyModifiersToStatistics(Champion *champ, int16 slotIndex, i
} }
if (cursed) { if (cursed) {
statIndex = kDMChampionStatLuck; statIndex = kDMStatLuck;
modifier = -3; modifier = -3;
} }
} }
if (!cursed) { if (!cursed) {
statIndex = (ChampionStatisticType)thingType; // variable sharing statIndex = (ChampionStatType)thingType; // variable sharing
if ((iconIndex == kDMIconIndiceJunkRabbitsFoot) && (slotIndex < k30_ChampionSlotChest_1)) { if ((iconIndex == kDMIconIndiceJunkRabbitsFoot) && (slotIndex < k30_ChampionSlotChest_1)) {
statIndex = kDMChampionStatLuck; statIndex = kDMStatLuck;
modifier = 10; modifier = 10;
} else if (slotIndex == k1_ChampionSlotActionHand) { } else if (slotIndex == k1_ChampionSlotActionHand) {
if (iconIndex == kDMIconIndiceWeaponMaceOfOrder) { if (iconIndex == kDMIconIndiceWeaponMaceOfOrder) {
statIndex = kDMChampionStatStrength; statIndex = kDMStatStrength;
modifier = 5; modifier = 5;
} else { } else {
statIndex = kDMChampionStatMana; statIndex = kDMStatMana;
if ((iconIndex >= kDMIconIndiceWeaponStaffOfClawsEmpty) && (iconIndex <= kDMIconIndiceWeaponStaffOfClawsFull)) { if ((iconIndex >= kDMIconIndiceWeaponStaffOfClawsEmpty) && (iconIndex <= kDMIconIndiceWeaponStaffOfClawsFull)) {
modifier = 4; modifier = 4;
} else { } else {
@ -368,17 +368,17 @@ void ChampionMan::applyModifiersToStatistics(Champion *champ, int16 slotIndex, i
} }
} else if (slotIndex == k4_ChampionSlotLegs) { } else if (slotIndex == k4_ChampionSlotLegs) {
if (iconIndex == kDMIconIndiceArmourPowertowers) { if (iconIndex == kDMIconIndiceArmourPowertowers) {
statIndex = kDMChampionStatStrength; statIndex = kDMStatStrength;
modifier = 10; modifier = 10;
} }
} else if (slotIndex == k2_ChampionSlotHead) { } else if (slotIndex == k2_ChampionSlotHead) {
switch (iconIndex) { switch (iconIndex) {
case kDMIconIndiceArmourCrownOfNerra: case kDMIconIndiceArmourCrownOfNerra:
statIndex = kDMChampionStatWisdom; statIndex = kDMStatWisdom;
modifier = 10; modifier = 10;
break; break;
case kDMIconIndiceArmourDexhelm: case kDMIconIndiceArmourDexhelm:
statIndex = kDMChampionStatDexterity; statIndex = kDMStatDexterity;
modifier = 10; modifier = 10;
break; break;
default: default:
@ -387,11 +387,11 @@ void ChampionMan::applyModifiersToStatistics(Champion *champ, int16 slotIndex, i
} else if (slotIndex == k3_ChampionSlotTorso) { } else if (slotIndex == k3_ChampionSlotTorso) {
switch (iconIndex) { switch (iconIndex) {
case kDMIconIndiceArmourFlamebain: case kDMIconIndiceArmourFlamebain:
statIndex = kDMChampionStatAntifire; statIndex = kDMStatAntifire;
modifier = 12; modifier = 12;
break; break;
case kDMIconIndiceArmourCloakOfNight: case kDMIconIndiceArmourCloakOfNight:
statIndex = kDMChampionStatDexterity; statIndex = kDMStatDexterity;
modifier = 8; modifier = 8;
break; break;
default: default:
@ -401,15 +401,15 @@ void ChampionMan::applyModifiersToStatistics(Champion *champ, int16 slotIndex, i
switch (iconIndex) { switch (iconIndex) {
case kDMIconIndiceJunkJewelSymalUnequipped: case kDMIconIndiceJunkJewelSymalUnequipped:
case kDMIconIndiceJunkJewelSymalEquipped: case kDMIconIndiceJunkJewelSymalEquipped:
statIndex = kDMChampionStatAntimagic; statIndex = kDMStatAntimagic;
modifier = 15; modifier = 15;
break; break;
case kDMIconIndiceArmourCloakOfNight: case kDMIconIndiceArmourCloakOfNight:
statIndex = kDMChampionStatDexterity; statIndex = kDMStatDexterity;
modifier = 8; modifier = 8;
break; break;
case kDMIconIndiceJunkMoonstone: case kDMIconIndiceJunkMoonstone:
statIndex = kDMChampionStatMana; statIndex = kDMStatMana;
modifier = 3; modifier = 3;
break; break;
default: default:
@ -421,11 +421,11 @@ void ChampionMan::applyModifiersToStatistics(Champion *champ, int16 slotIndex, i
if (modifier) { if (modifier) {
modifier *= modifierFactor; modifier *= modifierFactor;
//statIndex is set when modifier is set //statIndex is set when modifier is set
if (statIndex == kDMChampionStatMana) { if (statIndex == kDMStatMana) {
champ->_maxMana += modifier; champ->_maxMana += modifier;
} else if (statIndex < kDMChampionStatAntifire + 1) { } else if (statIndex < kDMStatAntifire + 1) {
for (uint16 statValIndex = kDMChampionStatMaximum; statValIndex <= kDMChampionStatMinimum; ++statValIndex) { for (uint16 statValIndex = kDMStatMaximum; statValIndex <= kDMStatMinimum; ++statValIndex) {
champ->getStatistic((ChampionStatisticType)statIndex, (ChampionStatisticValue)statValIndex) += modifier; champ->getStatistic((ChampionStatType)statIndex, (ChampionStatValue)statValIndex) += modifier;
} }
} }
} }
@ -511,7 +511,7 @@ void ChampionMan::drawChangedObjectIcons() {
} }
if (drawViewport) { if (drawViewport) {
champ->setAttributeFlag(kDMChampionAttributeViewport, true); champ->setAttributeFlag(kDMAttributeViewport, true);
drawChampionState((ChampionIndex)_vm->ordinalToIndex(invChampOrdinal)); drawChampionState((ChampionIndex)_vm->ordinalToIndex(invChampOrdinal));
} }
} }
@ -538,7 +538,7 @@ void ChampionMan::addObjectInSlot(ChampionIndex champIndex, Thing thing, Champio
} }
champ->_load += dunMan.getObjectWeight(thing); champ->_load += dunMan.getObjectWeight(thing);
champ->setAttributeFlag(kDMChampionAttributeLoad, true); champ->setAttributeFlag(kDMAttributeLoad, true);
IconIndice iconIndex = objMan.getIconIndex(thing); IconIndice iconIndex = objMan.getIconIndex(thing);
bool isInventoryChampion = (_vm->indexToOrdinal(champIndex) == invMan._inventoryChampionOrdinal); bool isInventoryChampion = (_vm->indexToOrdinal(champIndex) == invMan._inventoryChampionOrdinal);
applyModifiersToStatistics(champ, slotIndex, iconIndex, 1, thing); applyModifiersToStatistics(champ, slotIndex, iconIndex, 1, thing);
@ -546,7 +546,7 @@ void ChampionMan::addObjectInSlot(ChampionIndex champIndex, Thing thing, Champio
if (slotIndex < k2_ChampionSlotHead) { if (slotIndex < k2_ChampionSlotHead) {
if (slotIndex == k1_ChampionSlotActionHand) { if (slotIndex == k1_ChampionSlotActionHand) {
champ->setAttributeFlag(kDMChampionAttributeActionHand, true); champ->setAttributeFlag(kDMAttributeActionHand, true);
if (_actingChampionOrdinal == _vm->indexToOrdinal(champIndex)) if (_actingChampionOrdinal == _vm->indexToOrdinal(champIndex))
menuMan.clearActingChampion(); menuMan.clearActingChampion();
@ -562,7 +562,7 @@ void ChampionMan::addObjectInSlot(ChampionIndex champIndex, Thing thing, Champio
drawChangedObjectIcons(); drawChangedObjectIcons();
} else if (isInventoryChampion && (slotIndex == k1_ChampionSlotActionHand) && } else if (isInventoryChampion && (slotIndex == k1_ChampionSlotActionHand) &&
((iconIndex == kDMIconIndiceContainerChestClosed) || ((iconIndex >= kDMIconIndiceScrollOpen) && (iconIndex <= kDMIconIndiceScrollClosed)))) { ((iconIndex == kDMIconIndiceContainerChestClosed) || ((iconIndex >= kDMIconIndiceScrollOpen) && (iconIndex <= kDMIconIndiceScrollClosed)))) {
champ->setAttributeFlag(kDMChampionAttributePanel, true); champ->setAttributeFlag(kDMAttributePanel, true);
} }
} else if (slotIndex == k10_ChampionSlotNeck) { } else if (slotIndex == k10_ChampionSlotNeck) {
if ((iconIndex >= kDMIconIndiceJunkIllumuletUnequipped) && (iconIndex <= kDMIconIndiceJunkIllumuletEquipped)) { if ((iconIndex >= kDMIconIndiceJunkIllumuletUnequipped) && (iconIndex <= kDMIconIndiceJunkIllumuletEquipped)) {
@ -578,7 +578,7 @@ void ChampionMan::addObjectInSlot(ChampionIndex champIndex, Thing thing, Champio
drawSlot(champIndex, slotIndex); drawSlot(champIndex, slotIndex);
if (isInventoryChampion) if (isInventoryChampion)
champ->setAttributeFlag(kDMChampionAttributeViewport, true); champ->setAttributeFlag(kDMAttributeViewport, true);
} }
int16 ChampionMan::getScentOrdinal(int16 mapX, int16 mapY) { int16 ChampionMan::getScentOrdinal(int16 mapX, int16 mapY) {
@ -613,7 +613,7 @@ Thing ChampionMan::getObjectRemovedFromLeaderHand() {
_vm->_eventMan->hideMouse(); _vm->_eventMan->hideMouse();
if (_leaderIndex != kDMChampionNone) { if (_leaderIndex != kDMChampionNone) {
_champions[_leaderIndex]._load -= _vm->_dungeonMan->getObjectWeight(leaderHandObject); _champions[_leaderIndex]._load -= _vm->_dungeonMan->getObjectWeight(leaderHandObject);
setFlag(_champions[_leaderIndex]._attributes, kDMChampionAttributeLoad); setFlag(_champions[_leaderIndex]._attributes, kDMAttributeLoad);
drawChampionState(_leaderIndex); drawChampionState(_leaderIndex);
} }
} }
@ -622,7 +622,7 @@ Thing ChampionMan::getObjectRemovedFromLeaderHand() {
uint16 ChampionMan::getStrength(int16 champIndex, int16 slotIndex) { uint16 ChampionMan::getStrength(int16 champIndex, int16 slotIndex) {
Champion *curChampion = &_champions[champIndex]; Champion *curChampion = &_champions[champIndex];
int16 strength = _vm->getRandomNumber(16) + curChampion->_statistics[kDMChampionStatStrength][kDMChampionStatCurrent]; int16 strength = _vm->getRandomNumber(16) + curChampion->_statistics[kDMStatStrength][kDMStatCurrent];
Thing curThing = curChampion->_slots[slotIndex]; Thing curThing = curChampion->_slots[slotIndex];
uint16 objectWeight = _vm->_dungeonMan->getObjectWeight(curThing); uint16 objectWeight = _vm->_dungeonMan->getObjectWeight(curThing);
uint16 oneSixteenthMaximumLoad = getMaximumLoad(curChampion) >> 4; uint16 oneSixteenthMaximumLoad = getMaximumLoad(curChampion) >> 4;
@ -643,18 +643,18 @@ uint16 ChampionMan::getStrength(int16 champIndex, int16 slotIndex) {
uint16 skillLevel = 0; uint16 skillLevel = 0;
uint16 weaponClass = weaponInfo->_class; uint16 weaponClass = weaponInfo->_class;
if ((weaponClass == k0_WeaponClassSwingWeapon) || (weaponClass == k2_WeaponClassDaggerAndAxes)) { if ((weaponClass == k0_WeaponClassSwingWeapon) || (weaponClass == k2_WeaponClassDaggerAndAxes)) {
skillLevel = getSkillLevel(champIndex, k4_ChampionSkillSwing); skillLevel = getSkillLevel(champIndex, kDMSkillSwing);
} }
if ((weaponClass != k0_WeaponClassSwingWeapon) && (weaponClass < k16_WeaponClassFirstBow)) { if ((weaponClass != k0_WeaponClassSwingWeapon) && (weaponClass < k16_WeaponClassFirstBow)) {
skillLevel += getSkillLevel(champIndex, k10_ChampionSkillThrow); skillLevel += getSkillLevel(champIndex, kDMSkillThrow);
} }
if ((weaponClass >= k16_WeaponClassFirstBow) && (weaponClass < k112_WeaponClassFirstMagicWeapon)) { if ((weaponClass >= k16_WeaponClassFirstBow) && (weaponClass < k112_WeaponClassFirstMagicWeapon)) {
skillLevel += getSkillLevel(champIndex, k11_ChampionSkillShoot); skillLevel += getSkillLevel(champIndex, kDMSkillShoot);
} }
strength += skillLevel << 1; strength += skillLevel << 1;
} }
strength = getStaminaAdjustedValue(curChampion, strength); strength = getStaminaAdjustedValue(curChampion, strength);
if (getFlag(curChampion->_wounds, (slotIndex == k0_ChampionSlotReadyHand) ? kDMChampionWoundReadHand : kDMChampionWoundActionHand)) { if (getFlag(curChampion->_wounds, (slotIndex == k0_ChampionSlotReadyHand) ? kDMWoundReadHand : kDMWoundActionHand)) {
strength >>= 1; strength >>= 1;
} }
return getBoundedValue(0, strength >> 1, 100); return getBoundedValue(0, strength >> 1, 100);
@ -693,11 +693,11 @@ Thing ChampionMan::getObjectRemovedFromSlot(uint16 champIndex, uint16 slotIndex)
drawSlot(champIndex, slotIndex); drawSlot(champIndex, slotIndex);
if (isInventoryChampion) if (isInventoryChampion)
setFlag(curChampion->_attributes, kDMChampionAttributeViewport); setFlag(curChampion->_attributes, kDMAttributeViewport);
if (slotIndex < k2_ChampionSlotHead) { if (slotIndex < k2_ChampionSlotHead) {
if (slotIndex == k1_ChampionSlotActionHand) { if (slotIndex == k1_ChampionSlotActionHand) {
setFlag(curChampion->_attributes, kDMChampionAttributeActionHand); setFlag(curChampion->_attributes, kDMAttributeActionHand);
if (_actingChampionOrdinal == _vm->indexToOrdinal(champIndex)) if (_actingChampionOrdinal == _vm->indexToOrdinal(champIndex))
_vm->_menuMan->clearActingChampion(); _vm->_menuMan->clearActingChampion();
@ -720,7 +720,7 @@ Thing ChampionMan::getObjectRemovedFromSlot(uint16 champIndex, uint16 slotIndex)
// No break on purpose // No break on purpose
case kDMIconIndiceScrollOpen: case kDMIconIndiceScrollOpen:
case kDMIconIndiceScrollClosed: case kDMIconIndiceScrollClosed:
setFlag(curChampion->_attributes, kDMChampionAttributePanel); setFlag(curChampion->_attributes, kDMAttributePanel);
break; break;
default: default:
break; break;
@ -728,7 +728,7 @@ Thing ChampionMan::getObjectRemovedFromSlot(uint16 champIndex, uint16 slotIndex)
} }
} }
curChampion->_load -= _vm->_dungeonMan->getObjectWeight(curThing); curChampion->_load -= _vm->_dungeonMan->getObjectWeight(curThing);
setFlag(curChampion->_attributes, kDMChampionAttributeLoad); setFlag(curChampion->_attributes, kDMAttributeLoad);
return curThing; return curThing;
} }
@ -742,12 +742,12 @@ void ChampionMan::decrementStamina(int16 championIndex, int16 decrement) {
int16 stamina = curChampion->_currStamina; int16 stamina = curChampion->_currStamina;
if (stamina <= 0) { if (stamina <= 0) {
curChampion->_currStamina = 0; curChampion->_currStamina = 0;
addPendingDamageAndWounds_getDamage(championIndex, (-stamina) >> 1, kDMChampionWoundNone, k0_attackType_NORMAL); addPendingDamageAndWounds_getDamage(championIndex, (-stamina) >> 1, kDMWoundNone, k0_attackType_NORMAL);
} else if (stamina > curChampion->_maxStamina) { } else if (stamina > curChampion->_maxStamina) {
curChampion->_currStamina = curChampion->_maxStamina; curChampion->_currStamina = curChampion->_maxStamina;
} }
setFlag(curChampion->_attributes, kDMChampionAttributeLoad | kDMChampionAttributeStatistics); setFlag(curChampion->_attributes, kDMAttributeLoad | kDMAttributeStatistics);
} }
int16 ChampionMan::addPendingDamageAndWounds_getDamage(int16 champIndex, int16 attack, int16 allowedWounds, uint16 attackType) { int16 ChampionMan::addPendingDamageAndWounds_getDamage(int16 champIndex, int16 attack, int16 allowedWounds, uint16 attackType) {
@ -774,7 +774,7 @@ int16 ChampionMan::addPendingDamageAndWounds_getDamage(int16 champIndex, int16 a
switch (attackType) { switch (attackType) {
case k6_attackType_PSYCHIC: case k6_attackType_PSYCHIC:
{ {
int16 wisdomFactor = 115 - curChampion->_statistics[kDMChampionStatWisdom][kDMChampionStatCurrent]; int16 wisdomFactor = 115 - curChampion->_statistics[kDMStatWisdom][kDMStatCurrent];
if (wisdomFactor <= 0) { if (wisdomFactor <= 0) {
attack = 0; attack = 0;
} else { } else {
@ -785,12 +785,12 @@ int16 ChampionMan::addPendingDamageAndWounds_getDamage(int16 champIndex, int16 a
} }
break; break;
case k5_attackType_MAGIC: case k5_attackType_MAGIC:
attack = getStatisticAdjustedAttack(curChampion, kDMChampionStatAntimagic, attack); attack = getStatisticAdjustedAttack(curChampion, kDMStatAntimagic, attack);
attack -= _party._spellShieldDefense; attack -= _party._spellShieldDefense;
skipScaling = true; skipScaling = true;
break; break;
case k1_attackType_FIRE: case k1_attackType_FIRE:
attack = getStatisticAdjustedAttack(curChampion, kDMChampionStatAntifire, attack); attack = getStatisticAdjustedAttack(curChampion, kDMStatAntifire, attack);
attack -= _party._fireShieldDefense; attack -= _party._fireShieldDefense;
break; break;
case k2_attackType_SELF: case k2_attackType_SELF:
@ -818,7 +818,7 @@ int16 ChampionMan::addPendingDamageAndWounds_getDamage(int16 champIndex, int16 a
if (attack <= 0) if (attack <= 0)
return 0; return 0;
int16 adjustedAttack = getStatisticAdjustedAttack(curChampion, kDMChampionStatVitality, _vm->getRandomNumber(128) + 10); int16 adjustedAttack = getStatisticAdjustedAttack(curChampion, kDMStatVitality, _vm->getRandomNumber(128) + 10);
if (attack > adjustedAttack) { if (attack > adjustedAttack) {
/* BUG0_45 /* BUG0_45
This bug is not perceptible because of BUG0_41 that ignores Vitality while determining the This bug is not perceptible because of BUG0_41 that ignores Vitality while determining the
@ -858,7 +858,7 @@ int16 ChampionMan::getWoundDefense(int16 champIndex, uint16 woundIndex) {
} }
} }
int16 woundDefense = _vm->getRandomNumber((curChampion->_statistics[kDMChampionStatVitality][kDMChampionStatCurrent] >> 3) + 1); int16 woundDefense = _vm->getRandomNumber((curChampion->_statistics[kDMStatVitality][kDMStatCurrent] >> 3) + 1);
if (useSharpDefense) if (useSharpDefense)
woundDefense >>= 1; woundDefense >>= 1;
@ -881,7 +881,7 @@ int16 ChampionMan::getWoundDefense(int16 champIndex, uint16 woundIndex) {
} }
uint16 ChampionMan::getStatisticAdjustedAttack(Champion *champ, uint16 statIndex, uint16 attack) { uint16 ChampionMan::getStatisticAdjustedAttack(Champion *champ, uint16 statIndex, uint16 attack) {
int16 factor = 170 - champ->_statistics[statIndex][kDMChampionStatCurrent]; int16 factor = 170 - champ->_statistics[statIndex][kDMStatCurrent];
/* BUG0_41 /* BUG0_41
The Antifire and Antimagic statistics are completely ignored. The Vitality statistic is ignored The Antifire and Antimagic statistics are completely ignored. The Vitality statistic is ignored
@ -939,7 +939,7 @@ void ChampionMan::disableAction(uint16 champIndex, uint16 ticks) {
} }
_vm->_timeline->deleteEvent(eventIndex); _vm->_timeline->deleteEvent(eventIndex);
} else { } else {
setFlag(curChampion->_attributes, kDMChampionAttributeActionHand | kDMChampionAttributeDisableAction); setFlag(curChampion->_attributes, kDMAttributeActionHand | kDMAttributeDisableAction);
drawChampionState((ChampionIndex)champIndex); drawChampionState((ChampionIndex)champIndex);
} }
setMapAndTime(curEvent._mapTime, _vm->_dungeonMan->_partyMapIndex, updatedEnableActionEventTime); setMapAndTime(curEvent._mapTime, _vm->_dungeonMan->_partyMapIndex, updatedEnableActionEventTime);
@ -947,7 +947,7 @@ void ChampionMan::disableAction(uint16 champIndex, uint16 ticks) {
} }
void ChampionMan::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->_lastCreatureAttackTime < _vm->_gameTime - 150)) if ((skillIndex >= kDMSkillSwing) && (skillIndex <= kDMSkillShoot) && (_vm->_projexpl->_lastCreatureAttackTime < _vm->_gameTime - 150))
exp >>= 1; exp >>= 1;
if (exp) { if (exp) {
@ -956,14 +956,14 @@ void ChampionMan::addSkillExperience(uint16 champIndex, uint16 skillIndex, uint1
Champion *curChampion = &_champions[champIndex]; Champion *curChampion = &_champions[champIndex];
uint16 baseSkillIndex; uint16 baseSkillIndex;
if (skillIndex >= k4_ChampionSkillSwing) if (skillIndex >= kDMSkillSwing)
baseSkillIndex = (skillIndex - k4_ChampionSkillSwing) >> 2; baseSkillIndex = (skillIndex - kDMSkillSwing) >> 2;
else else
baseSkillIndex = skillIndex; baseSkillIndex = skillIndex;
uint16 skillLevelBefore = getSkillLevel(champIndex, baseSkillIndex | (kDMIgnoreObjectModifiers | kDMIgnoreTemporaryExperience)); uint16 skillLevelBefore = getSkillLevel(champIndex, baseSkillIndex | (kDMIgnoreObjectModifiers | kDMIgnoreTemporaryExperience));
if ((skillIndex >= k4_ChampionSkillSwing) && (_vm->_projexpl->_lastCreatureAttackTime > _vm->_gameTime - 25)) if ((skillIndex >= kDMSkillSwing) && (_vm->_projexpl->_lastCreatureAttackTime > _vm->_gameTime - 25))
exp <<= 1; exp <<= 1;
Skill *curSkill = &curChampion->_skills[skillIndex]; Skill *curSkill = &curChampion->_skills[skillIndex];
@ -972,7 +972,7 @@ void ChampionMan::addSkillExperience(uint16 champIndex, uint16 skillIndex, uint1
curSkill->_temporaryExperience += getBoundedValue(1, exp >> 3, 100); curSkill->_temporaryExperience += getBoundedValue(1, exp >> 3, 100);
curSkill = &curChampion->_skills[baseSkillIndex]; curSkill = &curChampion->_skills[baseSkillIndex];
if (skillIndex >= k4_ChampionSkillSwing) if (skillIndex >= kDMSkillSwing)
curSkill->_experience += exp; curSkill->_experience += exp;
uint16 skillLevelAfter = getSkillLevel(champIndex, baseSkillIndex | (kDMIgnoreObjectModifiers | kDMIgnoreTemporaryExperience)); uint16 skillLevelAfter = getSkillLevel(champIndex, baseSkillIndex | (kDMIgnoreObjectModifiers | kDMIgnoreTemporaryExperience));
@ -981,37 +981,37 @@ void ChampionMan::addSkillExperience(uint16 champIndex, uint16 skillIndex, uint1
int16 minorStatIncrease = _vm->getRandomNumber(2); int16 minorStatIncrease = _vm->getRandomNumber(2);
int16 majorStatIncrease = 1 + _vm->getRandomNumber(2); int16 majorStatIncrease = 1 + _vm->getRandomNumber(2);
uint16 vitalityAmount = _vm->getRandomNumber(2); /* For Priest skill, the amount is 0 or 1 for all skill levels */ uint16 vitalityAmount = _vm->getRandomNumber(2); /* For Priest skill, the amount is 0 or 1 for all skill levels */
if (baseSkillIndex != k2_ChampionSkillPriest) { if (baseSkillIndex != kDMSkillPriest) {
vitalityAmount &= skillLevelAfter; /* For non Priest skills the amount is 0 for even skill levels. The amount is 0 or 1 for odd skill levels */ vitalityAmount &= skillLevelAfter; /* For non Priest skills the amount is 0 for even skill levels. The amount is 0 or 1 for odd skill levels */
} }
curChampion->_statistics[kDMChampionStatVitality][kDMChampionStatMaximum] += vitalityAmount; curChampion->_statistics[kDMStatVitality][kDMStatMaximum] += vitalityAmount;
uint16 staminaAmount = curChampion->_maxStamina; uint16 staminaAmount = curChampion->_maxStamina;
curChampion->_statistics[kDMChampionStatAntifire][kDMChampionStatMaximum] += _vm->getRandomNumber(2) & ~skillLevelAfter; /* The amount is 0 for odd skill levels. The amount is 0 or 1 for even skill levels */ curChampion->_statistics[kDMStatAntifire][kDMStatMaximum] += _vm->getRandomNumber(2) & ~skillLevelAfter; /* The amount is 0 for odd skill levels. The amount is 0 or 1 for even skill levels */
bool increaseManaFl = false; bool increaseManaFl = false;
switch (baseSkillIndex) { switch (baseSkillIndex) {
case k0_ChampionSkillFighter: case kDMSkillFighter:
staminaAmount >>= 4; staminaAmount >>= 4;
skillLevelAfter *= 3; skillLevelAfter *= 3;
curChampion->_statistics[kDMChampionStatStrength][kDMChampionStatMaximum] += majorStatIncrease; curChampion->_statistics[kDMStatStrength][kDMStatMaximum] += majorStatIncrease;
curChampion->_statistics[kDMChampionStatDexterity][kDMChampionStatMaximum] += minorStatIncrease; curChampion->_statistics[kDMStatDexterity][kDMStatMaximum] += minorStatIncrease;
break; break;
case k1_ChampionSkillNinja: case kDMSkillNinja:
staminaAmount /= 21; staminaAmount /= 21;
skillLevelAfter <<= 1; skillLevelAfter <<= 1;
curChampion->_statistics[kDMChampionStatStrength][kDMChampionStatMaximum] += minorStatIncrease; curChampion->_statistics[kDMStatStrength][kDMStatMaximum] += minorStatIncrease;
curChampion->_statistics[kDMChampionStatDexterity][kDMChampionStatMaximum] += majorStatIncrease; curChampion->_statistics[kDMStatDexterity][kDMStatMaximum] += majorStatIncrease;
break; break;
case k3_ChampionSkillWizard: case kDMSkillWizard:
staminaAmount >>= 5; staminaAmount >>= 5;
curChampion->_maxMana += skillLevelAfter + (skillLevelAfter >> 1); curChampion->_maxMana += skillLevelAfter + (skillLevelAfter >> 1);
curChampion->_statistics[kDMChampionStatWisdom][kDMChampionStatMaximum] += majorStatIncrease; curChampion->_statistics[kDMStatWisdom][kDMStatMaximum] += majorStatIncrease;
increaseManaFl = true; increaseManaFl = true;
break; break;
case k2_ChampionSkillPriest: case kDMSkillPriest:
staminaAmount /= 25; staminaAmount /= 25;
curChampion->_maxMana += skillLevelAfter; curChampion->_maxMana += skillLevelAfter;
skillLevelAfter += (skillLevelAfter + 1) >> 1; skillLevelAfter += (skillLevelAfter + 1) >> 1;
curChampion->_statistics[kDMChampionStatWisdom][kDMChampionStatMaximum] += minorStatIncrease; curChampion->_statistics[kDMStatWisdom][kDMStatMaximum] += minorStatIncrease;
increaseManaFl = true; increaseManaFl = true;
break; break;
default: default:
@ -1020,7 +1020,7 @@ void ChampionMan::addSkillExperience(uint16 champIndex, uint16 skillIndex, uint1
if (increaseManaFl) { if (increaseManaFl) {
if ((curChampion->_maxMana += MIN(_vm->getRandomNumber(4), (uint16)(newBaseSkillLevel - 1))) > 900) if ((curChampion->_maxMana += MIN(_vm->getRandomNumber(4), (uint16)(newBaseSkillLevel - 1))) > 900)
curChampion->_maxMana = 900; curChampion->_maxMana = 900;
curChampion->_statistics[kDMChampionStatAntimagic][kDMChampionStatMaximum] += _vm->getRandomNumber(3); curChampion->_statistics[kDMStatAntimagic][kDMStatMaximum] += _vm->getRandomNumber(3);
} }
if ((curChampion->_maxHealth += skillLevelAfter + _vm->getRandomNumber((skillLevelAfter >> 1) + 1)) > 999) if ((curChampion->_maxHealth += skillLevelAfter + _vm->getRandomNumber((skillLevelAfter >> 1) + 1)) > 999)
@ -1029,7 +1029,7 @@ void ChampionMan::addSkillExperience(uint16 champIndex, uint16 skillIndex, uint1
if ((curChampion->_maxStamina += staminaAmount + _vm->getRandomNumber((staminaAmount >> 1) + 1)) > 9999) if ((curChampion->_maxStamina += staminaAmount + _vm->getRandomNumber((staminaAmount >> 1) + 1)) > 9999)
curChampion->_maxStamina = 9999; curChampion->_maxStamina = 9999;
setFlag(curChampion->_attributes, kDMChampionAttributeStatistics); setFlag(curChampion->_attributes, kDMAttributeStatistics);
drawChampionState((ChampionIndex)champIndex); drawChampionState((ChampionIndex)champIndex);
_vm->_textMan->printLineFeed(); _vm->_textMan->printLineFeed();
Color curChampionColor = _championColor[champIndex]; Color curChampionColor = _championColor[champIndex];
@ -1083,7 +1083,7 @@ int16 ChampionMan::getTargetChampionIndex(int16 mapX, int16 mapY, uint16 cell) {
} }
int16 ChampionMan::getDexterity(Champion *champ) { int16 ChampionMan::getDexterity(Champion *champ) {
int16 dexterity = _vm->getRandomNumber(8) + champ->_statistics[kDMChampionStatDexterity][kDMChampionStatCurrent]; int16 dexterity = _vm->getRandomNumber(8) + champ->_statistics[kDMStatDexterity][kDMStatCurrent];
dexterity -= ((int32)(dexterity >> 1) * (int32)champ->_load) / getMaximumLoad(champ); dexterity -= ((int32)(dexterity >> 1) * (int32)champ->_load) / getMaximumLoad(champ);
if (_partyIsSleeping) if (_partyIsSleeping)
dexterity >>= 1; dexterity >>= 1;
@ -1095,9 +1095,9 @@ bool ChampionMan::isLucky(Champion *champ, uint16 percentage) {
if (_vm->getRandomNumber(2) && (_vm->getRandomNumber(100) > percentage)) if (_vm->getRandomNumber(2) && (_vm->getRandomNumber(100) > percentage))
return true; return true;
unsigned char *curStat = champ->_statistics[kDMChampionStatLuck]; unsigned char *curStat = champ->_statistics[kDMStatLuck];
bool isLucky = (_vm->getRandomNumber(curStat[kDMChampionStatCurrent]) > percentage); bool isLucky = (_vm->getRandomNumber(curStat[kDMStatCurrent]) > percentage);
curStat[kDMChampionStatCurrent] = getBoundedValue<char>(curStat[kDMChampionStatMinimum], curStat[kDMChampionStatCurrent] + (isLucky ? -2 : 2), curStat[kDMChampionStatMaximum]); curStat[kDMStatCurrent] = getBoundedValue<char>(curStat[kDMStatMinimum], curStat[kDMStatCurrent] + (isLucky ? -2 : 2), curStat[kDMStatMaximum]);
return isLucky; return isLucky;
} }
@ -1106,10 +1106,10 @@ void ChampionMan::championPoison(int16 champIndex, uint16 attack) {
return; return;
Champion *curChampion = &_champions[champIndex]; Champion *curChampion = &_champions[champIndex];
addPendingDamageAndWounds_getDamage(champIndex, MAX(1, attack >> 6), kDMChampionWoundNone, k0_attackType_NORMAL); addPendingDamageAndWounds_getDamage(champIndex, MAX(1, attack >> 6), kDMWoundNone, k0_attackType_NORMAL);
setFlag(curChampion->_attributes, kDMChampionAttributeStatistics); setFlag(curChampion->_attributes, kDMAttributeStatistics);
if ((_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal) && (_vm->_inventoryMan->_panelContent == k0_PanelContentFoodWaterPoisoned)) { if ((_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal) && (_vm->_inventoryMan->_panelContent == k0_PanelContentFoodWaterPoisoned)) {
setFlag(curChampion->_attributes, kDMChampionAttributePanel); setFlag(curChampion->_attributes, kDMAttributePanel);
} }
if (--attack) { if (--attack) {
@ -1208,7 +1208,7 @@ void ChampionMan::putObjectInLeaderHand(Thing thing, bool setMousePointer) {
_vm->_eventMan->hideMouse(); _vm->_eventMan->hideMouse();
if (_leaderIndex != kDMChampionNone) { if (_leaderIndex != kDMChampionNone) {
_champions[_leaderIndex]._load += _vm->_dungeonMan->getObjectWeight(thing); _champions[_leaderIndex]._load += _vm->_dungeonMan->getObjectWeight(thing);
setFlag(_champions[_leaderIndex]._attributes, kDMChampionAttributeLoad); setFlag(_champions[_leaderIndex]._attributes, kDMAttributeLoad);
drawChampionState(_leaderIndex); drawChampionState(_leaderIndex);
} }
} }
@ -1235,7 +1235,7 @@ int16 ChampionMan::getMovementTicks(Champion *champ) {
woundTicks = 2; woundTicks = 2;
} }
if (getFlag(champ->_wounds, kDMChampionWoundFeet)) if (getFlag(champ->_wounds, kDMWoundFeet))
ticks += woundTicks; ticks += woundTicks;
if (_vm->_objectMan->getIconIndex(champ->_slots[k5_ChampionSlotFeet]) == kDMIconIndiceArmourBootOfSpeed) if (_vm->_objectMan->getIconIndex(champ->_slots[k5_ChampionSlotFeet]) == kDMIconIndiceArmourBootOfSpeed)
@ -1286,7 +1286,7 @@ void ChampionMan::viAltarRebirth(uint16 champIndex) {
curChampion->_currHealth = curChampion->_maxHealth >> 1; curChampion->_currHealth = curChampion->_maxHealth >> 1;
_vm->_menuMan->drawSpellAreaControls(_magicCasterChampionIndex); _vm->_menuMan->drawSpellAreaControls(_magicCasterChampionIndex);
curChampion->_dir = _vm->_dungeonMan->_partyDir; curChampion->_dir = _vm->_dungeonMan->_partyDir;
setFlag(curChampion->_attributes, kDMChampionAttributeActionHand | kDMChampionAttributeStatusBox | kDMChampionAttributeIcon); setFlag(curChampion->_attributes, kDMAttributeActionHand | kDMAttributeStatusBox | kDMAttributeIcon);
drawChampionState((ChampionIndex)champIndex); drawChampionState((ChampionIndex)champIndex);
} }
@ -1344,7 +1344,7 @@ bool ChampionMan::isProjectileSpellCast(uint16 champIndex, Thing thing, int16 ki
return false; return false;
curChampion->_currMana -= requiredManaAmount; curChampion->_currMana -= requiredManaAmount;
setFlag(curChampion->_attributes, kDMChampionAttributeStatistics); setFlag(curChampion->_attributes, kDMAttributeStatistics);
int16 stepEnergy = 10 - MIN(8, curChampion->_maxMana >> 3); int16 stepEnergy = 10 - MIN(8, curChampion->_maxMana >> 3);
if (kineticEnergy < (stepEnergy << 2)) { if (kineticEnergy < (stepEnergy << 2)) {
kineticEnergy += 3; kineticEnergy += 3;
@ -1385,9 +1385,9 @@ void ChampionMan::applyAndDrawPendingDamageAndWounds() {
championKill(championIndex); championKill(championIndex);
} else { } else {
championPtr->_currHealth = curHealth; championPtr->_currHealth = curHealth;
setFlag(championPtr->_attributes, kDMChampionAttributeStatistics); setFlag(championPtr->_attributes, kDMAttributeStatistics);
if (pendingWounds) { if (pendingWounds) {
setFlag(championPtr->_attributes, kDMChampionAttributeWounds); setFlag(championPtr->_attributes, kDMAttributeWounds);
} }
int16 textPosX = championIndex * k69_ChampionStatusBoxSpacing; int16 textPosX = championIndex * k69_ChampionStatusBoxSpacing;
@ -1449,7 +1449,7 @@ void ChampionMan::applyAndDrawPendingDamageAndWounds() {
void ChampionMan::championKill(uint16 champIndex) { void ChampionMan::championKill(uint16 champIndex) {
Champion *curChampion = &_champions[champIndex]; Champion *curChampion = &_champions[champIndex];
curChampion->_currHealth = 0; curChampion->_currHealth = 0;
setFlag(curChampion->_attributes, kDMChampionAttributeStatusBox); setFlag(curChampion->_attributes, kDMAttributeStatusBox);
if (_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal) { if (_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal) {
if (_vm->_pressingEye) { if (_vm->_pressingEye) {
_vm->_pressingEye = false; _vm->_pressingEye = false;
@ -1593,9 +1593,9 @@ void ChampionMan::applyTimeEffects() {
Champion *championPtr = _champions; Champion *championPtr = _champions;
for (uint16 championIndex = kDMChampionFirst; championIndex < _partyChampionCount; championIndex++, championPtr++) { for (uint16 championIndex = kDMChampionFirst; championIndex < _partyChampionCount; championIndex++, championPtr++) {
if (championPtr->_currHealth && (_vm->indexToOrdinal(championIndex) != _candidateChampionOrdinal)) { if (championPtr->_currHealth && (_vm->indexToOrdinal(championIndex) != _candidateChampionOrdinal)) {
uint16 wizardSkillLevel = getSkillLevel(championIndex, k3_ChampionSkillWizard) + getSkillLevel(championIndex, k2_ChampionSkillPriest); uint16 wizardSkillLevel = getSkillLevel(championIndex, kDMSkillWizard) + getSkillLevel(championIndex, kDMSkillPriest);
if ((championPtr->_currMana < championPtr->_maxMana) if ((championPtr->_currMana < championPtr->_maxMana)
&& (timeCriteria < championPtr->_statistics[kDMChampionStatWisdom][kDMChampionStatCurrent] + wizardSkillLevel)) { && (timeCriteria < championPtr->_statistics[kDMStatWisdom][kDMStatCurrent] + wizardSkillLevel)) {
int16 manaGain = championPtr->_maxMana / 40; int16 manaGain = championPtr->_maxMana / 40;
if (_partyIsSleeping) if (_partyIsSleeping)
manaGain <<= 1; manaGain <<= 1;
@ -1606,7 +1606,7 @@ void ChampionMan::applyTimeEffects() {
} else if (championPtr->_currMana > championPtr->_maxMana) } else if (championPtr->_currMana > championPtr->_maxMana)
championPtr->_currMana--; championPtr->_currMana--;
for (int16 idx = k19_ChampionSkillWater; idx >= k0_ChampionSkillFighter; idx--) { for (int16 idx = kDMSkillWater; idx >= kDMSkillFighter; idx--) {
if (championPtr->_skills[idx]._temporaryExperience > 0) if (championPtr->_skills[idx]._temporaryExperience > 0)
championPtr->_skills[idx]._temporaryExperience--; championPtr->_skills[idx]._temporaryExperience--;
} }
@ -1658,7 +1658,7 @@ void ChampionMan::applyTimeEffects() {
if (championPtr->_water < -1024) if (championPtr->_water < -1024)
championPtr->_water = -1024; championPtr->_water = -1024;
if ((championPtr->_currHealth < championPtr->_maxHealth) && (championPtr->_currStamina >= (championPtr->_maxStamina >> 2)) && (timeCriteria < (championPtr->_statistics[kDMChampionStatVitality][kDMChampionStatCurrent] + 12))) { if ((championPtr->_currHealth < championPtr->_maxHealth) && (championPtr->_currStamina >= (championPtr->_maxStamina >> 2)) && (timeCriteria < (championPtr->_statistics[kDMStatVitality][kDMStatCurrent] + 12))) {
int16 healthGain = (championPtr->_maxHealth >> 7) + 1; int16 healthGain = (championPtr->_maxHealth >> 7) + 1;
if (_partyIsSleeping) if (_partyIsSleeping)
healthGain <<= 1; healthGain <<= 1;
@ -1669,24 +1669,24 @@ void ChampionMan::applyTimeEffects() {
championPtr->_currHealth += MIN(healthGain, (int16)(championPtr->_maxHealth - championPtr->_currHealth)); championPtr->_currHealth += MIN(healthGain, (int16)(championPtr->_maxHealth - championPtr->_currHealth));
} }
if (!((int)_vm->_gameTime & (_partyIsSleeping ? 63 : 255))) { if (!((int)_vm->_gameTime & (_partyIsSleeping ? 63 : 255))) {
for (uint16 i = kDMChampionStatLuck; i <= kDMChampionStatAntifire; i++) { for (uint16 i = kDMStatLuck; i <= kDMStatAntifire; i++) {
byte *curStatistic = championPtr->_statistics[i]; byte *curStatistic = championPtr->_statistics[i];
uint16 statisticMaximum = curStatistic[kDMChampionStatMaximum]; uint16 statisticMaximum = curStatistic[kDMStatMaximum];
if (curStatistic[kDMChampionStatCurrent] < statisticMaximum) if (curStatistic[kDMStatCurrent] < statisticMaximum)
curStatistic[kDMChampionStatCurrent]++; curStatistic[kDMStatCurrent]++;
else if (curStatistic[kDMChampionStatCurrent] > statisticMaximum) else if (curStatistic[kDMStatCurrent] > statisticMaximum)
curStatistic[kDMChampionStatCurrent] -= curStatistic[kDMChampionStatCurrent] / statisticMaximum; curStatistic[kDMStatCurrent] -= curStatistic[kDMStatCurrent] / statisticMaximum;
} }
} }
if (!_partyIsSleeping && (championPtr->_dir != _vm->_dungeonMan->_partyDir) && (_vm->_projexpl->_lastCreatureAttackTime + 60 < _vm->_gameTime)) { if (!_partyIsSleeping && (championPtr->_dir != _vm->_dungeonMan->_partyDir) && (_vm->_projexpl->_lastCreatureAttackTime + 60 < _vm->_gameTime)) {
championPtr->_dir = _vm->_dungeonMan->_partyDir; championPtr->_dir = _vm->_dungeonMan->_partyDir;
championPtr->_maximumDamageReceived = 0; championPtr->_maximumDamageReceived = 0;
setFlag(championPtr->_attributes, kDMChampionAttributeIcon); setFlag(championPtr->_attributes, kDMAttributeIcon);
} }
setFlag(championPtr->_attributes, kDMChampionAttributeStatistics); setFlag(championPtr->_attributes, kDMAttributeStatistics);
if (_vm->indexToOrdinal(championIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal) { if (_vm->indexToOrdinal(championIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal) {
if (_vm->_pressingMouth || _vm->_pressingEye || (_vm->_inventoryMan->_panelContent == k0_PanelContentFoodWaterPoisoned)) { if (_vm->_pressingMouth || _vm->_pressingEye || (_vm->_inventoryMan->_panelContent == k0_PanelContentFoodWaterPoisoned)) {
setFlag(championPtr->_attributes, kDMChampionAttributePanel); setFlag(championPtr->_attributes, kDMAttributePanel);
} }
} }
} }
@ -1839,8 +1839,8 @@ void ChampionMan::resetDataToStartGame() {
Champion *curChampion = _champions; Champion *curChampion = _champions;
for (int16 idx = 0; idx < _partyChampionCount; idx++, curChampion++) { for (int16 idx = 0; idx < _partyChampionCount; idx++, curChampion++) {
clearFlag(curChampion->_attributes, kDMChampionAttributeNameTitle | kDMChampionAttributeStatistics | kDMChampionAttributeLoad | kDMChampionAttributeIcon | kDMChampionAttributePanel | kDMChampionAttributeStatusBox | kDMChampionAttributeWounds | kDMChampionAttributeViewport | kDMChampionAttributeActionHand); clearFlag(curChampion->_attributes, kDMAttributeNameTitle | kDMAttributeStatistics | kDMAttributeLoad | kDMAttributeIcon | kDMAttributePanel | kDMAttributeStatusBox | kDMAttributeWounds | kDMAttributeViewport | kDMAttributeActionHand);
setFlag(curChampion->_attributes, kDMChampionAttributeActionHand | kDMChampionAttributeStatusBox | kDMChampionAttributeIcon); setFlag(curChampion->_attributes, kDMAttributeActionHand | kDMAttributeStatusBox | kDMAttributeIcon);
} }
drawAllChampionStates(); drawAllChampionStates();
@ -1885,7 +1885,7 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) {
viewCell++; viewCell++;
championPtr->_cell = (ViewCell)normalizeModulo4(viewCell + _vm->_dungeonMan->_partyDir); championPtr->_cell = (ViewCell)normalizeModulo4(viewCell + _vm->_dungeonMan->_partyDir);
championPtr->_attributes = kDMChampionAttributeIcon; championPtr->_attributes = kDMAttributeIcon;
championPtr->_directionMaximumDamageReceived = _vm->_dungeonMan->_partyDir; championPtr->_directionMaximumDamageReceived = _vm->_dungeonMan->_partyDir;
championPtr->_food = 1500 + _vm->getRandomNumber(256); championPtr->_food = 1500 + _vm->getRandomNumber(256);
championPtr->_water = 1500 + _vm->getRandomNumber(256); championPtr->_water = 1500 + _vm->getRandomNumber(256);
@ -1919,7 +1919,7 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) {
} }
championPtr->_title[charIdx] = '\0'; championPtr->_title[charIdx] = '\0';
if (*decodedStringPtr++ == 'M') if (*decodedStringPtr++ == 'M')
setFlag(championPtr->_attributes, kDMChampionAttributeMale); setFlag(championPtr->_attributes, kDMAttributeMale);
decodedStringPtr++; decodedStringPtr++;
championPtr->_currHealth = championPtr->_maxHealth = getDecodedValue(decodedStringPtr, 4); championPtr->_currHealth = championPtr->_maxHealth = getDecodedValue(decodedStringPtr, 4);
@ -1929,19 +1929,19 @@ void ChampionMan::addCandidateChampionToParty(uint16 championPortraitIndex) {
championPtr->_currMana = championPtr->_maxMana = getDecodedValue(decodedStringPtr, 4); championPtr->_currMana = championPtr->_maxMana = getDecodedValue(decodedStringPtr, 4);
decodedStringPtr += 4; decodedStringPtr += 4;
decodedStringPtr++; decodedStringPtr++;
for (int16 statIdx = kDMChampionStatLuck; statIdx <= kDMChampionStatAntifire; statIdx++) { for (int16 statIdx = kDMStatLuck; statIdx <= kDMStatAntifire; statIdx++) {
championPtr->_statistics[statIdx][kDMChampionStatMinimum] = 30; championPtr->_statistics[statIdx][kDMStatMinimum] = 30;
championPtr->_statistics[statIdx][kDMChampionStatCurrent] = championPtr->_statistics[statIdx][kDMChampionStatMaximum] = getDecodedValue(decodedStringPtr, 2); championPtr->_statistics[statIdx][kDMStatCurrent] = championPtr->_statistics[statIdx][kDMStatMaximum] = getDecodedValue(decodedStringPtr, 2);
decodedStringPtr += 2; decodedStringPtr += 2;
} }
championPtr->_statistics[kDMChampionStatLuck][kDMChampionStatMinimum] = 10; championPtr->_statistics[kDMStatLuck][kDMStatMinimum] = 10;
decodedStringPtr++; decodedStringPtr++;
for (uint16 skillIdx = k4_ChampionSkillSwing; skillIdx <= k19_ChampionSkillWater; skillIdx++) { for (uint16 skillIdx = kDMSkillSwing; skillIdx <= kDMSkillWater; skillIdx++) {
int skillValue = *decodedStringPtr++ - 'A'; int skillValue = *decodedStringPtr++ - 'A';
if (skillValue > 0) if (skillValue > 0)
championPtr->_skills[skillIdx]._experience = 125L << skillValue; championPtr->_skills[skillIdx]._experience = 125L << skillValue;
} }
for (uint16 skillIdx = k0_ChampionSkillFighter; skillIdx <= k3_ChampionSkillWizard; skillIdx++) { for (uint16 skillIdx = kDMSkillFighter; skillIdx <= kDMSkillWizard; skillIdx++) {
int32 baseSkillExperience = 0; int32 baseSkillExperience = 0;
int16 hiddenSkillIndex = (skillIdx + 1) << 2; int16 hiddenSkillIndex = (skillIdx + 1) << 2;
for (uint16 hiddenIdx = 0; hiddenIdx < 4; hiddenIdx++) for (uint16 hiddenIdx = 0; hiddenIdx < 4; hiddenIdx++)
@ -2098,11 +2098,11 @@ uint16 ChampionMan::getStaminaAdjustedValue(Champion *champ, int16 val) {
} }
uint16 ChampionMan::getMaximumLoad(Champion *champ) { uint16 ChampionMan::getMaximumLoad(Champion *champ) {
uint16 maximumLoad = champ->getStatistic(kDMChampionStatStrength, kDMChampionStatCurrent) * 8 + 100; uint16 maximumLoad = champ->getStatistic(kDMStatStrength, kDMStatCurrent) * 8 + 100;
maximumLoad = getStaminaAdjustedValue(champ, maximumLoad); maximumLoad = getStaminaAdjustedValue(champ, maximumLoad);
int16 wounds = champ->getWounds(); int16 wounds = champ->getWounds();
if (wounds) if (wounds)
maximumLoad -= maximumLoad >> (champ->getWoundsFlag(kDMChampionWoundLegs) ? 2 : 3); maximumLoad -= maximumLoad >> (champ->getWoundsFlag(kDMWoundLegs) ? 2 : 3);
if (_vm->_objectMan->getIconIndex(champ->getSlot(k5_ChampionSlotFeet)) == kDMIconIndiceArmourElvenBoots) if (_vm->_objectMan->getIconIndex(champ->getSlot(k5_ChampionSlotFeet)) == kDMIconIndiceArmourElvenBoots)
maximumLoad += maximumLoad * 16; maximumLoad += maximumLoad * 16;
@ -2119,13 +2119,13 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
int16 championStatusBoxX = champIndex * k69_ChampionStatusBoxSpacing; int16 championStatusBoxX = champIndex * k69_ChampionStatusBoxSpacing;
Champion *curChampion = &_champions[champIndex]; Champion *curChampion = &_champions[champIndex];
uint16 championAttributes = curChampion->_attributes; uint16 championAttributes = curChampion->_attributes;
if (!getFlag(championAttributes, kDMChampionAttributeNameTitle | kDMChampionAttributeStatistics | kDMChampionAttributeLoad | kDMChampionAttributeIcon | kDMChampionAttributePanel | kDMChampionAttributeStatusBox | kDMChampionAttributeWounds | kDMChampionAttributeViewport | kDMChampionAttributeActionHand)) if (!getFlag(championAttributes, kDMAttributeNameTitle | kDMAttributeStatistics | kDMAttributeLoad | kDMAttributeIcon | kDMAttributePanel | kDMAttributeStatusBox | kDMAttributeWounds | kDMAttributeViewport | kDMAttributeActionHand))
return; return;
bool isInventoryChampion = (_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal); bool isInventoryChampion = (_vm->indexToOrdinal(champIndex) == _vm->_inventoryMan->_inventoryChampionOrdinal);
_vm->_displayMan->_useByteBoxCoordinates = false; _vm->_displayMan->_useByteBoxCoordinates = false;
_vm->_eventMan->showMouse(); _vm->_eventMan->showMouse();
if (getFlag(championAttributes, kDMChampionAttributeStatusBox)) { if (getFlag(championAttributes, kDMAttributeStatusBox)) {
Box box; Box box;
box._y1 = 0; box._y1 = 0;
box._y2 = 28; box._y2 = 28;
@ -2152,26 +2152,26 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
if (isInventoryChampion) { if (isInventoryChampion) {
_vm->_inventoryMan->drawStatusBoxPortrait(champIndex); _vm->_inventoryMan->drawStatusBoxPortrait(champIndex);
setFlag(championAttributes, kDMChampionAttributeStatistics); setFlag(championAttributes, kDMAttributeStatistics);
} else } else
setFlag(championAttributes, kDMChampionAttributeNameTitle | kDMChampionAttributeStatistics | kDMChampionAttributeWounds | kDMChampionAttributeActionHand); setFlag(championAttributes, kDMAttributeNameTitle | kDMAttributeStatistics | kDMAttributeWounds | kDMAttributeActionHand);
} else { } else {
_vm->_displayMan->blitToScreen(_vm->_displayMan->getNativeBitmapOrGraphic(k8_StatusBoxDeadChampion), &box, k40_byteWidth, kM1_ColorNoTransparency, 29); _vm->_displayMan->blitToScreen(_vm->_displayMan->getNativeBitmapOrGraphic(k8_StatusBoxDeadChampion), &box, k40_byteWidth, kM1_ColorNoTransparency, 29);
_vm->_textMan->printToLogicalScreen(championStatusBoxX + 1, 5, k13_ColorLightestGray, k1_ColorDarkGary, curChampion->_name); _vm->_textMan->printToLogicalScreen(championStatusBoxX + 1, 5, k13_ColorLightestGray, k1_ColorDarkGary, curChampion->_name);
_vm->_menuMan->drawActionIcon(champIndex); _vm->_menuMan->drawActionIcon(champIndex);
clearFlag(curChampion->_attributes, kDMChampionAttributeNameTitle | kDMChampionAttributeStatistics | kDMChampionAttributeLoad | kDMChampionAttributeIcon | kDMChampionAttributePanel | kDMChampionAttributeStatusBox | kDMChampionAttributeWounds | kDMChampionAttributeViewport | kDMChampionAttributeActionHand); clearFlag(curChampion->_attributes, kDMAttributeNameTitle | kDMAttributeStatistics | kDMAttributeLoad | kDMAttributeIcon | kDMAttributePanel | kDMAttributeStatusBox | kDMAttributeWounds | kDMAttributeViewport | kDMAttributeActionHand);
_vm->_eventMan->hideMouse(); _vm->_eventMan->hideMouse();
return; return;
} }
} }
if (!(curChampion->_currHealth)) { if (!(curChampion->_currHealth)) {
clearFlag(curChampion->_attributes, kDMChampionAttributeNameTitle | kDMChampionAttributeStatistics | kDMChampionAttributeLoad | kDMChampionAttributeIcon | kDMChampionAttributePanel | kDMChampionAttributeStatusBox | kDMChampionAttributeWounds | kDMChampionAttributeViewport | kDMChampionAttributeActionHand); clearFlag(curChampion->_attributes, kDMAttributeNameTitle | kDMAttributeStatistics | kDMAttributeLoad | kDMAttributeIcon | kDMAttributePanel | kDMAttributeStatusBox | kDMAttributeWounds | kDMAttributeViewport | kDMAttributeActionHand);
_vm->_eventMan->hideMouse(); _vm->_eventMan->hideMouse();
return; return;
} }
if (getFlag(championAttributes, kDMChampionAttributeNameTitle)) { if (getFlag(championAttributes, kDMAttributeNameTitle)) {
Color nameColor = (champIndex == _leaderIndex) ? k9_ColorGold : k13_ColorLightestGray; Color nameColor = (champIndex == _leaderIndex) ? k9_ColorGold : k13_ColorLightestGray;
if (isInventoryChampion) { if (isInventoryChampion) {
char *championName = curChampion->_name; char *championName = curChampion->_name;
@ -2182,7 +2182,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
championTitleX += 6; championTitleX += 6;
_vm->_textMan->printToViewport(championTitleX, 7, nameColor, curChampion->_title); _vm->_textMan->printToViewport(championTitleX, 7, nameColor, curChampion->_title);
setFlag(championAttributes, kDMChampionAttributeViewport); setFlag(championAttributes, kDMAttributeViewport);
} else { } else {
Box box; Box box;
box._y1 = 0; box._y1 = 0;
@ -2193,7 +2193,7 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
_vm->_textMan->printToLogicalScreen(championStatusBoxX + 1, 5, nameColor, k1_ColorDarkGary, curChampion->_name); _vm->_textMan->printToLogicalScreen(championStatusBoxX + 1, 5, nameColor, k1_ColorDarkGary, curChampion->_name);
} }
} }
if (getFlag(championAttributes, kDMChampionAttributeStatistics)) { if (getFlag(championAttributes, kDMAttributeStatistics)) {
drawChampionBarGraphs(champIndex); drawChampionBarGraphs(champIndex);
if (isInventoryChampion) { if (isInventoryChampion) {
drawHealthStaminaManaValues(curChampion); drawHealthStaminaManaValues(curChampion);
@ -2205,24 +2205,24 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
_vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(nativeBitmapIndex), boxMouth, k16_byteWidth, k12_ColorDarkestGray, 18); _vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(nativeBitmapIndex), boxMouth, k16_byteWidth, k12_ColorDarkestGray, 18);
nativeBitmapIndex = k33_SlotBoxNormalIndice; nativeBitmapIndex = k33_SlotBoxNormalIndice;
for (int i = kDMChampionStatStrength; i <= kDMChampionStatAntifire; i++) { for (int i = kDMStatStrength; i <= kDMStatAntifire; i++) {
if ((curChampion->_statistics[i][kDMChampionStatCurrent] < curChampion->_statistics[i][kDMChampionStatMaximum])) { if ((curChampion->_statistics[i][kDMStatCurrent] < curChampion->_statistics[i][kDMStatMaximum])) {
nativeBitmapIndex = k34_SlotBoxWoundedIndice; nativeBitmapIndex = k34_SlotBoxWoundedIndice;
break; break;
} }
} }
_vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(nativeBitmapIndex), boxEye, k16_byteWidth, k12_ColorDarkestGray, 18); _vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(nativeBitmapIndex), boxEye, k16_byteWidth, k12_ColorDarkestGray, 18);
setFlag(championAttributes, kDMChampionAttributeViewport); setFlag(championAttributes, kDMAttributeViewport);
} }
} }
if (getFlag(championAttributes, kDMChampionAttributeWounds)) { if (getFlag(championAttributes, kDMAttributeWounds)) {
for (int i = isInventoryChampion ? k5_ChampionSlotFeet : k1_ChampionSlotActionHand; i >= k0_ChampionSlotReadyHand; i--) for (int i = isInventoryChampion ? k5_ChampionSlotFeet : k1_ChampionSlotActionHand; i >= k0_ChampionSlotReadyHand; i--)
drawSlot(champIndex, i); drawSlot(champIndex, i);
if (isInventoryChampion) if (isInventoryChampion)
setFlag(championAttributes, kDMChampionAttributeViewport); setFlag(championAttributes, kDMAttributeViewport);
} }
if (getFlag(championAttributes, kDMChampionAttributeLoad) && isInventoryChampion) { if (getFlag(championAttributes, kDMAttributeLoad) && isInventoryChampion) {
uint16 maxLoad = getMaximumLoad(curChampion); uint16 maxLoad = getMaximumLoad(curChampion);
Color loadColor; Color loadColor;
if (curChampion->_load > maxLoad) if (curChampion->_load > maxLoad)
@ -2256,14 +2256,14 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
strcat(_vm->_stringBuildBuffer, getStringFromInteger(maxLoad, true, 3).c_str()); strcat(_vm->_stringBuildBuffer, getStringFromInteger(maxLoad, true, 3).c_str());
strcat(_vm->_stringBuildBuffer, " KG"); strcat(_vm->_stringBuildBuffer, " KG");
_vm->_textMan->printToViewport(148, 132, loadColor, _vm->_stringBuildBuffer); _vm->_textMan->printToViewport(148, 132, loadColor, _vm->_stringBuildBuffer);
setFlag(championAttributes, kDMChampionAttributeViewport); setFlag(championAttributes, kDMAttributeViewport);
} }
uint16 championIconIndex = getChampionIconIndex(curChampion->_cell, _vm->_dungeonMan->_partyDir); uint16 championIconIndex = getChampionIconIndex(curChampion->_cell, _vm->_dungeonMan->_partyDir);
if (getFlag(championAttributes, kDMChampionAttributeIcon) && (_vm->_eventMan->_useChampionIconOrdinalAsMousePointerBitmap != _vm->indexToOrdinal(championIconIndex))) { if (getFlag(championAttributes, kDMAttributeIcon) && (_vm->_eventMan->_useChampionIconOrdinalAsMousePointerBitmap != _vm->indexToOrdinal(championIconIndex))) {
_vm->_displayMan->fillScreenBox(_boxChampionIcons[championIconIndex], _championColor[champIndex]); _vm->_displayMan->fillScreenBox(_boxChampionIcons[championIconIndex], _championColor[champIndex]);
_vm->_displayMan->blitToBitmap(_vm->_displayMan->getNativeBitmapOrGraphic(k28_ChampionIcons), _vm->_displayMan->_bitmapScreen, _boxChampionIcons[championIconIndex], getChampionIconIndex(curChampion->_dir, _vm->_dungeonMan->_partyDir) * 19, 0, k40_byteWidth, k160_byteWidthScreen, k12_ColorDarkestGray, 14, k200_heightScreen); _vm->_displayMan->blitToBitmap(_vm->_displayMan->getNativeBitmapOrGraphic(k28_ChampionIcons), _vm->_displayMan->_bitmapScreen, _boxChampionIcons[championIconIndex], getChampionIconIndex(curChampion->_dir, _vm->_dungeonMan->_partyDir) * 19, 0, k40_byteWidth, k160_byteWidthScreen, k12_ColorDarkestGray, 14, k200_heightScreen);
} }
if (getFlag(championAttributes, kDMChampionAttributePanel) && isInventoryChampion) { if (getFlag(championAttributes, kDMAttributePanel) && isInventoryChampion) {
if (_vm->_pressingMouth) if (_vm->_pressingMouth)
_vm->_inventoryMan->drawPanelFoodWaterPoisoned(); _vm->_inventoryMan->drawPanelFoodWaterPoisoned();
else if (_vm->_pressingEye) { else if (_vm->_pressingEye) {
@ -2272,18 +2272,18 @@ void ChampionMan::drawChampionState(ChampionIndex champIndex) {
} else } else
_vm->_inventoryMan->drawPanel(); _vm->_inventoryMan->drawPanel();
setFlag(championAttributes, kDMChampionAttributeViewport); setFlag(championAttributes, kDMAttributeViewport);
} }
if (getFlag(championAttributes, kDMChampionAttributeActionHand)) { if (getFlag(championAttributes, kDMAttributeActionHand)) {
drawSlot(champIndex, k1_ChampionSlotActionHand); drawSlot(champIndex, k1_ChampionSlotActionHand);
_vm->_menuMan->drawActionIcon(champIndex); _vm->_menuMan->drawActionIcon(champIndex);
if (isInventoryChampion) if (isInventoryChampion)
setFlag(championAttributes, kDMChampionAttributeViewport); setFlag(championAttributes, kDMAttributeViewport);
} }
if (getFlag(championAttributes, kDMChampionAttributeViewport)) if (getFlag(championAttributes, kDMAttributeViewport))
_vm->_displayMan->drawViewport(k0_viewportNotDungeonView); _vm->_displayMan->drawViewport(k0_viewportNotDungeonView);
clearFlag(curChampion->_attributes, kDMChampionAttributeNameTitle | kDMChampionAttributeStatistics | kDMChampionAttributeLoad | kDMChampionAttributeIcon | kDMChampionAttributePanel | kDMChampionAttributeStatusBox | kDMChampionAttributeWounds | kDMChampionAttributeViewport | kDMChampionAttributeActionHand); clearFlag(curChampion->_attributes, kDMAttributeNameTitle | kDMAttributeStatistics | kDMAttributeLoad | kDMAttributeIcon | kDMAttributePanel | kDMAttributeStatusBox | kDMAttributeWounds | kDMAttributeViewport | kDMAttributeActionHand);
_vm->_eventMan->hideMouse(); _vm->_eventMan->hideMouse();
} }
@ -2557,9 +2557,9 @@ uint16 ChampionMan::getSkillLevel(int16 champIndex, uint16 skillIndex) {
if (!ignoreTmpExp) if (!ignoreTmpExp)
exp += skill->_temporaryExperience; exp += skill->_temporaryExperience;
if (skillIndex > k3_ChampionSkillWizard) { if (skillIndex > kDMSkillWizard) {
// Hidden skill // Hidden skill
skill = &champ->_skills[(skillIndex - k4_ChampionSkillSwing) >> 2]; skill = &champ->_skills[(skillIndex - kDMSkillSwing) >> 2];
exp += skill->_experience; // Add experience in the base skill exp += skill->_experience; // Add experience in the base skill
if (!ignoreTmpExp) if (!ignoreTmpExp)
exp += skill->_temporaryExperience; exp += skill->_temporaryExperience;
@ -2580,20 +2580,20 @@ uint16 ChampionMan::getSkillLevel(int16 champIndex, uint16 skillIndex) {
int16 neckIconIndex = _vm->_objectMan->getIconIndex(champ->_slots[k10_ChampionSlotNeck]); int16 neckIconIndex = _vm->_objectMan->getIconIndex(champ->_slots[k10_ChampionSlotNeck]);
switch (skillIndex) { switch (skillIndex) {
case k3_ChampionSkillWizard: case kDMSkillWizard:
if (neckIconIndex == kDMIconIndiceJunkPendantFeral) if (neckIconIndex == kDMIconIndiceJunkPendantFeral)
skillLevel += 1; skillLevel += 1;
break; break;
case k13_ChampionSkillHeal: case kDMSkillHeal:
// The skill modifiers of these two objects are not cumulative // The skill modifiers of these two objects are not cumulative
if ((neckIconIndex == kDMIconIndiceJunkGemOfAges) || (actionHandIconIndex == kDMIconIndiceWeaponSceptreOfLyf)) if ((neckIconIndex == kDMIconIndiceJunkGemOfAges) || (actionHandIconIndex == kDMIconIndiceWeaponSceptreOfLyf))
skillLevel += 1; skillLevel += 1;
break; break;
case k14_ChampionSkillInfluence: case kDMSkillInfluence:
if (neckIconIndex == kDMIconIndiceJunkMoonstone) if (neckIconIndex == kDMIconIndiceJunkMoonstone)
skillLevel += 1; skillLevel += 1;
break; break;
case k15_ChampionSkillDefend: case kDMSkillDefend:
if (neckIconIndex == kDMIconIndiceJunkEkkhardCross) if (neckIconIndex == kDMIconIndiceJunkEkkhardCross)
skillLevel += 1; skillLevel += 1;
break; break;

View File

@ -183,70 +183,69 @@ enum ChampionIndex {
}; };
enum ChampionAttribute { enum ChampionAttribute {
kDMChampionAttributNone = 0x0000, // @ MASK0x0000_NONE kDMAttributNone = 0x0000, // @ MASK0x0000_NONE
kDMChampionAttributeDisableAction = 0x0008, // @ MASK0x0008_DISABLE_ACTION kDMAttributeDisableAction = 0x0008, // @ MASK0x0008_DISABLE_ACTION
kDMChampionAttributeMale = 0x0010, // @ MASK0x0010_MALE kDMAttributeMale = 0x0010, // @ MASK0x0010_MALE
kDMChampionAttributeNameTitle = 0x0080, // @ MASK0x0080_NAME_TITLE kDMAttributeNameTitle = 0x0080, // @ MASK0x0080_NAME_TITLE
kDMChampionAttributeStatistics = 0x0100, // @ MASK0x0100_STATISTICS kDMAttributeStatistics = 0x0100, // @ MASK0x0100_STATISTICS
kDMChampionAttributeLoad = 0x0200, // @ MASK0x0200_LOAD kDMAttributeLoad = 0x0200, // @ MASK0x0200_LOAD
kDMChampionAttributeIcon = 0x0400, // @ MASK0x0400_ICON kDMAttributeIcon = 0x0400, // @ MASK0x0400_ICON
kDMChampionAttributePanel = 0x0800, // @ MASK0x0800_PANEL kDMAttributePanel = 0x0800, // @ MASK0x0800_PANEL
kDMChampionAttributeStatusBox = 0x1000, // @ MASK0x1000_STATUS_BOX kDMAttributeStatusBox = 0x1000, // @ MASK0x1000_STATUS_BOX
kDMChampionAttributeWounds = 0x2000, // @ MASK0x2000_WOUNDS kDMAttributeWounds = 0x2000, // @ MASK0x2000_WOUNDS
kDMChampionAttributeViewport = 0x4000, // @ MASK0x4000_VIEWPORT kDMAttributeViewport = 0x4000, // @ MASK0x4000_VIEWPORT
kDMChampionAttributeActionHand = 0x8000 // @ MASK0x8000_ACTION_HAND kDMAttributeActionHand = 0x8000 // @ MASK0x8000_ACTION_HAND
}; };
enum ChampionWound { enum ChampionWound {
kDMChampionWoundNone = 0x0000, // @ MASK0x0000_NO_WOUND kDMWoundNone = 0x0000, // @ MASK0x0000_NO_WOUND
kDMChampionWoundReadHand = 0x0001, // @ MASK0x0001_READY_HAND kDMWoundReadHand = 0x0001, // @ MASK0x0001_READY_HAND
kDMChampionWoundActionHand = 0x0002, // @ MASK0x0002_ACTION_HAND kDMWoundActionHand = 0x0002, // @ MASK0x0002_ACTION_HAND
kDMChampionWoundHead = 0x0004, // @ MASK0x0004_HEAD kDMWoundHead = 0x0004, // @ MASK0x0004_HEAD
kDMChampionWoundTorso = 0x0008, // @ MASK0x0008_TORSO kDMWoundTorso = 0x0008, // @ MASK0x0008_TORSO
kDMChampionWoundLegs = 0x0010, // @ MASK0x0010_LEGS kDMWoundLegs = 0x0010, // @ MASK0x0010_LEGS
kDMChampionWoundFeet = 0x0020 // @ MASK0x0020_FEET kDMWoundFeet = 0x0020 // @ MASK0x0020_FEET
}; };
enum ChampionStatisticType { enum ChampionStatType {
kDMChampionStatLuck = 0, // @ C0_STATISTIC_LUCK kDMStatLuck = 0, // @ C0_STATISTIC_LUCK
kDMChampionStatStrength = 1, // @ C1_STATISTIC_STRENGTH kDMStatStrength = 1, // @ C1_STATISTIC_STRENGTH
kDMChampionStatDexterity = 2, // @ C2_STATISTIC_DEXTERITY kDMStatDexterity = 2, // @ C2_STATISTIC_DEXTERITY
kDMChampionStatWisdom = 3, // @ C3_STATISTIC_WISDOM kDMStatWisdom = 3, // @ C3_STATISTIC_WISDOM
kDMChampionStatVitality = 4, // @ C4_STATISTIC_VITALITY kDMStatVitality = 4, // @ C4_STATISTIC_VITALITY
kDMChampionStatAntimagic = 5, // @ C5_STATISTIC_ANTIMAGIC kDMStatAntimagic = 5, // @ C5_STATISTIC_ANTIMAGIC
kDMChampionStatAntifire = 6, // @ C6_STATISTIC_ANTIFIRE kDMStatAntifire = 6, // @ C6_STATISTIC_ANTIFIRE
kDMChampionStatMana = 8 // @ C8_STATISTIC_MANA /* Used as a fake statistic index for objects granting a Mana bonus */ kDMStatMana = 8 // @ C8_STATISTIC_MANA /* Used as a fake statistic index for objects granting a Mana bonus */
}; };
enum ChampionStatisticValue { enum ChampionStatValue {
kDMChampionStatMaximum = 0, // @ C0_MAXIMUM kDMStatMaximum = 0, // @ C0_MAXIMUM
kDMChampionStatCurrent = 1, // @ C1_CURRENT kDMStatCurrent = 1, // @ C1_CURRENT
kDMChampionStatMinimum = 2 // @ C2_MINIMUM kDMStatMinimum = 2 // @ C2_MINIMUM
}; };
enum ChampionSkill { enum ChampionSkill {
k0_ChampionSkillFighter = 0, // @ C00_SKILL_FIGHTER kDMSkillFighter = 0, // @ C00_SKILL_FIGHTER
k1_ChampionSkillNinja = 1, // @ C01_SKILL_NINJA kDMSkillNinja = 1, // @ C01_SKILL_NINJA
k2_ChampionSkillPriest = 2, // @ C02_SKILL_PRIEST kDMSkillPriest = 2, // @ C02_SKILL_PRIEST
k3_ChampionSkillWizard = 3, // @ C03_SKILL_WIZARD kDMSkillWizard = 3, // @ C03_SKILL_WIZARD
k4_ChampionSkillSwing = 4, // @ C04_SKILL_SWING kDMSkillSwing = 4, // @ C04_SKILL_SWING
k5_ChampionSkillThrust = 5, // @ C05_SKILL_THRUST kDMSkillThrust = 5, // @ C05_SKILL_THRUST
k6_ChampionSkillClub = 6, // @ C06_SKILL_CLUB kDMSkillClub = 6, // @ C06_SKILL_CLUB
k7_ChampionSkillParry = 7, // @ C07_SKILL_PARRY kDMSkillParry = 7, // @ C07_SKILL_PARRY
k8_ChampionSkillSteal = 8, // @ C08_SKILL_STEAL kDMSkillSteal = 8, // @ C08_SKILL_STEAL
k9_ChampionSkillFight = 9, // @ C09_SKILL_FIGHT kDMSkillFight = 9, // @ C09_SKILL_FIGHT
k10_ChampionSkillThrow = 10, // @ C10_SKILL_THROW kDMSkillThrow = 10, // @ C10_SKILL_THROW
k11_ChampionSkillShoot = 11, // @ C11_SKILL_SHOOT kDMSkillShoot = 11, // @ C11_SKILL_SHOOT
k12_ChampionSkillIdentify = 12, // @ C12_SKILL_IDENTIFY kDMSkillIdentify = 12, // @ C12_SKILL_IDENTIFY
k13_ChampionSkillHeal = 13, // @ C13_SKILL_HEAL kDMSkillHeal = 13, // @ C13_SKILL_HEAL
k14_ChampionSkillInfluence = 14, // @ C14_SKILL_INFLUENCE kDMSkillInfluence = 14, // @ C14_SKILL_INFLUENCE
k15_ChampionSkillDefend = 15, // @ C15_SKILL_DEFEND kDMSkillDefend = 15, // @ C15_SKILL_DEFEND
k16_ChampionSkillFire = 16, // @ C16_SKILL_FIRE kDMSkillFire = 16, // @ C16_SKILL_FIRE
k17_ChampionSkillAir = 17, // @ C17_SKILL_AIR kDMSkillAir = 17, // @ C17_SKILL_AIR
k18_ChampionSkillEarth = 18, // @ C18_SKILL_EARTH kDMSkillEarth = 18, // @ C18_SKILL_EARTH
k19_ChampionSkillWater = 19 // @ C19_SKILL_WATER kDMSkillWater = 19 // @ C19_SKILL_WATER
}; };
enum ChampionSlot { enum ChampionSlot {
@ -350,6 +349,40 @@ enum AttackType {
k7_attackType_LIGHTNING = 7 // @ C7_ATTACK_LIGHTNING k7_attackType_LIGHTNING = 7 // @ C7_ATTACK_LIGHTNING
}; };
#define k0x0000_maskDoNotUseSharpDefense 0x0000 // @ MASK0x0000_DO_NOT_USE_SHARP_DEFENSE
#define k0x8000_maskUseSharpDefense 0x8000 // @ MASK0x8000_USE_SHARP_DEFENSE
#define k0x8000_mergeCycles 0x8000 // @ MASK0x8000_MERGE_CYCLES
#define k0_spellCastFailure 0 // @ C0_SPELL_CAST_FAILURE
#define k1_spellCastSuccess 1 // @ C1_SPELL_CAST_SUCCESS
#define k3_spellCastFailureNeedsFlask 3 // @ C3_SPELL_CAST_FAILURE_NEEDS_FLASK
#define k0_failureNeedsMorePractice 0 // @ C00_FAILURE_NEEDS_MORE_PRACTICE
#define k1_failureMeaninglessSpell 1 // @ C01_FAILURE_MEANINGLESS_SPELL
#define k10_failureNeedsFlaskInHand 10 // @ C10_FAILURE_NEEDS_FLASK_IN_HAND
#define k11_failureNeedsMagicMapInHand 11 // @ C11_FAILURE_NEEDS_MAGIC_MAP_IN_HAND
#define k1_spellKindPotion 1 // @ C1_SPELL_KIND_POTION
#define k2_spellKindProjectile 2 // @ C2_SPELL_KIND_PROJECTILE
#define k3_spellKindOther 3 // @ C3_SPELL_KIND_OTHER
#define k4_spellKindMagicMap 4 // @ C4_SPELL_KIND_MAGIC_MAP
#define k4_spellType_projectileOpenDoor 4 // @ C4_SPELL_TYPE_PROJECTILE_OPEN_DOOR
#define k0_spellType_otherLight 0 // @ C0_SPELL_TYPE_OTHER_LIGHT
#define k1_spellType_otherDarkness 1 // @ C1_SPELL_TYPE_OTHER_DARKNESS
#define k2_spellType_otherThievesEye 2 // @ C2_SPELL_TYPE_OTHER_THIEVES_EYE
#define k3_spellType_otherInvisibility 3 // @ C3_SPELL_TYPE_OTHER_INVISIBILITY
#define k4_spellType_otherPartyShield 4 // @ C4_SPELL_TYPE_OTHER_PARTY_SHIELD
#define k5_spellType_otherMagicTorch 5 // @ C5_SPELL_TYPE_OTHER_MAGIC_TORCH
#define k6_spellType_otherFootprints 6 // @ C6_SPELL_TYPE_OTHER_FOOTPRINTS
#define k7_spellType_otherZokathra 7 // @ C7_SPELL_TYPE_OTHER_ZOKATHRA
#define k8_spellType_otherFireshield 8 // @ C8_SPELL_TYPE_OTHER_FIRESHIELD
#define k0_spellType_magicMap0 0 // @ C0_SPELL_TYPE_MAGIC_MAP
#define k1_spellType_magicMap1 1 // @ C1_SPELL_TYPE_MAGIC_MAP
#define k2_spellType_magicMap2 2 // @ C2_SPELL_TYPE_MAGIC_MAP
#define k3_spellType_magicMap3 3 // @ C3_SPELL_TYPE_MAGIC_MAP
class Skill { class Skill {
public: public:
int16 _temporaryExperience; int16 _temporaryExperience;
@ -397,18 +430,18 @@ public:
void setSkillExp(ChampionSkill skill, int32 val) { _skills[skill]._experience = val; } void setSkillExp(ChampionSkill skill, int32 val) { _skills[skill]._experience = val; }
void setSkillTempExp(ChampionSkill skill, int16 val) { _skills[skill]._temporaryExperience= val; } void setSkillTempExp(ChampionSkill skill, int16 val) { _skills[skill]._temporaryExperience= val; }
byte& getStatistic(ChampionStatisticType type, ChampionStatisticValue valType) { return _statistics[type][valType]; } byte& getStatistic(ChampionStatType type, ChampionStatValue valType) { return _statistics[type][valType]; }
void setStatistic(ChampionStatisticType type, ChampionStatisticValue valType, byte newVal) { _statistics[type][valType] = newVal; } void setStatistic(ChampionStatType type, ChampionStatValue valType, byte newVal) { _statistics[type][valType] = newVal; }
uint16 getAttributes() { return _attributes; } uint16 getAttributes() { return _attributes; }
uint16 getAttributes(ChampionAttribute flag) { return _attributes & flag; } uint16 getAttributes(ChampionAttribute flag) { return _attributes & flag; }
void setAttributeFlag(ChampionAttribute flag, bool value); void setAttributeFlag(ChampionAttribute flag, bool value);
void clearAttributes(ChampionAttribute attribute = kDMChampionAttributNone) { _attributes = attribute; } void clearAttributes(ChampionAttribute attribute = kDMAttributNone) { _attributes = attribute; }
uint16 getWounds() { return _wounds; } uint16 getWounds() { return _wounds; }
void setWoundsFlag(ChampionWound flag, bool value); void setWoundsFlag(ChampionWound flag, bool value);
uint16 getWoundsFlag(ChampionWound wound) { return _wounds & wound; } uint16 getWoundsFlag(ChampionWound wound) { return _wounds & wound; }
void clearWounds() { _wounds = kDMChampionWoundNone; } void clearWounds() { _wounds = kDMWoundNone; }
void resetSkillsToZero() { void resetSkillsToZero() {
for (int16 i = 0; i < 20; ++i) for (int16 i = 0; i < 20; ++i)
_skills[i].resetToZero(); _skills[i].resetToZero();
@ -417,40 +450,6 @@ public:
}; // @ CHAMPION_INCLUDING_PORTRAIT }; // @ CHAMPION_INCLUDING_PORTRAIT
#define k0x0000_maskDoNotUseSharpDefense 0x0000 // @ MASK0x0000_DO_NOT_USE_SHARP_DEFENSE
#define k0x8000_maskUseSharpDefense 0x8000 // @ MASK0x8000_USE_SHARP_DEFENSE
#define k0x8000_mergeCycles 0x8000 // @ MASK0x8000_MERGE_CYCLES
#define k0_spellCastFailure 0 // @ C0_SPELL_CAST_FAILURE
#define k1_spellCastSuccess 1 // @ C1_SPELL_CAST_SUCCESS
#define k3_spellCastFailureNeedsFlask 3 // @ C3_SPELL_CAST_FAILURE_NEEDS_FLASK
#define k0_failureNeedsMorePractice 0 // @ C00_FAILURE_NEEDS_MORE_PRACTICE
#define k1_failureMeaninglessSpell 1 // @ C01_FAILURE_MEANINGLESS_SPELL
#define k10_failureNeedsFlaskInHand 10 // @ C10_FAILURE_NEEDS_FLASK_IN_HAND
#define k11_failureNeedsMagicMapInHand 11 // @ C11_FAILURE_NEEDS_MAGIC_MAP_IN_HAND
#define k1_spellKindPotion 1 // @ C1_SPELL_KIND_POTION
#define k2_spellKindProjectile 2 // @ C2_SPELL_KIND_PROJECTILE
#define k3_spellKindOther 3 // @ C3_SPELL_KIND_OTHER
#define k4_spellKindMagicMap 4 // @ C4_SPELL_KIND_MAGIC_MAP
#define k4_spellType_projectileOpenDoor 4 // @ C4_SPELL_TYPE_PROJECTILE_OPEN_DOOR
#define k0_spellType_otherLight 0 // @ C0_SPELL_TYPE_OTHER_LIGHT
#define k1_spellType_otherDarkness 1 // @ C1_SPELL_TYPE_OTHER_DARKNESS
#define k2_spellType_otherThievesEye 2 // @ C2_SPELL_TYPE_OTHER_THIEVES_EYE
#define k3_spellType_otherInvisibility 3 // @ C3_SPELL_TYPE_OTHER_INVISIBILITY
#define k4_spellType_otherPartyShield 4 // @ C4_SPELL_TYPE_OTHER_PARTY_SHIELD
#define k5_spellType_otherMagicTorch 5 // @ C5_SPELL_TYPE_OTHER_MAGIC_TORCH
#define k6_spellType_otherFootprints 6 // @ C6_SPELL_TYPE_OTHER_FOOTPRINTS
#define k7_spellType_otherZokathra 7 // @ C7_SPELL_TYPE_OTHER_ZOKATHRA
#define k8_spellType_otherFireshield 8 // @ C8_SPELL_TYPE_OTHER_FIRESHIELD
#define k0_spellType_magicMap0 0 // @ C0_SPELL_TYPE_MAGIC_MAP
#define k1_spellType_magicMap1 1 // @ C1_SPELL_TYPE_MAGIC_MAP
#define k2_spellType_magicMap2 2 // @ C2_SPELL_TYPE_MAGIC_MAP
#define k3_spellType_magicMap3 3 // @ C3_SPELL_TYPE_MAGIC_MAP
class Spell { class Spell {
public: public:
Spell() {} Spell() {}

View File

@ -655,7 +655,7 @@ void DMEngine::endGame(bool doNotDrawCreditsOnly) {
textPosX += 6; textPosX += 6;
_textMan->printEndGameString(textPosX, textPosY++, k9_ColorGold, curChampion->_title); _textMan->printEndGameString(textPosX, textPosY++, k9_ColorGold, curChampion->_title);
for (int16 idx = k0_ChampionSkillFighter; idx <= k3_ChampionSkillWizard; idx++) { for (int16 idx = kDMSkillFighter; idx <= kDMSkillWizard; idx++) {
uint16 skillLevel = MIN<uint16>(16, _championMan->getSkillLevel(championIndex, idx | (kDMIgnoreObjectModifiers | kDMIgnoreTemporaryExperience))); uint16 skillLevel = MIN<uint16>(16, _championMan->getSkillLevel(championIndex, idx | (kDMIgnoreObjectModifiers | kDMIgnoreTemporaryExperience)));
if (skillLevel == 1) if (skillLevel == 1)
continue; continue;

View File

@ -1009,9 +1009,9 @@ void EventManager::commandMoveParty(CommandType cmdType) {
movementArrowIdx += (_vm->_dungeonMan->_partyDir + 2); movementArrowIdx += (_vm->_dungeonMan->_partyDir + 2);
int16 L1124_i_FirstDamagedChampionIndex = _vm->_championMan->getTargetChampionIndex(partyMapX, partyMapY, normalizeModulo4(movementArrowIdx)); int16 L1124_i_FirstDamagedChampionIndex = _vm->_championMan->getTargetChampionIndex(partyMapX, partyMapY, normalizeModulo4(movementArrowIdx));
int16 L1125_i_SecondDamagedChampionIndex = _vm->_championMan->getTargetChampionIndex(partyMapX, partyMapY, returnNextVal(movementArrowIdx)); int16 L1125_i_SecondDamagedChampionIndex = _vm->_championMan->getTargetChampionIndex(partyMapX, partyMapY, returnNextVal(movementArrowIdx));
int16 damage = _vm->_championMan->addPendingDamageAndWounds_getDamage(L1124_i_FirstDamagedChampionIndex, 1, kDMChampionWoundTorso | kDMChampionWoundLegs, k2_attackType_SELF); int16 damage = _vm->_championMan->addPendingDamageAndWounds_getDamage(L1124_i_FirstDamagedChampionIndex, 1, kDMWoundTorso | kDMWoundLegs, k2_attackType_SELF);
if (L1124_i_FirstDamagedChampionIndex != L1125_i_SecondDamagedChampionIndex) if (L1124_i_FirstDamagedChampionIndex != L1125_i_SecondDamagedChampionIndex)
damage |= _vm->_championMan->addPendingDamageAndWounds_getDamage(L1125_i_SecondDamagedChampionIndex, 1, kDMChampionWoundTorso | kDMChampionWoundLegs, k2_attackType_SELF); damage |= _vm->_championMan->addPendingDamageAndWounds_getDamage(L1125_i_SecondDamagedChampionIndex, 1, kDMWoundTorso | kDMWoundLegs, k2_attackType_SELF);
if (damage) if (damage)
_vm->_sound->requestPlay(k18_soundPARTY_DAMAGED, partyMapX, partyMapY, k0_soundModePlayImmediately); _vm->_sound->requestPlay(k18_soundPARTY_DAMAGED, partyMapX, partyMapY, k0_soundModePlayImmediately);
@ -1110,8 +1110,8 @@ void EventManager::commandSetLeader(ChampionIndex champIndex) {
if (cm._leaderIndex != kDMChampionNone) { if (cm._leaderIndex != kDMChampionNone) {
leaderIndex = cm._leaderIndex; leaderIndex = cm._leaderIndex;
cm._champions[leaderIndex].setAttributeFlag(kDMChampionAttributeLoad, true); cm._champions[leaderIndex].setAttributeFlag(kDMAttributeLoad, true);
cm._champions[leaderIndex].setAttributeFlag(kDMChampionAttributeNameTitle, true); cm._champions[leaderIndex].setAttributeFlag(kDMAttributeNameTitle, true);
cm._champions[leaderIndex]._load -= _vm->_dungeonMan->getObjectWeight(cm._leaderHandObject); cm._champions[leaderIndex]._load -= _vm->_dungeonMan->getObjectWeight(cm._leaderHandObject);
cm._leaderIndex = kDMChampionNone; cm._leaderIndex = kDMChampionNone;
cm.drawChampionState(leaderIndex); cm.drawChampionState(leaderIndex);
@ -1125,8 +1125,8 @@ void EventManager::commandSetLeader(ChampionIndex champIndex) {
champion->_dir = _vm->_dungeonMan->_partyDir; champion->_dir = _vm->_dungeonMan->_partyDir;
cm._champions[champIndex]._load += _vm->_dungeonMan->getObjectWeight(cm._leaderHandObject); cm._champions[champIndex]._load += _vm->_dungeonMan->getObjectWeight(cm._leaderHandObject);
if (_vm->indexToOrdinal(champIndex) != cm._candidateChampionOrdinal) { if (_vm->indexToOrdinal(champIndex) != cm._candidateChampionOrdinal) {
champion->setAttributeFlag(kDMChampionAttributeIcon, true); champion->setAttributeFlag(kDMAttributeIcon, true);
champion->setAttributeFlag(kDMChampionAttributeNameTitle, true); champion->setAttributeFlag(kDMAttributeNameTitle, true);
cm.drawChampionState(champIndex); cm.drawChampionState(champIndex);
} }
} }
@ -1280,8 +1280,8 @@ void EventManager::commandProcessCommands160To162ClickInResurrectReincarnatePane
for (uint16 i = 0; i < 12; i++) { for (uint16 i = 0; i < 12; i++) {
uint16 statIndex = _vm->getRandomNumber(7); uint16 statIndex = _vm->getRandomNumber(7);
champ->getStatistic((ChampionStatisticType)statIndex, kDMChampionStatCurrent)++; // returns reference champ->getStatistic((ChampionStatType)statIndex, kDMStatCurrent)++; // returns reference
champ->getStatistic((ChampionStatisticType)statIndex, kDMChampionStatMaximum)++; // returns reference champ->getStatistic((ChampionStatType)statIndex, kDMStatMaximum)++; // returns reference
} }
} }
@ -1476,19 +1476,19 @@ void EventManager::mouseProcessCommands125To128_clickOnChampionIcon(uint16 champ
_useChampionIconOrdinalAsMousePointerBitmap = _vm->indexToOrdinal(kDMChampionNone); _useChampionIconOrdinalAsMousePointerBitmap = _vm->indexToOrdinal(kDMChampionNone);
int16 championCellIndex = _vm->_championMan->getIndexInCell(normalizeModulo4(championIconIndex + _vm->_dungeonMan->_partyDir)); int16 championCellIndex = _vm->_championMan->getIndexInCell(normalizeModulo4(championIconIndex + _vm->_dungeonMan->_partyDir));
if (championIconIndex == champIconIndex) { if (championIconIndex == champIconIndex) {
setFlag(_vm->_championMan->_champions[championCellIndex]._attributes, kDMChampionAttributeIcon); setFlag(_vm->_championMan->_champions[championCellIndex]._attributes, kDMAttributeIcon);
_vm->_championMan->drawChampionState((ChampionIndex)championCellIndex); _vm->_championMan->drawChampionState((ChampionIndex)championCellIndex);
} else { } else {
int16 championIndex = _vm->_championMan->getIndexInCell(normalizeModulo4(champIconIndex + _vm->_dungeonMan->_partyDir)); int16 championIndex = _vm->_championMan->getIndexInCell(normalizeModulo4(champIconIndex + _vm->_dungeonMan->_partyDir));
if (championIndex >= 0) { if (championIndex >= 0) {
_vm->_championMan->_champions[championIndex]._cell = (ViewCell)normalizeModulo4(championIconIndex + _vm->_dungeonMan->_partyDir); _vm->_championMan->_champions[championIndex]._cell = (ViewCell)normalizeModulo4(championIconIndex + _vm->_dungeonMan->_partyDir);
setFlag(_vm->_championMan->_champions[championIndex]._attributes, kDMChampionAttributeIcon); setFlag(_vm->_championMan->_champions[championIndex]._attributes, kDMAttributeIcon);
_vm->_championMan->drawChampionState((ChampionIndex)championIndex); _vm->_championMan->drawChampionState((ChampionIndex)championIndex);
} else } else
_vm->_displayMan->fillScreenBox(_vm->_championMan->_boxChampionIcons[championIconIndex], k0_ColorBlack); _vm->_displayMan->fillScreenBox(_vm->_championMan->_boxChampionIcons[championIconIndex], k0_ColorBlack);
_vm->_championMan->_champions[championCellIndex]._cell = (ViewCell)normalizeModulo4(champIconIndex + _vm->_dungeonMan->_partyDir); _vm->_championMan->_champions[championCellIndex]._cell = (ViewCell)normalizeModulo4(champIconIndex + _vm->_dungeonMan->_partyDir);
setFlag(_vm->_championMan->_champions[championCellIndex]._attributes, kDMChampionAttributeIcon); setFlag(_vm->_championMan->_champions[championCellIndex]._attributes, kDMAttributeIcon);
_vm->_championMan->drawChampionState((ChampionIndex)championCellIndex); _vm->_championMan->drawChampionState((ChampionIndex)championCellIndex);
} }
} }

View File

@ -1577,7 +1577,7 @@ int16 GroupMan::getChampionDamage(Group *group, uint16 champIndex) {
int16 doubledMapDifficulty = _vm->_dungeonMan->_currMap->_difficulty << 1; int16 doubledMapDifficulty = _vm->_dungeonMan->_currMap->_difficulty << 1;
CreatureInfo creatureInfo = _vm->_dungeonMan->_creatureInfos[group->_type]; CreatureInfo creatureInfo = _vm->_dungeonMan->_creatureInfos[group->_type];
_vm->_championMan->addSkillExperience(champIndex, k7_ChampionSkillParry, creatureInfo.getExperience()); _vm->_championMan->addSkillExperience(champIndex, kDMSkillParry, creatureInfo.getExperience());
if (_vm->_championMan->_partyIsSleeping || (((_vm->_championMan->getDexterity(curChampion) < (_vm->getRandomNumber(32) + creatureInfo._dexterity + doubledMapDifficulty - 16)) || !_vm->getRandomNumber(4)) && !_vm->_championMan->isLucky(curChampion, 60))) { if (_vm->_championMan->_partyIsSleeping || (((_vm->_championMan->getDexterity(curChampion) < (_vm->getRandomNumber(32) + creatureInfo._dexterity + doubledMapDifficulty - 16)) || !_vm->getRandomNumber(4)) && !_vm->_championMan->isLucky(curChampion, 60))) {
uint16 allowedWound; uint16 allowedWound;
uint16 woundTest = _vm->getRandomNumber(65536); uint16 woundTest = _vm->getRandomNumber(65536);
@ -1592,7 +1592,7 @@ int16 GroupMan::getChampionDamage(Group *group, uint16 champIndex) {
} else } else
allowedWound = woundTest & 0x0001; /* 0 (Ready hand) or 1 (action hand) */ allowedWound = woundTest & 0x0001; /* 0 (Ready hand) or 1 (action hand) */
int16 attack = (_vm->getRandomNumber(16) + creatureInfo._attack + doubledMapDifficulty) - (_vm->_championMan->getSkillLevel(champIndex, k7_ChampionSkillParry) << 1); int16 attack = (_vm->getRandomNumber(16) + creatureInfo._attack + doubledMapDifficulty) - (_vm->_championMan->getSkillLevel(champIndex, kDMSkillParry) << 1);
if (attack <= 1) { if (attack <= 1) {
if (_vm->getRandomNumber(2)) if (_vm->getRandomNumber(2))
return 0; return 0;
@ -1613,7 +1613,7 @@ int16 GroupMan::getChampionDamage(Group *group, uint16 champIndex) {
uint16 poisonAttack = creatureInfo._poisonAttack; uint16 poisonAttack = creatureInfo._poisonAttack;
if (poisonAttack && _vm->getRandomNumber(2)) { if (poisonAttack && _vm->getRandomNumber(2)) {
poisonAttack = _vm->_championMan->getStatisticAdjustedAttack(curChampion, kDMChampionStatVitality, poisonAttack); poisonAttack = _vm->_championMan->getStatisticAdjustedAttack(curChampion, kDMStatVitality, poisonAttack);
if (poisonAttack >= 0) if (poisonAttack >= 0)
_vm->_championMan->championPoison(champIndex, poisonAttack); _vm->_championMan->championPoison(champIndex, poisonAttack);
} }

View File

@ -103,7 +103,7 @@ void InventoryMan::toggleInventory(ChampionIndex championIndex) {
closeChest(); closeChest();
Champion *champion = &_vm->_championMan->_champions[_vm->ordinalToIndex(inventoryChampionOrdinal)]; Champion *champion = &_vm->_championMan->_champions[_vm->ordinalToIndex(inventoryChampionOrdinal)];
if (champion->_currHealth && !_vm->_championMan->_candidateChampionOrdinal) { if (champion->_currHealth && !_vm->_championMan->_candidateChampionOrdinal) {
setFlag(champion->_attributes, kDMChampionAttributeStatusBox); setFlag(champion->_attributes, kDMAttributeStatusBox);
_vm->_championMan->drawChampionState((ChampionIndex)_vm->ordinalToIndex(inventoryChampionOrdinal)); _vm->_championMan->drawChampionState((ChampionIndex)_vm->ordinalToIndex(inventoryChampionOrdinal));
} }
if (_vm->_championMan->_partyIsSleeping) { if (_vm->_championMan->_partyIsSleeping) {
@ -152,7 +152,7 @@ void InventoryMan::toggleInventory(ChampionIndex championIndex) {
for (uint16 i = k0_ChampionSlotReadyHand; i < k30_ChampionSlotChest_1; i++) for (uint16 i = k0_ChampionSlotReadyHand; i < k30_ChampionSlotChest_1; i++)
_vm->_championMan->drawSlot(championIndex, i); _vm->_championMan->drawSlot(championIndex, i);
setFlag(champion->_attributes, kDMChampionAttributeViewport | kDMChampionAttributeStatusBox | kDMChampionAttributePanel | kDMChampionAttributeLoad | kDMChampionAttributeStatistics | kDMChampionAttributeNameTitle); setFlag(champion->_attributes, kDMAttributeViewport | kDMAttributeStatusBox | kDMAttributePanel | kDMAttributeLoad | kDMAttributeStatistics | kDMAttributeNameTitle);
_vm->_championMan->drawChampionState(championIndex); _vm->_championMan->drawChampionState(championIndex);
_vm->_eventMan->_mousePointerBitmapUpdated = true; _vm->_eventMan->_mousePointerBitmapUpdated = true;
_vm->_eventMan->hideMouse(); _vm->_eventMan->hideMouse();
@ -515,7 +515,7 @@ void InventoryMan::drawPanelObject(Thing thingToDraw, bool pressingEye) {
descString = str; descString = str;
} else if ((thingType == k8_PotionThingType) } else if ((thingType == k8_PotionThingType)
&& (iconIndex != kDMIconIndicePotionWaterFlask) && (iconIndex != kDMIconIndicePotionWaterFlask)
&& (champMan.getSkillLevel((ChampionIndex)_vm->ordinalToIndex(_inventoryChampionOrdinal), k2_ChampionSkillPriest) > 1)) { && (champMan.getSkillLevel((ChampionIndex)_vm->ordinalToIndex(_inventoryChampionOrdinal), kDMSkillPriest) > 1)) {
str = ('_' + ((Potion *)rawThingPtr)->getPower() / 40); str = ('_' + ((Potion *)rawThingPtr)->getPower() / 40);
str += " "; str += " ";
str += objMan._objectNames[iconIndex]; str += objMan._objectNames[iconIndex];
@ -802,7 +802,7 @@ void InventoryMan::drawChampionSkillsAndStatistics() {
Champion *curChampion = &_vm->_championMan->_champions[championIndex]; Champion *curChampion = &_vm->_championMan->_champions[championIndex];
_vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k20_PanelEmptyIndice), _boxPanel, k72_byteWidth, k8_ColorRed, 73); _vm->_displayMan->blitToViewport(_vm->_displayMan->getNativeBitmapOrGraphic(k20_PanelEmptyIndice), _boxPanel, k72_byteWidth, k8_ColorRed, 73);
int16 textPosY = 58; int16 textPosY = 58;
for (uint16 idx = k0_ChampionSkillFighter; idx <= k3_ChampionSkillWizard; idx++) { for (uint16 idx = kDMSkillFighter; idx <= kDMSkillWizard; idx++) {
int16 skillLevel = MIN((uint16)16, _vm->_championMan->getSkillLevel(championIndex, idx | kDMIgnoreTemporaryExperience)); int16 skillLevel = MIN((uint16)16, _vm->_championMan->getSkillLevel(championIndex, idx | kDMIgnoreTemporaryExperience));
if (skillLevel == 1) if (skillLevel == 1)
continue; continue;
@ -822,10 +822,10 @@ void InventoryMan::drawChampionSkillsAndStatistics() {
textPosY += 7; textPosY += 7;
} }
textPosY = 86; textPosY = 86;
for (uint16 idx = kDMChampionStatStrength; idx <= kDMChampionStatAntifire; idx++) { for (uint16 idx = kDMStatStrength; idx <= kDMStatAntifire; idx++) {
_vm->_textMan->printToViewport(108, textPosY, k13_ColorLightestGray, statisticNames[idx]); _vm->_textMan->printToViewport(108, textPosY, k13_ColorLightestGray, statisticNames[idx]);
int16 statisticCurrentValue = curChampion->_statistics[idx][kDMChampionStatCurrent]; int16 statisticCurrentValue = curChampion->_statistics[idx][kDMStatCurrent];
uint16 statisticMaximumValue = curChampion->_statistics[idx][kDMChampionStatMaximum]; uint16 statisticMaximumValue = curChampion->_statistics[idx][kDMStatMaximum];
int16 statisticColor; int16 statisticColor;
if (statisticCurrentValue < statisticMaximumValue) if (statisticCurrentValue < statisticMaximumValue)
statisticColor = k8_ColorRed; statisticColor = k8_ColorRed;
@ -932,16 +932,16 @@ void InventoryMan::clickOnMouth() {
switch (((Potion *)junkData)->getType()) { switch (((Potion *)junkData)->getType()) {
case k6_PotionTypeRos: case k6_PotionTypeRos:
adjustStatisticCurrentValue(curChampion, kDMChampionStatDexterity, adjustedPotionPower); adjustStatisticCurrentValue(curChampion, kDMStatDexterity, adjustedPotionPower);
break; break;
case k7_PotionTypeKu: case k7_PotionTypeKu:
adjustStatisticCurrentValue(curChampion, kDMChampionStatStrength, (((Potion *)junkData)->getPower() / 35) + 5); /* Value between 5 and 12 */ adjustStatisticCurrentValue(curChampion, kDMStatStrength, (((Potion *)junkData)->getPower() / 35) + 5); /* Value between 5 and 12 */
break; break;
case k8_PotionTypeDane: case k8_PotionTypeDane:
adjustStatisticCurrentValue(curChampion, kDMChampionStatWisdom, adjustedPotionPower); adjustStatisticCurrentValue(curChampion, kDMStatWisdom, adjustedPotionPower);
break; break;
case k9_PotionTypeNeta: case k9_PotionTypeNeta:
adjustStatisticCurrentValue(curChampion, kDMChampionStatVitality, adjustedPotionPower); adjustStatisticCurrentValue(curChampion, kDMStatVitality, adjustedPotionPower);
break; break;
case k10_PotionTypeAntivenin: case k10_PotionTypeAntivenin:
_vm->_championMan->unpoison(championIndex); _vm->_championMan->unpoison(championIndex);
@ -961,7 +961,7 @@ void InventoryMan::clickOnMouth() {
newEvent._priority = championIndex; newEvent._priority = championIndex;
newEvent._B._defense = adjustedPotionPower; newEvent._B._defense = adjustedPotionPower;
_vm->_timeline->addEventGetEventIndex(&newEvent); _vm->_timeline->addEventGetEventIndex(&newEvent);
setFlag(curChampion->_attributes, kDMChampionAttributeStatusBox); setFlag(curChampion->_attributes, kDMAttributeStatusBox);
} }
break; break;
case k13_PotionTypeEe: { case k13_PotionTypeEe: {
@ -985,7 +985,7 @@ void InventoryMan::clickOnMouth() {
healWoundIterationCount = 1; healWoundIterationCount = 1;
} while ((wounds == curChampion->_wounds) && --counter); /* Loop until at least one wound is healed or there are no more heal iterations */ } while ((wounds == curChampion->_wounds) && --counter); /* Loop until at least one wound is healed or there are no more heal iterations */
} }
setFlag(curChampion->_attributes, kDMChampionAttributeLoad | kDMChampionAttributeWounds); setFlag(curChampion->_attributes, kDMAttributeLoad | kDMAttributeWounds);
} }
break; break;
case k15_PotionTypeWaterFlask: case k15_PotionTypeWaterFlask:
@ -1015,13 +1015,13 @@ void InventoryMan::clickOnMouth() {
} else { } else {
_vm->_championMan->drawChangedObjectIcons(); _vm->_championMan->drawChangedObjectIcons();
_vm->_championMan->_champions[_vm->_championMan->_leaderIndex]._load += _vm->_dungeonMan->getObjectWeight(handThing) - handThingWeight; _vm->_championMan->_champions[_vm->_championMan->_leaderIndex]._load += _vm->_dungeonMan->getObjectWeight(handThing) - handThingWeight;
setFlag(_vm->_championMan->_champions[_vm->_championMan->_leaderIndex]._attributes, kDMChampionAttributeLoad); setFlag(_vm->_championMan->_champions[_vm->_championMan->_leaderIndex]._attributes, kDMAttributeLoad);
} }
_vm->_sound->requestPlay(k08_soundSWALLOW, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, k0_soundModePlayImmediately); _vm->_sound->requestPlay(k08_soundSWALLOW, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, k0_soundModePlayImmediately);
setFlag(curChampion->_attributes, kDMChampionAttributeStatistics); setFlag(curChampion->_attributes, kDMAttributeStatistics);
if (_panelContent == k0_PanelContentFoodWaterPoisoned) if (_panelContent == k0_PanelContentFoodWaterPoisoned)
setFlag(curChampion->_attributes, kDMChampionAttributePanel); setFlag(curChampion->_attributes, kDMAttributePanel);
_vm->_championMan->drawChampionState((ChampionIndex)championIndex); _vm->_championMan->drawChampionState((ChampionIndex)championIndex);
_vm->_eventMan->hideMouse(); _vm->_eventMan->hideMouse();
@ -1030,7 +1030,7 @@ void InventoryMan::clickOnMouth() {
void InventoryMan::adjustStatisticCurrentValue(Champion *champ, uint16 statIndex, int16 valueDelta) { void InventoryMan::adjustStatisticCurrentValue(Champion *champ, uint16 statIndex, int16 valueDelta) {
int16 delta; int16 delta;
if (valueDelta >= 0) { if (valueDelta >= 0) {
int16 currentValue = champ->_statistics[statIndex][kDMChampionStatCurrent]; int16 currentValue = champ->_statistics[statIndex][kDMStatCurrent];
if (currentValue > 120) { if (currentValue > 120) {
valueDelta >>= 1; valueDelta >>= 1;
if (currentValue > 150) { if (currentValue > 150) {
@ -1040,9 +1040,9 @@ void InventoryMan::adjustStatisticCurrentValue(Champion *champ, uint16 statIndex
} }
delta = MIN(valueDelta, (int16)(170 - currentValue)); delta = MIN(valueDelta, (int16)(170 - currentValue));
} else { /* BUG0_00 Useless code. The function is always called with valueDelta having a positive value */ } else { /* BUG0_00 Useless code. The function is always called with valueDelta having a positive value */
delta = MAX(valueDelta, int16(champ->_statistics[statIndex][kDMChampionStatMinimum] - champ->_statistics[statIndex][kDMChampionStatCurrent])); delta = MAX(valueDelta, int16(champ->_statistics[statIndex][kDMStatMinimum] - champ->_statistics[statIndex][kDMStatCurrent]));
} }
champ->_statistics[statIndex][kDMChampionStatCurrent] += delta; champ->_statistics[statIndex][kDMStatCurrent] += delta;
} }
void InventoryMan::clickOnEye() { void InventoryMan::clickOnEye() {

View File

@ -175,7 +175,7 @@ void MenuMan::clearActingChampion() {
ChampionMan &cm = *_vm->_championMan; ChampionMan &cm = *_vm->_championMan;
if (cm._actingChampionOrdinal) { if (cm._actingChampionOrdinal) {
cm._actingChampionOrdinal--; cm._actingChampionOrdinal--;
cm._champions[cm._actingChampionOrdinal].setAttributeFlag(kDMChampionAttributeActionHand, true); cm._champions[cm._actingChampionOrdinal].setAttributeFlag(kDMAttributeActionHand, true);
cm.drawChampionState((ChampionIndex)cm._actingChampionOrdinal); cm.drawChampionState((ChampionIndex)cm._actingChampionOrdinal);
cm._actingChampionOrdinal = _vm->indexToOrdinal(kDMChampionNone); cm._actingChampionOrdinal = _vm->indexToOrdinal(kDMChampionNone);
_refreshActionArea = true; _refreshActionArea = true;
@ -221,7 +221,7 @@ T0386006:
box2._y1 = 95; box2._y1 = 95;
box2._y2 = 110; box2._y2 = 110;
dm.blitToScreen(bitmapIcon, &box2, k8_byteWidth, kM1_ColorNoTransparency, 16); dm.blitToScreen(bitmapIcon, &box2, k8_byteWidth, kM1_ColorNoTransparency, 16);
if (champion.getAttributes(kDMChampionAttributeDisableAction) || _vm->_championMan->_candidateChampionOrdinal || _vm->_championMan->_partyIsSleeping) { if (champion.getAttributes(kDMAttributeDisableAction) || _vm->_championMan->_candidateChampionOrdinal || _vm->_championMan->_partyIsSleeping) {
_vm->_displayMan->shadeScreenBox(&box, k0_ColorBlack); _vm->_displayMan->shadeScreenBox(&box, k0_ColorBlack);
} }
} }
@ -268,7 +268,7 @@ void MenuMan::refreshActionAreaAndSetChampDirMaxDamageReceived() {
&& (champ->_dir != champ->_directionMaximumDamageReceived)) { && (champ->_dir != champ->_directionMaximumDamageReceived)) {
champ->_dir = (Direction)champ->_directionMaximumDamageReceived; champ->_dir = (Direction)champ->_directionMaximumDamageReceived;
champ->setAttributeFlag(kDMChampionAttributeIcon, true); champ->setAttributeFlag(kDMAttributeIcon, true);
champMan.drawChampionState((ChampionIndex)champIndex); champMan.drawChampionState((ChampionIndex)champIndex);
} }
champ->_maximumDamageReceived = 0; champ->_maximumDamageReceived = 0;
@ -288,7 +288,7 @@ void MenuMan::refreshActionAreaAndSetChampDirMaxDamageReceived() {
} }
} else { } else {
_actionAreaContainsIcons = false; _actionAreaContainsIcons = false;
champ->setAttributeFlag(kDMChampionAttributeActionHand, true); champ->setAttributeFlag(kDMAttributeActionHand, true);
champMan.drawChampionState((ChampionIndex)_vm->ordinalToIndex(champMan._actingChampionOrdinal)); champMan.drawChampionState((ChampionIndex)_vm->ordinalToIndex(champMan._actingChampionOrdinal));
drawActionArea(); drawActionArea();
} }
@ -540,7 +540,7 @@ int16 MenuMan::getChampionSpellCastResult(uint16 champIndex) {
if (skillLevel < requiredSkillLevel) { if (skillLevel < requiredSkillLevel) {
int16 missingSkillLevelCount = requiredSkillLevel - skillLevel; int16 missingSkillLevelCount = requiredSkillLevel - skillLevel;
while (missingSkillLevelCount--) { while (missingSkillLevelCount--) {
if (_vm->getRandomNumber(128) > MIN(curChampion->_statistics[kDMChampionStatWisdom][kDMChampionStatCurrent] + 15, 115)) { if (_vm->getRandomNumber(128) > MIN(curChampion->_statistics[kDMStatWisdom][kDMStatCurrent] + 15, 115)) {
_vm->_championMan->addSkillExperience(champIndex, curSpell->_skillIndex, experience >> (requiredSkillLevel - skillLevel)); _vm->_championMan->addSkillExperience(champIndex, curSpell->_skillIndex, experience >> (requiredSkillLevel - skillLevel));
menusPrintSpellFailureMessage(curChampion, k0_failureNeedsMorePractice, curSpell->_skillIndex); menusPrintSpellFailureMessage(curChampion, k0_failureNeedsMorePractice, curSpell->_skillIndex);
return k0_spellCastFailure; return k0_spellCastFailure;
@ -561,7 +561,7 @@ int16 MenuMan::getChampionSpellCastResult(uint16 champIndex) {
curChampion->_load += _vm->_dungeonMan->getObjectWeight(newObject) - emptyFlaskWeight; curChampion->_load += _vm->_dungeonMan->getObjectWeight(newObject) - emptyFlaskWeight;
_vm->_championMan->drawChangedObjectIcons(); _vm->_championMan->drawChangedObjectIcons();
if (_vm->_inventoryMan->_inventoryChampionOrdinal == _vm->indexToOrdinal(champIndex)) { if (_vm->_inventoryMan->_inventoryChampionOrdinal == _vm->indexToOrdinal(champIndex)) {
setFlag(curChampion->_attributes, kDMChampionAttributeLoad); setFlag(curChampion->_attributes, kDMAttributeLoad);
_vm->_championMan->drawChampionState((ChampionIndex)champIndex); _vm->_championMan->drawChampionState((ChampionIndex)champIndex);
} }
} }
@ -569,7 +569,7 @@ int16 MenuMan::getChampionSpellCastResult(uint16 champIndex) {
case k2_spellKindProjectile: case k2_spellKindProjectile:
if (curChampion->_dir != _vm->_dungeonMan->_partyDir) { if (curChampion->_dir != _vm->_dungeonMan->_partyDir) {
curChampion->_dir = _vm->_dungeonMan->_partyDir; curChampion->_dir = _vm->_dungeonMan->_partyDir;
setFlag(curChampion->_attributes, kDMChampionAttributeIcon); setFlag(curChampion->_attributes, kDMAttributeIcon);
_vm->_championMan->drawChampionState((ChampionIndex)champIndex); _vm->_championMan->drawChampionState((ChampionIndex)champIndex);
} }
if (curSpell->getType() == k4_spellType_projectileOpenDoor) if (curSpell->getType() == k4_spellType_projectileOpenDoor)
@ -744,7 +744,7 @@ void MenuMan::menusPrintSpellFailureMessage(Champion *champ, uint16 failureType,
const char *messagesFR[5] = {" DOIT PRATIQUER DAVANTAGE SON ", "ENVOUTEMENT.", " MARMONNE UNE CONJURATION IMCOMPREHENSIBLE.", const char *messagesFR[5] = {" DOIT PRATIQUER DAVANTAGE SON ", "ENVOUTEMENT.", " MARMONNE UNE CONJURATION IMCOMPREHENSIBLE.",
" DOIT AVOIR UN FLACON VIDE EN MAIN POUR LA POTION.", "EXORCISME."}; " DOIT AVOIR UN FLACON VIDE EN MAIN POUR LA POTION.", "EXORCISME."};
if (skillIndex > k3_ChampionSkillWizard) if (skillIndex > kDMSkillWizard)
skillIndex = (skillIndex - 4) / 4; skillIndex = (skillIndex - 4) / 4;
_vm->_textMan->printLineFeed(); _vm->_textMan->printLineFeed();
@ -768,7 +768,7 @@ void MenuMan::menusPrintSpellFailureMessage(Champion *champ, uint16 failureType,
case k0_failureNeedsMorePractice: case k0_failureNeedsMorePractice:
_vm->_textMan->printMessage(k4_ColorCyan, messages[0]); _vm->_textMan->printMessage(k4_ColorCyan, messages[0]);
_vm->_textMan->printMessage(k4_ColorCyan, _vm->_championMan->_baseSkillName[skillIndex]); _vm->_textMan->printMessage(k4_ColorCyan, _vm->_championMan->_baseSkillName[skillIndex]);
if (_vm->getGameLanguage() != Common::FR_FRA || skillIndex == k3_ChampionSkillWizard) if (_vm->getGameLanguage() != Common::FR_FRA || skillIndex == kDMSkillWizard)
message = messages[1]; message = messages[1];
else else
message = messages[4]; message = messages[4];
@ -889,7 +889,7 @@ void MenuMan::addChampionSymbol(int16 symbolIndex) {
if (manaCost <= casterChampion->_currMana) { if (manaCost <= casterChampion->_currMana) {
casterChampion->_currMana -= manaCost; casterChampion->_currMana -= manaCost;
setFlag(casterChampion->_attributes, kDMChampionAttributeStatistics); setFlag(casterChampion->_attributes, kDMAttributeStatistics);
casterChampion->_symbols[symbolStep] = 96 + (symbolStep * 6) + symbolIndex; casterChampion->_symbols[symbolStep] = 96 + (symbolStep * 6) + symbolIndex;
casterChampion->_symbols[symbolStep + 1] = '\0'; casterChampion->_symbols[symbolStep + 1] = '\0';
casterChampion->_symbolStep = symbolStep = returnNextVal(symbolStep); casterChampion->_symbolStep = symbolStep = returnNextVal(symbolStep);
@ -932,7 +932,7 @@ bool MenuMan::didClickTriggerAction(int16 actionListIndex) {
if (_actionDisabledTicks[actionIndex]) if (_actionDisabledTicks[actionIndex])
curChampion->_actionDefense += _vm->_timeline->_actionDefense[actionIndex]; curChampion->_actionDefense += _vm->_timeline->_actionDefense[actionIndex];
setFlag(curChampion->_attributes, kDMChampionAttributeStatistics); setFlag(curChampion->_attributes, kDMAttributeStatistics);
retVal = isActionPerformed(championIndex, actionIndex); retVal = isActionPerformed(championIndex, actionIndex);
curChampion->_actionIndex = (ChampionAction)actionIndex; curChampion->_actionIndex = (ChampionAction)actionIndex;
} }
@ -1055,7 +1055,7 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) {
uint16 targetSquare = _vm->_dungeonMan->getSquare(nextMapX, nextMapY).toByte(); uint16 targetSquare = _vm->_dungeonMan->getSquare(nextMapX, nextMapY).toByte();
int16 requiredManaAmount = 0; int16 requiredManaAmount = 0;
if (((actionSkillIndex >= k16_ChampionSkillFire) && (actionSkillIndex <= k19_ChampionSkillWater)) || (actionSkillIndex == k3_ChampionSkillWizard)) if (((actionSkillIndex >= kDMSkillFire) && (actionSkillIndex <= kDMSkillWater)) || (actionSkillIndex == kDMSkillWizard))
requiredManaAmount = 7 - MIN<uint16>(6, _vm->_championMan->getSkillLevel(champIndex, actionSkillIndex)); requiredManaAmount = 7 - MIN<uint16>(6, _vm->_championMan->getSkillLevel(champIndex, actionSkillIndex));
bool setDirectionFl = false; bool setDirectionFl = false;
@ -1160,7 +1160,7 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) {
setChampionDirectionToPartyDirection(curChampion); setChampionDirectionToPartyDirection(curChampion);
Thing removedObject = _vm->_championMan->getObjectRemovedFromSlot(champIndex, k0_ChampionSlotReadyHand); Thing removedObject = _vm->_championMan->getObjectRemovedFromSlot(champIndex, k0_ChampionSlotReadyHand);
_vm->_sound->requestPlay(k16_soundCOMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, k1_soundModePlayIfPrioritized); _vm->_sound->requestPlay(k16_soundCOMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, k1_soundModePlayIfPrioritized);
_vm->_championMan->championShootProjectile(curChampion, removedObject, weaponInfoActionHand->_kineticEnergy + weaponInfoReadyHand->_kineticEnergy, (weaponInfoActionHand->getShootAttack() + _vm->_championMan->getSkillLevel(champIndex, k11_ChampionSkillShoot)) << 1, stepEnergy); _vm->_championMan->championShootProjectile(curChampion, removedObject, weaponInfoActionHand->_kineticEnergy + weaponInfoReadyHand->_kineticEnergy, (weaponInfoActionHand->getShootAttack() + _vm->_championMan->getSkillLevel(champIndex, kDMSkillShoot)) << 1, stepEnergy);
} }
break; break;
case k5_ChampionActionFlip: { case k5_ChampionActionFlip: {
@ -1234,7 +1234,7 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) {
Experience gain is 2 + 2 * heal cycle count */ Experience gain is 2 + 2 * heal cycle count */
int16 missingHealth = curChampion->_maxHealth - curChampion->_currHealth; int16 missingHealth = curChampion->_maxHealth - curChampion->_currHealth;
if ((missingHealth > 0) && curChampion->_currMana) { if ((missingHealth > 0) && curChampion->_currMana) {
int16 healingCapability = MIN((uint16)10, _vm->_championMan->getSkillLevel(champIndex, k13_ChampionSkillHeal)); int16 healingCapability = MIN((uint16)10, _vm->_championMan->getSkillLevel(champIndex, kDMSkillHeal));
actionExperienceGain = 2; actionExperienceGain = 2;
uint16 healingAmount; uint16 healingAmount;
do { do {
@ -1249,7 +1249,7 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) {
if (curChampion->_currMana < 0) if (curChampion->_currMana < 0)
curChampion->_currMana = 0; curChampion->_currMana = 0;
setFlag(curChampion->_attributes, kDMChampionAttributeStatistics); setFlag(curChampion->_attributes, kDMAttributeStatistics);
actionPerformed = true; actionPerformed = true;
} }
} }
@ -1340,7 +1340,7 @@ bool MenuMan::isActionPerformed(uint16 champIndex, int16 actionIndex) {
void MenuMan::setChampionDirectionToPartyDirection(Champion *champ) { void MenuMan::setChampionDirectionToPartyDirection(Champion *champ) {
if (champ->_dir != _vm->_dungeonMan->_partyDir) { if (champ->_dir != _vm->_dungeonMan->_partyDir) {
champ->_dir = _vm->_dungeonMan->_partyDir; champ->_dir = _vm->_dungeonMan->_partyDir;
setFlag(champ->_attributes, kDMChampionAttributeIcon); setFlag(champ->_attributes, kDMAttributeIcon);
} }
} }
@ -1528,7 +1528,7 @@ bool MenuMan::isGroupFrightenedByAction(int16 champIndex, uint16 actionIndex, in
experience = 45; experience = 45;
break; break;
} }
frightAmount += _vm->_championMan->getSkillLevel(champIndex, k14_ChampionSkillInfluence); frightAmount += _vm->_championMan->getSkillLevel(champIndex, kDMSkillInfluence);
Group *targetGroup = (Group *)_vm->_dungeonMan->getThingData(_actionTargetGroupThing); Group *targetGroup = (Group *)_vm->_dungeonMan->getThingData(_actionTargetGroupThing);
CreatureInfo *creatureInfo = &_vm->_dungeonMan->_creatureInfos[targetGroup->_type]; CreatureInfo *creatureInfo = &_vm->_dungeonMan->_creatureInfos[targetGroup->_type];
uint16 fearResistance = creatureInfo->getFearResistance(); uint16 fearResistance = creatureInfo->getFearResistance();
@ -1544,7 +1544,7 @@ bool MenuMan::isGroupFrightenedByAction(int16 champIndex, uint16 actionIndex, in
activeGroup->_delayFleeingFromTarget = ((16 - fearResistance) << 2) / creatureInfo->_movementTicks; activeGroup->_delayFleeingFromTarget = ((16 - fearResistance) << 2) / creatureInfo->_movementTicks;
isGroupFrightenedByAction = true; isGroupFrightenedByAction = true;
} }
_vm->_championMan->addSkillExperience(champIndex, k14_ChampionSkillInfluence, experience); _vm->_championMan->addSkillExperience(champIndex, kDMSkillInfluence, experience);
return isGroupFrightenedByAction; return isGroupFrightenedByAction;
} }
@ -1627,7 +1627,7 @@ void MenuMan::processCommands116To119_setActingChampion(uint16 champIndex) {
}; };
Champion *curChampion = &_vm->_championMan->_champions[champIndex]; Champion *curChampion = &_vm->_championMan->_champions[champIndex];
if (getFlag(curChampion->_attributes, kDMChampionAttributeDisableAction) || !curChampion->_currHealth) if (getFlag(curChampion->_attributes, kDMAttributeDisableAction) || !curChampion->_currHealth)
return; return;
uint16 actionSetIndex; uint16 actionSetIndex;
@ -1645,7 +1645,7 @@ void MenuMan::processCommands116To119_setActingChampion(uint16 champIndex) {
_vm->_championMan->_actingChampionOrdinal = _vm->indexToOrdinal(champIndex); _vm->_championMan->_actingChampionOrdinal = _vm->indexToOrdinal(champIndex);
setActionList(actionSet); setActionList(actionSet);
_actionAreaContainsIcons = false; _actionAreaContainsIcons = false;
setFlag(curChampion->_attributes, kDMChampionAttributeActionHand); setFlag(curChampion->_attributes, kDMAttributeActionHand);
_vm->_championMan->drawChampionState((ChampionIndex)champIndex); _vm->_championMan->drawChampionState((ChampionIndex)champIndex);
drawActionArea(); drawActionArea();
drawActionArea(); drawActionArea();

View File

@ -331,7 +331,7 @@ bool MovesensMan::getMoveResult(Thing thing, int16 mapX, int16 mapY, int16 destM
if (curChampion->_currHealth) if (curChampion->_currHealth)
_vm->_championMan->decrementStamina(championIdx, ((curChampion->_load * 25) / _vm->_championMan->getMaximumLoad(curChampion)) + 1); _vm->_championMan->decrementStamina(championIdx, ((curChampion->_load * 25) / _vm->_championMan->getMaximumLoad(curChampion)) + 1);
} }
} else if (_vm->_championMan->getDamagedChampionCount(20, kDMChampionWoundLegs | kDMChampionWoundFeet, k2_attackType_SELF)) } else if (_vm->_championMan->getDamagedChampionCount(20, kDMWoundLegs | kDMWoundFeet, k2_attackType_SELF))
_vm->_sound->requestPlay(k06_soundSCREAM, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, k0_soundModePlayImmediately); _vm->_sound->requestPlay(k06_soundSCREAM, _vm->_dungeonMan->_partyMapX, _vm->_dungeonMan->_partyMapY, k0_soundModePlayImmediately);
} }
_useRopeToClimbDownPit = false; _useRopeToClimbDownPit = false;
@ -927,7 +927,7 @@ void MovesensMan::triggerEffect(Sensor *sensor, int16 effect, int16 mapX, int16
void MovesensMan::triggerLocalEffect(int16 localEffect, int16 effX, int16 effY, int16 effCell) { void MovesensMan::triggerLocalEffect(int16 localEffect, int16 effX, int16 effY, int16 effCell) {
if (localEffect == k10_SensorEffAddExp) { if (localEffect == k10_SensorEffAddExp) {
addSkillExperience(k8_ChampionSkillSteal, 300, localEffect != kM1_CellAny); addSkillExperience(kDMSkillSteal, 300, localEffect != kM1_CellAny);
return; return;
} }
_sensorRotationEffect = localEffect; _sensorRotationEffect = localEffect;

View File

@ -195,7 +195,7 @@ bool ProjExpl::hasProjectileImpactOccurred(int16 impactType, int16 mapXCombo, in
break; break;
} }
if (championAttack && _projectilePoisonAttack && _vm->getRandomNumber(2) if (championAttack && _projectilePoisonAttack && _vm->getRandomNumber(2)
&& _vm->_championMan->addPendingDamageAndWounds_getDamage(championIndex, attack, kDMChampionWoundHead | kDMChampionWoundTorso, _projectileAttackType)) && _vm->_championMan->addPendingDamageAndWounds_getDamage(championIndex, attack, kDMWoundHead | kDMWoundTorso, _projectileAttackType))
_vm->_championMan->championPoison(championIndex, _projectilePoisonAttack); _vm->_championMan->championPoison(championIndex, _projectilePoisonAttack);
if (createExplosionOnImpact || removePotion) { if (createExplosionOnImpact || removePotion) {
@ -325,7 +325,7 @@ void ProjExpl::createExplosion(Thing explThing, uint16 attack, uint16 mapXCombo,
attack += _vm->getRandomNumber(attack) + 1; attack += _vm->getRandomNumber(attack) + 1;
if ((explThing == Thing::_explFireBall) || (attack >>= 1)) { if ((explThing == Thing::_explFireBall) || (attack >>= 1)) {
if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (projectileMapX == _vm->_dungeonMan->_partyMapX) && (projectileMapY == _vm->_dungeonMan->_partyMapY)) { if ((_vm->_dungeonMan->_currMapIndex == _vm->_dungeonMan->_partyMapIndex) && (projectileMapX == _vm->_dungeonMan->_partyMapX) && (projectileMapY == _vm->_dungeonMan->_partyMapY)) {
int16 wounds = kDMChampionWoundReadHand | kDMChampionWoundActionHand | kDMChampionWoundHead | kDMChampionWoundTorso | kDMChampionWoundLegs | kDMChampionWoundFeet; int16 wounds = kDMWoundReadHand | kDMWoundActionHand | kDMWoundHead | kDMWoundTorso | kDMWoundLegs | kDMWoundFeet;
_vm->_championMan->getDamagedChampionCount(attack, wounds, k1_attackType_FIRE); _vm->_championMan->getDamagedChampionCount(attack, wounds, k1_attackType_FIRE);
} else { } else {
unusedThing = _vm->_groupMan->groupGetThing(projectileMapX, projectileMapY); unusedThing = _vm->_groupMan->groupGetThing(projectileMapX, projectileMapY);
@ -536,7 +536,7 @@ void ProjExpl::processEvent25(TimelineEvent *event) {
break; break;
case 0xFF87: case 0xFF87:
if (explosionOnPartySquare) if (explosionOnPartySquare)
_vm->_championMan->getDamagedChampionCount(attack, kDMChampionWoundNone, k0_attackType_NORMAL); _vm->_championMan->getDamagedChampionCount(attack, kDMWoundNone, k0_attackType_NORMAL);
else if ((groupThing != Thing::_endOfList) else if ((groupThing != Thing::_endOfList)
&& (attack = _vm->_groupMan->groupGetResistanceAdjustedPoisonAttack(creatureType, attack)) && (attack = _vm->_groupMan->groupGetResistanceAdjustedPoisonAttack(creatureType, attack))
&& (_vm->_groupMan->getDamageAllCreaturesOutcome(group, mapX, mapY, attack, true) != k2_outcomeKilledAllCreaturesInGroup) && (_vm->_groupMan->getDamageAllCreaturesOutcome(group, mapX, mapY, attack, true) != k2_outcomeKilledAllCreaturesInGroup)

View File

@ -333,7 +333,7 @@ void Timeline::processTimeline() {
break; break;
case k72_TMEventTypeChampionShield: case k72_TMEventTypeChampionShield:
_vm->_championMan->_champions[newEvent._priority]._shieldDefense -= newEvent._B._defense; _vm->_championMan->_champions[newEvent._priority]._shieldDefense -= newEvent._B._defense;
setFlag(_vm->_championMan->_champions[newEvent._priority]._attributes, kDMChampionAttributeStatusBox); setFlag(_vm->_championMan->_champions[newEvent._priority]._attributes, kDMAttributeStatusBox);
_vm->_championMan->drawChampionState((ChampionIndex)newEvent._priority); _vm->_championMan->drawChampionState((ChampionIndex)newEvent._priority);
break; break;
case k73_TMEventTypeThievesEye: case k73_TMEventTypeThievesEye:
@ -400,7 +400,7 @@ void Timeline::processEventDoorAnimation(TimelineEvent *event) {
// Strangerke // 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 // 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 // See BUG0_78
int16 wounds = kDMChampionWoundTorso | (verticalDoorFl ? kDMChampionWoundHead : kDMChampionWoundReadHand | kDMChampionWoundActionHand); int16 wounds = kDMWoundTorso | (verticalDoorFl ? kDMWoundHead : kDMWoundReadHand | kDMWoundActionHand);
if (_vm->_championMan->getDamagedChampionCount(5, wounds, k2_attackType_SELF)) if (_vm->_championMan->getDamagedChampionCount(5, wounds, k2_attackType_SELF))
_vm->_sound->requestPlay(k18_soundPARTY_DAMAGED, mapX, mapY, k1_soundModePlayIfPrioritized); _vm->_sound->requestPlay(k18_soundPARTY_DAMAGED, mapX, mapY, k1_soundModePlayIfPrioritized);
} }
@ -815,7 +815,7 @@ void Timeline::procesEventEnableGroupGenerator(TimelineEvent *event) {
void Timeline::processEventEnableChampionAction(uint16 champIndex) { void Timeline::processEventEnableChampionAction(uint16 champIndex) {
Champion *curChampion = &_vm->_championMan->_champions[champIndex]; Champion *curChampion = &_vm->_championMan->_champions[champIndex];
curChampion->_enableActionEventIndex = -1; curChampion->_enableActionEventIndex = -1;
clearFlag(curChampion->_attributes, kDMChampionAttributeDisableAction); clearFlag(curChampion->_attributes, kDMAttributeDisableAction);
if (curChampion->_actionIndex != k255_ChampionActionNone) { if (curChampion->_actionIndex != k255_ChampionActionNone) {
curChampion->_actionDefense -= _actionDefense[curChampion->_actionDefense]; curChampion->_actionDefense -= _actionDefense[curChampion->_actionDefense];
} }
@ -832,7 +832,7 @@ void Timeline::processEventEnableChampionAction(uint16 champIndex) {
} }
} }
} }
setFlag(curChampion->_attributes, kDMChampionAttributeActionHand); setFlag(curChampion->_attributes, kDMAttributeActionHand);
_vm->_championMan->drawChampionState((ChampionIndex)champIndex); _vm->_championMan->drawChampionState((ChampionIndex)champIndex);
} }
curChampion->_actionIndex = k255_ChampionActionNone; curChampion->_actionIndex = k255_ChampionActionNone;
@ -872,7 +872,7 @@ void Timeline::processEventHideDamageReceived(uint16 champIndex) {
_vm->_inventoryMan->drawStatusBoxPortrait((ChampionIndex)champIndex); _vm->_inventoryMan->drawStatusBoxPortrait((ChampionIndex)champIndex);
_vm->_eventMan->hideMouse(); _vm->_eventMan->hideMouse();
} else { } else {
setFlag(curChampion->_attributes, kDMChampionAttributeNameTitle); setFlag(curChampion->_attributes, kDMAttributeNameTitle);
_vm->_championMan->drawChampionState((ChampionIndex)champIndex); _vm->_championMan->drawChampionState((ChampionIndex)champIndex);
} }
} }
@ -905,7 +905,7 @@ void Timeline::processEventLight(TimelineEvent *event) {
void Timeline::refreshAllChampionStatusBoxes() { void Timeline::refreshAllChampionStatusBoxes() {
for (uint16 idx = kDMChampionFirst; idx < _vm->_championMan->_partyChampionCount; idx++) for (uint16 idx = kDMChampionFirst; idx < _vm->_championMan->_partyChampionCount; idx++)
setFlag(_vm->_championMan->_champions[idx]._attributes, kDMChampionAttributeStatusBox); setFlag(_vm->_championMan->_champions[idx]._attributes, kDMAttributeStatusBox);
_vm->_championMan->drawAllChampionStates(); _vm->_championMan->drawAllChampionStates();
} }