View Single Post
Old 07-04-2003, 05:27 AM   #5 (permalink)
Stween
Registered User
 
Join Date: Jul 2003
Posts: 4
Stween is on a distinguished road
Quote:
Originally posted by EscapeCharacter
what format is the image? since you said it is included in a header file that makes me believe it may be a xpm which has its own xlib routines to handle it. libxpm and whatnot.
Ok, the map tiles themselves use a 256 colour palette which is selected from a 15-bit colour palette - this colour palette arranges colours as BGR (the reverse of what is normally used), with 5 bits per channel.

This is represented in the header file by an array of 256 16-bit unsigned numbers (presumably the most significant bit is ignored when looking at the 15-bits required for the colour).

What I'd be wanting to do would be read in both the tile data and the palette, and use the values in the tile data to lookup the appropriate palette colour and set the pixel to that.

In my mind, it's a really simple thing to achieve... The only hazy bit is the difference between the 15-bit palette the tiles are using and the 24-bit palette I'd probably have to represent it with, but even then, a couple of bit shifting operations to get the RGB fields in the correct place would allow me to see what tiles are where; I can probably overlook wonky colours there
Stween is offline   Reply With Quote