From fc198503c8aae9eaa34345e9dab5822518856a9d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 10 May 2016 11:55:49 +0200 Subject: SCUMM HE: Resolved couple of TODOs in Moonbase FOW code --- engines/scumm/he/moonbase/moonbase_fow.cpp | 4 ++-- engines/scumm/he/wiz_he.cpp | 17 +++++++++++++++++ engines/scumm/he/wiz_he.h | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/engines/scumm/he/moonbase/moonbase_fow.cpp b/engines/scumm/he/moonbase/moonbase_fow.cpp index 7693d4dd24..f76bebf89e 100644 --- a/engines/scumm/he/moonbase/moonbase_fow.cpp +++ b/engines/scumm/he/moonbase/moonbase_fow.cpp @@ -138,7 +138,7 @@ bool Moonbase::setFOWImage(int image) { return false; } - int nStates = _vm->_wiz->getWizImageStates(0); //_fowImage); // TODO + int nStates = _vm->_wiz->getWizImageStates(_fowImage); if (nStates > FOW_ANIM_FRAME_COUNT) { releaseFOWResources(); @@ -349,7 +349,7 @@ void Moonbase::setFOWInfo(int fowInfoArray, int downDim, int acrossDim, int view void Moonbase::renderFOWState(uint8 *destSurface, int dstPitch, int dstType, int dstw, int dsth, int x, int y, int srcw, int srch, int state, int flags) { int spotx, spoty; - //getWizImageSpot(_fowImage, state, &spotx, &spoty); // TODO + _vm->_wiz->getWizStateSpot(_fowImage, state, &spotx, &spoty); Common::Rect r(_fowClipX1, _fowClipY1, _fowClipX2, _fowClipY2); _vm->_wiz->drawWizImageEx(destSurface, _fowImage, 0, dstPitch, dstType, dstw, dsth, x - spotx, y - spoty, srcw, srch, state, &r, flags, 0, 0, 16, 0, 0); diff --git a/engines/scumm/he/wiz_he.cpp b/engines/scumm/he/wiz_he.cpp index 94d5938724..9a5be1cc5f 100644 --- a/engines/scumm/he/wiz_he.cpp +++ b/engines/scumm/he/wiz_he.cpp @@ -2744,6 +2744,11 @@ int Wiz::getWizImageData(int resNum, int state, int type) { int Wiz::getWizImageStates(int resNum) { const uint8 *dataPtr = _vm->getResourceAddress(rtImage, resNum); assert(dataPtr); + + return getWizImageStates(dataPtr); +} + +int Wiz::getWizImageStates(const uint8 *dataPtr) { if (READ_BE_UINT32(dataPtr) == MKTAG('M','U','L','T')) { const byte *offs, *wrap; @@ -2761,6 +2766,18 @@ int Wiz::getWizImageStates(int resNum) { } } +void Wiz::getWizStateSpot(byte *data, int state, int *x, int *y) { + byte *spot = _vm->findWrappedBlock(MKTAG('S','P','O','T'), data, state, 0); + + if (!spot) { + *x = *y = 0; + return; + } + + *x = READ_LE_UINT32(spot + 0x0); + *y = READ_LE_UINT32(spot + 0x4); +} + int Wiz::isWizPixelNonTransparent(int resNum, int state, int x, int y, int flags) { int ret = 0; uint8 *data = _vm->getResourceAddress(rtImage, resNum); diff --git a/engines/scumm/he/wiz_he.h b/engines/scumm/he/wiz_he.h index 202f774560..ff5169f7e8 100644 --- a/engines/scumm/he/wiz_he.h +++ b/engines/scumm/he/wiz_he.h @@ -221,6 +221,8 @@ public: void getWizImageDim(int resNum, int state, int32 &w, int32 &h); int getWizImageStates(int resnum); + int getWizImageStates(const uint8 *ptr); + void getWizStateSpot(byte *data, int state, int *x, int *y); int isWizPixelNonTransparent(int resnum, int state, int x, int y, int flags); uint16 getWizPixelColor(int resnum, int state, int x, int y); int getWizImageData(int resNum, int state, int type); -- cgit v1.2.3