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

spalek at users.sourceforge.net spalek at users.sourceforge.net
Mon Oct 12 02:01:39 CEST 2009


Revision: 44960
          http://scummvm.svn.sourceforge.net/scummvm/?rev=44960&view=rev
Author:   spalek
Date:     2009-10-12 00:01:39 +0000 (Mon, 12 Oct 2009)

Log Message:
-----------
Disambiguated _anims.

It's both a pointer to an AnimationManager and list of animation ID's fo
each object.  The latter renamed to _anim so that I can easily search for
them.

Also, fixed the bug promised in the previous commit.

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

Modified: scummvm/trunk/engines/draci/game.cpp
===================================================================
--- scummvm/trunk/engines/draci/game.cpp	2009-10-11 23:54:44 UTC (rev 44959)
+++ scummvm/trunk/engines/draci/game.cpp	2009-10-12 00:01:39 UTC (rev 44960)
@@ -599,8 +599,8 @@
 	for (uint i = 0; i < _info._numObjects; ++i) {
 		GameObject *obj = &_objects[i];
 
-		for (uint j = 0; j < obj->_anims.size(); ++j) {
-			if (obj->_anims[j] == animID) {
+		for (uint j = 0; j < obj->_anim.size(); ++j) {
+			if (obj->_anim[j] == animID) {
 				return i;
 			}
 		}
@@ -953,15 +953,15 @@
 
 	GameObject *dragon = getObject(kDragonObject);
 
-	for (uint i = 0; i < dragon->_anims.size(); ++i) {
-		_vm->_anims->stop(dragon->_anims[i]);
+	for (uint i = 0; i < dragon->_anim.size(); ++i) {
+		_vm->_anims->stop(dragon->_anim[i]);
 	}
 
 	debugC(3, kDraciLogicDebugLevel, "Walk to x: %d y: %d", _hero.x, _hero.y);
 
 	// Fetch dragon's animation ID
 	// FIXME: Need to add proper walking (this only warps the dragon to position)
-	int animID = dragon->_anims[0];
+	int animID = dragon->_anim[0];
 
 	Animation *anim = _vm->_anims->getAnimation(animID);
 	positionAnimAsHero(anim);
@@ -1265,10 +1265,10 @@
 		GameObject *obj = &_objects[i];
 
 		if (i != 0 && (obj->_location == getPreviousRoomNum())) {
-			for (uint j = 0; j < obj->_anims.size(); ++j) {
-					_vm->_anims->deleteAnimation(obj->_anims[j]);
+			for (uint j = 0; j < obj->_anim.size(); ++j) {
+					_vm->_anims->deleteAnimation(obj->_anim[j]);
 			}
-			obj->_anims.clear();
+			obj->_anim.clear();
 		}
 	}
 }
@@ -1297,8 +1297,8 @@
 
 	// TODO: Make objects capable of stopping their own animations
 	const GameObject *dragon = getObject(kDragonObject);
-	for (uint i = 0; i < dragon->_anims.size(); ++i) {
-		_vm->_anims->stop(dragon->_anims[i]);
+	for (uint i = 0; i < dragon->_anim.size(); ++i) {
+		_vm->_anims->stop(dragon->_anim[i]);
 	}
 
 	// Remember the previous room for returning back from the map.
@@ -1518,12 +1518,12 @@
 	for (uint i = 0; i < getNumObjects(); ++i) {
 		GameObject *obj = &_objects[i];
 
-		for (uint j = 0; j < obj->_anims.size(); ++j) {
+		for (uint j = 0; j < obj->_anim.size(); ++j) {
 			Animation *anim;
 
-			anim = _vm->_anims->getAnimation(obj->_anims[j]);
+			anim = _vm->_anims->getAnimation(obj->_anim[j]);
 			if (anim != NULL && anim->getIndex() > lastAnimIndex)
-				obj->_anims.remove_at(j);
+				obj->_anim.remove_at(j--);
 		}
 	}
 

Modified: scummvm/trunk/engines/draci/game.h
===================================================================
--- scummvm/trunk/engines/draci/game.h	2009-10-11 23:54:44 UTC (rev 44959)
+++ scummvm/trunk/engines/draci/game.h	2009-10-12 00:01:39 UTC (rev 44960)
@@ -140,7 +140,7 @@
 	uint _lookX, _lookY, _useX, _useY;
 	int _lookDir, _useDir;
 	uint _absNum;
-	Common::Array<int> _anims;
+	Common::Array<int> _anim;
 	GPL2Program _program;
 	Common::String _title;
 	int _location;

Modified: scummvm/trunk/engines/draci/script.cpp
===================================================================
--- scummvm/trunk/engines/draci/script.cpp	2009-10-11 23:54:44 UTC (rev 44959)
+++ scummvm/trunk/engines/draci/script.cpp	2009-10-12 00:01:39 UTC (rev 44960)
@@ -338,7 +338,7 @@
 	bool visible = (obj->_location == _vm->_game->getRoomNum() && obj->_visible);
 
 	if (objID == kDragonObject || visible) {
-		int animID = obj->_anims[0];
+		int animID = obj->_anim[0];
 		Animation *anim = _vm->_anims->getAnimation(animID);
 		ret = anim->currentFrameNum();
 	}
@@ -371,13 +371,13 @@
 	// depend on this.
 
 	uint i;
-	for (i = 0; i < obj->_anims.size(); ++i) {
-		if (obj->_anims[i] > animID) {
+	for (i = 0; i < obj->_anim.size(); ++i) {
+		if (obj->_anim[i] > animID) {
 			break;
 		}
 	}
 
-	obj->_anims.insert_at(i, animID);
+	obj->_anim.insert_at(i, animID);
 	return _vm->_anims->getAnimation(animID);
 }
 
@@ -393,8 +393,8 @@
 	GameObject *obj = _vm->_game->getObject(objID);
 
 	// If the animation is already loaded, return
-	for (i = 0; i < obj->_anims.size(); ++i) {
-		if (obj->_anims[i] == animID) {
+	for (i = 0; i < obj->_anim.size(); ++i) {
+		if (obj->_anim[i] == animID) {
 			return;
 		}
 	}
@@ -414,8 +414,8 @@
 
 	// Stop all animation that the object owns
 
-	for (uint i = 0; i < obj->_anims.size(); ++i) {
-		_vm->_anims->stop(obj->_anims[i]);
+	for (uint i = 0; i < obj->_anim.size(); ++i) {
+		_vm->_anims->stop(obj->_anim[i]);
 	}
 
 	Animation *anim = _vm->_anims->getAnimation(animID);
@@ -466,8 +466,8 @@
 
 	// Stop all animation that the object owns
 
-	for (uint i = 0; i < obj->_anims.size(); ++i) {
-		_vm->_anims->stop(obj->_anims[i]);
+	for (uint i = 0; i < obj->_anim.size(); ++i) {
+		_vm->_anims->stop(obj->_anim[i]);
 	}
 
 	Animation *anim = _vm->_anims->getAnimation(animID);
@@ -599,8 +599,8 @@
 		obj->_location = -1;
 	}
 
-	for (uint i = 0; i < obj->_anims.size(); ++i) {
-		_vm->_anims->stop(obj->_anims[i]);
+	for (uint i = 0; i < obj->_anim.size(); ++i) {
+		_vm->_anims->stop(obj->_anim[i]);
 	}
 }
 


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