[Scummvm-cvs-logs] scummvm master -> 6c2a7f0ca3df2dcce4d1050a3d93c883a8faad52
sev-
sev at scummvm.org
Mon Apr 28 23:20:36 CEST 2014
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
b3de0843a9 DRACI: Opening inventory during movements and actions.
ad842e61da DRACI: Inventory opening after finished callback.
6c2a7f0ca3 Merge pull request #443 from lukaslw/first_branch
Commit: b3de0843a9cd66e133a33b467da1f6ba1a572db9
https://github.com/scummvm/scummvm/commit/b3de0843a9cd66e133a33b467da1f6ba1a572db9
Author: lukaslw (lukaslw at gmail.com)
Date: 2014-04-28T21:42:10+02:00
Commit Message:
DRACI: Opening inventory during movements and actions.
Changed paths:
engines/draci/game.cpp
engines/draci/game.h
engines/draci/walking.cpp
engines/draci/walking.h
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index 3a335f2..b98593c 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) {
diff --git a/engines/draci/game.h b/engines/draci/game.h
index 638c979..53a472a 100644
--- a/engines/draci/game.h
+++ b/engines/draci/game.h
@@ -356,6 +356,7 @@ private:
Common::Point _hero;
Common::Point _heroLoading;
+ Common::Point _lastTarget;
int *_variables;
Person *_persons;
diff --git a/engines/draci/walking.cpp b/engines/draci/walking.cpp
index 1467ece..1670c9a 100644
--- a/engines/draci/walking.cpp
+++ b/engines/draci/walking.cpp
@@ -439,8 +439,8 @@ void WalkingState::startWalking(const Common::Point &p1, const Common::Point &p2
}
void WalkingState::setCallback(const GPL2Program *program, uint16 offset) {
- _callback = program;
- _callbackOffset = offset;
+ _callback = _callbackLast = program;
+ _callbackOffset = _callbackOffsetLast = offset;
}
void WalkingState::callback() {
@@ -454,6 +454,10 @@ void WalkingState::callback() {
_vm->_script->runWrapper(originalCallback, _callbackOffset, true, false);
}
+void WalkingState::callbackLast() {
+ setCallback(_callbackLast, _callbackOffsetLast);
+}
+
bool WalkingState::continueWalkingOrClearPath() {
const bool stillWalking = continueWalking();
if (!stillWalking) {
diff --git a/engines/draci/walking.h b/engines/draci/walking.h
index ee2b48d..fcdef38 100644
--- a/engines/draci/walking.h
+++ b/engines/draci/walking.h
@@ -110,6 +110,8 @@ public:
_lastAnimPhase = 0;
_turningFinished = 0;
_callbackOffset = 0;
+ _callbackOffsetLast = 0;
+ _callbackLast = 0;
stopWalking();
}
@@ -124,6 +126,7 @@ public:
void setCallback(const GPL2Program *program, uint16 offset);
void callback();
+ void callbackLast();
bool isActive() const { return _path.size() > 0; }
@@ -157,7 +160,9 @@ private:
bool _turningFinished;
const GPL2Program *_callback;
+ const GPL2Program *_callbackLast;
uint16 _callbackOffset;
+ uint16 _callbackOffsetLast;
// Initiates turning of the dragon into the direction for the next
// segment / after walking. Returns false when there is nothing left
Commit: ad842e61da920952e1583c7d88e252fac43e4f6c
https://github.com/scummvm/scummvm/commit/ad842e61da920952e1583c7d88e252fac43e4f6c
Author: lukaslw (lukaslw at gmail.com)
Date: 2014-04-28T21:49:34+02:00
Commit Message:
DRACI: Inventory opening after finished callback.
Changed paths:
engines/draci/game.cpp
engines/draci/walking.cpp
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index b98593c..4893b0f 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -1218,7 +1218,7 @@ void Game::walkHero(int x, int y, SightDirection dir) {
}
// Save point of player's last target.
- if(_loopStatus != kStatusInventory) {
+ if (_loopStatus != kStatusInventory) {
_lastTarget = target;
}
diff --git a/engines/draci/walking.cpp b/engines/draci/walking.cpp
index 1670c9a..6914898 100644
--- a/engines/draci/walking.cpp
+++ b/engines/draci/walking.cpp
@@ -452,6 +452,8 @@ void WalkingState::callback() {
const GPL2Program &originalCallback = *_callback;
_callback = NULL;
_vm->_script->runWrapper(originalCallback, _callbackOffset, true, false);
+ _callbackLast = NULL;
+ _callbackOffset = NULL;
}
void WalkingState::callbackLast() {
Commit: 6c2a7f0ca3df2dcce4d1050a3d93c883a8faad52
https://github.com/scummvm/scummvm/commit/6c2a7f0ca3df2dcce4d1050a3d93c883a8faad52
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2014-04-29T00:20:04+03:00
Commit Message:
Merge pull request #443 from lukaslw/first_branch
DRACI: Opening inventory during movements and actions.
Changed paths:
engines/draci/game.cpp
engines/draci/game.h
engines/draci/walking.cpp
engines/draci/walking.h
More information about the Scummvm-git-logs
mailing list