aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Brown2002-09-23 15:43:29 +0000
committerJames Brown2002-09-23 15:43:29 +0000
commit412075437b712cdf91dae5c569026bd8c742a491 (patch)
treea183a0cce58a1a4dd009755e024c4c3aa966eecb
parent536692556b9495ac7cbb53e1275ad2e6aadf500b (diff)
downloadscummvm-rg350-412075437b712cdf91dae5c569026bd8c742a491.tar.gz
scummvm-rg350-412075437b712cdf91dae5c569026bd8c742a491.tar.bz2
scummvm-rg350-412075437b712cdf91dae5c569026bd8c742a491.zip
Patch #612847: Sam and Max painting subgame fix
svn-id: r5008
-rw-r--r--scumm/gfx.cpp20
-rw-r--r--scumm/script_v2.cpp15
-rw-r--r--scumm/scumm.h1
3 files changed, 31 insertions, 5 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index ce8e06c8af..30fce35d6a 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -2661,7 +2661,25 @@ void Scumm::swapPalColors(int a, int b)
ap[2] = bp[2];
bp[2] = t;
- setDirtyColors(a, b);
+ setDirtyColors(a, a);
+ setDirtyColors(b, b);
+}
+
+void Scumm::copyPalColor(int dst, int src)
+{
+ byte *dp, *sp;
+
+ if ((uint) dst >= 256 || (uint) src >= 256)
+ error("copyPalColor: invalid values, %d, %d", dst, src);
+
+ dp = &_currentPalette[dst * 3];
+ sp = &_currentPalette[src * 3];
+
+ dp[0] = sp[0];
+ dp[1] = sp[1];
+ dp[2] = sp[2];
+
+ setDirtyColors(dst, dst);
}
void Gdi::resetBackground(int top, int bottom, int strip)
diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp
index ac542d4ff7..8919b83604 100644
--- a/scumm/script_v2.cpp
+++ b/scumm/script_v2.cpp
@@ -2908,7 +2908,7 @@ void Scumm::o6_miscOps()
break;
case 123:
- swapPalColors(args[1], args[2]);
+ copyPalColor(args[2], args[1]);
break;
case 124: /* samnmax */
@@ -2932,9 +2932,16 @@ void Scumm::o6_kernelFunction()
switch (args[0]) {
case 113:
- // Do something to [1] x [2] (x/y)
- warning("o6_kernelFunction: stub113(%d,%d)", args[1], args[2]);
- push(0);
+ // This is used for the Sam & Max paint-by-numbers mini-game
+ // to find out what color to change. I think that what we have
+ // the virtual mouse coordinates, because that's what used
+ // everywhere else in the script.
+
+ if (args[1] != -1 && args[2] != -1) {
+ VirtScreen *vs = &virtscr[0];
+ push(vs->screenPtr[args[1] + args[2] * vs->width]);
+ } else
+ push(0);
break;
case 115:
push(getSpecialBox(args[1], args[2]));
diff --git a/scumm/scumm.h b/scumm/scumm.h
index 4a7537f92f..d28f65f0d6 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -800,6 +800,7 @@ public:
void setDirtyColors(int min, int max);
byte *findPalInPals(byte *pal, int index);
void swapPalColors(int a, int b);
+ void copyPalColor(int dst, int src);
void cyclePalette();
void stopCycle(int i);
void palManipulateInit(int start, int end, int string_id, int time);