diff options
author | Paul Gilbert | 2018-01-27 15:10:11 -0500 |
---|---|---|
committer | Paul Gilbert | 2018-01-27 15:10:11 -0500 |
commit | c74700e2f7a85113fffc8ff5a4d7d2623d025740 (patch) | |
tree | 571914ac41cf29b3e0cb570824418c2803d79288 /engines | |
parent | 1b0ffaf31104e086ae4735447beab78f37626fd8 (diff) | |
download | scummvm-rg350-c74700e2f7a85113fffc8ff5a4d7d2623d025740.tar.gz scummvm-rg350-c74700e2f7a85113fffc8ff5a4d7d2623d025740.tar.bz2 scummvm-rg350-c74700e2f7a85113fffc8ff5a4d7d2623d025740.zip |
XEEN: Fix giving entire party damage in giveCharDamage
Diffstat (limited to 'engines')
-rw-r--r-- | engines/xeen/combat.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp index 8900d13e9e..32fa59297b 100644 --- a/engines/xeen/combat.cpp +++ b/engines/xeen/combat.cpp @@ -140,6 +140,7 @@ void Combat::clearShooting() { } void Combat::giveCharDamage(int damage, DamageType attackType, int charIndex) { + EventsManager &events = *_vm->_events; Interface &intf = *_vm->_interface; Party &party = *_vm->_party; Scripts &scripts = *_vm->_scripts; @@ -153,7 +154,7 @@ void Combat::giveCharDamage(int damage, DamageType attackType, int charIndex) { windows.closeAll(); int idx = (int)party._activeParty.size(); - if (!scripts._v2) { + if (scripts._v2 == 2) { for (idx = 0; idx < (int)party._activeParty.size(); ++idx) { Character &c = party._activeParty[idx]; Condition condition = c.worstCondition(); @@ -163,22 +164,21 @@ void Combat::giveCharDamage(int damage, DamageType attackType, int charIndex) { selectedIndex1 = idx + 1; } else { selectedIndex2 = idx + 1; + --selectedIndex1; break; } } } } if (idx == (int)party._activeParty.size()) { - selectedIndex1 = scripts._v2 ? charIndex : 0; - goto loop; + if (!scripts._v2) + selectedIndex1 = 0; } for (;;) { - // The if below is to get around errors due to the - // goto I was forced to use when reimplementing this method - if (true) { + for (; selectedIndex1 < (scripts._v2 ? charIndex1 : (int)party._activeParty.size()); ++selectedIndex1) { Character &c = party._activeParty[selectedIndex1]; - c._conditions[ASLEEP] = 0; // Force character to be awake + c._conditions[ASLEEP] = 0; // Force attacked character to be awake int frame = 0, fx = 0; switch (attackType) { @@ -249,12 +249,7 @@ void Combat::giveCharDamage(int damage, DamageType attackType, int charIndex) { // Subtract the hit points from the character c.subtractHitPoints(damage); - } - - if (selectedIndex2) { - ++selectedIndex1; -loop: - if ((scripts._v2 ? charIndex1 : (int)party._activeParty.size()) > selectedIndex1) + if (selectedIndex2) break; } @@ -265,6 +260,10 @@ loop: selectedIndex1 = selectedIndex2 - 1; breakFlag = true; } + + events.ipause(5); + intf.drawParty(true); + party.checkPartyDead(); } void Combat::doCharDamage(Character &c, int charNum, int monsterDataIndex) { |