aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNipun Garg2019-06-07 22:28:45 +0530
committerEugene Sandulenko2019-09-03 17:16:44 +0200
commit33850b80d294b60e8f25a2f2475d1aa6267122eb (patch)
tree0dbe578feb2cd5657ecfc16b2c8caa5b56c715c4
parenta0b6b08ecd294003eaceb8b2aba037bb4d56f069 (diff)
downloadscummvm-rg350-33850b80d294b60e8f25a2f2475d1aa6267122eb.tar.gz
scummvm-rg350-33850b80d294b60e8f25a2f2475d1aa6267122eb.tar.bz2
scummvm-rg350-33850b80d294b60e8f25a2f2475d1aa6267122eb.zip
HDB: Add cacheTile() to load a Tile into memory
-rw-r--r--engines/hdb/draw-manager.cpp23
-rw-r--r--engines/hdb/draw-manager.h1
2 files changed, 24 insertions, 0 deletions
diff --git a/engines/hdb/draw-manager.cpp b/engines/hdb/draw-manager.cpp
index 564e178f35..85c313ab14 100644
--- a/engines/hdb/draw-manager.cpp
+++ b/engines/hdb/draw-manager.cpp
@@ -78,6 +78,29 @@ bool DrawMan::init() {
return true;
}
+bool DrawMan::cacheTile(int index) {
+
+ if (index < 0) {
+ return false;
+ }
+ if (index > _numTiles) {
+ return false;
+ }
+ if (_tLookupArray[index].skyIndex) {
+ // We don't draw Sky Tiles, so return true
+ return true;
+ }
+
+ if (_tLookupArray[index].tData == NULL) {
+ Common::SeekableReadStream *stream = g_hdb->_fileMan->findFirstData(_tLookupArray[index].filename, TYPE_TILE32);
+ Tile *tile = new Tile;
+ tile->load(stream);
+ _tLookupArray[index].tData = tile;
+ }
+
+ return true;
+}
+
Picture::~Picture() {
_surface.free();
}
diff --git a/engines/hdb/draw-manager.h b/engines/hdb/draw-manager.h
index 2c651dd816..fac91c78ad 100644
--- a/engines/hdb/draw-manager.h
+++ b/engines/hdb/draw-manager.h
@@ -48,6 +48,7 @@ public:
DrawMan();
bool init();
+ bool cacheTile(int index);
private:
int _numTiles;