aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/combat.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2015-02-25 19:42:29 -0500
committerPaul Gilbert2015-02-25 19:42:29 -0500
commitad33b8bb824803630bc37766da30047efa3f3f13 (patch)
tree60ee5da8fbf6b20ce98c75e9acdc9e0d82c3491e /engines/xeen/combat.cpp
parent0e1bd4951b4912ab4b555228d2da410da8ad4697 (diff)
downloadscummvm-rg350-ad33b8bb824803630bc37766da30047efa3f3f13.tar.gz
scummvm-rg350-ad33b8bb824803630bc37766da30047efa3f3f13.tar.bz2
scummvm-rg350-ad33b8bb824803630bc37766da30047efa3f3f13.zip
XEEN: Fixed display of attacking monster names
Diffstat (limited to 'engines/xeen/combat.cpp')
-rw-r--r--engines/xeen/combat.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp
index 69ffd7214a..df9ba9bb50 100644
--- a/engines/xeen/combat.cpp
+++ b/engines/xeen/combat.cpp
@@ -1073,11 +1073,8 @@ void Combat::setupCombatParty() {
void Combat::setSpeedTable() {
Map &map = *_vm->_map;
Common::Array<int> charSpeeds;
- bool flag = _whosSpeed != -1;
- int oldSpeed = (_whosSpeed == -1) ? 0 : _speedTable[_whosSpeed];
-
- Common::fill(&_speedTable[0], &_speedTable[12], -1);
- Common::fill(&charSpeeds[0], &charSpeeds[12], -1);
+ bool hasSpeed = _whosSpeed != -1 && _whosSpeed < _speedTable.size();
+ int oldSpeed = hasSpeed ? _speedTable[_whosSpeed] : 0;
// Set up speeds for party membres
int maxSpeed = 0;
@@ -1101,6 +1098,8 @@ void Combat::setSpeedTable() {
}
}
+ // Populate the _speedTable list with the character/monster indexes
+ // in order of attacking speed
_speedTable.clear();
for (; maxSpeed >= 0; --maxSpeed) {
for (uint idx = 0; idx < charSpeeds.size(); ++idx) {
@@ -1109,7 +1108,7 @@ void Combat::setSpeedTable() {
}
}
- if (flag) {
+ if (hasSpeed) {
if (_speedTable[_whosSpeed] != oldSpeed) {
for (uint idx = 0; idx < charSpeeds.size(); ++idx) {
if (oldSpeed == _speedTable[idx]) {
@@ -1164,10 +1163,12 @@ Common::String Combat::getMonsterDescriptions() {
if (_attackMonsters[idx] != -1) {
MazeMonster &monster = map._mobData._monsters[_attackMonsters[idx]];
MonsterStruct &monsterData = map._monsterData[monster._spriteId];
+ int textColor = monster.getTextColor();
Common::String format = "\n\v020\f%2u%s\fd";
format.setChar('2' + idx, 3);
- lines[idx] = Common::String::format(format.c_str(), monsterData._name.c_str());
+ lines[idx] = Common::String::format(format.c_str(), textColor,
+ monsterData._name.c_str());
}
}