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

spalek at users.sourceforge.net spalek at users.sourceforge.net
Sun Nov 8 07:46:24 CET 2009


Revision: 45748
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45748&view=rev
Author:   spalek
Date:     2009-11-08 06:46:24 +0000 (Sun, 08 Nov 2009)

Log Message:
-----------
Implement QuickHero walking.

Pressing Q during the game enables/disables faster walking; all animation
phases are flipped after one refresh instead of after given delay.

Modified Paths:
--------------
    scummvm/trunk/engines/draci/animation.cpp
    scummvm/trunk/engines/draci/animation.h
    scummvm/trunk/engines/draci/script.cpp
    scummvm/trunk/engines/draci/script.h

Modified: scummvm/trunk/engines/draci/animation.cpp
===================================================================
--- scummvm/trunk/engines/draci/animation.cpp	2009-11-08 06:30:10 UTC (rev 45747)
+++ scummvm/trunk/engines/draci/animation.cpp	2009-11-08 06:46:24 UTC (rev 45748)
@@ -38,6 +38,7 @@
 	_playing = false;
 	_looping = false;
 	_paused = false;
+	_canBeQuick = false;
 	_tick = _vm->_system->getMillis();
 	_currentFrame = 0;
 	_hasChangedFrame = true;
@@ -95,7 +96,8 @@
 	const Drawable *frame = getConstCurrentFrame();
 	Surface *surface = _vm->_screen->getSurface();
 
-	if (force || (_tick + frame->getDelay() <= _vm->_system->getMillis())) {
+	if (force || (_tick + frame->getDelay() <= _vm->_system->getMillis()) ||
+	    _canBeQuick && _vm->_game->getEnableQuickHero() && _vm->_game->getWantQuickHero()) {
 		// If we are at the last frame and not looping, stop the animation
 		// The animation is also restarted to frame zero
 		if ((_currentFrame == getFrameCount() - 1) && !_looping) {

Modified: scummvm/trunk/engines/draci/animation.h
===================================================================
--- scummvm/trunk/engines/draci/animation.h	2009-11-08 06:30:10 UTC (rev 45747)
+++ scummvm/trunk/engines/draci/animation.h	2009-11-08 06:46:24 UTC (rev 45748)
@@ -101,6 +101,8 @@
 	Displacement getCurrentFrameDisplacement() const;	// displacement of the current frame (includes _shift)
 	Common::Point getCurrentFramePosition() const;	// with displacement and shift applied
 
+	void supportsQuickAnimation(bool val) { _canBeQuick = val; }
+
 	int getIndex() const { return _index; }
 	void setIndex(int index) { _index = index; }
 
@@ -148,6 +150,8 @@
 	bool _looping;
 	bool _paused;
 
+	bool _canBeQuick;
+
 	/** Array of frames of the animation.  The animation object owns these pointers.
 	 */
 	Common::Array<Drawable *> _frames;

Modified: scummvm/trunk/engines/draci/script.cpp
===================================================================
--- scummvm/trunk/engines/draci/script.cpp	2009-11-08 06:30:10 UTC (rev 45747)
+++ scummvm/trunk/engines/draci/script.cpp	2009-11-08 06:46:24 UTC (rev 45748)
@@ -365,10 +365,16 @@
 	_vm->_game->loop(kInnerUntilExit, true);
 }
 
-Animation *Script::loadObjectAnimation(GameObject *obj, int animID) {
+Animation *Script::loadObjectAnimation(int objID, GameObject *obj, int animID) {
 	_vm->_game->loadAnimation(animID, obj->_z);
 	obj->_anim.push_back(animID);
-	return _vm->_anims->getAnimation(animID);
+	Animation *anim = _vm->_anims->getAnimation(animID);
+	if (objID == kDragonObject && obj->_anim.size() - 1 <= kLastTurning) {
+		// obj->_anim.size() is the Movement type.  All walking and
+		// turning movements can be accelerated.
+		anim->supportsQuickAnimation(true);
+	}
+	return anim;
 }
 
 void Script::load(Common::Queue<int> &params) {
@@ -393,7 +399,7 @@
 	// AnimationManager while not being registered in the object's array of
 	// animations.  This cannot legally happen and an assertion will be
 	// thrown by loadAnimation().
-	loadObjectAnimation(obj, animID);
+	loadObjectAnimation(objID, obj, animID);
 }
 
 void Script::start(Common::Queue<int> &params) {
@@ -426,7 +432,7 @@
 		// to apply the hedgehog, but there is no way that the game
 		// player would load the requested animation by itself.
 		// See objekty:5077 and parezy.txt:27.
-		anim = loadObjectAnimation(obj, animID);
+		anim = loadObjectAnimation(objID, obj, animID);
 		debugC(1, kDraciBytecodeDebugLevel, "start(%d=%s) cannot find animation %d.  Loading.",
 			objID, obj->_title.c_str(), animID);
 	}
@@ -456,7 +462,7 @@
 
 	Animation *anim = _vm->_anims->getAnimation(animID);
 	if (!anim) {
-		anim = loadObjectAnimation(obj, animID);
+		anim = loadObjectAnimation(objID, obj, animID);
 		debugC(1, kDraciBytecodeDebugLevel, "startPlay(%d=%s) cannot find animation %d.  Loading.",
 			objID, obj->_title.c_str(), animID);
 	}

Modified: scummvm/trunk/engines/draci/script.h
===================================================================
--- scummvm/trunk/engines/draci/script.h	2009-11-08 06:30:10 UTC (rev 45747)
+++ scummvm/trunk/engines/draci/script.h	2009-11-08 06:46:24 UTC (rev 45748)
@@ -189,7 +189,7 @@
 	DraciEngine *_vm;
 
 	// Auxilliary functions
-	Animation *loadObjectAnimation(GameObject *obj, int animID);
+	Animation *loadObjectAnimation(int objID, GameObject *obj, int animID);
 };
 
 } // End of namespace Draci


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