[Scummvm-cvs-logs] scummvm master -> 084b2deccc7eeb64f2936dbb6cd0fb47319e5db2

bluegr md5 at scummvm.org
Wed Oct 12 02:01:19 CEST 2011


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

Summary:
c5e6cdea55 SCI: 3 Uninitialized read workarounds for Shivers
084b2deccc SCI: Implementation of kCelInfo subop 4


Commit: c5e6cdea551f34fd78ab23411d76724959d597a8
    https://github.com/scummvm/scummvm/commit/c5e6cdea551f34fd78ab23411d76724959d597a8
Author: Heather Douglass (heather.douglass at gmail.com)
Date: 2011-10-11T16:47:26-07:00

Commit Message:
SCI: 3 Uninitialized read workarounds for Shivers

Changed paths:
    engines/sci/engine/workarounds.cpp



diff --git a/engines/sci/engine/workarounds.cpp b/engines/sci/engine/workarounds.cpp
index 90b685e..ce65520 100644
--- a/engines/sci/engine/workarounds.cpp
+++ b/engines/sci/engine/workarounds.cpp
@@ -155,6 +155,9 @@ const SciWorkaroundEntry uninitializedReadWorkarounds[] = {
 	{ GID_SHIVERS,        -1,   952,  0,       "SoundManager", "stop",           -1,    2, { WORKAROUND_FAKE,   0 } }, // Just after Sierra logo
 	{ GID_SHIVERS,        -1, 64950,  0,            "Feature", "handleEvent",    -1,    0, { WORKAROUND_FAKE,   0 } }, // When clicking on the locked door at the beginning
 	{ GID_SHIVERS,        -1, 64950,  0,               "View", "handleEvent",    -1,    0, { WORKAROUND_FAKE,   0 } }, // When clicking on the gargoyle eye at the beginning
+	{ GID_SHIVERS,     20311, 64964,  0,              "DPath", "init",           -1,    1, { WORKAROUND_FAKE,   0 } }, // Just after door puzzle is solved and the metal balls start to roll
+	{ GID_SHIVERS,     29260, 29260,  0,             "spMars", "handleEvent",    -1,    4, { WORKAROUND_FAKE,   0 } }, // When clicking mars after seeing fortune to align earth etc...
+	{ GID_SHIVERS,     29260, 29260,  0,            "spVenus", "handleEvent",    -1,    4, { WORKAROUND_FAKE,   0 } }, // When clicking venus after seeing fortune to align earth etc...
 	{ GID_SQ1,           103,   103,  0,               "hand", "internalEvent",  -1,   -1, { WORKAROUND_FAKE,   0 } }, // Spanish (and maybe early versions?) only: when moving cursor over input pad, temps 1 and 2
 	{ GID_SQ1,            -1,   703,  0,                   "", "export 1",       -1,    0, { WORKAROUND_FAKE,   0 } }, // sub that's called from several objects while on sarien battle cruiser
 	{ GID_SQ1,            -1,   703,  0,         "firePulsar", "changeState", 0x18a,    0, { WORKAROUND_FAKE,   0 } }, // export 1, but called locally (when shooting at aliens)


Commit: 084b2deccc7eeb64f2936dbb6cd0fb47319e5db2
    https://github.com/scummvm/scummvm/commit/084b2deccc7eeb64f2936dbb6cd0fb47319e5db2
Author: Heather Douglass (heather.douglass at gmail.com)
Date: 2011-10-11T16:50:28-07:00

Commit Message:
SCI: Implementation of kCelInfo subop 4

kCelInfo subop 4 returns the pixel color at the
passed in x,y coordinates for the passed in view,
loop, cel.  Shivers uses this function for the
red door puzzle, room 23601 to determine what
blocks on the puzzle board are already occupied
by pieces.

Changed paths:
    engines/sci/engine/kgraphics.cpp
    engines/sci/graphics/cache.cpp
    engines/sci/graphics/cache.h
    engines/sci/graphics/view.cpp
    engines/sci/graphics/view.h



diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index c60c0a4..ce670b2 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -1471,10 +1471,8 @@ reg_t kSetShowStyle(EngineState *s, int argc, reg_t *argv) {
 }
 
 reg_t kCelInfo(EngineState *s, int argc, reg_t *argv) {
-	// TODO: This is all a stub/skeleton, thus we're invoking kStub() for now
-	kStub(s, argc, argv);
-
-	// Used by Shivers 1, room 23601
+	// Used by Shivers 1, room 23601 to determine what blocks on the red door puzzle board
+	// are occupied by pieces already
 
 	// 6 arguments, all integers:
 	// argv[0] - subop (0 - 4). It's constantly called with 4 in Shivers 1
@@ -1490,7 +1488,21 @@ reg_t kCelInfo(EngineState *s, int argc, reg_t *argv) {
 	// 2, 3 - nop
 	// 4 - return value of pixel at x, y
 
-	return s->r_acc;
+	switch (argv[0].toUint16()) {
+		case 4: {
+			GuiResourceId viewId = argv[1].toSint16();
+			int16 loopNo = argv[2].toSint16();
+			int16 celNo = argv[3].toSint16();
+			int16 x = argv[4].toUint16();
+			int16 y = argv[5].toUint16();
+			byte color = g_sci->_gfxCache->kernelViewGetColorAtCoordinate(viewId, loopNo, celNo, x, y);
+			return make_reg(0, color);
+		}
+		default: {
+			kStub(s, argc, argv);
+			return s->r_acc;
+		}
+	}
 }
 
 reg_t kScrollWindow(EngineState *s, int argc, reg_t *argv) {
diff --git a/engines/sci/graphics/cache.cpp b/engines/sci/graphics/cache.cpp
index d2bd76a..55f8624 100644
--- a/engines/sci/graphics/cache.cpp
+++ b/engines/sci/graphics/cache.cpp
@@ -102,4 +102,8 @@ int16 GfxCache::kernelViewGetCelCount(GuiResourceId viewId, int16 loopNo) {
 	return getView(viewId)->getCelCount(loopNo);
 }
 
+byte GfxCache::kernelViewGetColorAtCoordinate(GuiResourceId viewId, int16 loopNo, int16 celNo, int16 x, int16 y) {
+	return getView(viewId)->getColorAtCoordinate(loopNo, celNo, x, y);
+}
+
 } // End of namespace Sci
diff --git a/engines/sci/graphics/cache.h b/engines/sci/graphics/cache.h
index c090cda..2f462fe 100644
--- a/engines/sci/graphics/cache.h
+++ b/engines/sci/graphics/cache.h
@@ -49,6 +49,8 @@ public:
 	int16 kernelViewGetLoopCount(GuiResourceId viewId);
 	int16 kernelViewGetCelCount(GuiResourceId viewId, int16 loopNo);
 
+	byte kernelViewGetColorAtCoordinate(GuiResourceId viewId, int16 loopNo, int16 celNo, int16 x, int16 y);
+
 private:
 	void purgeFontCache();
 	void purgeViewCache();
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index a0d5b51..d5c52bf 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -837,4 +837,13 @@ void GfxView::adjustBackUpscaledCoordinates(int16 &y, int16 &x) {
 	_screen->adjustBackUpscaledCoordinates(y, x, _sci2ScaleRes);
 }
 
+byte GfxView::getColorAtCoordinate(int16 loopNo, int16 celNo, int16 x, int16 y) {
+	const CelInfo *celInfo = getCelInfo(loopNo, celNo);
+	const byte *bitmap = getBitmap(loopNo, celNo);
+	const int16 celWidth = celInfo->width;
+
+	bitmap += (celWidth * y);
+	return bitmap[x];
+}
+
 } // End of namespace Sci
diff --git a/engines/sci/graphics/view.h b/engines/sci/graphics/view.h
index 19ef2e6..d3473f1 100644
--- a/engines/sci/graphics/view.h
+++ b/engines/sci/graphics/view.h
@@ -85,6 +85,8 @@ public:
 	void adjustToUpscaledCoordinates(int16 &y, int16 &x);
 	void adjustBackUpscaledCoordinates(int16 &y, int16 &x);
 
+	byte getColorAtCoordinate(int16 loopNo, int16 celNo, int16 x, int16 y);
+
 private:
 	void initData(GuiResourceId resourceId);
 	void unpackCel(int16 loopNo, int16 celNo, byte *outPtr, uint32 pixelCount);






More information about the Scummvm-git-logs mailing list