mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-22 01:57:16 +00:00
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
This commit is contained in:
parent
6768065f14
commit
6aaf99ec67
@ -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--);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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> ¶ms) {
|
||||
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> ¶ms) {
|
||||
|
||||
// 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> ¶ms) {
|
||||
|
||||
// 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> ¶ms) {
|
||||
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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user