diff options
author | Eugene Sandulenko | 2019-07-13 16:04:05 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:19 +0200 |
commit | 62a6a3646322b4161233dee87270b27e316620bc (patch) | |
tree | b5d787cc1ba2cfd93b9a88501c8a53f4eb2de3f1 /engines/hdb | |
parent | 5fa5f6fb391449369e54836bf2c0f8e201a63691 (diff) | |
download | scummvm-rg350-62a6a3646322b4161233dee87270b27e316620bc.tar.gz scummvm-rg350-62a6a3646322b4161233dee87270b27e316620bc.tar.bz2 scummvm-rg350-62a6a3646322b4161233dee87270b27e316620bc.zip |
HDB: Complete Map::restartSystem()
Diffstat (limited to 'engines/hdb')
-rw-r--r-- | engines/hdb/gfx.cpp | 11 | ||||
-rw-r--r-- | engines/hdb/gfx.h | 2 | ||||
-rw-r--r-- | engines/hdb/map.cpp | 21 |
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; } |