22 #ifndef MADS_PALETTE_H 23 #define MADS_PALETTE_H 25 #include "common/scummsys.h" 26 #include "common/stream.h" 31 class RexNebularEngine;
33 #define PALETTE_USAGE_COUNT 4 35 #define PALETTE_RESERVED_LOW_COUNT 18 36 #define PALETTE_RESERVED_HIGH_COUNT 10 38 constexpr
int PALETTE_COUNT = 256;
39 constexpr
int RGB_SIZE = 3;
40 constexpr
int PALETTE_SIZE = (256 * 3);
46 PALFLAG_BACKGROUND = 0x8000,
47 PALFLAG_RESERVED = 0x4000,
48 PALFLAG_ANY_TO_CLOSEST = 0x2000,
49 PALFLAG_ALL_TO_CLOSEST = 0x1000,
50 PALFLAG_TOP_COLORS = 0x0800,
51 PALFLAG_DEFINE_RESERVED = 0x0400,
58 byte _firstColorIndex;
62 _colorCount = _firstListColor = _firstColorIndex = _ticks = 0;
87 _palIndex = palIndex; _sortValue = -1;
90 _palIndex = 0; _sortValue = 0;
104 int getGamePalFreeIndex(
int *palIndex);
106 int rgbFactor(byte *palEntry,
RGB6 &pal6);
121 return _data ==
nullptr;
124 uint16 &operator[](
int index) {
125 return (*_data)[index]._palIndex;
153 void resetPalFlags(
int idx);
155 int checkRGB(
const byte *rgb,
int palStart,
bool flag,
int *palIndex);
180 bool &operator[](
int idx) {
193 void mapToGreyRamp(byte palette[PALETTE_SIZE],
int baseColor,
int numColors,
194 int baseGrey,
int numGreys,
GreyEntry *map);
196 void getGreyValues(
const byte palette[PALETTE_SIZE], byte greyList[PALETTE_COUNT],
197 int baseColor,
int numColors);
203 void greyPopularity(
const byte greyList[PALETTE_COUNT], byte greyTable[64],
int numColors);
208 void insertionSort(
int size, byte *
id, byte *value);
211 byte _rgb64Map[PALETTE_COUNT];
224 void setPalette(
const byte *colors, uint start, uint num);
229 void grabPalette(byte *colors, uint start, uint num);
234 void getFullPalette(byte palette[PALETTE_SIZE]);
239 void setFullPalette(byte palette[PALETTE_SIZE]);
244 int rgbMerge(byte r, byte g, byte b);
249 int rgbMerge(
RGB6 &palEntry);
254 void fadeOut(byte palette[PALETTE_SIZE], byte *paletteMap,
255 int baseColor,
int numColors,
int baseGrey,
int numGreys,
256 int tickDelay,
int steps);
261 void fadeIn(byte palette[PALETTE_SIZE], byte destPalette[PALETTE_SIZE],
262 int baseColor,
int numColors,
int baseGrey,
int numGreys,
263 int tickDelay,
int steps);
272 void initVGAPalette(byte *palette);
274 byte _mainPalette[PALETTE_SIZE];
275 byte _cyclingPalette[PALETTE_SIZE];
276 uint32 _palFlags[PALETTE_COUNT];
297 void setEntry(byte palIndex, byte r, byte g, byte b);
303 uint8 palIndexFromRgb(byte r, byte g, byte b, byte *paletteData =
nullptr);
308 void setSystemPalette();
313 static void setGradient(byte *palette,
int start,
int count,
int rgbValue1,
int rgbValue2);
318 void resetGamePalette(
int lowRange,
int highRange);
330 void setColorFlags(byte r, byte g, byte b);
331 void setColorValues(byte r, byte g, byte b);
336 void refreshSceneColors();
338 static int closestColor(
const byte *matchColor,
const byte *refPalette,
339 int paletteInc,
int count);
Definition: palette.h:158
Definition: palette.h:185
Out copy(In first, In last, Out dst)
Definition: algorithm.h:52
virtual ~Palette()
Definition: palette.h:291
Definition: palette.h:187
bool empty() const
Definition: palette.h:120
void setEmpty()
Definition: palette.h:131
Definition: sound_manager.h:38
Definition: palette.h:266