aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2015-02-19 08:26:55 -0500
committerPaul Gilbert2015-02-19 08:26:55 -0500
commit7c3f373b9b935b71b3006f203a1f75442818673a (patch)
tree0441639bfd267b49bdc6892d9322c3d96f5bfc33
parente17d258217f8605d7722927cd0180b59f87717a5 (diff)
downloadscummvm-rg350-7c3f373b9b935b71b3006f203a1f75442818673a.tar.gz
scummvm-rg350-7c3f373b9b935b71b3006f203a1f75442818673a.tar.bz2
scummvm-rg350-7c3f373b9b935b71b3006f203a1f75442818673a.zip
XEEN: Fix selecting spells to cast in spells dialog
-rw-r--r--engines/xeen/dialogs_spells.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/engines/xeen/dialogs_spells.cpp b/engines/xeen/dialogs_spells.cpp
index 5084843319..0383886c4d 100644
--- a/engines/xeen/dialogs_spells.cpp
+++ b/engines/xeen/dialogs_spells.cpp
@@ -93,6 +93,8 @@ Character *SpellsDialog::execute(ButtonContainer *priorDialog, Character *c, int
}
}
+ if (selection >= topIndex && selection < (topIndex + 10))
+ colors[selection - topIndex] = 15;
if (_spells.size() == 0)
names[0] = errorMsg;
@@ -225,10 +227,9 @@ Character *SpellsDialog::execute(ButtonContainer *priorDialog, Character *c, int
int spellIndex = _spells[newSelection]._spellIndex;
int spellCost = spells.calcSpellCost(spellId, expenseFactor);
if (isCasting) {
- // TODO: Confirm this refactoring against against original
- selection = _buttonValue;
+ selection = newSelection;
} else {
- Common::String spellName = _spells[_buttonValue]._name;
+ Common::String spellName = _spells[newSelection]._name;
Common::String msg = (castingCopy & 0x80) ?
Common::String::format(SPELLS_PRESS_A_KEY, msg.c_str()) :
Common::String::format(SPELLS_PURCHASE, msg.c_str(), spellCost);
@@ -273,6 +274,9 @@ Character *SpellsDialog::execute(ButtonContainer *priorDialog, Character *c, int
} while (!_vm->shouldQuit() && _buttonValue != Common::KEYCODE_ESCAPE);
screen._windows[25].close();
+
+ if (_vm->shouldQuit())
+ selection = -1;
if (isCasting && selection != -1)
c->_currentSpell = _spells[selection]._spellIndex;
@@ -479,7 +483,6 @@ int CastSpell::execute(Character *&c, int mode) {
Window &w = screen._windows[10];
Mode oldMode = (Mode)mode;
- int category = c->getClassCategory();
w.open();
loadButtons();
@@ -488,6 +491,7 @@ int CastSpell::execute(Character *&c, int mode) {
bool redrawFlag = true;
do {
if (redrawFlag) {
+ int category = c->getClassCategory();
int spellIndex = c->_currentSpell != -1 ? c->_currentSpell : 39;
spellId = SPELLS_ALLOWED[category][spellIndex];
int gemCost = SPELL_GEM_COST[spellId];