From 00063b142303483cfea7fc2522ac45daaa7025f4 Mon Sep 17 00:00:00 2001 From: Robert Špalek Date: Sun, 22 Nov 2009 20:17:39 +0000 Subject: Clearing object animations in a cleaner way Verified that we really do not need object animations even if they are in a different location, and clearing them thus regardless of their location. Although the game was not crashing due to previous work-arounds at this moment, this cleanup obliterates the most horrible hack and makes sure animations will never get stale. svn-id: r46095 --- engines/draci/game.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'engines/draci/game.cpp') diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 76594e78cb..dd4d6f7961 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -1157,11 +1157,13 @@ void Game::loadOverlays() { } void Game::deleteObjectAnimations() { + // Deallocate all animations, because their sound samples will not + // survive clearing the sound sample cache when changing the location. + // It's OK to unload them even if they are still in the inventory, + // because we only need their icons which survive. for (uint i = 1; i < _info._numObjects; ++i) { GameObject *obj = &_objects[i]; - if (obj->_location == getPreviousRoomNum()) { - obj->deleteAnims(); - } + obj->deleteAnims(); } // WORKAROUND @@ -1209,13 +1211,6 @@ void Game::deleteObjectAnimations() { // animations instead of listing what to deallocate. maybe simply // deallocate everything; reloading isn't that expensive. // - // 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 // memory completely on my own? -- cgit v1.2.3