aboutsummaryrefslogtreecommitdiff
path: root/engines/draci
diff options
context:
space:
mode:
authorRobert Špalek2009-10-12 00:32:51 +0000
committerRobert Špalek2009-10-12 00:32:51 +0000
commitb99e69f4d9a4ec864d5b6f26787d1841e4bdc56d (patch)
tree9d82cc5017d54846ff84f2d8867c73c3b88031b7 /engines/draci
parent3ef5145b41852ce39494e353ee7c95600d49093e (diff)
downloadscummvm-rg350-b99e69f4d9a4ec864d5b6f26787d1841e4bdc56d.tar.gz
scummvm-rg350-b99e69f4d9a4ec864d5b6f26787d1841e4bdc56d.tar.bz2
scummvm-rg350-b99e69f4d9a4ec864d5b6f26787d1841e4bdc56d.zip
Fix indexing of the dragon's animations.
After inspection, I assert that it isn't true that the _anim array needs to be sorted. In fact, sorting ruins the ordering of the dragon's animations, which corresponds to enum Movement. After fixing this, let the dragon have a rest instead of constantly walking down. svn-id: r44962
Diffstat (limited to 'engines/draci')
-rw-r--r--engines/draci/game.cpp2
-rw-r--r--engines/draci/script.cpp21
2 files changed, 6 insertions, 17 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index 97a9f6b5bc..c335773de3 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -958,7 +958,7 @@ void Game::walkHero(int x, int y) {
// Fetch dragon's animation ID
// FIXME: Need to add proper walking (this only warps the dragon to position)
- int animID = dragon->_anim[0];
+ int animID = dragon->_anim[kStopRight];
Animation *anim = _vm->_anims->getAnimation(animID);
positionAnimAsHero(anim);
diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp
index 12976c268b..a090ee6b86 100644
--- a/engines/draci/script.cpp
+++ b/engines/draci/script.cpp
@@ -338,6 +338,10 @@ int Script::funcActPhase(int objID) const {
bool visible = (obj->_location == _vm->_game->getRoomNum() && obj->_visible);
if (objID == kDragonObject || visible) {
+ // FIXME: we should check which animation is active and return
+ // the phase of it, instead of the first one. this function
+ // is only used at 3 places of the game, hence possible
+ // breakage may not show easily.
int animID = obj->_anim[0];
Animation *anim = _vm->_anims->getAnimation(animID);
ret = anim->currentFrameNum();
@@ -361,23 +365,8 @@ void Script::play(Common::Queue<int> &params) {
}
Animation *Script::loadObjectAnimation(GameObject *obj, int animID) {
- // Load the animation into memory
-
_vm->_game->loadAnimation(animID, obj->_z);
-
- // We insert the ID of the loaded animation into the object's internal array
- // of owned animation IDs.
- // Care must be taken to store them sorted (increasing order) as some things
- // depend on this.
-
- uint i;
- for (i = 0; i < obj->_anim.size(); ++i) {
- if (obj->_anim[i] > animID) {
- break;
- }
- }
-
- obj->_anim.insert_at(i, animID);
+ obj->_anim.push_back(animID);
return _vm->_anims->getAnimation(animID);
}