aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb
diff options
context:
space:
mode:
authorNipun Garg2019-06-20 05:15:47 +0530
committerEugene Sandulenko2019-09-03 17:16:51 +0200
commitf6fe88bab927a3d5aa523ca8847fd68828c09722 (patch)
treec17a5d04cdf280c2f41df4b9b7c142a9463d0a3b /engines/hdb
parent898d32e1dec832266265b66119fb802fb59989c3 (diff)
downloadscummvm-rg350-f6fe88bab927a3d5aa523ca8847fd68828c09722.tar.gz
scummvm-rg350-f6fe88bab927a3d5aa523ca8847fd68828c09722.tar.bz2
scummvm-rg350-f6fe88bab927a3d5aa523ca8847fd68828c09722.zip
HDB: Add getGfx to get and cache Gfx files
Diffstat (limited to 'engines/hdb')
-rw-r--r--engines/hdb/draw-manager.cpp27
-rw-r--r--engines/hdb/draw-manager.h2
2 files changed, 29 insertions, 0 deletions
diff --git a/engines/hdb/draw-manager.cpp b/engines/hdb/draw-manager.cpp
index 479e39cdc6..b73b9471b1 100644
--- a/engines/hdb/draw-manager.cpp
+++ b/engines/hdb/draw-manager.cpp
@@ -169,6 +169,33 @@ Picture *DrawMan::getPicture(const char *name) {
return picture;
}
+Tile *DrawMan::getGfx(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;
+ }
+ }
+ }
+
+ GfxCache *gc = new GfxCache;
+ strcpy(gc->name, name);
+
+ Common::SeekableReadStream *stream = g_hdb->_fileMan->findFirstData(name, TYPE_TILE32);
+
+ Tile *gfxTile = new Tile;
+ gfxTile->load(stream);
+
+ gc->size = size;
+ gc->loaded = 1;
+
+ _gfxCache->push_back(gc);
+
+ return gc->gfx;
+}
+
int DrawMan::isSky(int index) {
if (!index) {
return 0;
diff --git a/engines/hdb/draw-manager.h b/engines/hdb/draw-manager.h
index 101da99995..c05c7e94a9 100644
--- a/engines/hdb/draw-manager.h
+++ b/engines/hdb/draw-manager.h
@@ -79,6 +79,8 @@ public:
int getTileIndex(const char *name);
Picture *getPicture(const char *name);
+ Tile *getGfx(const char *name, uint32 size);
+
int isSky(int skyIndex);
void setSky(int skyIndex);
void setup3DStars();