aboutsummaryrefslogtreecommitdiff
path: root/engines/draci
diff options
context:
space:
mode:
authorRobert Špalek2009-11-22 20:17:39 +0000
committerRobert Špalek2009-11-22 20:17:39 +0000
commit00063b142303483cfea7fc2522ac45daaa7025f4 (patch)
treeb5d6dce8d11bceecbccbfd510e838ed77e4e1f43 /engines/draci
parent3d687d07f5d57b61fe2a454e6ec05667125dad00 (diff)
downloadscummvm-rg350-00063b142303483cfea7fc2522ac45daaa7025f4.tar.gz
scummvm-rg350-00063b142303483cfea7fc2522ac45daaa7025f4.tar.bz2
scummvm-rg350-00063b142303483cfea7fc2522ac45daaa7025f4.zip
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
Diffstat (limited to 'engines/draci')
-rw-r--r--engines/draci/game.cpp15
1 files changed, 5 insertions, 10 deletions
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?