[Scummvm-cvs-logs] scummvm master -> 42db1618fdf5680a9204af1685abc5ba7fc262cb

sev- sev at scummvm.org
Wed May 11 11:23:27 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
42db1618fd SCUMM HE: Further work on Moonbase FOW. Now the game does not crash.


Commit: 42db1618fdf5680a9204af1685abc5ba7fc262cb
    https://github.com/scummvm/scummvm/commit/42db1618fdf5680a9204af1685abc5ba7fc262cb
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-05-11T10:46:01+02:00

Commit Message:
SCUMM HE: Further work on Moonbase FOW. Now the game does not crash.

Changed paths:
    engines/scumm/he/logic/moonbase_logic.cpp
    engines/scumm/he/moonbase/moonbase_fow.cpp
    engines/scumm/he/wiz_he.cpp
    engines/scumm/he/wiz_he.h



diff --git a/engines/scumm/he/logic/moonbase_logic.cpp b/engines/scumm/he/logic/moonbase_logic.cpp
index 4483f1a..a323566 100644
--- a/engines/scumm/he/logic/moonbase_logic.cpp
+++ b/engines/scumm/he/logic/moonbase_logic.cpp
@@ -191,7 +191,9 @@ void LogicHEmoonbase::op_set_fow_sentinel(int32 *args) {
 }
 
 void LogicHEmoonbase::op_set_fow_information(int op, int numArgs, int32 *args) {
-	Common::String str("op_set_fow_information(%d", args[0]);
+	Common::String str;
+
+	str = Common::String::format("op_set_fow_information(%d", args[0]);
 	for (int i = 1; i < numArgs; i++) {
 		str += Common::String::format(", %d", args[i]);
 	}
diff --git a/engines/scumm/he/moonbase/moonbase_fow.cpp b/engines/scumm/he/moonbase/moonbase_fow.cpp
index 4b7cb4b..d7726e4 100644
--- a/engines/scumm/he/moonbase/moonbase_fow.cpp
+++ b/engines/scumm/he/moonbase/moonbase_fow.cpp
@@ -130,16 +130,8 @@ bool Moonbase::setFOWImage(int image) {
 
 	_fowAnimationFrames = (nStates + FOW_ANIM_FRAME_COUNT - 1) / FOW_ANIM_FRAME_COUNT;
 
-	Common::Point fowTileSize(0, 0); //getWizStateSize(_fowImage, (nStates - 1)); // TODO
-
-	_fowTileW = fowTileSize.x;
-	_fowTileH = fowTileSize.y;
-
-	int hitTestValue = 0;
-	uint pixelValue = 0;
-
-	//LayeredWizHitTest(&hitTestValue, &pixelValue, _fowImage, (nStates - 1), 0, 0, 0, 0); // TODO
-	_fowBlackMode = (pixelValue == 0) ? 1 : 0;
+	_vm->_wiz->getWizImageDim(_fowImage, (nStates - 1), _fowTileW, _fowTileH);
+	_fowBlackMode = !_vm->_wiz->isWizPixelNonTransparent(_fowImage, nStates - 1, 0, 0, 0);
 
 	if (ConfMan.hasKey("EnableFOWRects"))
 		_fowBlackMode = (ConfMan.getInt("EnableFOWRects") == 1);
@@ -166,7 +158,7 @@ enum FOWElement {
 };
 
 int Moonbase::readFOWVisibilityArray(int array, int y, int x) {
-	//_vm->VAR(_vm->VAR_U32_ARRAY_UNK) = array; // TODO
+	_vm->VAR(116) = array;
 
 	if (_vm->readArray(116, y, x) > 0)
 		return FOW_EMPTY;
@@ -332,7 +324,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;
 
-	_vm->_wiz->getWizStateSpot(_fowImage, state, &spotx, &spoty);
+	_vm->_wiz->getWizImageSpot(_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 4f4bfa1..361c53f 100644
--- a/engines/scumm/he/wiz_he.cpp
+++ b/engines/scumm/he/wiz_he.cpp
@@ -977,7 +977,7 @@ void Wiz::decompressRawWizImage(uint8 *dst, int dstPitch, int dstType, const uin
 	}
 }
 
-int Wiz::isWizPixelNonTransparent(const uint8 *data, int x, int y, int w, int h, uint8 bitDepth) {
+int Wiz::isPixelNonTransparent(const uint8 *data, int x, int y, int w, int h, uint8 bitDepth) {
 	if (x < 0 || x >= w || y < 0 || y >= h) {
 		return 0;
 	}
@@ -2699,6 +2699,10 @@ void Wiz::processWizImage(const WizParameters *params) {
 void Wiz::getWizImageDim(int resNum, int state, int32 &w, int32 &h) {
 	uint8 *dataPtr = _vm->getResourceAddress(rtImage, resNum);
 	assert(dataPtr);
+	getWizImageDim(dataPtr, state, w, h);
+}
+
+void Wiz::getWizImageDim(uint8 *dataPtr, int state, int32 &w, int32 &h) {
 	uint8 *wizh = _vm->findWrappedBlock(MKTAG('W','I','Z','H'), dataPtr, state, 0);
 	assert(wizh);
 	w = READ_LE_UINT32(wizh + 0x4);
@@ -2708,6 +2712,10 @@ void Wiz::getWizImageDim(int resNum, int state, int32 &w, int32 &h) {
 void Wiz::getWizImageSpot(int resId, int state, int32 &x, int32 &y) {
 	uint8 *dataPtr = _vm->getResourceAddress(rtImage, resId);
 	assert(dataPtr);
+	getWizImageSpot(dataPtr, state, x, y);
+}
+
+void Wiz::getWizImageSpot(uint8 *dataPtr, int state, int32 &x, int32 &y) {
 	uint8 *spotPtr = _vm->findWrappedBlock(MKTAG('S','P','O','T'), dataPtr, state, 0);
 	if (spotPtr) {
 		x = READ_LE_UINT32(spotPtr + 0);
@@ -2767,22 +2775,15 @@ int Wiz::getWizImageStates(const uint8 *dataPtr) {
 	}
 }
 
-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;
-	}
+int Wiz::isWizPixelNonTransparent(int resNum, int state, int x, int y, int flags) {
+	uint8 *data = _vm->getResourceAddress(rtImage, resNum);
+	assert(data);
 
-	*x = READ_LE_UINT32(spot + 0x0);
-	*y = READ_LE_UINT32(spot + 0x4);
+	return isWizPixelNonTransparent(data, state, x, y, flags);
 }
 
-int Wiz::isWizPixelNonTransparent(int resNum, int state, int x, int y, int flags) {
+int Wiz::isWizPixelNonTransparent(uint8 *data, int state, int x, int y, int flags) {
 	int ret = 0;
-	uint8 *data = _vm->getResourceAddress(rtImage, resNum);
-	assert(data);
 	uint8 *wizh = _vm->findWrappedBlock(MKTAG('W','I','Z','H'), data, state, 0);
 	assert(wizh);
 	int c = READ_LE_UINT32(wizh + 0x0);
@@ -2806,7 +2807,7 @@ int Wiz::isWizPixelNonTransparent(int resNum, int state, int x, int y, int flags
 			}
 			break;
 		case 1:
-			ret = isWizPixelNonTransparent(wizd, x, y, w, h, 1);
+			ret = isPixelNonTransparent(wizd, x, y, w, h, 1);
 			break;
 #ifdef USE_RGB_COLOR
 		case 2:
@@ -2819,7 +2820,7 @@ int Wiz::isWizPixelNonTransparent(int resNum, int state, int x, int y, int flags
 			break;
 		}
 		case 5:
-			ret = isWizPixelNonTransparent(wizd, x, y, w, h, 2);
+			ret = isPixelNonTransparent(wizd, x, y, w, h, 2);
 			break;
 #endif
 		default:
diff --git a/engines/scumm/he/wiz_he.h b/engines/scumm/he/wiz_he.h
index ff5169f..692ad76 100644
--- a/engines/scumm/he/wiz_he.h
+++ b/engines/scumm/he/wiz_he.h
@@ -220,16 +220,19 @@ public:
 	void remapWizImagePal(const WizParameters *params);
 
 	void getWizImageDim(int resNum, int state, int32 &w, int32 &h);
+	void getWizImageDim(uint8 *dataPtr, 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);
+	int isWizPixelNonTransparent(uint8 *data, int state, int x, int y, int flags);
+	int isPixelNonTransparent(const uint8 *data, int x, int y, int w, int h, uint8 bitdepth);
 	uint16 getWizPixelColor(int resnum, int state, int x, int y);
 	int getWizImageData(int resNum, int state, int type);
 
 	void flushWizBuffer();
 
 	void getWizImageSpot(int resId, int state, int32 &x, int32 &y);
+	void getWizImageSpot(uint8 *data, int state, int32 &x, int32 &y);
 	void loadWizCursor(int resId, int palette);
 
 	void captureWizImage(int resNum, const Common::Rect& r, bool frontBuffer, int compType);
@@ -274,7 +277,6 @@ public:
 	template<int type> static void write8BitColor(uint8 *dst, const uint8 *src, int dstType, const uint8 *palPtr, const uint8 *xmapPtr, uint8 bitDepth);
 	static void writeColor(uint8 *dstPtr, int dstType, uint16 color);
 
-	int isWizPixelNonTransparent(const uint8 *data, int x, int y, int w, int h, uint8 bitdepth);
 	uint16 getWizPixelColor(const uint8 *data, int x, int y, int w, int h, uint8 bitDepth, uint16 color);
 	uint16 getRawWizPixelColor(const uint8 *data, int x, int y, int w, int h, uint8 bitDepth, uint16 color);
 	void computeWizHistogram(uint32 *histogram, const uint8 *data, const Common::Rect& rCapt);






More information about the Scummvm-git-logs mailing list