From 9b6e83451fe5dc24801e6c6ea1bf0116b5b6fd7d Mon Sep 17 00:00:00 2001 From: Nipun Garg Date: Thu, 4 Jul 2019 01:19:13 +0530 Subject: HDB: Add check for unknown size --- engines/hdb/gfx.cpp | 8 ++++++-- engines/hdb/gfx.h | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'engines/hdb') diff --git a/engines/hdb/gfx.cpp b/engines/hdb/gfx.cpp index a17eab6f03..2f3e501d7d 100644 --- a/engines/hdb/gfx.cpp +++ b/engines/hdb/gfx.cpp @@ -308,7 +308,7 @@ bool Gfx::selectGfxType(const char *name) { return true; } -Tile *Gfx::getTileGfx(const char *name, uint32 size) { +Tile *Gfx::getTileGfx(const char *name, int32 size) { // Try to find graphic for (Common::Array::iterator it = _gfxCache->begin(); it != _gfxCache->end(); it++) { if (Common::matchString((*it)->name, name)) { @@ -328,6 +328,8 @@ Tile *Gfx::getTileGfx(const char *name, uint32 size) { gfxTile->load(stream); gc->tileGfx = gfxTile; + if (size == -1) + size = g_hdb->_fileMan->getLength(name, TYPE_TILE32); gc->size = size; gc->loaded = 1; @@ -336,7 +338,7 @@ Tile *Gfx::getTileGfx(const char *name, uint32 size) { return gc->tileGfx; } -Picture *Gfx::getPicGfx(const char *name, uint32 size) { +Picture *Gfx::getPicGfx(const char *name, int32 size) { // Try to find graphic for (Common::Array::iterator it = _gfxCache->begin(); it != _gfxCache->end(); it++) { if (Common::matchString((*it)->name, name)) { @@ -356,6 +358,8 @@ Picture *Gfx::getPicGfx(const char *name, uint32 size) { gfxPic->load(stream); gc->picGfx = gfxPic; + if (size == -1) + size = g_hdb->_fileMan->getLength(name, TYPE_PIC); gc->size = size; gc->loaded = 1; diff --git a/engines/hdb/gfx.h b/engines/hdb/gfx.h index fb26fe4e04..41277a1e4c 100644 --- a/engines/hdb/gfx.h +++ b/engines/hdb/gfx.h @@ -121,8 +121,8 @@ public: // Returns: true->Tile, false->Pic bool selectGfxType(const char *name); - Tile *getTileGfx(const char *name, uint32 size); - Picture *getPicGfx(const char *name, uint32 size); + Tile *getTileGfx(const char *name, int32 size); + Picture *getPicGfx(const char *name, int32 size); int isSky(int skyIndex); void setSky(int skyIndex); -- cgit v1.2.3