[Scummvm-cvs-logs] SF.net SVN: scummvm:[45690] scummvm/trunk/engines/draci

spalek at users.sourceforge.net spalek at users.sourceforge.net
Fri Nov 6 00:59:26 CET 2009


Revision: 45690
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45690&view=rev
Author:   spalek
Date:     2009-11-05 23:59:26 +0000 (Thu, 05 Nov 2009)

Log Message:
-----------
Fixed several gross walking bugs.

- SIGSEGV by not stopping walking when changing rooms
- reset of the mouse cursor and object title during gate scripts
- updating the previous animation phase, also when starting new animation
- swapped up and down animations

Modified Paths:
--------------
    scummvm/trunk/engines/draci/game.cpp
    scummvm/trunk/engines/draci/walking.cpp

Modified: scummvm/trunk/engines/draci/game.cpp
===================================================================
--- scummvm/trunk/engines/draci/game.cpp	2009-11-05 21:09:46 UTC (rev 45689)
+++ scummvm/trunk/engines/draci/game.cpp	2009-11-05 23:59:26 UTC (rev 45690)
@@ -1381,8 +1381,22 @@
 	  	_persons[kDragonObject]._y = 0;
 	}
 
-	// Set the appropriate loop statu before loading the room
+	// Set the appropriate loop status before loading the room
 	setLoopStatus(kStatusGate);
+
+	// Make sure the possible walking path from the previous room is
+	// cleaned up.  Some rooms (e.g., the map) don't support walking.
+	_walkingState.stopWalking();
+
+	// Clean the mouse and animation title.  It gets first updated in
+	// loop(), hence if the hero walks during the initialization scripts,
+	// the old values would remain otherwise.
+	_vm->_mouse->setCursorType(kNormalCursor);
+	Animation *titleAnim = _vm->_anims->getAnimation(kTitleText);
+	titleAnim->markDirtyRect(_vm->_screen->getSurface());
+	Text *title = reinterpret_cast<Text *>(titleAnim->getCurrentFrame());
+	title->setText("");
+
 	// Reset the flag allowing to run the scripts.  It may have been turned
 	// on by pressing Escape in the intro or in the map room.
 	_vm->_script->endCurrentProgram(false);
@@ -1406,8 +1420,6 @@
 	// Reset the loop status.
 	setLoopStatus(kStatusOrdinary);
 
-	_vm->_mouse->setCursorType(kNormalCursor);
-
 	setIsReloaded(false);
 	if (_vm->_script->shouldEndProgram()) {
 		// Escape pressed during the intro or map animations run in the

Modified: scummvm/trunk/engines/draci/walking.cpp
===================================================================
--- scummvm/trunk/engines/draci/walking.cpp	2009-11-05 21:09:46 UTC (rev 45689)
+++ scummvm/trunk/engines/draci/walking.cpp	2009-11-05 23:59:26 UTC (rev 45690)
@@ -516,6 +516,7 @@
 	if (!wasUpdated) {
 		return true;
 	}
+	_lastAnimPhase = animPhase;
 
 	debugC(3, kDraciWalkingDebugLevel, "Continuing walking in segment %d and position %d/%d", _segment, _position, _length);
 
@@ -573,8 +574,15 @@
 	// walking/staying/talking animations are cyclic.
 	Movement nextAnim = directionForNextPhase();
 	_vm->_game->playHeroAnimation(nextAnim);
-	_lastAnimPhase = 0;
 
+	// Retrieve the current animation phase.  Don't just use 0, because we
+	// cannot assume that nextAnim has just started.  If it was already
+	// playing before, then playHeroAnimation(nextAnim) does nothing.
+	const GameObject *dragon = _vm->_game->getObject(kDragonObject);
+	const int animID = dragon->_anim[nextAnim];
+	Animation *anim = _vm->_anims->getAnimation(animID);
+	_lastAnimPhase = anim->currentFrameNum();
+
 	debugC(2, kDraciWalkingDebugLevel, "Turned for segment %d, starting animation %d", _segment+1, nextAnim);
 
 	if (++_segment < (int) (_path.size() - 1)) {
@@ -596,7 +604,7 @@
 	if (abs(dx) >= abs(dy)) {
 		return dx >= 0 ? kMoveRight : kMoveLeft;
 	} else {
-		return dy >= 0 ? kMoveUp : kMoveDown;
+		return dy >= 0 ? kMoveDown : kMoveUp;
 	}
 }
 


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