Author Topic: How to get r,g,b from palette inside map.cpp ?  (Read 1724 times)

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
How to get r,g,b from palette inside map.cpp ?
« on: May 20, 2022, 07:36:15 pm »
Hello,

Most of my experimental code takes place in map.cpp, which contains surfaces and such and these call setPixel and getPixel and these are probably setting some palette index somwhere in SDL and such.

What would be an (easy) way for me to get the r,g,b of each palette index inside map.cpp ?

(I tried some getPalette method on the main surface inside map.cpp drawTerrain, but it returned all black colors ? The question is why ? Perhaps because of a fade in on the first few frames or so (during battlescape/battle) ? Or is this palette never set ? Hmmm.... )

Bye,
  Skybuck.
« Last Edit: May 20, 2022, 07:46:52 pm by Skybuck »

Offline Yankes

  • Commander
  • *****
  • Posts: 3210
    • View Profile
Re: How to get r,g,b from palette inside map.cpp ?
« Reply #1 on: May 20, 2022, 08:29:19 pm »
Because only screen palette matters, 90% blitting is done only on palette indexes values not colors from palette (in OXCE its near 99%).

Offline Skybuck

  • Colonel
  • ****
  • Posts: 223
    • View Profile
Re: How to get r,g,b from palette inside map.cpp ?
« Reply #2 on: May 21, 2022, 02:30:00 am »
I know, but for exporting and other purposes it would be great to know where the actually r,g,b values are stored, so that they can be retrieved... any ideas ?