diff options
Diffstat (limited to 'engines/xeen/interface.cpp')
-rw-r--r-- | engines/xeen/interface.cpp | 75 |
1 files changed, 33 insertions, 42 deletions
diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp index 8e52aae7ae..e986b9f2c1 100644 --- a/engines/xeen/interface.cpp +++ b/engines/xeen/interface.cpp @@ -262,7 +262,6 @@ void Interface::perform() { Party &party = *_vm->_party; Scripts &scripts = *_vm->_scripts; Sound &sound = *_vm->_sound; - const Common::Rect WAIT_BOUNDS(8, 8, 224, 140); do { // Draw the next frame @@ -276,10 +275,7 @@ void Interface::perform() { if (g_vm->shouldExit() || g_vm->isLoadPending() || party._dead) return; - if (events._leftButton && WAIT_BOUNDS.contains(events._mousePos)) - _buttonValue = Common::KEYCODE_SPACE; - else - checkEvents(g_vm); + checkEvents(g_vm); } while (!_buttonValue && events.timeElapsed() < 1); } while (!_buttonValue); @@ -516,21 +512,18 @@ void Interface::perform() { } break; - case Common::KEYCODE_c: { + case Common::KEYCODE_c: // Cast spell if (_tillMove) { combat.moveMonsters(); draw3d(true); } - int result = CastSpell::show(_vm); - - if (result == 1) { + if (CastSpell::show(_vm) != -1) { chargeStep(); doStepCode(); } break; - } case Common::KEYCODE_i: // Show Info dialog @@ -566,7 +559,7 @@ void Interface::perform() { if (combat._attackMonsters[0] != -1 || combat._attackMonsters[1] != -1 || combat._attackMonsters[2] != -1) { - if ((_vm->_mode == MODE_1 || _vm->_mode == MODE_SLEEPING) + if ((_vm->_mode == MODE_INTERACTIVE || _vm->_mode == MODE_SLEEPING) && !combat._monstersAttacking && !_charsShooting) { doCombat(); } @@ -772,8 +765,8 @@ void Interface::startFalling(bool flag) { break; } } else { - if (party._mazeId > 89 && party._mazeId < 113) { - party._mazeId += 168; + if (party._mazeId > 88 && party._mazeId < 114) { + party._mazeId -= 88; } else { switch (party._mazeId - 25) { case 0: @@ -1006,7 +999,7 @@ void Interface::rest() { map.cellFlagLookup(party._mazePosition); if ((map._currentCantRest || (map.mazeData()._mazeFlags & RESTRICTION_REST)) - && _vm->_mode != MODE_12) { + && _vm->_mode != MODE_INTERACTIVE2) { ErrorScroll::show(_vm, Res.TOO_DANGEROUS_TO_REST, WT_NONFREEZED_WAIT); } else { // Check whether any character is in danger of dying @@ -1032,14 +1025,14 @@ void Interface::rest() { Mode oldMode = _vm->_mode; _vm->_mode = MODE_SLEEPING; - if (oldMode == MODE_12) { + if (oldMode == MODE_INTERACTIVE2) { party.changeTime(8 * 60); } else { for (int idx = 0; idx < 10; ++idx) { chargeStep(); draw3d(true); - if (_vm->_mode == MODE_1) { + if (_vm->_mode == MODE_INTERACTIVE) { _vm->_mode = oldMode; return; } @@ -1197,7 +1190,7 @@ void Interface::draw3d(bool updateFlag, bool pauseFlag) { _flipUIFrame = (_flipUIFrame + 1) % 4; if (_flipUIFrame == 0) _flipWater = !_flipWater; - if (_tillMove && (_vm->_mode == MODE_1 || _vm->_mode == MODE_COMBAT) && + if (_tillMove && (_vm->_mode == MODE_INTERACTIVE || _vm->_mode == MODE_COMBAT) && !combat._monstersAttacking && combat._moveMonsters) { if (--_tillMove == 0) combat.moveMonsters(); @@ -1233,7 +1226,7 @@ void Interface::draw3d(bool updateFlag, bool pauseFlag) { if (combat._attackMonsters[0] != -1 || combat._attackMonsters[1] != -1 || combat._attackMonsters[2] != -1) { - if ((_vm->_mode == MODE_1 || _vm->_mode == MODE_SLEEPING) && + if ((_vm->_mode == MODE_INTERACTIVE || _vm->_mode == MODE_SLEEPING) && !combat._monstersAttacking && !_charsShooting && combat._moveMonsters) { doCombat(); if (scripts._eventSkipped) @@ -1446,7 +1439,6 @@ void Interface::doCombat() { Map &map = *_vm->_map; Party &party = *_vm->_party; Scripts &scripts = *_vm->_scripts; - Spells &spells = *_vm->_spells; Sound &sound = *_vm->_sound; Windows &windows = *_vm->_windows; bool upDoorText = _upDoorText; @@ -1523,7 +1515,7 @@ void Interface::doCombat() { } while (!_vm->shouldExit() && events.timeElapsed() < 1 && !_buttonValue); } while (!_vm->shouldExit() && !_buttonValue); if (_vm->shouldExit()) - return; + goto exit; switch (_buttonValue) { case Common::KEYCODE_TAB: @@ -1560,10 +1552,7 @@ void Interface::doCombat() { case Common::KEYCODE_c: { // Cast spell - int spellId = CastSpell::show(_vm); - if (spellId != -1) { - Character *c = combat._combatParty[combat._whosTurn]; - spells.castSpell(c, (MagicSpell)spellId); + if (CastSpell::show(_vm) != -1) { nextChar(); } else { highlightChar(combat._whosTurn); @@ -1600,7 +1589,7 @@ void Interface::doCombat() { combat.run(); nextChar(); - if (_vm->_mode == MODE_1) { + if (_vm->_mode == MODE_INTERACTIVE) { party._treasure._gems = 0; party._treasure._gold = 0; party._treasure._hasItems = false; @@ -1691,7 +1680,7 @@ void Interface::doCombat() { break; } - _vm->_mode = MODE_1; + _vm->_mode = MODE_INTERACTIVE; if (combat._partyRan && (combat._attackMonsters[0] != -1 || combat._attackMonsters[1] != -1 || combat._attackMonsters[2] != -1)) { party.checkPartyDead(); @@ -1705,14 +1694,14 @@ void Interface::doCombat() { } } } - +exit: w.close(); events.clearEvents(); _vm->_mode = MODE_COMBAT; draw3d(true); party.giveTreasure(); - _vm->_mode = MODE_1; + _vm->_mode = MODE_INTERACTIVE; party._stepped = true; unhighlightChar(); @@ -1725,21 +1714,23 @@ void Interface::doCombat() { mainIconsPrint(); combat._monster2Attack = -1; - if (upDoorText) { - map.cellFlagLookup(party._mazePosition); - if (map._currentIsEvent) - scripts.checkEvents(); - } + if (!g_vm->isLoadPending()) { + if (upDoorText) { + map.cellFlagLookup(party._mazePosition); + if (map._currentIsEvent) + scripts.checkEvents(); + } - if (reloadMap) { - sound.playFX(51); - map._loadCcNum = _vm->getGameID() != GType_WorldOfXeen ? 1 : 0; - map.load(_vm->getGameID() == GType_WorldOfXeen ? 28 : 29); - party._mazeDirection = _vm->getGameID() == GType_WorldOfXeen ? - DIR_EAST : DIR_SOUTH; + if (reloadMap) { + sound.playFX(51); + map._loadCcNum = _vm->getGameID() != GType_WorldOfXeen ? 1 : 0; + map.load(_vm->getGameID() == GType_WorldOfXeen ? 28 : 29); + party._mazeDirection = _vm->getGameID() == GType_WorldOfXeen ? + DIR_EAST : DIR_SOUTH; + } } - combat._combatMode = COMBATMODE_1; + combat._combatMode = COMBATMODE_INTERACTIVE; } void Interface::nextChar() { @@ -1750,7 +1741,7 @@ void Interface::nextChar() { return; if ((combat._attackMonsters[0] == -1 && combat._attackMonsters[1] == -1 && combat._attackMonsters[2] == -1) || combat._combatParty.size() == 0) { - _vm->_mode = MODE_1; + _vm->_mode = MODE_INTERACTIVE; return; } @@ -1760,7 +1751,7 @@ void Interface::nextChar() { // Check if party is dead party.checkPartyDead(); if (party._dead) { - _vm->_mode = MODE_1; + _vm->_mode = MODE_INTERACTIVE; break; } |