Opened 17 years ago

Closed 17 years ago

Last modified 19 months ago

#8174 closed patch

CMI: Possible SO_ROOM_SATURATION implementation

Reported by: eriktorbjorn Owned by: fingolfin
Priority: normal Component: Engine: SCUMM
Keywords: Cc:
Game: Monkey Island 3

Description

This is an attempt at implementing what SO_ROOM_SATURATION might be meant to do. Fingolfin already guessed that it is similar to darkenPalette() in that it takes three scaling parameters and a palette range, but apparently wasn't sure how the scaling was done. Neither am I, but I'm guessing that it's the colour's hue, saturation and value (HSV) that are to be scaled.

CMI uses this opcode when Guybrush walks off the beach towards the swamp to make him sort of fade into the background mists.

It's not meant to be a definitive implementation. The result doesn't look quite like the original, and it uses floating-point math because I didn't want to stray too far from the description I had of the algorithm until I was more certain that I was using the right algorithm at all. I'll look into simplifying it later.

Ticket imported from: #686427. Ticket imported from: patches/279.

Attachments (2)

cmi-room-saturation.diff (5.5 KB ) - added by eriktorbjorn 17 years ago.
Patch against a February 12 CVS snapshot
cmi-room-saturation2.diff (4.4 KB ) - added by eriktorbjorn 17 years ago.
Patch against a February 19 CVS snapshot

Download all attachments as: .zip

Change History (6)

by eriktorbjorn, 17 years ago

Attachment: cmi-room-saturation.diff added

Patch against a February 12 CVS snapshot

comment:1 by fingolfin, 17 years ago

I recally endy gave me the disasm for this function... I am not sure, but it didn't really look like HSV operations. Might be wrong, though, but in any case this code should first be analyzed before we think of commiting this patch.

by eriktorbjorn, 17 years ago

Attachment: cmi-room-saturation2.diff added

Patch against a February 19 CVS snapshot

comment:2 by eriktorbjorn, 17 years ago

Since I'm not in any position to study, let alone understand, the original code, here's another experimental patch. This time I use Hue, Saturation and Lightness instead of Hue, Saturation and Value. The result is close enough to the original that I couldn't tell the difference just by looking at the resulting pictures.

As with the previous patch it's written to follow the algorithm description I found, so it's not in any way optimized. This is very much paint-by-numbers programming.

comment:3 by fingolfin, 17 years ago

Owner: set to fingolfin
Status: newclosed

comment:4 by digitall, 19 months ago

Component: Engine: SCUMM
Game: Monkey Island 3
Note: See TracTickets for help on using tickets.