[Scummvm-cvs-logs] SF.net SVN: scummvm:[45649] scummvm/trunk/engines/draci/game.cpp
spalek at users.sourceforge.net
spalek at users.sourceforge.net
Wed Nov 4 05:27:31 CET 2009
Revision: 45649
http://scummvm.svn.sourceforge.net/scummvm/?rev=45649&view=rev
Author: spalek
Date: 2009-11-04 04:27:31 +0000 (Wed, 04 Nov 2009)
Log Message:
-----------
Properly animate the last phase of the walk before running callbacks
Modified Paths:
--------------
scummvm/trunk/engines/draci/game.cpp
Modified: scummvm/trunk/engines/draci/game.cpp
===================================================================
--- scummvm/trunk/engines/draci/game.cpp 2009-11-04 00:42:37 UTC (rev 45648)
+++ scummvm/trunk/engines/draci/game.cpp 2009-11-04 04:27:31 UTC (rev 45649)
@@ -441,25 +441,9 @@
// Walk the hero. The WalkingState class handles everything including
// proper timing.
+ bool walkingFinished = false;
if (_walkingState.isActive()) {
- if (!_walkingState.continueWalking()) {
- // Walking has finished.
- bool exitLoop = false;
- if (_loopSubstatus == kInnerUntilExit) {
- // The callback may run another inner loop (for
- // example, a dialogue). Reset the loop
- // substatus temporarily to the outer one.
- exitLoop = true;
- setLoopSubstatus(kOuterLoop);
- }
- debugC(2, kDraciWalkingDebugLevel, "Finished walking");
- _walkingState.callback(); // clears callback pointer first
- if (exitLoop) {
- debugC(3, kDraciWalkingDebugLevel, "Exiting from the inner loop");
- setExitLoop(true);
- setLoopSubstatus(kInnerUntilExit);
- }
- }
+ walkingFinished = !_walkingState.continueWalking();
}
// Advance animations (this may also call setExitLoop(true) in the
@@ -467,6 +451,26 @@
_vm->_anims->drawScene(_vm->_screen->getSurface());
_vm->_screen->copyToScreen();
_vm->_system->delayMillis(20);
+
+ // If the hero has arrived at his destination, after even the last
+ // phase was correctly animated, run the callback.
+ if (walkingFinished) {
+ bool exitLoop = false;
+ if (_loopSubstatus == kInnerUntilExit) {
+ // The callback may run another inner loop (for
+ // example, a dialogue). Reset the loop
+ // substatus temporarily to the outer one.
+ exitLoop = true;
+ setLoopSubstatus(kOuterLoop);
+ }
+ debugC(2, kDraciWalkingDebugLevel, "Finished walking");
+ _walkingState.callback(); // clears callback pointer first
+ if (exitLoop) {
+ debugC(3, kDraciWalkingDebugLevel, "Exiting from the inner loop");
+ setExitLoop(true);
+ setLoopSubstatus(kInnerUntilExit);
+ }
+ }
}
void Game::loop(LoopSubstatus substatus, bool shouldExit) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list