diff options
-rw-r--r-- | engines/xeen/dialogs_spells.cpp | 17 | ||||
-rw-r--r-- | engines/xeen/dialogs_spells.h | 6 | ||||
-rw-r--r-- | engines/xeen/interface.cpp | 7 |
3 files changed, 17 insertions, 13 deletions
diff --git a/engines/xeen/dialogs_spells.cpp b/engines/xeen/dialogs_spells.cpp index ea423aac72..9a19ac2042 100644 --- a/engines/xeen/dialogs_spells.cpp +++ b/engines/xeen/dialogs_spells.cpp @@ -435,7 +435,7 @@ const char *SpellsDialog::setSpellText(Character *c, int isCasting) { /*------------------------------------------------------------------------*/ -int CastSpell::show(XeenEngine *vm, int mode) { +int CastSpell::show(XeenEngine *vm) { Combat &combat = *vm->_combat; Interface &intf = *vm->_interface; Party &party = *vm->_party; @@ -443,7 +443,7 @@ int CastSpell::show(XeenEngine *vm, int mode) { int charNum; // Get which character is doing the casting - if (mode == MODE_COMBAT) { + if (vm->_mode == MODE_COMBAT) { charNum = combat._whosTurn; } else if (spells._lastCaster >= 0 && spells._lastCaster < (int)party._activeParty.size()) { charNum = spells._lastCaster; @@ -460,21 +460,21 @@ int CastSpell::show(XeenEngine *vm, int mode) { intf.highlightChar(charNum); CastSpell *dlg = new CastSpell(vm); - int spellId = dlg->execute(c, mode); + int spellId = dlg->execute(c); delete dlg; return spellId; } -int CastSpell::show(XeenEngine *vm, Character *&c, int mode) { +int CastSpell::show(XeenEngine *vm, Character *&c) { CastSpell *dlg = new CastSpell(vm); - int spellId = dlg->execute(c, mode); + int spellId = dlg->execute(c); delete dlg; return spellId; } -int CastSpell::execute(Character *&c, int mode) { +int CastSpell::execute(Character *&c) { EventsManager &events = *_vm->_events; Interface &intf = *_vm->_interface; Party &party = *_vm->_party; @@ -482,7 +482,8 @@ int CastSpell::execute(Character *&c, int mode) { Spells &spells = *_vm->_spells; Window &w = screen._windows[10]; - Mode oldMode = (Mode)mode; + Mode oldMode = _vm->_mode; + _vm->_mode = MODE_3; w.open(); loadButtons(); @@ -503,7 +504,6 @@ int CastSpell::execute(Character *&c, int mode) { drawButtons(&screen); w.update(); - _vm->_mode = MODE_3; redrawFlag = false; } @@ -565,6 +565,7 @@ int CastSpell::execute(Character *&c, int mode) { if (_vm->shouldQuit()) spellId = -1; + _vm->_mode = oldMode; return spellId; } diff --git a/engines/xeen/dialogs_spells.h b/engines/xeen/dialogs_spells.h index 32d079023d..6a9e43f416 100644 --- a/engines/xeen/dialogs_spells.h +++ b/engines/xeen/dialogs_spells.h @@ -65,12 +65,12 @@ private: CastSpell(XeenEngine *vm) : ButtonContainer(), _vm(vm) {} - int execute(Character *&c, int mode); + int execute(Character *&c); void loadButtons(); public: - static int show(XeenEngine *vm, int mode); - static int show(XeenEngine *vm, Character *&c, int mode); + static int show(XeenEngine *vm); + static int show(XeenEngine *vm, Character *&c); }; } // End of namespace Xeen diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp index 6c65dd4f0b..076437add6 100644 --- a/engines/xeen/interface.cpp +++ b/engines/xeen/interface.cpp @@ -531,7 +531,7 @@ void Interface::perform() { spells._lastCaster >= (int)party._activeParty.size()) ? (int)party._activeParty.size() - 1 : spells._lastCaster]; do { - int spellId = CastSpell::show(_vm, c, _vm->_mode); + int spellId = CastSpell::show(_vm, c); if (spellId == -1 || c == nullptr) break; @@ -1975,10 +1975,13 @@ void Interface::doCombat() { case Common::KEYCODE_c: { // Cast spell - int spellId = CastSpell::show(_vm, _vm->_mode); + int spellId = CastSpell::show(_vm); if (spellId != -1) { Character *c = combat._combatParty[combat._whosTurn]; spells.castSpell(c, spellId); + nextChar(); + } else { + highlightChar(combat._combatParty[combat._whosTurn]->_rosterId); } break; } |