aliens

Author Topic: (Question) Is it possible to edit the default palettes?  (Read 4542 times)

Offline new_civilian

  • Commander
  • *****
  • Posts: 725
    • View Profile
(Question) Is it possible to edit the default palettes?
« on: July 29, 2015, 04:48:28 pm »
I wondered if it would be possible to edit the default XCom color pallettes. It would be nice to have a real dark olive green (for terrain and armors) as well as a true 255,0,0 red (RGB values) for example...

Not sure if one would have to replace existing colors or if it even would be possible to add colors....  ???

Offline yrizoud

  • Commander
  • *****
  • Posts: 1014
    • View Profile
Re: (Question) Is it possible to edit the default palettes?
« Reply #1 on: July 29, 2015, 08:48:52 pm »
You can only recycle existing colors if you make sure that your mod removes/replaces all the graphics that were using them.
If you do, you can put your own colors in the freed slots, in the tactical palette of PALETTTES.DAT. You also need to redefine the lookup table that defines the darkness levels (I can't find where is that table ?)

Offline liberation

  • Captain
  • ***
  • Posts: 75
    • View Profile
Re: (Question) Is it possible to edit the default palettes?
« Reply #2 on: July 29, 2015, 09:09:06 pm »
editing the palette, is easy enough. just use a hex editor to edit the colours you want. ive changed a lot of the geoscape colours for my tc.

however... you also need to change the darkened version's to something similar as yrizoud has mentioned. its easy enough just can a pain with tons of numbers everywhere.

I got the palettes off the xcom wiki, shrank them to 1/3 so 1 pixel is 1 colour then you have a index for the hex editor. every colour is 3 entrys ie. 11 22 01 is one colour so you need to times your index number by 3 to find the exact colour in the palette.dat. ie 1x3 is 3 and that's the second colour in the palette, first colour starts with 00, second 03 third 06 and so on

Hope that makes sense and helps  8)   

Offline new_civilian

  • Commander
  • *****
  • Posts: 725
    • View Profile
Re: (Question) Is it possible to edit the default palettes?
« Reply #3 on: July 30, 2015, 12:39:22 pm »
Yes it does both!  :)

Thanks to you both, i gonna try my luck now, i'm quite good with HxD, should be no big problem then. *crosses fingers*

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: (Question) Is it possible to edit the default palettes?
« Reply #4 on: July 30, 2015, 01:29:50 pm »
just remember these values are in old-school VESA standard, and range from 0 (0x00) to 63 (0x3F), not 255 (0xFF). we multiply each value by 4 to get our "modern equivalent" RGB values. pure 255 is simply not possible, the closest you'll get is 252 (63*4).
« Last Edit: July 30, 2015, 01:32:44 pm by Warboy1982 »

Offline yrizoud

  • Commander
  • *****
  • Posts: 1014
    • View Profile
Re: (Question) Is it possible to edit the default palettes?
« Reply #5 on: July 30, 2015, 03:45:40 pm »
we multiply each value by 4 to get our "modern equivalent" RGB values.
It's something I have wondered about, when converting an other program from direct VGA(assembler) to SDL. Multiplying the R6G6B6 components by 4 ends up slghtly darker than it *could* be.
I chose to go for y = x * 255 / 63, for the principle of it, but I just spent a bit of time researching, and it seems the cheap TFT screens are of the "TN" variety, and tend to have only 18bit colors anyway.

Offline new_civilian

  • Commander
  • *****
  • Posts: 725
    • View Profile
Re: (Question) Is it possible to edit the default palettes?
« Reply #6 on: August 01, 2015, 11:29:40 am »
just remember these values are in old-school VESA standard, and range from 0 (0x00) to 63 (0x3F), not 255 (0xFF). we multiply each value by 4 to get our "modern equivalent" RGB values. pure 255 is simply not possible, the closest you'll get is 252 (63*4).

Oh thanks, that explains the strange numbers I saw...  :)

Offline liberation

  • Captain
  • ***
  • Posts: 75
    • View Profile
Re: (Question) Is it possible to edit the default palettes?
« Reply #7 on: August 01, 2015, 12:44:23 pm »
Yes it does both!  :)

Thanks to you both, i gonna try my luck now, i'm quite good with HxD, should be no big problem then. *crosses fingers*

Glad I could help  :)

1 piece of advice if your not already is to make backups, if you delete even 1 number by accident then your in big trouble... I found this out the hard way  ::)

Offline new_civilian

  • Commander
  • *****
  • Posts: 725
    • View Profile
Re: (Question) Is it possible to edit the default palettes?
« Reply #8 on: August 03, 2015, 02:38:24 pm »
Thanks, will do. Had no success so far, but mainly because of a lack of time and not because of technical issues...  :)