diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp index 1ee9657c2c..d26f5b456c 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp @@ -1211,7 +1211,7 @@ void OpenGLDrawingContext::DrawTTFBitmap( right += clip.GetLeft() - rt.x; bottom += clip.GetTop() - rt.y; - if (info->flags & TEXT_DRAW_FLAG_OUTLINE) + if (info->colourFlags.has(ColourFlag::withOutline)) { std::array boundsArr = { { { left + 1, top, right + 1, bottom }, @@ -1235,7 +1235,7 @@ void OpenGLDrawingContext::DrawTTFBitmap( command.zoom = 1.0f; } } - if (info->flags & TEXT_DRAW_FLAG_INSET) + if (info->colourFlags.has(ColourFlag::inset)) { DrawRectCommand& command = _commandBuffers.rects.allocate(); command.clip = { clip.GetLeft(), clip.GetTop(), clip.GetRight(), clip.GetBottom() }; diff --git a/src/openrct2/drawing/Drawing.String.cpp b/src/openrct2/drawing/Drawing.String.cpp index 4ee71b54ee..15a7de1c6f 100644 --- a/src/openrct2/drawing/Drawing.String.cpp +++ b/src/openrct2/drawing/Drawing.String.cpp @@ -273,7 +273,7 @@ void GfxDrawStringLeftCentred( /** * Changes the palette so that the next character changes colour */ -static void ColourCharacter(TextColour colour, const uint16_t* current_font_flags, uint8_t* palette_pointer) +static void ColourCharacter(TextColour colour, bool withOutline, uint8_t* palette_pointer) { int32_t colour32 = 0; const G1Element* g1 = GfxGetG1Element(SPR_TEXT_PALETTE); @@ -283,7 +283,7 @@ static void ColourCharacter(TextColour colour, const uint16_t* current_font_flag std::memcpy(&colour32, &g1->offset[idx], sizeof(colour32)); } - if (!(*current_font_flags & TEXT_DRAW_FLAG_OUTLINE)) + if (!withOutline) { colour32 = colour32 & 0x0FF0000FF; } @@ -298,12 +298,12 @@ static void ColourCharacter(TextColour colour, const uint16_t* current_font_flag * Changes the palette so that the next character changes colour * This is specific to changing to a predefined window related colour */ -static void ColourCharacterWindow(colour_t colour, const uint16_t* current_font_flags, uint8_t* palette_pointer) +static void ColourCharacterWindow(colour_t colour, bool withOutline, uint8_t* palette_pointer) { int32_t eax; eax = ColourMapA[colour].colour_11; - if (*current_font_flags & TEXT_DRAW_FLAG_OUTLINE) + if (withOutline) { eax |= 0x0A0A00; } @@ -569,27 +569,24 @@ static void TTFProcessFormatCode(RenderTarget& rt, const FmtString::Token& token info->fontStyle = FontStyle::medium; break; case FormatToken::outlineEnable: - info->flags |= TEXT_DRAW_FLAG_OUTLINE; + info->colourFlags.set(ColourFlag::withOutline); break; case FormatToken::outlineDisable: - info->flags &= ~TEXT_DRAW_FLAG_OUTLINE; + info->colourFlags.unset(ColourFlag::withOutline); break; case FormatToken::colourWindow1: { - uint16_t flags = info->flags; - ColourCharacterWindow(gCurrentWindowColours[0], &flags, info->palette); + ColourCharacterWindow(gCurrentWindowColours[0], info->colourFlags.has(ColourFlag::withOutline), info->palette); break; } case FormatToken::colourWindow2: { - uint16_t flags = info->flags; - ColourCharacterWindow(gCurrentWindowColours[1], &flags, info->palette); + ColourCharacterWindow(gCurrentWindowColours[1], info->colourFlags.has(ColourFlag::withOutline), info->palette); break; } case FormatToken::colourWindow3: { - uint16_t flags = info->flags; - ColourCharacterWindow(gCurrentWindowColours[2], &flags, info->palette); + ColourCharacterWindow(gCurrentWindowColours[2], info->colourFlags.has(ColourFlag::withOutline), info->palette); break; } case FormatToken::inlineSprite: @@ -609,9 +606,8 @@ static void TTFProcessFormatCode(RenderTarget& rt, const FmtString::Token& token default: if (FormatTokenIsColour(token.kind)) { - uint16_t flags = info->flags; auto colourIndex = FormatTokenToTextColour(token.kind); - ColourCharacter(colourIndex, &flags, info->palette); + ColourCharacter(colourIndex, info->colourFlags.has(ColourFlag::withOutline), info->palette); } break; } @@ -753,20 +749,14 @@ static void TTFProcessInitialColour(ColourWithFlags colour, TextDrawInfo* info) { if (colour.colour != kTextColour254 && colour.colour != kTextColour255) { - info->flags &= ~(TEXT_DRAW_FLAG_INSET | TEXT_DRAW_FLAG_OUTLINE); - if (colour.flags.has(ColourFlag::withOutline)) - { - info->flags |= TEXT_DRAW_FLAG_OUTLINE; - } + info->colourFlags = colour.flags; if (!colour.flags.has(ColourFlag::inset)) { - uint16_t flags = info->flags; - ColourCharacterWindow(colour.colour, &flags, reinterpret_cast(&info->palette)); + ColourCharacterWindow( + colour.colour, info->colourFlags.has(ColourFlag::withOutline), reinterpret_cast(&info->palette)); } else { - info->flags |= TEXT_DRAW_FLAG_INSET; - uint32_t eax = 0; switch (info->darkness) { diff --git a/src/openrct2/drawing/Drawing.String.h b/src/openrct2/drawing/Drawing.String.h index 082966aa60..74a005c5a5 100644 --- a/src/openrct2/drawing/Drawing.String.h +++ b/src/openrct2/drawing/Drawing.String.h @@ -9,6 +9,8 @@ #pragma once +#include "../interface/Colour.h" + #include enum class FontStyle : uint8_t; @@ -23,6 +25,7 @@ struct TextDrawInfo int32_t maxX; int32_t maxY; int32_t flags; + ColourFlags colourFlags; TextDarkness darkness; uint8_t palette[8]; FontStyle fontStyle; diff --git a/src/openrct2/drawing/Drawing.h b/src/openrct2/drawing/Drawing.h index b47cd49b0c..65475258bc 100644 --- a/src/openrct2/drawing/Drawing.h +++ b/src/openrct2/drawing/Drawing.h @@ -115,8 +115,6 @@ struct RenderTarget enum : uint32_t { - TEXT_DRAW_FLAG_INSET = 1 << 0, - TEXT_DRAW_FLAG_OUTLINE = 1 << 1, TEXT_DRAW_FLAG_NO_FORMATTING = 1 << 28, TEXT_DRAW_FLAG_Y_OFFSET_EFFECT = 1 << 29, TEXT_DRAW_FLAG_TTF = 1 << 30, diff --git a/src/openrct2/drawing/X8DrawingEngine.cpp b/src/openrct2/drawing/X8DrawingEngine.cpp index 5bd76ccc4c..d3aa7e21f4 100644 --- a/src/openrct2/drawing/X8DrawingEngine.cpp +++ b/src/openrct2/drawing/X8DrawingEngine.cpp @@ -747,14 +747,14 @@ void X8DrawingContext::DrawTTFBitmap( const uint8_t fgColor = info->palette[1]; const uint8_t bgColor = info->palette[3]; - if (info->flags & TEXT_DRAW_FLAG_OUTLINE) + if (info->colourFlags.has(ColourFlag::withOutline)) { DrawTTFBitmapInternal(rt, bgColor, surface, x + 1, y, 0); DrawTTFBitmapInternal(rt, bgColor, surface, x - 1, y, 0); DrawTTFBitmapInternal(rt, bgColor, surface, x, y + 1, 0); DrawTTFBitmapInternal(rt, bgColor, surface, x, y - 1, 0); } - if (info->flags & TEXT_DRAW_FLAG_INSET) + if (info->colourFlags.has(ColourFlag::inset)) { DrawTTFBitmapInternal(rt, bgColor, surface, x + 1, y + 1, 0); }