diff options
| author | Denis Kasak | 2009-07-07 21:18:28 +0000 | 
|---|---|---|
| committer | Denis Kasak | 2009-07-07 21:18:28 +0000 | 
| commit | 586af0ab4264e022efe84fff8cdf080d580e8432 (patch) | |
| tree | c492938acd6d5815801641d24158cee56ee04d40 | |
| parent | 9246e9cf4a6f6a561274274019309b16ae1b96c4 (diff) | |
| download | scummvm-rg350-586af0ab4264e022efe84fff8cdf080d580e8432.tar.gz scummvm-rg350-586af0ab4264e022efe84fff8cdf080d580e8432.tar.bz2 scummvm-rg350-586af0ab4264e022efe84fff8cdf080d580e8432.zip | |
* 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
svn-id: r42244
| -rw-r--r-- | engines/draci/game.cpp | 22 | ||||
| -rw-r--r-- | engines/draci/game.h | 8 | ||||
| -rw-r--r-- | engines/draci/script.cpp | 3 | 
3 files changed, 14 insertions, 19 deletions
| diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 072d205436..ce09ff42a5 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -201,7 +201,7 @@ void Game::loadRoom(uint roomNum) {  	_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 @@ int Game::loadAnimation(uint animNum) {  	// 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 @@ int Game::loadAnimation(uint animNum) {  		if (mirror)   			sp->setMirrorOn(); -		// HACK: This is only for testing -		anim->setLooping(true); +		anim->setLooping(cyclic);  		anim->addFrame(sp);  	} @@ -262,8 +261,8 @@ void Game::loadObject(uint objNum) {  	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 @@ void Game::loadObject(uint objNum) {  	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 @@ void Game::changeRoom(uint roomNum) {  		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 @@ Game::~Game() {  }  GameObject::~GameObject() {  -	delete[] _seqTab;   	delete[] _title;  	delete[] _program._bytecode;  } diff --git a/engines/draci/game.h b/engines/draci/game.h index 1c572f95e9..124aa5c769 100644 --- a/engines/draci/game.h +++ b/engines/draci/game.h @@ -45,19 +45,17 @@ enum StructSizes {  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 @@ public:  	}  	void loadRoom(uint roomNum); -	int loadAnimation(uint animNum); +	int loadAnimation(uint animNum, uint z);  	void loadOverlays();  	void loadObject(uint numObj); diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp index f45f45cb76..ed6e2b2802 100644 --- a/engines/draci/script.cpp +++ b/engines/draci/script.cpp @@ -226,7 +226,8 @@ void Script::load(Common::Queue<int> ¶ms) {  	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> ¶ms) { | 
