Opened 22 years ago

Closed 22 years ago

Last modified 6 years ago

#8061 closed patch

SAM: paint-by-numbers fix

Reported by: eriktorbjorn Owned by: SF/ender
Priority: normal Component: Engine: SCUMM
Version: Keywords:
Cc: Game: Sam and Max

Description

This patch fixes the paint-by-number mini-game so that it works flawlessly for me. I'm still a bit concerned about the correctness of the patch, though. Here's what it does:

First of all, it implements the missing kernelFunction 113. It pushes the palette index of the pixel the mouse is currently over onto the stack. Since I still don't quite understand how VirtScreen works, I don't know if I got this right. I guess it also depends on whether it's the real or virtual mouse coordinates.

In doing this I uncovered a problem in swapPalColors(): When calling setDirtyColors(), it doesn't make sure the first parameter is smaller than the second one, and that can cause ScummVM to crash. I've changed it to dirty only the two colours in question, not every colour in between. (The way dirty colours are implemented it will dirty all those colours anyway, but that's beside the point.)

Finally, for the whole thing to work, miscOps 123 had to be changed to just copy one palette entry to another, not swap them. Otherwise the crayons will absorb the colour of everything they paint, which will eventually leave you with a box full of mostly black crayons. This change makes sense since there aready is a miscOps 120 for swapping colours, but since I don't know where else miscOps 123 is used I can't test if I accidentally broke anything else.

Apart from these caveats, the patch is complete and cleaned up.

Ticket imported from: #612847. Ticket imported from: patches/166.

Attachments (2)

painting.diff (2.4 KB ) - added by eriktorbjorn 22 years ago.
Patch against a September 21 CVS snapshot
samnmax.s35 (47.2 KB ) - added by eriktorbjorn 22 years ago.
Convenient savegame for testing

Download all attachments as: .zip

Change History (5)

by eriktorbjorn, 22 years ago

Attachment: painting.diff added

Patch against a September 21 CVS snapshot

by eriktorbjorn, 22 years ago

Attachment: samnmax.s35 added

Convenient savegame for testing

comment:1 by SF/ender, 22 years ago

Owner: set to SF/ender
Status: newclosed

comment:2 by SF/ender, 22 years ago

Looks good :)

miscOps 123 was only used there, and its implementation was just a total guess when I first coded it. I've never seen it used elsewhere, and I'm pretty sure thats the correct behavor anyway.

Thanks.

comment:3 by digitall, 6 years ago

Component: Engine: SCUMM
Game: Sam and Max
Note: See TracTickets for help on using tickets.