View Full Version : Charset - help needed

09-19-2004, 07:31 AM
After messing with Antti's Character Set Viewer (http://www.lucasforums.com/showthread.php?s=&threadid=82789) I decided to knock up a quick version of my own. (http://quick.mixnmojo.com/charset.gif)

The specs as set out in various places are:

4 bytes Header
4 bytes BE Size
6 bytes Unknown
15 bytes Colour Map
1 byte Bits per pixel
1 byte Max char height?
1 byte No chars
1 byte Unknown

4 bytes * NoChars Character Offsets
if NoChars=0 then NoChars=256
Character Offsets are relative to the end of the Colour Map data (byte 29)

Individual char data:
1 byte Char width
1 byte Char height
1 byte X offset
1 byte Y offset
x bits Data bitstream

Thats all fine, but I dont know how to choose the correct colours for the character data. At 1bpp theres 2 possible colours, at 2bpp 4 and at 4bpp 16.

I can guess at colour values of course, but I'm unsure as to how the colour values are obtained or how they relate to the colour map. I've got a nasty suspicion that the colours are set in the game scripts and that they specify what colour values go into the colourmap but of course I dont really know.

If anyone could explain this to me, or work out the answer from the scummvm source it'd be much appreciated :)

Oh, I'm also unsure what bits map to which colour in the colourmap at 4bpp. I've looked at the ScummVM source for all this, but being ignorant of C++ I couldnt figure it out..

09-19-2004, 12:36 PM
you may be right about the color being controlled by script. MI2, when Lechuck comes in in Guybrush's dream, he's suspiciously wearing a blue coat, for no reason. Unless I missed something?

09-19-2004, 07:43 PM
In the case of a 1BPP image (thru to SCUMM V4), the only colour used is the talkColour set by the script. Yes, this is script controlled.

In the case of 2BPP-8BPP fonts (SCUMM5+), the first indexed colour is the talkColour. The others are mapped somehow, I think into the font data itself.

map[...] = ??
map[1] = talkColor;

(do RLE loop and stuff...)
color = (bits >> (8 - bpp)) & 0xFF;
if (color) {

09-20-2004, 03:24 AM
Cheers Endy, I'll have a go at that :)