- defined a new constant, CR_NATIVEPAL, to use the font functions with a predefined palette.

This is mainly for code clarification, the value is the same as CR_UNDEFINED.
This commit is contained in:
Christoph Oelckers 2021-05-29 11:47:05 +02:00
parent 22be26bd2d
commit 8fae793341
19 changed files with 34 additions and 32 deletions

View file

@ -185,7 +185,7 @@ void DrawChar(F2DDrawer *drawer, FFont* font, int normalcolor, double x, double
{
return;
}
bool palettetrans = (normalcolor == CR_UNDEFINED && parms.TranslationId != 0);
bool palettetrans = (normalcolor == CR_NATIVEPAL && parms.TranslationId != 0);
PalEntry color = 0xffffffff;
if (!palettetrans) parms.TranslationId = font->GetColorTranslation((EColorRange)normalcolor, &color);
parms.color = PalEntry((color.a * parms.color.a) / 255, (color.r * parms.color.r) / 255, (color.g * parms.color.g) / 255, (color.b * parms.color.b) / 255);
@ -210,7 +210,7 @@ void DrawChar(F2DDrawer *drawer, FFont *font, int normalcolor, double x, double
uint32_t tag = ListGetInt(args);
bool res = ParseDrawTextureTags(drawer, pic, x, y, tag, args, &parms, false);
if (!res) return;
bool palettetrans = (normalcolor == CR_UNDEFINED && parms.TranslationId != 0);
bool palettetrans = (normalcolor == CR_NATIVEPAL && parms.TranslationId != 0);
PalEntry color = 0xffffffff;
if (!palettetrans) parms.TranslationId = font->GetColorTranslation((EColorRange)normalcolor, &color);
parms.color = PalEntry((color.a * parms.color.a) / 255, (color.r * parms.color.r) / 255, (color.g * parms.color.g) / 255, (color.b * parms.color.b) / 255);
@ -265,7 +265,7 @@ void DrawTextCommon(F2DDrawer *drawer, FFont *font, int normalcolor, double x, d
if (parms.celly == 0) parms.celly = font->GetHeight() + 1;
parms.celly = int (parms.celly * scaley);
bool palettetrans = (normalcolor == CR_UNDEFINED && parms.TranslationId != 0);
bool palettetrans = (normalcolor == CR_NATIVEPAL && parms.TranslationId != 0);
if (normalcolor >= NumTextColors)
normalcolor = CR_UNTRANSLATED;