From ad33b8bb824803630bc37766da30047efa3f3f13 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 25 Feb 2015 19:42:29 -0500 Subject: XEEN: Fixed display of attacking monster names --- engines/xeen/combat.cpp | 15 ++++++++------- engines/xeen/map.cpp | 5 +++++ engines/xeen/map.h | 2 ++ engines/xeen/resources.cpp | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) (limited to 'engines/xeen') 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 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()); } } diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp index 10fba6d6b0..439d5a8251 100644 --- a/engines/xeen/map.cpp +++ b/engines/xeen/map.cpp @@ -662,6 +662,11 @@ MazeMonster::MazeMonster() { _attackSprites = nullptr; } +int MazeMonster::getTextColor() const { + warning("TODO: getTextColor"); + return 0; +} + /*------------------------------------------------------------------------*/ MazeWallItem::MazeWallItem() { diff --git a/engines/xeen/map.h b/engines/xeen/map.h index 7faf59fc04..85a1b8b5a5 100644 --- a/engines/xeen/map.h +++ b/engines/xeen/map.h @@ -255,6 +255,8 @@ struct MazeMonster { SpriteResource *_attackSprites; MazeMonster(); + + int getTextColor() const; }; class MazeWallItem { diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp index bcf408d893..2716f245b3 100644 --- a/engines/xeen/resources.cpp +++ b/engines/xeen/resources.cpp @@ -1489,7 +1489,7 @@ const int NEW_CHARACTER_SPELLS[10][4] = { { 20, 1, -1, -1 } }; -const char *const COMBAT_DETAILS = "\r\f00\x03c\v000\t000\x02Combat%s%s%s\x1"; +const char *const COMBAT_DETAILS = "\r\f00\x3""c\v000\t000\x2""Combat%s%s%s\x1"; const char *NOT_ENOUGH_TO_CAST = "\x03c\v010Not enough %s to Cast %s"; const char *SPELL_CAST_COMPONENTS[2] = { "Spell Points", "Gems" }; -- cgit v1.2.3