aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Špalek2009-11-22 20:02:13 +0000
committerRobert Špalek2009-11-22 20:02:13 +0000
commit3d687d07f5d57b61fe2a454e6ec05667125dad00 (patch)
tree1527d5094bc1c281e1f220631b18542a194735d0
parent485159f0dcfa41d9d95b0c5c7e5cc223dcd3caf4 (diff)
downloadscummvm-rg350-3d687d07f5d57b61fe2a454e6ec05667125dad00.tar.gz
scummvm-rg350-3d687d07f5d57b61fe2a454e6ec05667125dad00.tar.bz2
scummvm-rg350-3d687d07f5d57b61fe2a454e6ec05667125dad00.zip
Fixed assert() on already loaded animation
Now the game seems fully playable with crazy loading all the time, even though it is a hacky solution. Updated the TODOs svn-id: r46094
-rw-r--r--engines/draci/game.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index 19d680a2da..76594e78cb 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -138,6 +138,8 @@ Game::Game(DraciEngine *vm) : _vm(vm), _walkingState(vm) {
_objects[i]._location = (~(1 << 7) & tmp) - 1;
_objects[i]._playingAnim = -1;
+ _objects[i]._absNum = i;
+ // _anims have been initialized by the constructor
}
assert(numDialogues == _info._numDialogues);
@@ -1207,12 +1209,12 @@ void Game::deleteObjectAnimations() {
// animations instead of listing what to deallocate. maybe simply
// deallocate everything; reloading isn't that expensive.
//
- // URGENT TODO: if a game item's location changes (e.g., due to a GPL2
- // command), its animations survive and we get assert in
- // AnimationManager::load() next time. we must address this before a
- // proper clean-up to make game playable. happens when loading game
- // before getting the fairy tale book, playing a bit, and then doing it
- // again. the fairy-tale book's animations raise an assert.
+ // TODO: if a game item's location changes (e.g., due to a GPL2
+ // command), its animations survive in the memory. I believe this
+ // isn't needed, because only icons need to survive, but it is
+ // dangerous if those animations contain sounds. maybe delete all
+ // objects regardless of their location. dump first how often this
+ // happens.
//
// TODO: completely rewrite the resource management. maybe implement
// usage counters? maybe completely ignore the GPL2 hints and manage
@@ -1597,7 +1599,7 @@ void GameObject::load(uint objNum, BArchive *archive) {
_program._length = file->_length;
_playingAnim = -1;
- _anim.clear();
+ deleteAnims(); // If the object has already been loaded, then discard the previous animations
}
void GameItem::load(int itemID, BArchive *archive) {