[Scummvm-cvs-logs] SF.net SVN: scummvm:[42244] scummvm/branches/gsoc2009-draci/engines/draci

dkasak13 at users.sourceforge.net dkasak13 at users.sourceforge.net
Tue Jul 7 23:18:29 CEST 2009


Revision: 42244
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42244&view=rev
Author:   dkasak13
Date:     2009-07-07 21:18:28 +0000 (Tue, 07 Jul 2009)

Log Message:
-----------
* From Game::GameObject removed the following _idxSeq, _numSeq, _animObj, _seqTab (not used anymore), added Common::Array<int> _anims.
* Handled cylic animations properly
* Handled the Z coordinate properly

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

Modified: scummvm/branches/gsoc2009-draci/engines/draci/game.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/game.cpp	2009-07-07 21:11:36 UTC (rev 42243)
+++ scummvm/branches/gsoc2009-draci/engines/draci/game.cpp	2009-07-07 21:18:28 UTC (rev 42244)
@@ -201,7 +201,7 @@
 	_vm->_screen->setPalette(f->_data, 0, kNumColours);
 }
 
-int Game::loadAnimation(uint animNum) {
+int Game::loadAnimation(uint animNum, uint z) {
 
 	BAFile *animFile = _vm->_animationsArchive->getFile(animNum);
 	Common::MemoryReadStream animationReader(animFile->_data, animFile->_length);	
@@ -211,10 +211,10 @@
 	// FIXME: handle these properly
 	animationReader.readByte(); // Memory logic field, not used
 	animationReader.readByte(); // Disable erasing field, not used
-	animationReader.readByte(); // Cyclic field, not used
+	bool cyclic = animationReader.readByte(); // Cyclic field, not used
 	animationReader.readByte(); // Relative field, not used
 
-	Animation *anim = _vm->_anims->addAnimation(animNum, 254, false);
+	Animation *anim = _vm->_anims->addAnimation(animNum, z, false);
 	
 	for (uint i = 0; i < numFrames; ++i) {
 		uint spriteNum = animationReader.readUint16LE() - 1;
@@ -236,8 +236,7 @@
 		if (mirror) 
 			sp->setMirrorOn();
 
-		// HACK: This is only for testing
-		anim->setLooping(true);
+		anim->setLooping(cyclic);
 
 		anim->addFrame(sp);
 	}
@@ -262,8 +261,8 @@
 	obj->_imUse = objReader.readByte();
 	obj->_walkDir = objReader.readByte();
 	obj->_priority = objReader.readByte();
-	obj->_idxSeq = objReader.readUint16LE();
-	obj->_numSeq = objReader.readUint16LE();
+	objReader.readUint16LE(); // idxSeq field, not used
+	objReader.readUint16LE(); // numSeq field, not used
 	obj->_lookX = objReader.readUint16LE();
 	obj->_lookY = objReader.readUint16LE();
 	obj->_useX = objReader.readUint16LE();
@@ -272,10 +271,7 @@
 	obj->_useDir = objReader.readByte();
 	
 	obj->_absNum = objNum;
-	obj->_animObj = 0;
 	
-	obj->_seqTab = new uint16[obj->_numSeq];
-
 	file = _vm->_objectsArchive->getFile(objNum * 3 + 1);
 	obj->_title = new byte[file->_length];
 	memcpy(obj->_title, file->_data, file->_length);
@@ -327,8 +323,9 @@
 		GameObject *obj = &_objects[i];
 	
 		if (i != 0 && obj->_location == oldRoomNum) {
-			for (uint j = 0; j < obj->_numSeq; ++j) {
-					_vm->_anims->deleteAnimation(obj->_seqTab[j]);
+			for (uint j = 0; j < obj->_anims.size(); ++j) {
+					_vm->_anims->deleteAnimation(obj->_anims[j]);
+					obj->_anims.pop_back();
 			}
 		}
 	}
@@ -352,7 +349,6 @@
 }
 
 GameObject::~GameObject() { 
-	delete[] _seqTab; 
 	delete[] _title;
 	delete[] _program._bytecode;
 }

Modified: scummvm/branches/gsoc2009-draci/engines/draci/game.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/game.h	2009-07-07 21:11:36 UTC (rev 42243)
+++ scummvm/branches/gsoc2009-draci/engines/draci/game.h	2009-07-07 21:18:28 UTC (rev 42244)
@@ -45,19 +45,17 @@
 
 struct GameObject {
 	
-	GameObject() : _seqTab(NULL), _title(NULL) {}
+	GameObject() : _title(NULL) {}
 	~GameObject();
 		
 	uint16 _init, _look, _use, _canUse;
 	bool _imInit, _imLook, _imUse;
 	byte _walkDir;
 	byte _priority;
-	uint16 _idxSeq, _numSeq;
 	uint16 _lookX, _lookY, _useX, _useY;
 	byte _lookDir, _useDir;
 	uint16 _absNum;
-	byte _animObj;
-	uint16 *_seqTab;
+	Common::Array<int> _anims;
 	GPL2Program _program;
 	byte *_title;
 	byte _location;
@@ -125,7 +123,7 @@
 	}
 
 	void loadRoom(uint roomNum);
-	int loadAnimation(uint animNum);
+	int loadAnimation(uint animNum, uint z);
 	void loadOverlays();
 	void loadObject(uint numObj);
 

Modified: scummvm/branches/gsoc2009-draci/engines/draci/script.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/script.cpp	2009-07-07 21:11:36 UTC (rev 42243)
+++ scummvm/branches/gsoc2009-draci/engines/draci/script.cpp	2009-07-07 21:18:28 UTC (rev 42244)
@@ -226,7 +226,8 @@
 
 	GameObject *obj = _vm->_game->getObject(objID);
 
-	obj->_seqTab[animID - obj->_idxSeq] = _vm->_game->loadAnimation(animID);
+	_vm->_game->loadAnimation(animID, obj->_priority);
+	obj->_anims.push_back(animID);
 }
 
 void Script::start(Common::Queue<int> &params) {


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