diff options
author | Nipun Garg | 2019-06-21 04:53:22 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:16:53 +0200 |
commit | ec5fea4e97345ebbf456940b0b5e42df6f9e6491 (patch) | |
tree | 8ee241a46f998b1496094ff31388c5e08fcb4d4d /engines | |
parent | 5bf7e9c23d4347f598f7fffb29c01273a1a36e1e (diff) | |
download | scummvm-rg350-ec5fea4e97345ebbf456940b0b5e42df6f9e6491.tar.gz scummvm-rg350-ec5fea4e97345ebbf456940b0b5e42df6f9e6491.tar.bz2 scummvm-rg350-ec5fea4e97345ebbf456940b0b5e42df6f9e6491.zip |
HDB: Split getGfx() into getTileGfx and getPicGfx
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hdb/draw-manager.cpp | 35 | ||||
-rw-r--r-- | engines/hdb/draw-manager.h | 3 |
2 files changed, 34 insertions, 4 deletions
diff --git a/engines/hdb/draw-manager.cpp b/engines/hdb/draw-manager.cpp index 37d41c2a45..c716e6d661 100644 --- a/engines/hdb/draw-manager.cpp +++ b/engines/hdb/draw-manager.cpp @@ -169,13 +169,13 @@ Picture *DrawMan::getPicture(const char *name) { return picture; } -Tile *DrawMan::getGfx(const char *name, uint32 size) { +Tile *DrawMan::getTileGfx(const char *name, uint32 size) { // Try to find graphic for (Common::Array<GfxCache *>::iterator it = _gfxCache->begin(); it != _gfxCache->end(); it++) { if (Common::matchString((*it)->name, name)) { if ((*it)->loaded == -1) { // Marked for Deletetion? (*it)->loaded = 1; // Reactivate it - return (*it)->gfx; + return (*it)->tileGfx; } } } @@ -188,12 +188,41 @@ Tile *DrawMan::getGfx(const char *name, uint32 size) { Tile *gfxTile = new Tile; gfxTile->load(stream); + gc->tileGfx = gfxTile; gc->size = size; gc->loaded = 1; _gfxCache->push_back(gc); - return gc->gfx; + return gc->tileGfx; +} + +Picture *DrawMan::getPicGfx(const char *name, uint32 size) { + // Try to find graphic + for (Common::Array<GfxCache *>::iterator it = _gfxCache->begin(); it != _gfxCache->end(); it++) { + if (Common::matchString((*it)->name, name)) { + if ((*it)->loaded == -1) { // Marked for Deletetion? + (*it)->loaded = 1; // Reactivate it + return (*it)->picGfx; + } + } + } + + GfxCache *gc = new GfxCache; + strcpy(gc->name, name); + + Common::SeekableReadStream *stream = g_hdb->_fileMan->findFirstData(name, TYPE_TILE32); + + Picture *gfxPic = new Picture; + gfxPic->load(stream); + + gc->picGfx = gfxPic; + gc->size = size; + gc->loaded = 1; + + _gfxCache->push_back(gc); + + return gc->picGfx; } int DrawMan::isSky(int index) { diff --git a/engines/hdb/draw-manager.h b/engines/hdb/draw-manager.h index 012ef804f4..934a37acbe 100644 --- a/engines/hdb/draw-manager.h +++ b/engines/hdb/draw-manager.h @@ -82,7 +82,8 @@ public: int getTileIndex(const char *name); Picture *getPicture(const char *name); - Tile *getGfx(const char *name, uint32 size); + Tile *getTileGfx(const char *name, uint32 size); + Picture *getPicGfx(const char *name, uint32 size); int isSky(int skyIndex); void setSky(int skyIndex); |