mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Add 'Invert' translation
This commit is contained in:
parent
f8d75ee077
commit
9ac88031e1
1 changed files with 24 additions and 0 deletions
|
@ -33,6 +33,7 @@ static boolean PaletteRemap_AddColorRange(remaptable_t *tr, int start, int end,
|
|||
static boolean PaletteRemap_AddDesaturation(remaptable_t *tr, int start, int end, double r1, double g1, double b1, double r2, double g2, double b2);
|
||||
static boolean PaletteRemap_AddColourisation(remaptable_t *tr, int start, int end, int r, int g, int b);
|
||||
static boolean PaletteRemap_AddTint(remaptable_t *tr, int start, int end, int r, int g, int b, int amount);
|
||||
static boolean PaletteRemap_AddInvert(remaptable_t *tr, int start, int end);
|
||||
|
||||
enum PaletteRemapType
|
||||
{
|
||||
|
@ -101,6 +102,12 @@ void PaletteRemap_Init(void)
|
|||
memset(allBlack->remap, 31, NUM_PALETTE_ENTRIES * sizeof(UINT8));
|
||||
R_AddCustomTranslation("AllBlack", PaletteRemap_Add(allBlack));
|
||||
|
||||
// Invert
|
||||
remaptable_t *invertRemap = PaletteRemap_New();
|
||||
PaletteRemap_SetIdentity(invertRemap);
|
||||
PaletteRemap_AddInvert(invertRemap, 0, 255);
|
||||
R_AddCustomTranslation("Invert", PaletteRemap_Add(invertRemap));
|
||||
|
||||
// Dash mode (TC_DASHMODE)
|
||||
MakeDashModeRemap();
|
||||
}
|
||||
|
@ -417,6 +424,23 @@ static boolean PaletteRemap_AddTint(remaptable_t *tr, int start, int end, int r,
|
|||
return true;
|
||||
}
|
||||
|
||||
static boolean PaletteRemap_AddInvert(remaptable_t *tr, int start, int end)
|
||||
{
|
||||
if (IndicesOutOfRange(start, end))
|
||||
return false;
|
||||
|
||||
for (int i = start; i < end; ++i)
|
||||
{
|
||||
tr->remap[i] = NearestColor(
|
||||
255 - tr->remap[pMasterPalette[i].s.red],
|
||||
255 - tr->remap[pMasterPalette[i].s.green],
|
||||
255 - tr->remap[pMasterPalette[i].s.blue]
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
struct ParsedTranslation
|
||||
{
|
||||
struct ParsedTranslation *next;
|
||||
|
|
Loading…
Reference in a new issue