diff options
author | Nipun Garg | 2019-07-18 19:08:59 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:23 +0200 |
commit | 05cb55b8883fdf4f6a44f285d29716d2d17da9c2 (patch) | |
tree | 4c6cdf2cf2524e9fb28beb5449edc4ccc2b1059e /engines | |
parent | fd91bb7f59ba6ac1b3be7bc245bc25042a05a464 (diff) | |
download | scummvm-rg350-05cb55b8883fdf4f6a44f285d29716d2d17da9c2.tar.gz scummvm-rg350-05cb55b8883fdf4f6a44f285d29716d2d17da9c2.tar.bz2 scummvm-rg350-05cb55b8883fdf4f6a44f285d29716d2d17da9c2.zip |
HDB: Delete Cached gfx data in one place
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hdb/ai-init.cpp | 26 | ||||
-rw-r--r-- | engines/hdb/ai.h | 2 | ||||
-rw-r--r-- | engines/hdb/gfx.cpp | 12 | ||||
-rw-r--r-- | engines/hdb/gfx.h | 3 |
4 files changed, 12 insertions, 31 deletions
diff --git a/engines/hdb/ai-init.cpp b/engines/hdb/ai-init.cpp index 6a470aa8d3..bc6ebeeffc 100644 --- a/engines/hdb/ai-init.cpp +++ b/engines/hdb/ai-init.cpp @@ -940,23 +940,7 @@ AI::~AI() { // Free Player Graphics for (int i = 0; i < 8; i++) { - delete _clubDownGfx[i]; - delete _clubUpGfx[i]; - delete _clubLeftGfx[i]; - delete _clubRightGfx[i]; delete _slugAttackGfx[i]; - delete _pushdownGfx[i]; - delete _pushupGfx[i]; - delete _pushleftGfx[i]; - delete _pushrightGfx[i]; - delete _stunDownGfx[i]; - delete _stunUpGfx[i]; - delete _stunLeftGfx[i]; - delete _stunRightGfx[i]; - delete _slugDownGfx[i]; - delete _slugUpGfx[i]; - delete _slugLeftGfx[i]; - delete _slugRightGfx[i]; } memset(_clubDownGfx, 0, sizeof(_clubDownGfx)); @@ -977,16 +961,6 @@ AI::~AI() { memset(_slugLeftGfx, 0, sizeof(_slugLeftGfx)); memset(_slugRightGfx, 0, sizeof(_slugRightGfx)); - // Free Player Death Graphics - for (int i = 0; i < 12; i++) { - delete _horrible1Gfx[i]; - delete _horrible2Gfx[i]; - delete _horrible3Gfx[i]; - delete _horrible4Gfx[i]; - delete _plummetGfx[i]; - delete _dyingGfx[i]; - } - memset(_horrible1Gfx, 0, sizeof(_horrible1Gfx)); memset(_horrible2Gfx, 0, sizeof(_horrible2Gfx)); memset(_horrible3Gfx, 0, sizeof(_horrible3Gfx)); diff --git a/engines/hdb/ai.h b/engines/hdb/ai.h index aa47996516..83fe88b9ff 100644 --- a/engines/hdb/ai.h +++ b/engines/hdb/ai.h @@ -633,9 +633,7 @@ struct DlvEnt { destGfxName[0] = 0; } ~DlvEnt() { - delete itemGfx; itemGfx = NULL; - delete destGfx; destGfx = NULL; } }; diff --git a/engines/hdb/gfx.cpp b/engines/hdb/gfx.cpp index 94c46bddf8..94ba77b604 100644 --- a/engines/hdb/gfx.cpp +++ b/engines/hdb/gfx.cpp @@ -42,8 +42,14 @@ Gfx::Gfx() { } Gfx::~Gfx() { - for (uint i = 0; i < _gfxCache->size(); i++) - delete _gfxCache->operator[](i); + for (uint i = 0; i < _gfxCache->size(); i++) { + GfxCache *cache = _gfxCache->operator[](i); + if (cache->status) + delete cache->picGfx; + else + delete cache->tileGfx; + delete cache; + } delete _gfxCache; for (uint i = 0; i < _charInfoBlocks.size(); i++) delete _charInfoBlocks[i]; @@ -544,6 +550,7 @@ Tile *Gfx::getTileGfx(const char *name, int32 size) { delete stream; gc->tileGfx = gfxTile; + gc->status = false; if (size == -1) size = g_hdb->_fileMan->getLength(name, TYPE_TILE32); gc->size = size; @@ -584,6 +591,7 @@ Picture *Gfx::getPicGfx(const char *name, int32 size) { delete stream; gc->picGfx = gfxPic; + gc->status = true; if (size == -1) size = g_hdb->_fileMan->getLength(name, TYPE_PIC); gc->size = size; diff --git a/engines/hdb/gfx.h b/engines/hdb/gfx.h index ce6ceb6502..73fb92a8ae 100644 --- a/engines/hdb/gfx.h +++ b/engines/hdb/gfx.h @@ -60,6 +60,7 @@ struct TileLookup { struct GfxCache { char name[32]; + bool status; // false = tileGfx, true = picGfx union { Tile *tileGfx; Picture *picGfx; @@ -67,7 +68,7 @@ struct GfxCache { uint32 size; int16 loaded; - GfxCache() : tileGfx(NULL), size(0), loaded(0) { name[0] = 0; } + GfxCache() : status(false), tileGfx(NULL), size(0), loaded(0) { name[0] = 0; } }; struct FontInfo { |