aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/game.cpp
diff options
context:
space:
mode:
authorlukaslw2014-03-06 04:20:47 +0100
committerlukaslw2014-04-28 21:42:10 +0200
commitb3de0843a9cd66e133a33b467da1f6ba1a572db9 (patch)
treeb9372a2c6cef2f4e9cbaa66e9731feac6df5e6df /engines/draci/game.cpp
parentf74c46e93efa23db094599e9307caf80ebf5bcda (diff)
downloadscummvm-rg350-b3de0843a9cd66e133a33b467da1f6ba1a572db9.tar.gz
scummvm-rg350-b3de0843a9cd66e133a33b467da1f6ba1a572db9.tar.bz2
scummvm-rg350-b3de0843a9cd66e133a33b467da1f6ba1a572db9.zip
DRACI: Opening inventory during movements and actions.
Diffstat (limited to 'engines/draci/game.cpp')
-rw-r--r--engines/draci/game.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index 3a335f249a..b98593c8a4 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -891,9 +891,6 @@ void Game::putItem(GameItem *item, int position) {
void Game::inventoryInit() {
// Pause all "background" animations
_vm->_anims->pauseAnimations();
- if (_walkingState.isActive()) {
- walkHero(_hero.x, _hero.y, kDirectionLast);
- }
// Draw the inventory and the current items
inventoryDraw();
@@ -904,6 +901,13 @@ void Game::inventoryInit() {
// Set the appropriate loop status
setLoopStatus(kStatusInventory);
+ if (_walkingState.isActive()) {
+ _walkingState.stopWalking();
+ walkHero(_hero.x, _hero.y, kDirectionLast);
+ } else {
+ _lastTarget = _hero;
+ }
+
// Don't return from the inventory mode immediately if the mouse is out.
_mouseChangeTick = kMouseDoNotSwitch;
}
@@ -922,6 +926,10 @@ void Game::inventoryDone() {
}
}
+ // Start moving to last target
+ walkHero(_lastTarget.x, _lastTarget.y, kDirectionLast);
+ _walkingState.callbackLast();
+
// Reset item under cursor
_itemUnderCursor = NULL;
@@ -1208,6 +1216,12 @@ void Game::walkHero(int x, int y, SightDirection dir) {
debug(1, "Unreachable point [%d,%d]", target.x, target.y);
return;
}
+
+ // Save point of player's last target.
+ if(_loopStatus != kStatusInventory) {
+ _lastTarget = target;
+ }
+
_walkingMap.obliquePath(shortestPath, &obliquePath);
debugC(2, kDraciWalkingDebugLevel, "Walking path lengths: shortest=%d oblique=%d", shortestPath.size(), obliquePath.size());
if (_vm->_showWalkingMap) {