|
Post by Tedmilk on Oct 28, 2009 19:05:50 GMT
I'm using the 256 color palette that someone saved as a gimp palette and it's working beautifully with all the in-level graphics and menu backgrounds, but for the fonts and title screen, for example, the colors are all off.
For example, on the main menu screen the font color is close to the palette I'm using, but not exact. And the purple text that is rendered above that purple planet background isn't in the palette either.
What are Tyrian's 23 different palettes, and how does it handle font palette shifting and rendering those PCX backgrounds? Once again, I've poured over the opentyrian source but I'm too stupid to figure it out. Cheers me dears!
|
|
|
Post by Mindless on Oct 29, 2009 3:28:20 GMT
throw this code somewhere around opentyr.c:300 (anywhere after the call to JE_loadpals() will do) and it will show you all the palettes
{ for (int x = 0; x < 16; ++x) for (int y = 0; y < 16; ++y) for (int dx = 0; dx < 4; ++dx) for (int dy = 0; dy < 4; ++dy) JE_pix(x * 4 + dx, y * 4 + dy, y * 16 + x); for (int i = 0; i < palette_count; ++i) { set_palette(palettes[i], 0, 255); JE_showVGA(); SDL_Delay(1000); service_SDL_events(false); } }
For the font coloring, the palette is ordered in such a way that changes in brightness and hue are simple changes in the color's index in the palette: hue is the first nibble, brightness is the second nibble. So 0x00 is dark and 0x0F is bright (0x01..0x0E are all the brightnesses in between), 0x10 is dark and 0x1F is bright of a different hue, and so on.
Most of the PCX backgrounds have unique palettes.
|
|
|
Post by Tedmilk on Oct 29, 2009 15:37:57 GMT
That makes sense! In fact this is exactly how I am currently shifting palette values during a level. What doesn't make sense is that, when I take a screen grab of the main menu in opentyrian, the fonts are all of a shade that doesn't appear in tyrian's 256 color palette. Is this color shifting relative to tyrian's palette, or is it independant from it (since the color of the fonts aren't in the original palette)?
Oh, and just to clarify, I'm actually doing all of this in as3/Flex using paletteMap, using a technique that was first used in someone's attempt at creating the Doom engine in flash. Cheers mindless!
|
|
|
Post by yuriks on Oct 29, 2009 17:31:24 GMT
Like was said, most of the PCX backgrounds have unique palettes. The title screen palette isn't the same as the in-game one, and, is also worth mentioning, doesn't follow the brightness/hue scheme for the entire palette, just for the ranges used for text.
|
|
|
Post by Tedmilk on Oct 29, 2009 22:35:35 GMT
Thanks guys... but my problem, specifically, is this:  Is font palette changing separate from Tyrian's 256 color palette?
|
|
|
Post by yuriks on Oct 30, 2009 0:38:54 GMT
Except those two backgrounds don't use the same palette, so you're trying to match at least one of them against the wrong pal, I suspect both. =)
I'll make a background png ripper later then I'll extract the backgrounds for you.
|
|
|
Post by Tedmilk on Oct 30, 2009 12:54:51 GMT
Yuriks, I already have the backgrounds, thanks  I'd just like to know where the colors of the fonts in the image I posted came from, as they clearly didn't come from the palette in the image.
|
|
|
Post by Tedmilk on Oct 30, 2009 13:21:37 GMT
Hmm... are you saying that the fonts use colors straight from the PNG's palette? I think I get what you're saying now. All I need, then, is the palette data for each background then? I don't think I have it for the images I have currently (the title screen palette, for example, doesn't contain the colors of the title screen menu font).
|
|
|
Post by Mindless on Oct 30, 2009 16:13:22 GMT
I've reripped the backgrounds but left the palettes in tact this time. (tyrian.pic link in my signature)
|
|
|
Post by yuriks on Oct 30, 2009 17:59:22 GMT
In case you're interested, I just commited a tool to the Enhanced repository that will extract the palettes from palette.dat as GIMP palette files. You'll need to compile it though, it's in the tools\ directory.
EDIT:
This is the mapping of the backgrounds in .pic to their palettes:
const JE_byte pcxpal[PCX_NUM] = /* [1..PCXnum] */ { 0, 7, 5, 8, 10, 5, 18, 19, 19, 20, 21, 22, 5};
|
|
|
Post by Tedmilk on Oct 31, 2009 14:26:17 GMT
Wow... you guys are awesome! This was just what I needed! :huggles:
|
|