diff options
author | Paul Gilbert | 2015-02-26 08:10:01 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-02-26 08:10:01 -0500 |
commit | 68e30b2967797537a951c5126b89fdb905138cb6 (patch) | |
tree | f81357fa3c62ace480b390b2a1dd1ebe1f01ab1f /engines/xeen | |
parent | 4191335dfabc0baff9459a61e5453dad6270582f (diff) | |
download | scummvm-rg350-68e30b2967797537a951c5126b89fdb905138cb6.tar.gz scummvm-rg350-68e30b2967797537a951c5126b89fdb905138cb6.tar.bz2 scummvm-rg350-68e30b2967797537a951c5126b89fdb905138cb6.zip |
XEEN: Fix monster/party taking turns in combat
Diffstat (limited to 'engines/xeen')
-rw-r--r-- | engines/xeen/combat.cpp | 65 | ||||
-rw-r--r-- | engines/xeen/interface.cpp | 4 |
2 files changed, 35 insertions, 34 deletions
diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp index 1aa41fb52b..4e32d431a8 100644 --- a/engines/xeen/combat.cpp +++ b/engines/xeen/combat.cpp @@ -777,41 +777,40 @@ void Combat::doMonsterTurn(int monsterId) { SoundManager &sound = *_vm->_sound; if (_monstersAttacking) { - warning("TODO: Original used uninitialized variables if flag was set"); - return; - } + int monsterIndex; + switch (_whosTurn - _combatParty.size()) { + case 0: + monsterIndex = _attackMonsters[0]; + intf._indoorList[156]._scale = 0; + break; + case 1: + monsterIndex = _attackMonsters[1]; + intf._indoorList[150]._scale = 0; + break; + case 2: + default: + monsterIndex = _attackMonsters[2]; + intf._indoorList[153]._scale = 0; + } - int monsterIndex; - switch (_whosTurn - _combatParty.size()) { - case 0: - monsterIndex = _attackMonsters[0]; - intf._indoorList[156]._scale = 0; - break; - case 1: - monsterIndex = _attackMonsters[1]; - intf._indoorList[150]._scale = 0; - break; - case 2: - default: - monsterIndex = _attackMonsters[2]; - intf._indoorList[153]._scale = 0; - } + MazeMonster &monster = map._mobData._monsters[monsterIndex]; + MonsterStruct &monsterData = *monster._monsterData; + if (monster._damageType) + return; - MazeMonster &monster = map._mobData._monsters[monsterIndex]; - MonsterStruct &monsterData = *monster._monsterData; - if (monster._damageType) - return; + monster._frame = 8; + monster._fieldA = 3; + monster._field9 = 0; + intf.draw3d(true); + intf.draw3d(true); - monster._frame = 8; - monster._fieldA = 3; - monster._field9 = 0; - intf.draw3d(true); - intf.draw3d(true); + File f(Common::String::format("%s.voc", monsterData._attackVoc.c_str())); + sound.playSample(&f, 0); + monsterId = monster._spriteId; + } - File f(Common::String::format("%s.voc", monsterData._attackVoc.c_str())); - sound.playSample(&f, 0); + MonsterStruct &monsterData = map._monsterData[monsterId]; bool flag = false; - for (int attackNum = 0; attackNum < monsterData._numberOfAttacks; ++attackNum) { int charNum = -1; bool isHated = false; @@ -918,14 +917,14 @@ void Combat::doMonsterTurn(int monsterId) { if (true) { Character &c = *_combatParty[charNum]; if (monsterData._attackType != DT_PHYSICAL || c._conditions[ASLEEP]) { - doCharDamage(c, charNum, monster._spriteId); + doCharDamage(c, charNum, monsterId); } else { int v = _vm->getRandomNumber(1, 20); if (v == 1) { sound.playFX(6); } else { if (v == 20) - doCharDamage(c, charNum, monster._spriteId); + doCharDamage(c, charNum, monsterId); v += monsterData._hitChance / 4 + _vm->getRandomNumber(1, monsterData._hitChance); @@ -934,7 +933,7 @@ void Combat::doMonsterTurn(int monsterId) { if (ac > v) { sound.playFX(6); } else { - doCharDamage(c, charNum, monster._spriteId); + doCharDamage(c, charNum, monsterId); } } } diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp index c06ef79dc9..6c65dd4f0b 100644 --- a/engines/xeen/interface.cpp +++ b/engines/xeen/interface.cpp @@ -2192,7 +2192,9 @@ void Interface::nextChar() { } if (combat._whosTurn < (int)combat._combatParty.size()) { - if (!combat._combatParty[idx]->isDisabledOrDead()) + // If it's a party member, only allow them to become active if + // they're still conscious + if (combat._combatParty[idx]->isDisabledOrDead()) continue; } |