From 3d687d07f5d57b61fe2a454e6ec05667125dad00 Mon Sep 17 00:00:00 2001 From: Robert Špalek Date: Sun, 22 Nov 2009 20:02:13 +0000 Subject: 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 --- engines/draci/game.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'engines/draci') 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) { -- cgit v1.2.3