aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/hdb/gfx.cpp11
-rw-r--r--engines/hdb/gfx.h2
-rw-r--r--engines/hdb/map.cpp21
3 files changed, 32 insertions, 2 deletions
diff --git a/engines/hdb/gfx.cpp b/engines/hdb/gfx.cpp
index 19109c368c..94b8922293 100644
--- a/engines/hdb/gfx.cpp
+++ b/engines/hdb/gfx.cpp
@@ -406,7 +406,7 @@ Tile *Gfx::getTile(int index) {
}
void Gfx::emptyGfxCaches() {
- warning("STUB: mptyGfxCaches()");
+ // We have plenty of memory, so do not do it
}
void Gfx::cacheTileSequence(int tileIndex, int count) {
@@ -510,6 +510,15 @@ Tile *Gfx::getTileGfx(const char *name, int32 size) {
return gc->tileGfx;
}
+void Gfx::markGfxCacheFreeable() {
+ for (Common::Array<GfxCache *>::iterator it = _gfxCache->begin(); it != _gfxCache->end(); it++)
+ (*it)->loaded = -1;
+}
+
+void Gfx::markTileCacheFreeable() {
+ // we have plenty of memory, so do not do it
+}
+
Picture *Gfx::getPicGfx(const char *name, int32 size) {
// Try to find graphic
for (Common::Array<GfxCache *>::iterator it = _gfxCache->begin(); it != _gfxCache->end(); it++) {
diff --git a/engines/hdb/gfx.h b/engines/hdb/gfx.h
index 36204c59f9..59d44fb39a 100644
--- a/engines/hdb/gfx.h
+++ b/engines/hdb/gfx.h
@@ -122,6 +122,8 @@ public:
Picture *getPicture(const char *name);
void emptyGfxCaches();
+ void markTileCacheFreeable();
+ void markGfxCacheFreeable();
// Returns: true->Tile, false->Pic
bool selectGfxType(const char *name);
diff --git a/engines/hdb/map.cpp b/engines/hdb/map.cpp
index 5f76a0dacb..8f53524cb8 100644
--- a/engines/hdb/map.cpp
+++ b/engines/hdb/map.cpp
@@ -217,7 +217,22 @@ int Map::loadTiles() {
}
void Map::restartSystem() {
- warning("STUB: Map::restartSystem()");
+ _listBGAnimFast.clear();
+ _listBGAnimMedium.clear();
+ _listBGAnimSlow.clear();
+ _listFGAnimFast.clear();
+ _listFGAnimMedium.clear();
+ _listFGAnimSlow.clear();
+
+ delete _background;
+ _background = NULL;
+ delete _foreground;
+ _foreground = NULL;
+ delete _iconList;
+ _iconList = NULL;
+
+ _width = _height = 0;
+ _animCycle = 0;
free(_mapExplosions);
free(_mapExpBarrels);
@@ -227,6 +242,10 @@ void Map::restartSystem() {
_mapExpBarrels = NULL;
_mapLaserBeams = NULL;
+ // mark all in-memory tiles as being in memory, but able to be freed
+ g_hdb->_gfx->markTileCacheFreeable();
+ g_hdb->_gfx->markGfxCacheFreeable();
+
_mapLoaded = false;
}