1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-20 05:23:04 +01:00

Reduce usage of gCurrentFontSpriteBase

This commit is contained in:
Gymnasiast
2021-02-27 17:43:23 +01:00
parent 3e536e2711
commit 826f6c7442
10 changed files with 24 additions and 38 deletions

View File

@@ -275,10 +275,9 @@ static int32_t chat_history_draw_string(
FormatStringToBuffer(gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), "{OUTLINE}{WHITE}{STRING}", text);
int32_t numLines;
FontSpriteBase fontSpriteBase;
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
gfx_wrap_string(buffer, width, &numLines, &fontSpriteBase);
auto lineHeight = font_get_line_height(fontSpriteBase);
gfx_wrap_string(buffer, width, &numLines);
auto lineHeight = font_get_line_height(FontSpriteBase::MEDIUM);
int32_t expectedY = screenCoords.y - (numLines * lineHeight);
if (expectedY < 50)
@@ -301,7 +300,6 @@ static int32_t chat_history_draw_string(
int32_t chat_string_wrapped_get_height(void* args, int32_t width)
{
int32_t lineHeight, lineY, numLines;
FontSpriteBase fontSpriteBase;
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
@@ -309,8 +307,8 @@ int32_t chat_string_wrapped_get_height(void* args, int32_t width)
format_string(buffer, 256, STR_STRING, args);
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
gfx_wrap_string(buffer, width, &numLines, &fontSpriteBase);
lineHeight = font_get_line_height(fontSpriteBase);
gfx_wrap_string(buffer, width, &numLines);
lineHeight = font_get_line_height(FontSpriteBase::MEDIUM);
lineY = 0;
for (int32_t line = 0; line <= numLines; ++line)