diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/xeen/dialogs_spells.cpp | 52 | ||||
-rw-r--r-- | engines/xeen/dialogs_spells.h | 11 | ||||
-rw-r--r-- | engines/xeen/resources.cpp | 13 | ||||
-rw-r--r-- | engines/xeen/resources.h | 6 | ||||
-rw-r--r-- | engines/xeen/spells.cpp | 11 | ||||
-rw-r--r-- | engines/xeen/xeen.cpp | 5 | ||||
-rw-r--r-- | engines/xeen/xeen.h | 2 |
7 files changed, 99 insertions, 1 deletions
diff --git a/engines/xeen/dialogs_spells.cpp b/engines/xeen/dialogs_spells.cpp index eb7373313e..f49dca66b1 100644 --- a/engines/xeen/dialogs_spells.cpp +++ b/engines/xeen/dialogs_spells.cpp @@ -973,4 +973,56 @@ int TownPortal::execute() { return townNumber; } +/*------------------------------------------------------------------------*/ + +void IdentifyMonster::show(XeenEngine *vm) { + IdentifyMonster *dlg = new IdentifyMonster(vm); + dlg->execute(); + delete dlg; +} + +void IdentifyMonster::execute() { + Combat &combat = *_vm->_combat; + EventsManager &events = *_vm->_events; + Interface &intf = *_vm->_interface; + Map &map = *_vm->_map; + Screen &screen = *_vm->_screen; + SoundManager &sound = *_vm->_sound; + Spells &spells = *_vm->_spells; + Window &w = screen._windows[17]; + Common::String monsterDesc[3]; + + for (int monIndex = 0; monIndex < 3; ++monIndex) { + if (combat._attackMonsters[monIndex] == -1) + continue; + + MazeMonster &monster = map._mobData._monsters[combat._attackMonsters[monIndex]]; + MonsterStruct &monsterData = *monster._monsterData; + + monsterDesc[monIndex] = Common::String::format(MONSTER_DETAILS, + monsterData._name.c_str(), + _vm->printK2(monster._hp).c_str(), + monsterData._accuracy, monsterData._numberOfAttacks, + MONSTER_SPECIAL_ATTACKS[monsterData._specialAttack] + ); + } + + sound.playFX(20); + w.open(); + w.writeString(Common::String::format(IDENTIFY_MONSTERS, + monsterDesc[0].c_str(), monsterDesc[1].c_str(), monsterDesc[2].c_str())); + w.update(); + + do { + events.updateGameCounter(); + intf.draw3d(false); + w.frame(); + screen._windows[3].update(); + + events.wait(1); + } while (!events.isKeyMousePressed()); + + w.close(); +} + } // End of namespace Xeen diff --git a/engines/xeen/dialogs_spells.h b/engines/xeen/dialogs_spells.h index 9f4af15636..35b2708f7a 100644 --- a/engines/xeen/dialogs_spells.h +++ b/engines/xeen/dialogs_spells.h @@ -146,6 +146,17 @@ public: static int show(XeenEngine *vm); }; +class IdentifyMonster : public ButtonContainer { +private: + XeenEngine *_vm; + + IdentifyMonster(XeenEngine *vm) : ButtonContainer(), _vm(vm) {} + + void execute(); +public: + static void show(XeenEngine *vm); +}; + } // End of namespace Xeen #endif /* XEEN_DIALOGS_SPELLS_H */ diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp index 085cfab58d..8bc99f6579 100644 --- a/engines/xeen/resources.cpp +++ b/engines/xeen/resources.cpp @@ -1572,4 +1572,17 @@ const int TOWN_MAP_NUMBERS[2][5] = { { 28, 29, 30, 31, 32 }, { 29, 31, 33, 35, 37 } }; +const char *const MONSTER_DETAILS = + "\x3l\n" + "%s\x3""c\t100%s\t140%u\t180%u\x3r\t000%s"; + +const char *const MONSTER_SPECIAL_ATTACKS[23] = { + "None", "Magic", "Fire", "Elec", "Cold", "Poison", "Energy", "Disease", + "Insane", "Asleep", "CurseItm", "InLove", "DrnSPts", "Curse", "Paralys", + "Uncons", "Confuse", "BrkWpn", "Weak", "Erad", "Age+5", "Dead", "Stone" +}; + +const char *const IDENTIFY_MONSTERS = + "Name\x3""c\t100HP\t140AC\t177#Atks\x3r\t000Special%s%s%s"; + } // End of namespace Xeen diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h index 29e86112a1..e15c509391 100644 --- a/engines/xeen/resources.h +++ b/engines/xeen/resources.h @@ -556,6 +556,12 @@ extern const char *const TOWN_PORTAL; extern const int TOWN_MAP_NUMBERS[2][5]; +extern const char *const MONSTER_DETAILS; + +extern const char *const MONSTER_SPECIAL_ATTACKS[23]; + +extern const char *const IDENTIFY_MONSTERS; + } // End of namespace Xeen #endif /* XEEN_RESOURCES_H */ diff --git a/engines/xeen/spells.cpp b/engines/xeen/spells.cpp index e2e8cfde36..ba4e78bfb9 100644 --- a/engines/xeen/spells.cpp +++ b/engines/xeen/spells.cpp @@ -711,7 +711,16 @@ void Spells::hypnotize() { combat.multiAttack(7); } -void Spells::identifyMonster() { error("TODO: spell"); } +void Spells::identifyMonster() { + Combat &combat = *_vm->_combat; + + if (combat._attackMonsters[0] == -1 && combat._attackMonsters[1] == -1 + && combat._attackMonsters[2] == -1) { + spellFailed(); + } else { + IdentifyMonster::show(_vm); + } +} void Spells::implosion() { Combat &combat = *_vm->_combat; diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index a1604a5eab..fb7edead00 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -350,4 +350,9 @@ Common::String XeenEngine::printK(uint value) { Common::String::format("%u", value); } +Common::String XeenEngine::printK2(uint value) { + return (value > 999) ? Common::String::format("%uk", value / 1000) : + Common::String::format("%u", value); +} + } // End of namespace Xeen diff --git a/engines/xeen/xeen.h b/engines/xeen/xeen.h index 2d995a1dd3..71859413aa 100644 --- a/engines/xeen/xeen.h +++ b/engines/xeen/xeen.h @@ -203,6 +203,8 @@ public: static Common::String printMil(uint value); static Common::String printK(uint value); + + static Common::String printK2(uint value); }; } // End of namespace Xeen |