From ec86b55bd9cfbe859f29d1222b87b093d7cda814 Mon Sep 17 00:00:00 2001 From: tomvd Date: Wed, 2 Mar 2011 23:38:02 +0100 Subject: [PATCH] - Fix: Terrain destruction after explosion animation finished. - Fix: Stay in "aiming mode" until right-click. --- src/Battlescape/BattlescapeState.cpp | 25 +++++++++++++++++++++---- src/Battlescape/ExplosionBState.cpp | 2 +- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/Battlescape/BattlescapeState.cpp b/src/Battlescape/BattlescapeState.cpp index b96807054e..f45dfabc03 100644 --- a/src/Battlescape/BattlescapeState.cpp +++ b/src/Battlescape/BattlescapeState.cpp @@ -268,7 +268,18 @@ void BattlescapeState::mapClick(Action *action) // right-click aborts walking state if (action->getDetails()->button.button == SDL_BUTTON_RIGHT) { - if (!_states.empty()) + if (_states.empty()) + { + if (_targeting) + { + _targeting = false; + _map->setCursorType(CT_NORMAL); + _game->getCursor()->setVisible(true); + _selectedAction = BA_NONE; + return; + } + } + else { _states.front()->cancel(); return; @@ -289,7 +300,6 @@ void BattlescapeState::mapClick(Action *action) if (_targeting) { // -= fire weapon =- - _targeting = false; _target = pos; _map->setCursorType(CT_NONE); _game->getCursor()->setVisible(false); @@ -634,8 +644,15 @@ void BattlescapeState::popState() // if all states are empty - give the mouse back to the player if (_states.empty()) { - _map->setCursorType(CT_NORMAL); - _game->getCursor()->setVisible(true); + if (_selectedAction == BA_NONE) + { + _map->setCursorType(CT_NORMAL); + _game->getCursor()->setVisible(true); + } + else + { + _map->setCursorType(CT_AIM); + } } else { diff --git a/src/Battlescape/ExplosionBState.cpp b/src/Battlescape/ExplosionBState.cpp index f1d880054a..94047b1ce6 100644 --- a/src/Battlescape/ExplosionBState.cpp +++ b/src/Battlescape/ExplosionBState.cpp @@ -61,7 +61,6 @@ void ExplosionBState::init() _parent->getMap()->getExplosions()->insert(explosion); // KABOOM _parent->getGame()->getResourcePack()->getSoundSet("BATTLE.CAT")->getSound(_parent->getSelectedItem()->getRules()->getHitSound())->play(); - _parent->getGame()->getSavedGame()->getBattleGame()->getTerrainModifier()->explode(_center, _item->getAmmoItem()->getRules()->getPower(), _item->getAmmoItem()->getRules()->getDamageType(), 100); } void ExplosionBState::think() @@ -73,6 +72,7 @@ void ExplosionBState::think() _parent->getMap()->getExplosions()->erase((*i)); if (_parent->getMap()->getExplosions()->empty()) { + _parent->getGame()->getSavedGame()->getBattleGame()->getTerrainModifier()->explode(_center, _item->getAmmoItem()->getRules()->getPower(), _item->getAmmoItem()->getRules()->getDamageType(), 100); _parent->popState(); return; }