aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2016-05-10 17:40:09 +0200
committerEugene Sandulenko2016-05-10 18:07:36 +0200
commitaa875aefb2609ebea224f311638c8721711c5bb5 (patch)
tree4d8acce4db399a6d268f746abf1919314171232e
parent543920a1d672c13d6015bf0cedcf1ebe2f827270 (diff)
downloadscummvm-rg350-aa875aefb2609ebea224f311638c8721711c5bb5.tar.gz
scummvm-rg350-aa875aefb2609ebea224f311638c8721711c5bb5.tar.bz2
scummvm-rg350-aa875aefb2609ebea224f311638c8721711c5bb5.zip
SCUMM HE: Read FOW image from U32
-rw-r--r--engines/scumm/he/moonbase/moonbase.h1
-rw-r--r--engines/scumm/he/moonbase/moonbase_fow.cpp51
2 files changed, 12 insertions, 40 deletions
diff --git a/engines/scumm/he/moonbase/moonbase.h b/engines/scumm/he/moonbase/moonbase.h
index c312ddd758..b3223b6425 100644
--- a/engines/scumm/he/moonbase/moonbase.h
+++ b/engines/scumm/he/moonbase/moonbase.h
@@ -50,7 +50,6 @@ public:
void renderFOW(uint8 *destSurface, int dstPitch, int dstType, int dstw, int dsth, int flags);
private:
- bool captureFOWImageFromLocation(void *src);
int readFOWVisibilityArray(int array, int y, int x);
void renderFOWState(uint8 *destSurface, int dstPitch, int dstType, int dstw, int dsth, int x, int y, int srcw, int srch, int state, int flags);
diff --git a/engines/scumm/he/moonbase/moonbase_fow.cpp b/engines/scumm/he/moonbase/moonbase_fow.cpp
index e907449f13..4b7cb4b2de 100644
--- a/engines/scumm/he/moonbase/moonbase_fow.cpp
+++ b/engines/scumm/he/moonbase/moonbase_fow.cpp
@@ -69,25 +69,6 @@ void Moonbase::releaseFOWResources() {
}
}
-bool Moonbase::captureFOWImageFromLocation(void *src) {
- if (!src)
- return false;
-
- int imageDataSize = 0; //getMemoryBlockSize(src); // TODO
-
- if (imageDataSize <= 0)
- return false;
-
- _fowImage = (byte *)malloc(imageDataSize);
-
- if (!_fowImage)
- return false;
-
- memcpy(_fowImage, src, imageDataSize);
-
- return true;
-}
-
bool Moonbase::setFOWImage(int image) {
releaseFOWResources();
@@ -99,21 +80,21 @@ bool Moonbase::setFOWImage(int image) {
void *wiz = loadWizFromFilename(fowImageFilename);
if (wiz) {
- captureFOWImageFromLocation(wiz);
+ captureFOWImageFromLocation(wiz, file.size());
free(wiz);
}
}
#endif
if (!_fowImage && image < 0) {
- int resType;
+ int resId;
// PIECES BUBBLES CIRCLES SIMPLE* WEDGEY BUBBLE2
// WEDGE2 SPIKEY ANGLES SMOOTHED WUZZY SYS7-BEVELED
if (image >= -12 && image <= -1)
- resType = 210 - image; // 211-222 range
+ resId = 210 - image; // 211-222 range
else
- resType = 214; // default, SIMPLE
+ resId = 214; // default, SIMPLE
if (_fileName.empty()) { // We are running for the first time
_fileName = _vm->generateFilename(-3);
@@ -122,28 +103,20 @@ bool Moonbase::setFOWImage(int image) {
error("Cannot open file %s", _fileName.c_str());
}
-#if 0 // TODO
- HRSRC hResource = FindResource(g_hInst, resType, 10);
- if (hResource) {
- byte res = LoadResource(g_hInst, hResource);
+ Common::SeekableReadStream *stream = _exe.getResource(Common::kPERCData, resId);
- if (res) {
- uint16 nDataSize = SizeofResource(g_hInst, hResource);
+ if (stream->size()) {
+ _fowImage = (byte *)malloc(stream->size());
- if (nDataSize)
- captureFOWImageFromLocation(res);
- }
+ stream->read(_fowImage, stream->size());
}
-#endif
- }
- if (!_fowImage && image > 0) {
- void *glob = _vm->getResourceAddress(rtImage, image);
-
- if (glob)
- captureFOWImageFromLocation(glob);
+ delete stream;
}
+ if (!_fowImage && image > 0)
+ _fowImage = _vm->getResourceAddress(rtImage, image);
+
if (!_fowImage)
return false;
}