aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Špalek2009-10-12 00:01:39 +0000
committerRobert Špalek2009-10-12 00:01:39 +0000
commit6aaf99ec6756c2ff4d661b88f0aad489784212ac (patch)
tree0cf77c0a49e4e2921477198348cdc45da3fd2349
parent6768065f142b4fe87ac4786d23023806022f3b7c (diff)
downloadscummvm-rg350-6aaf99ec6756c2ff4d661b88f0aad489784212ac.tar.gz
scummvm-rg350-6aaf99ec6756c2ff4d661b88f0aad489784212ac.tar.bz2
scummvm-rg350-6aaf99ec6756c2ff4d661b88f0aad489784212ac.zip
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. svn-id: r44960
-rw-r--r--engines/draci/game.cpp26
-rw-r--r--engines/draci/game.h2
-rw-r--r--engines/draci/script.cpp24
3 files changed, 26 insertions, 26 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index 6d0c929fc6..52ba2db930 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -599,8 +599,8 @@ int Game::getObjectWithAnimation(int animID) const {
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 @@ void Game::walkHero(int x, int y) {
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 @@ void Game::deleteObjectAnimations() {
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 @@ void Game::enterNewRoom(bool force_reload) {
// 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 @@ void Game::deleteAnimationsAfterIndex(int lastAnimIndex) {
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--);
}
}
diff --git a/engines/draci/game.h b/engines/draci/game.h
index 4c521a028b..8d8c9642f5 100644
--- a/engines/draci/game.h
+++ b/engines/draci/game.h
@@ -140,7 +140,7 @@ struct GameObject {
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;
diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp
index da53fad979..e337920b17 100644
--- a/engines/draci/script.cpp
+++ b/engines/draci/script.cpp
@@ -338,7 +338,7 @@ int Script::funcActPhase(int objID) const {
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 @@ Animation *Script::loadObjectAnimation(GameObject *obj, int animID) {
// 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 @@ void Script::load(Common::Queue<int> &params) {
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 @@ void Script::start(Common::Queue<int> &params) {
// 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 @@ void Script::startPlay(Common::Queue<int> &params) {
// 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 @@ void Script::objStat(Common::Queue<int> &params) {
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]);
}
}