1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-21 05:53:02 +01:00

Replace darkness flags with TextDarkness enum

This commit is contained in:
Gymnasiast
2025-10-16 20:48:59 +02:00
parent fe24e9b77b
commit 10d9fc5e56
4 changed files with 17 additions and 26 deletions

View File

@@ -770,27 +770,26 @@ static void TTFProcessInitialColour(ColourWithFlags colour, TextDrawInfo* info)
{
info->flags |= TEXT_DRAW_FLAG_INSET;
uint32_t eax;
if (info->flags & TEXT_DRAW_FLAG_DARK)
uint32_t eax = 0;
switch (info->darkness)
{
if (info->flags & TEXT_DRAW_FLAG_EXTRA_DARK)
{
case TextDarkness::extraDark:
eax = ColourMapA[colour.colour].mid_light;
eax = eax << 16;
eax = eax | ColourMapA[colour.colour].dark;
}
else
{
break;
case TextDarkness::dark:
eax = ColourMapA[colour.colour].light;
eax = eax << 16;
eax = eax | ColourMapA[colour.colour].mid_dark;
}
}
else
{
eax = ColourMapA[colour.colour].lighter;
eax = eax << 16;
eax = eax | ColourMapA[colour.colour].mid_light;
break;
case TextDarkness::regular:
eax = ColourMapA[colour.colour].lighter;
eax = eax << 16;
eax = eax | ColourMapA[colour.colour].mid_light;
break;
}
// Adjust text palette. Store current colour? ;
@@ -816,6 +815,7 @@ void TTFDrawString(
info.startY = coords.y;
info.x = coords.x;
info.y = coords.y;
info.darkness = darkness;
if (LocalisationService_UseTrueTypeFont())
{
@@ -827,15 +827,6 @@ void TTFDrawString(
info.flags |= TEXT_DRAW_FLAG_NO_FORMATTING;
}
if (darkness == TextDarkness::dark)
{
info.flags |= TEXT_DRAW_FLAG_DARK;
}
else if (darkness == TextDarkness::extraDark)
{
info.flags |= (TEXT_DRAW_FLAG_DARK | TEXT_DRAW_FLAG_EXTRA_DARK);
}
std::memcpy(info.palette, gTextPalette, sizeof(info.palette));
TTFProcessInitialColour(colour, &info);
TTFProcessString(rt, text, &info);

View File

@@ -12,6 +12,7 @@
#include <cstdint>
enum class FontStyle : uint8_t;
enum class TextDarkness : uint8_t;
struct TextDrawInfo
{
@@ -22,6 +23,7 @@ struct TextDrawInfo
int32_t maxX;
int32_t maxY;
int32_t flags;
TextDarkness darkness;
uint8_t palette[8];
FontStyle fontStyle;
const int8_t* yOffset;

View File

@@ -117,8 +117,6 @@ enum : uint32_t
{
TEXT_DRAW_FLAG_INSET = 1 << 0,
TEXT_DRAW_FLAG_OUTLINE = 1 << 1,
TEXT_DRAW_FLAG_DARK = 1 << 2,
TEXT_DRAW_FLAG_EXTRA_DARK = 1 << 3,
TEXT_DRAW_FLAG_NO_FORMATTING = 1 << 28,
TEXT_DRAW_FLAG_Y_OFFSET_EFFECT = 1 << 29,
TEXT_DRAW_FLAG_TTF = 1 << 30,

View File

@@ -34,7 +34,7 @@ enum class TextUnderline
on,
};
enum class TextDarkness
enum class TextDarkness : uint8_t
{
regular = 0,
dark = 1,