mirror of https://github.com/OpenRCT2/OpenRCT2.git
Remove last remnants of gCurrentFontSpriteBase
This commit is contained in:
parent
c40701d997
commit
7fd049c22e
|
@ -276,7 +276,6 @@ void InGameConsole::Draw(rct_drawpixelinfo* dpi) const
|
|||
return;
|
||||
|
||||
// Set font
|
||||
gCurrentFontSpriteBase = InGameconsoleGetFontSpriteBase();
|
||||
uint8_t textColour = NOT_TRANSLUCENT(ThemeGetColour(WC_CONSOLE, 1));
|
||||
const int32_t lineHeight = InGameConsoleGetLineHeight();
|
||||
const int32_t maxLines = GetNumVisibleLines();
|
||||
|
@ -330,7 +329,7 @@ void InGameConsole::Draw(rct_drawpixelinfo* dpi) const
|
|||
|
||||
// Draw current line
|
||||
lineBuffer = colourFormatStr + _consoleCurrentLine;
|
||||
gfx_draw_string_no_formatting(dpi, lineBuffer.c_str(), TEXT_COLOUR_255, screenCoords);
|
||||
gfx_draw_string_no_formatting(dpi, screenCoords, lineBuffer.c_str(), { TEXT_COLOUR_255, InGameconsoleGetFontSpriteBase() });
|
||||
|
||||
// Draw caret
|
||||
if (_consoleCaretTicks < CONSOLE_CARET_FLASH_THRESHOLD)
|
||||
|
|
|
@ -333,7 +333,7 @@ static void WidgetTextCentred(rct_drawpixelinfo* dpi, rct_window* w, rct_widgeti
|
|||
return;
|
||||
|
||||
// Get the colour
|
||||
uint8_t colour = w->colours[widget->colour];
|
||||
colour_t colour = w->colours[widget->colour];
|
||||
colour &= ~(COLOUR_FLAG_TRANSLUCENT);
|
||||
if (WidgetIsDisabled(w, widgetIndex))
|
||||
colour |= COLOUR_FLAG_INSET;
|
||||
|
@ -362,7 +362,7 @@ static void WidgetTextCentred(rct_drawpixelinfo* dpi, rct_window* w, rct_widgeti
|
|||
}
|
||||
else
|
||||
{
|
||||
DrawTextEllipsised(dpi, coords, widget->width() - 2, stringId, ft, colour, TextAlignment::CENTRE);
|
||||
DrawTextEllipsised(dpi, coords, widget->width() - 2, stringId, ft, { colour, TextAlignment::CENTRE });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -563,7 +563,7 @@ static void WidgetCaptionDraw(rct_drawpixelinfo* dpi, rct_window* w, rct_widgeti
|
|||
}
|
||||
topLeft.x += width / 2;
|
||||
DrawTextEllipsised(
|
||||
dpi, topLeft, width, widget->text, Formatter::Common(), COLOUR_WHITE | COLOUR_FLAG_OUTLINE, TextAlignment::CENTRE);
|
||||
dpi, topLeft, width, widget->text, Formatter::Common(), { COLOUR_WHITE | COLOUR_FLAG_OUTLINE, TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -600,7 +600,7 @@ static void WidgetCloseboxDraw(rct_drawpixelinfo* dpi, rct_window* w, rct_widget
|
|||
if (WidgetIsDisabled(w, widgetIndex))
|
||||
colour |= COLOUR_FLAG_INSET;
|
||||
|
||||
DrawTextEllipsised(dpi, topLeft, widget->width() - 2, widget->text, Formatter::Common(), colour, TextAlignment::CENTRE);
|
||||
DrawTextEllipsised(dpi, topLeft, widget->width() - 2, widget->text, Formatter::Common(), { colour, TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -671,8 +671,6 @@ static void WidgetScrollDraw(rct_drawpixelinfo* dpi, rct_window* w, rct_widgetin
|
|||
bottomRight.x--;
|
||||
bottomRight.y--;
|
||||
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
|
||||
// Horizontal scrollbar
|
||||
if (scroll->flags & HSCROLLBAR_VISIBLE)
|
||||
WidgetHScrollbarDraw(
|
||||
|
@ -1105,8 +1103,6 @@ static void WidgetTextBoxDraw(rct_drawpixelinfo* dpi, rct_window* w, rct_widgeti
|
|||
// gfx_fill_rect_inset(dpi, l, t, r, b, colour, 0x20 | (!active ? 0x40 : 0x00));
|
||||
gfx_fill_rect_inset(dpi, { topLeft, bottomRight }, colour, INSET_RECT_F_60);
|
||||
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
|
||||
// Figure out where the text should be positioned vertically.
|
||||
topLeft.y = w->windowPos.y + widget->textTop();
|
||||
|
||||
|
@ -1115,8 +1111,9 @@ static void WidgetTextBoxDraw(rct_drawpixelinfo* dpi, rct_window* w, rct_widgeti
|
|||
if (w->widgets[widgetIndex].text != 0)
|
||||
{
|
||||
safe_strcpy(wrapped_string, w->widgets[widgetIndex].string, 512);
|
||||
gfx_wrap_string(wrapped_string, bottomRight.x - topLeft.x - 5, &no_lines);
|
||||
gfx_draw_string_no_formatting(dpi, wrapped_string, w->colours[1], { topLeft.x + 2, topLeft.y });
|
||||
gfx_wrap_string(wrapped_string, bottomRight.x - topLeft.x - 5, FontSpriteBase::MEDIUM, &no_lines);
|
||||
gfx_draw_string_no_formatting(
|
||||
dpi, { topLeft.x + 2, topLeft.y }, wrapped_string, { w->colours[1], FontSpriteBase::MEDIUM });
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1125,9 +1122,9 @@ static void WidgetTextBoxDraw(rct_drawpixelinfo* dpi, rct_window* w, rct_widgeti
|
|||
|
||||
// String length needs to add 12 either side of box
|
||||
// +13 for cursor when max length.
|
||||
gfx_wrap_string(wrapped_string, bottomRight.x - topLeft.x - 5 - 6, &no_lines);
|
||||
gfx_wrap_string(wrapped_string, bottomRight.x - topLeft.x - 5 - 6, FontSpriteBase::MEDIUM, &no_lines);
|
||||
|
||||
gfx_draw_string_no_formatting(dpi, wrapped_string, w->colours[1], { topLeft.x + 2, topLeft.y });
|
||||
gfx_draw_string_no_formatting(dpi, { topLeft.x + 2, topLeft.y }, wrapped_string, { w->colours[1], FontSpriteBase::MEDIUM });
|
||||
|
||||
size_t string_length = get_string_size(wrapped_string) - 1;
|
||||
|
||||
|
|
|
@ -758,7 +758,7 @@ void CustomListView::PaintCell(
|
|||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<const char*>(text);
|
||||
DrawTextEllipsised(dpi, pos, size.width, stringId, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, pos, size.width, stringId, ft, {});
|
||||
}
|
||||
|
||||
std::optional<RowColumn> CustomListView::GetItemIndexAt(const ScreenCoordsXY& pos)
|
||||
|
|
|
@ -213,8 +213,6 @@ static void window_changelog_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
|
||||
static void window_changelog_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, [[maybe_unused]] int32_t scrollIndex)
|
||||
{
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
|
||||
const int32_t lineHeight = font_get_line_height(FontSpriteBase::MEDIUM);
|
||||
|
||||
ScreenCoordsXY screenCoords(3, 3 - lineHeight);
|
||||
|
@ -241,7 +239,6 @@ static void window_changelog_process_changelog_text(const std::string& text)
|
|||
// To get the last substring (or only, if delimiter is not found)
|
||||
_changelogLines.push_back(text.substr(prev));
|
||||
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
_changelogLongestLineWidth = 0;
|
||||
for (const auto& line : _changelogLines)
|
||||
{
|
||||
|
|
|
@ -118,7 +118,6 @@ void WindowDropdownShowText(const ScreenCoordsXY& screenPos, int32_t extray, uin
|
|||
for (size_t i = 0; i < num_items; i++)
|
||||
{
|
||||
format_string(buffer, 256, gDropdownItemsFormat[i], static_cast<void*>(&gDropdownItemsArgs[i]));
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
string_width = gfx_get_string_width(buffer, FontSpriteBase::MEDIUM);
|
||||
max_string_width = std::max(string_width, max_string_width);
|
||||
}
|
||||
|
@ -287,7 +286,7 @@ void WindowDropdownClose()
|
|||
|
||||
static void window_dropdown_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
int32_t cell_x, cell_y, l, t, r, b, item, image, colour;
|
||||
int32_t cell_x, cell_y, l, t, r, b, item, image;
|
||||
|
||||
WindowDrawWidgets(w, dpi);
|
||||
|
||||
|
@ -362,7 +361,7 @@ static void window_dropdown_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
}
|
||||
|
||||
// Calculate colour
|
||||
colour = NOT_TRANSLUCENT(w->colours[0]);
|
||||
colour_t colour = NOT_TRANSLUCENT(w->colours[0]);
|
||||
if (i == highlightedIndex)
|
||||
colour = COLOUR_WHITE;
|
||||
if (Dropdown::IsDisabled(i))
|
||||
|
@ -373,7 +372,7 @@ static void window_dropdown_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
ScreenCoordsXY screenCoords = { w->windowPos.x + 2 + (cell_x * _dropdown_item_width),
|
||||
w->windowPos.y + 2 + (cell_y * _dropdown_item_height) };
|
||||
Formatter ft(reinterpret_cast<uint8_t*>(&gDropdownItemsArgs[i]));
|
||||
DrawTextEllipsised(dpi, screenCoords, w->width - 5, item, ft, colour);
|
||||
DrawTextEllipsised(dpi, screenCoords, w->width - 5, item, ft, { colour });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -561,7 +561,7 @@ static void window_editor_inventions_list_paint(rct_window* w, rct_drawpixelinfo
|
|||
width = w->width - w->widgets[WIDX_RESEARCH_ORDER_SCROLL].right - 6;
|
||||
|
||||
auto [drawString, ft] = window_editor_inventions_list_prepare_name(researchItem, false);
|
||||
DrawTextEllipsised(dpi, screenPos, width, drawString, ft, COLOUR_BLACK, TextAlignment::CENTRE);
|
||||
DrawTextEllipsised(dpi, screenPos, width, drawString, ft, { TextAlignment::CENTRE });
|
||||
screenPos.y += 15;
|
||||
|
||||
// Item category
|
||||
|
@ -613,22 +613,19 @@ static void window_editor_inventions_list_scrollpaint(rct_window* w, rct_drawpix
|
|||
if (researchItem.Equals(&_editorInventionsListDraggedItem))
|
||||
continue;
|
||||
|
||||
uint8_t colour;
|
||||
// TODO: this parameter by itself produces very light text.
|
||||
// It needs a {BLACK} token in the string to work properly.
|
||||
colour_t colour = COLOUR_BLACK;
|
||||
FontSpriteBase fontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
|
||||
if (researchItem.IsAlwaysResearched())
|
||||
{
|
||||
if (w->research_item == &researchItem && _editorInventionsListDraggedItem.IsNull())
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM_EXTRA_DARK;
|
||||
fontSpriteBase = FontSpriteBase::MEDIUM_EXTRA_DARK;
|
||||
else
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM_DARK;
|
||||
fontSpriteBase = FontSpriteBase::MEDIUM_DARK;
|
||||
colour = w->colours[1] | COLOUR_FLAG_INSET;
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: this parameter by itself produces very light text.
|
||||
// It needs a {BLACK} token in the string to work properly.
|
||||
colour = COLOUR_BLACK;
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
}
|
||||
|
||||
const rct_string_id itemNameId = researchItem.GetName();
|
||||
|
||||
|
@ -642,19 +639,22 @@ static void window_editor_inventions_list_scrollpaint(rct_window* w, rct_drawpix
|
|||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(rideTypeName);
|
||||
DrawTextEllipsised(
|
||||
dpi, { 1, itemY }, columnSplitOffset - 11, STR_INVENTIONS_LIST_RIDE_AND_VEHICLE_NAME, ft, colour);
|
||||
dpi, { 1, itemY }, columnSplitOffset - 11, STR_INVENTIONS_LIST_RIDE_AND_VEHICLE_NAME, ft,
|
||||
{ colour, fontSpriteBase });
|
||||
|
||||
// Draw vehicle name
|
||||
ft = Formatter();
|
||||
ft.Add<rct_string_id>(itemNameId);
|
||||
DrawTextEllipsised(dpi, { columnSplitOffset + 1, itemY }, columnSplitOffset - 11, STR_BLACK_STRING, ft, colour);
|
||||
DrawTextEllipsised(
|
||||
dpi, { columnSplitOffset + 1, itemY }, columnSplitOffset - 11, STR_BLACK_STRING, ft,
|
||||
{ colour, fontSpriteBase });
|
||||
}
|
||||
else
|
||||
{
|
||||
// Scenery group, flat ride or shop
|
||||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(itemNameId);
|
||||
DrawTextEllipsised(dpi, { 1, itemY }, boxWidth, STR_BLACK_STRING, ft, colour);
|
||||
DrawTextEllipsised(dpi, { 1, itemY }, boxWidth, STR_BLACK_STRING, ft, { colour, fontSpriteBase });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1018,7 +1018,7 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
|
|||
: STR_NONE;
|
||||
ft.Add<rct_string_id>(stringId);
|
||||
auto screenPos = w->windowPos + ScreenCoordsXY{ widget->left + 1, widget->top + 1 };
|
||||
DrawTextEllipsised(dpi, screenPos, widget->width(), STR_OBJECTS_SORT_TYPE, ft, w->colours[1]);
|
||||
DrawTextEllipsised(dpi, screenPos, widget->width(), STR_OBJECTS_SORT_TYPE, ft, { w->colours[1] });
|
||||
}
|
||||
widget = &w->widgets[WIDX_LIST_SORT_RIDE];
|
||||
if (widget->type != WindowWidgetType::Empty)
|
||||
|
@ -1028,7 +1028,7 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
|
|||
: STR_NONE;
|
||||
ft.Add<rct_string_id>(stringId);
|
||||
auto screenPos = w->windowPos + ScreenCoordsXY{ widget->left + 1, widget->top + 1 };
|
||||
DrawTextEllipsised(dpi, screenPos, widget->width(), STR_OBJECTS_SORT_RIDE, ft, w->colours[1]);
|
||||
DrawTextEllipsised(dpi, screenPos, widget->width(), STR_OBJECTS_SORT_RIDE, ft, { w->colours[1] });
|
||||
}
|
||||
|
||||
if (w->selected_list_item == -1 || _loadedObject == nullptr)
|
||||
|
@ -1056,7 +1056,7 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
|
|||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<const char*>(listItem->repositoryItem->Name.c_str());
|
||||
DrawTextEllipsised(dpi, screenPos, width, STR_WINDOW_COLOUR_2_STRINGID, ft, COLOUR_BLACK, TextAlignment::CENTRE);
|
||||
DrawTextEllipsised(dpi, screenPos, width, STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
// Draw description of object
|
||||
|
@ -1117,7 +1117,7 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
|
|||
ft.Add<const char*>(authorsString.c_str());
|
||||
DrawTextEllipsised(
|
||||
dpi, { w->windowPos.x + w->width - 5, screenPos.y }, w->width - w->widgets[WIDX_LIST].right - 4,
|
||||
STR_WINDOW_COLOUR_2_STRINGID, ft, COLOUR_BLACK, TextAlignment::RIGHT);
|
||||
STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::RIGHT });
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -1126,7 +1126,6 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
|
|||
*/
|
||||
static void window_editor_object_selection_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_t scrollIndex)
|
||||
{
|
||||
int32_t colour, colour2;
|
||||
ScreenCoordsXY screenCoords;
|
||||
|
||||
bool ridePage = (get_selected_object_type(w) == ObjectType::Ride);
|
||||
|
@ -1155,9 +1154,8 @@ static void window_editor_object_selection_scrollpaint(rct_window* w, rct_drawpi
|
|||
if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && (*listItem.flags & OBJECT_SELECTION_FLAG_SELECTED))
|
||||
{
|
||||
screenCoords.x = 2;
|
||||
FontSpriteBase fontSpriteBase = highlighted ? FontSpriteBase::MEDIUM_EXTRA_DARK : FontSpriteBase::MEDIUM_DARK;
|
||||
gCurrentFontSpriteBase = fontSpriteBase;
|
||||
colour2 = NOT_TRANSLUCENT(w->colours[1]);
|
||||
FontSpriteBase fontSpriteBase = highlighted ? FontSpriteBase::MEDIUM_EXTRA_DARK : FontSpriteBase::MEDIUM_DARK;
|
||||
colour_t colour2 = NOT_TRANSLUCENT(w->colours[1]);
|
||||
if (*listItem.flags & (OBJECT_SELECTION_FLAG_IN_USE | OBJECT_SELECTION_FLAG_ALWAYS_REQUIRED))
|
||||
colour2 |= COLOUR_FLAG_INSET;
|
||||
|
||||
|
@ -1171,15 +1169,12 @@ static void window_editor_object_selection_scrollpaint(rct_window* w, rct_drawpi
|
|||
auto bufferWithColour = strcpy(gCommonStringFormatBuffer, highlighted ? "{WINDOW_COLOUR_2}" : "{BLACK}");
|
||||
auto buffer = strchr(bufferWithColour, '\0');
|
||||
|
||||
colour_t colour = COLOUR_BLACK;
|
||||
FontSpriteBase fontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
if (*listItem.flags & OBJECT_SELECTION_FLAG_6)
|
||||
{
|
||||
colour = w->colours[1] & 0x7F;
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM_DARK;
|
||||
}
|
||||
else
|
||||
{
|
||||
colour = COLOUR_BLACK;
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
fontSpriteBase = FontSpriteBase::MEDIUM_DARK;
|
||||
}
|
||||
|
||||
int32_t width_limit = w->widgets[WIDX_LIST].width() - screenCoords.x;
|
||||
|
@ -1192,7 +1187,7 @@ static void window_editor_object_selection_scrollpaint(rct_window* w, rct_drawpi
|
|||
safe_strcpy(buffer, language_get_string(rideTypeStringId), 256 - (buffer - bufferWithColour));
|
||||
auto ft = Formatter();
|
||||
ft.Add<const char*>(gCommonStringFormatBuffer);
|
||||
DrawTextEllipsised(dpi, screenCoords, width_limit - 15, STR_STRING, ft, colour);
|
||||
DrawTextEllipsised(dpi, screenCoords, width_limit - 15, STR_STRING, ft, { colour, fontSpriteBase });
|
||||
screenCoords.x = w->widgets[WIDX_LIST_SORT_RIDE].left - w->widgets[WIDX_LIST].left;
|
||||
}
|
||||
|
||||
|
@ -1207,7 +1202,7 @@ static void window_editor_object_selection_scrollpaint(rct_window* w, rct_drawpi
|
|||
}
|
||||
auto ft = Formatter();
|
||||
ft.Add<const char*>(gCommonStringFormatBuffer);
|
||||
DrawTextEllipsised(dpi, screenCoords, width_limit, STR_STRING, ft, colour);
|
||||
DrawTextEllipsised(dpi, screenCoords, width_limit, STR_STRING, ft, { colour, fontSpriteBase });
|
||||
}
|
||||
screenCoords.y += SCROLLABLE_ROW_HEIGHT;
|
||||
}
|
||||
|
|
|
@ -890,7 +890,7 @@ static void window_editor_objective_options_main_paint(rct_window* w, rct_drawpi
|
|||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<const char*>(parkName);
|
||||
DrawTextEllipsised(dpi, screenCoords, width, STR_WINDOW_PARK_NAME, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, screenCoords, width, STR_WINDOW_PARK_NAME, ft);
|
||||
}
|
||||
|
||||
// Scenario name
|
||||
|
@ -900,7 +900,7 @@ static void window_editor_objective_options_main_paint(rct_window* w, rct_drawpi
|
|||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<const char*>(gS6Info.name);
|
||||
DrawTextEllipsised(dpi, screenCoords, width, STR_WINDOW_SCENARIO_NAME, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, screenCoords, width, STR_WINDOW_SCENARIO_NAME, ft);
|
||||
|
||||
// Scenario details label
|
||||
screenCoords = w->windowPos + ScreenCoordsXY{ 8, w->widgets[WIDX_DETAILS].top };
|
||||
|
@ -1099,11 +1099,11 @@ static void window_editor_objective_options_rides_scrollpaint(rct_window* w, rct
|
|||
{
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE)
|
||||
{
|
||||
gCurrentFontSpriteBase = stringId == STR_WINDOW_COLOUR_2_STRINGID ? FontSpriteBase::MEDIUM_EXTRA_DARK
|
||||
: FontSpriteBase::MEDIUM_DARK;
|
||||
FontSpriteBase fontSpriteBase = stringId == STR_WINDOW_COLOUR_2_STRINGID ? FontSpriteBase::MEDIUM_EXTRA_DARK
|
||||
: FontSpriteBase::MEDIUM_DARK;
|
||||
gfx_draw_string(
|
||||
dpi, { 2, y }, static_cast<const char*>(CheckBoxMarkString),
|
||||
{ static_cast<colour_t>(w->colours[1] & 0x7F) });
|
||||
{ static_cast<colour_t>(w->colours[1] & 0x7F), fontSpriteBase });
|
||||
}
|
||||
|
||||
// Ride name
|
||||
|
|
|
@ -83,12 +83,10 @@ rct_window* window_error_open(std::string_view title, std::string_view message)
|
|||
if (buffer.size() <= 1)
|
||||
return nullptr;
|
||||
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
width = gfx_get_string_width_new_lined(buffer.data(), FontSpriteBase::MEDIUM);
|
||||
width = std::clamp(width, 64, 196);
|
||||
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
gfx_wrap_string(buffer.data(), width + 1, &numLines);
|
||||
gfx_wrap_string(buffer.data(), width + 1, FontSpriteBase::MEDIUM, &numLines);
|
||||
|
||||
_window_error_num_lines = numLines;
|
||||
width = width + 3;
|
||||
|
@ -160,5 +158,5 @@ static void window_error_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
|
||||
l = w->windowPos.x + (w->width + 1) / 2 - 1;
|
||||
t = w->windowPos.y + 1;
|
||||
draw_string_centred_raw(dpi, { l, t }, _window_error_num_lines, _window_error_text.data());
|
||||
draw_string_centred_raw(dpi, { l, t }, _window_error_num_lines, _window_error_text.data(), FontSpriteBase::MEDIUM);
|
||||
}
|
||||
|
|
|
@ -1099,7 +1099,7 @@ static void window_finances_marketing_paint(rct_window* w, rct_drawpixelinfo* dp
|
|||
}
|
||||
|
||||
// Advertisement
|
||||
DrawTextEllipsised(dpi, screenCoords + ScreenCoordsXY{ 4, 0 }, 296, MarketingCampaignNames[i][1], ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, screenCoords + ScreenCoordsXY{ 4, 0 }, 296, MarketingCampaignNames[i][1], ft);
|
||||
|
||||
// Duration
|
||||
uint16_t weeksRemaining = campaign->WeeksLeft;
|
||||
|
|
|
@ -978,7 +978,7 @@ void window_guest_overview_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
auto ft = Formatter();
|
||||
peep->FormatActionTo(ft);
|
||||
int32_t width = widget->width();
|
||||
DrawTextEllipsised(dpi, screenPos, width, STR_BLACK_STRING, ft, COLOUR_BLACK, TextAlignment::CENTRE);
|
||||
DrawTextEllipsised(dpi, screenPos, width, STR_BLACK_STRING, ft, { TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
// Draw the marquee thought
|
||||
|
@ -1585,7 +1585,7 @@ void window_guest_rides_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
ft.Add<rct_string_id>(STR_PEEP_FAVOURITE_RIDE_NOT_AVAILABLE);
|
||||
}
|
||||
|
||||
DrawTextEllipsised(dpi, screenCoords, w->width - 14, STR_FAVOURITE_RIDE, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, screenCoords, w->width - 14, STR_FAVOURITE_RIDE, ft);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -472,7 +472,7 @@ public:
|
|||
|
||||
{
|
||||
Formatter ft(_filterArguments.args);
|
||||
DrawTextEllipsised(&dpi, screenCoords, 310, format, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(&dpi, screenCoords, 310, format, ft);
|
||||
}
|
||||
|
||||
// Number of guests (list items)
|
||||
|
@ -677,7 +677,7 @@ private:
|
|||
}
|
||||
auto ft = Formatter();
|
||||
peep->FormatNameTo(ft);
|
||||
DrawTextEllipsised(&dpi, { 0, y }, 113, format, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(&dpi, { 0, y }, 113, format, ft);
|
||||
|
||||
switch (_selectedView)
|
||||
{
|
||||
|
@ -692,7 +692,7 @@ private:
|
|||
// Action
|
||||
ft = Formatter();
|
||||
peep->FormatActionTo(ft);
|
||||
DrawTextEllipsised(&dpi, { 133, y }, 314, format, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(&dpi, { 133, y }, 314, format, ft);
|
||||
break;
|
||||
case GuestViewType::Thoughts:
|
||||
// For each thought
|
||||
|
@ -707,7 +707,7 @@ private:
|
|||
|
||||
ft = Formatter();
|
||||
peep_thought_set_format_args(&thought, ft);
|
||||
DrawTextEllipsised(&dpi, { 118, y }, 329, format, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(&dpi, { 118, y }, 329, format, ft);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -749,7 +749,7 @@ private:
|
|||
|
||||
// Draw action
|
||||
Formatter ft(group.Arguments.args);
|
||||
DrawTextEllipsised(&dpi, { 0, y }, 414, format, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(&dpi, { 0, y }, 414, format, ft);
|
||||
|
||||
// Draw guest count
|
||||
ft = Formatter();
|
||||
|
|
|
@ -220,7 +220,7 @@ static void window_install_track_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
{
|
||||
// Scenery not available
|
||||
DrawTextEllipsised(
|
||||
dpi, screenPos, 308, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, {}, COLOUR_BLACK, TextAlignment::CENTRE);
|
||||
dpi, screenPos, 308, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, {}, { TextAlignment::CENTRE });
|
||||
screenPos.y -= LIST_ROW_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ static void window_install_track_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(STR_RIDE_LENGTH_ENTRY);
|
||||
ft.Add<uint16_t>(td6->ride_length);
|
||||
DrawTextEllipsised(dpi, screenPos, 214, STR_TRACK_LIST_RIDE_LENGTH, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, screenPos, 214, STR_TRACK_LIST_RIDE_LENGTH, ft);
|
||||
screenPos.y += LIST_ROW_HEIGHT;
|
||||
}
|
||||
|
||||
|
|
|
@ -692,7 +692,7 @@ static void window_loadsave_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
|
||||
if (_shortenedDirectory[0] == '\0')
|
||||
{
|
||||
shorten_path(_shortenedDirectory, sizeof(_shortenedDirectory), _directory, w->width - 8);
|
||||
shorten_path(_shortenedDirectory, sizeof(_shortenedDirectory), _directory, w->width - 8, FontSpriteBase::MEDIUM);
|
||||
}
|
||||
|
||||
// Format text
|
||||
|
@ -703,7 +703,7 @@ static void window_loadsave_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
// Draw path text
|
||||
auto ft = Formatter();
|
||||
ft.Add<const char*>(Platform::StrDecompToPrecomp(buffer.data()));
|
||||
DrawTextEllipsised(dpi, { w->windowPos.x + 4, w->windowPos.y + 20 }, w->width - 8, STR_STRING, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, { w->windowPos.x + 4, w->windowPos.y + 20 }, w->width - 8, STR_STRING, ft);
|
||||
|
||||
// Name button text
|
||||
rct_string_id id = STR_NONE;
|
||||
|
@ -770,7 +770,7 @@ static void window_loadsave_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, i
|
|||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<char*>(_listItems[i].name.c_str());
|
||||
int32_t max_file_width = w->widgets[WIDX_SORT_NAME].width() - 10;
|
||||
DrawTextEllipsised(dpi, { 10, y }, max_file_width, stringId, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, { 10, y }, max_file_width, stringId, ft);
|
||||
|
||||
// Print formatted modified date, if this is a file
|
||||
if (_listItems[i].type == TYPE_FILE)
|
||||
|
@ -778,13 +778,12 @@ static void window_loadsave_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, i
|
|||
ft = Formatter();
|
||||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<char*>(_listItems[i].date_formatted.c_str());
|
||||
DrawTextEllipsised(
|
||||
dpi, { dateAnchor - DATE_TIME_GAP, y }, maxDateWidth, stringId, ft, COLOUR_BLACK, TextAlignment::RIGHT);
|
||||
DrawTextEllipsised(dpi, { dateAnchor - DATE_TIME_GAP, y }, maxDateWidth, stringId, ft, { TextAlignment::RIGHT });
|
||||
|
||||
ft = Formatter();
|
||||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<char*>(_listItems[i].time_formatted.c_str());
|
||||
DrawTextEllipsised(dpi, { dateAnchor + DATE_TIME_GAP, y }, maxTimeWidth, stringId, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, { dateAnchor + DATE_TIME_GAP, y }, maxTimeWidth, stringId, ft);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -336,8 +336,6 @@ static ScreenCoordsXY window_multiplayer_information_get_size()
|
|||
return _windowInformationSize;
|
||||
}
|
||||
|
||||
// Reset font sprite base and compute line height
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
int32_t lineHeight = font_get_line_height(FontSpriteBase::MEDIUM);
|
||||
|
||||
// Base dimensions.
|
||||
|
@ -348,7 +346,7 @@ static ScreenCoordsXY window_multiplayer_information_get_size()
|
|||
// Server name is displayed word-wrapped, so figure out how high it will be.
|
||||
{
|
||||
utf8* buffer = _strdup(network_get_server_name());
|
||||
gfx_wrap_string(buffer, width, &numLines);
|
||||
gfx_wrap_string(buffer, width, FontSpriteBase::MEDIUM, &numLines);
|
||||
free(buffer);
|
||||
height += ++numLines * lineHeight + (LIST_ROW_HEIGHT / 2);
|
||||
}
|
||||
|
@ -358,7 +356,7 @@ static ScreenCoordsXY window_multiplayer_information_get_size()
|
|||
if (!str_is_null_or_empty(descString))
|
||||
{
|
||||
utf8* buffer = _strdup(descString);
|
||||
gfx_wrap_string(buffer, width, &numLines);
|
||||
gfx_wrap_string(buffer, width, FontSpriteBase::MEDIUM, &numLines);
|
||||
free(buffer);
|
||||
height += ++numLines * lineHeight + (LIST_ROW_HEIGHT / 2);
|
||||
}
|
||||
|
@ -602,7 +600,7 @@ static void window_multiplayer_players_scrollpaint(rct_window* w, rct_drawpixeli
|
|||
buffer += network_get_player_name(i);
|
||||
}
|
||||
screenCoords.x = 0;
|
||||
gfx_clip_string(buffer.data(), 230);
|
||||
gfx_clip_string(buffer.data(), 230, FontSpriteBase::MEDIUM);
|
||||
gfx_draw_string(dpi, screenCoords, buffer.c_str(), { colour });
|
||||
|
||||
// Draw group name
|
||||
|
@ -613,7 +611,7 @@ static void window_multiplayer_players_scrollpaint(rct_window* w, rct_drawpixeli
|
|||
buffer += "{BLACK}";
|
||||
screenCoords.x = 173;
|
||||
buffer += network_get_group_name(group);
|
||||
gfx_clip_string(buffer.data(), 80);
|
||||
gfx_clip_string(buffer.data(), 80, FontSpriteBase::MEDIUM);
|
||||
gfx_draw_string(dpi, screenCoords, buffer.c_str(), { colour });
|
||||
}
|
||||
|
||||
|
@ -628,7 +626,7 @@ static void window_multiplayer_players_scrollpaint(rct_window* w, rct_drawpixeli
|
|||
{
|
||||
ft.Add<rct_string_id>(STR_ACTION_NA);
|
||||
}
|
||||
DrawTextEllipsised(dpi, { 256, screenCoords.y }, 100, STR_BLACK_STRING, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, { 256, screenCoords.y }, 100, STR_BLACK_STRING, ft);
|
||||
|
||||
// Draw ping
|
||||
buffer.resize(0);
|
||||
|
@ -845,7 +843,7 @@ static void window_multiplayer_groups_paint(rct_window* w, rct_drawpixelinfo* dp
|
|||
ft.Add<const char*>(buffer.c_str());
|
||||
DrawTextEllipsised(
|
||||
dpi, w->windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 8, STR_STRING, ft,
|
||||
COLOUR_BLACK, TextAlignment::CENTRE);
|
||||
{ TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
auto screenPos = w->windowPos
|
||||
|
@ -869,7 +867,7 @@ static void window_multiplayer_groups_paint(rct_window* w, rct_drawpixelinfo* dp
|
|||
ft.Add<const char*>(buffer.c_str());
|
||||
DrawTextEllipsised(
|
||||
dpi, w->windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 8, STR_STRING, ft,
|
||||
COLOUR_BLACK, TextAlignment::CENTRE);
|
||||
{ TextAlignment::CENTRE });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -155,12 +155,11 @@ static void window_network_status_invalidate(rct_window* w)
|
|||
static void window_network_status_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
WindowDrawWidgets(w, dpi);
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
|
||||
thread_local std::string buffer;
|
||||
buffer.assign("{BLACK}");
|
||||
buffer += window_network_status_text;
|
||||
gfx_clip_string(buffer.data(), w->widgets[WIDX_BACKGROUND].right - 50);
|
||||
gfx_clip_string(buffer.data(), w->widgets[WIDX_BACKGROUND].right - 50, FontSpriteBase::MEDIUM);
|
||||
ScreenCoordsXY screenCoords(w->windowPos.x + (w->width / 2), w->windowPos.y + (w->height / 2));
|
||||
screenCoords.x -= gfx_get_string_width(buffer, FontSpriteBase::MEDIUM) / 2;
|
||||
gfx_draw_string(dpi, screenCoords, buffer.c_str());
|
||||
|
|
|
@ -911,7 +911,7 @@ static void window_new_ride_paint_ride_information(
|
|||
const char* drawString = availabilityString;
|
||||
ft = Formatter();
|
||||
ft.Add<const char*>(drawString);
|
||||
DrawTextEllipsised(dpi, screenPos + ScreenCoordsXY{ 0, 39 }, WW - 2, STR_AVAILABLE_VEHICLES, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, screenPos + ScreenCoordsXY{ 0, 39 }, WW - 2, STR_AVAILABLE_VEHICLES, ft);
|
||||
}
|
||||
|
||||
ft = Formatter();
|
||||
|
|
|
@ -547,7 +547,7 @@ static void window_object_load_error_paint(rct_window* w, rct_drawpixelinfo* dpi
|
|||
ft = Formatter();
|
||||
ft.Add<rct_string_id>(STR_OBJECT_ERROR_WINDOW_FILE);
|
||||
ft.Add<utf8*>(file_path.c_str());
|
||||
DrawTextEllipsised(dpi, { w->windowPos.x + 5, w->windowPos.y + 43 }, WW - 5, STR_BLACK_STRING, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, { w->windowPos.x + 5, w->windowPos.y + 43 }, WW - 5, STR_BLACK_STRING, ft);
|
||||
}
|
||||
|
||||
static void window_object_load_error_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_t scrollIndex)
|
||||
|
|
|
@ -2140,7 +2140,7 @@ static void window_options_advanced_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
uint32_t padding = widgetHeight > lineHeight ? (widgetHeight - lineHeight) / 2 : 0;
|
||||
ScreenCoordsXY screenCoords = { w->windowPos.x + pathWidget.left + 1,
|
||||
w->windowPos.y + pathWidget.top + static_cast<int32_t>(padding) };
|
||||
DrawTextEllipsised(dpi, screenCoords, 277, STR_STRING, ft, w->colours[1]);
|
||||
DrawTextEllipsised(dpi, screenCoords, 277, STR_STRING, ft, { w->colours[1] });
|
||||
}
|
||||
|
||||
static OpenRCT2String window_options_advanced_tooltip(
|
||||
|
|
|
@ -729,7 +729,7 @@ static void window_park_entrance_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
labelWidget = &window_park_entrance_widgets[WIDX_STATUS];
|
||||
DrawTextEllipsised(
|
||||
dpi, w->windowPos + ScreenCoordsXY{ labelWidget->midX(), labelWidget->top }, labelWidget->width(), STR_BLACK_STRING, ft,
|
||||
COLOUR_BLACK, TextAlignment::CENTRE);
|
||||
{ TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -338,7 +338,7 @@ void window_player_overview_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
|
||||
DrawTextEllipsised(
|
||||
dpi, w->windowPos + ScreenCoordsXY{ widget->midX() - 5, widget->top }, widget->width() - 8, STR_STRING, ft,
|
||||
COLOUR_BLACK, TextAlignment::CENTRE);
|
||||
{ TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
// Draw ping
|
||||
|
@ -364,7 +364,7 @@ void window_player_overview_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
{
|
||||
ft.Add<rct_string_id>(STR_ACTION_NA);
|
||||
}
|
||||
DrawTextEllipsised(dpi, screenCoords, width, STR_LAST_ACTION_RAN, ft, COLOUR_BLACK, TextAlignment::CENTRE);
|
||||
DrawTextEllipsised(dpi, screenCoords, width, STR_LAST_ACTION_RAN, ft, { TextAlignment::CENTRE });
|
||||
|
||||
if (w->viewport != nullptr && w->var_492 != -1)
|
||||
{
|
||||
|
|
|
@ -2678,7 +2678,7 @@ static void window_ride_main_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
rct_string_id rideStatus = window_ride_get_status(w, ft);
|
||||
DrawTextEllipsised(
|
||||
dpi, w->windowPos + ScreenCoordsXY{ (widget->left + widget->right) / 2, widget->top }, widget->width(), rideStatus, ft,
|
||||
COLOUR_BLACK, TextAlignment::CENTRE);
|
||||
{ TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
@ -4891,7 +4891,7 @@ static void window_ride_colour_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
}
|
||||
}
|
||||
|
||||
DrawTextEllipsised(dpi, { w->windowPos.x + 3, w->windowPos.y + 103 }, 97, STR_STATION_STYLE, {}, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, { w->windowPos.x + 3, w->windowPos.y + 103 }, 97, STR_STATION_STYLE, {});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5688,7 +5688,7 @@ static void window_ride_measurements_paint(rct_window* w, rct_drawpixelinfo* dpi
|
|||
ft.Add<uint16_t>(0);
|
||||
ft.Add<uint16_t>(0);
|
||||
ft.Add<uint16_t>(0);
|
||||
DrawTextEllipsised(dpi, screenCoords, 308, STR_RIDE_TIME, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, screenCoords, 308, STR_RIDE_TIME, ft);
|
||||
screenCoords.y += LIST_ROW_HEIGHT;
|
||||
}
|
||||
|
||||
|
@ -5726,7 +5726,7 @@ static void window_ride_measurements_paint(rct_window* w, rct_drawpixelinfo* dpi
|
|||
ft.Add<uint16_t>(0);
|
||||
ft.Add<uint16_t>(0);
|
||||
ft.Add<uint16_t>(0);
|
||||
DrawTextEllipsised(dpi, screenCoords, 308, STR_RIDE_LENGTH, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, screenCoords, 308, STR_RIDE_LENGTH, ft);
|
||||
|
||||
screenCoords.y += LIST_ROW_HEIGHT;
|
||||
|
||||
|
|
|
@ -594,7 +594,7 @@ static void window_ride_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi,
|
|||
// Ride name
|
||||
auto ft = Formatter();
|
||||
ride->FormatNameTo(ft);
|
||||
DrawTextEllipsised(dpi, { 0, y - 1 }, 159, format, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, { 0, y - 1 }, 159, format, ft);
|
||||
|
||||
// Ride information
|
||||
ft = Formatter();
|
||||
|
@ -746,7 +746,7 @@ static void window_ride_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi,
|
|||
ft.Rewind();
|
||||
ft.Add<rct_string_id>(formatSecondary);
|
||||
}
|
||||
DrawTextEllipsised(dpi, { 160, y - 1 }, 157, format, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, { 160, y - 1 }, 157, format, ft);
|
||||
y += SCROLLABLE_ROW_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -438,6 +438,7 @@ static void window_scenarioselect_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
WindowDrawWidgets(w, dpi);
|
||||
|
||||
format = ScenarioSelectUseSmallFont() ? STR_SMALL_WINDOW_COLOUR_2_STRINGID : STR_WINDOW_COLOUR_2_STRINGID;
|
||||
FontSpriteBase fontSpriteBase = ScenarioSelectUseSmallFont() ? FontSpriteBase::SMALL : FontSpriteBase::MEDIUM;
|
||||
|
||||
// Text for each tab
|
||||
for (uint32_t i = 0; i < std::size(ScenarioOriginStringIds); i++)
|
||||
|
@ -457,7 +458,7 @@ static void window_scenarioselect_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
}
|
||||
|
||||
ScreenCoordsXY stringCoords(widget->midX() + w->windowPos.x, widget->midY() + w->windowPos.y - 3);
|
||||
DrawTextWrapped(dpi, stringCoords, 87, format, ft, { COLOUR_AQUAMARINE, TextAlignment::CENTRE });
|
||||
DrawTextWrapped(dpi, stringCoords, 87, format, ft, { COLOUR_AQUAMARINE, fontSpriteBase, TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
// Return if no scenario highlighted
|
||||
|
@ -471,7 +472,7 @@ static void window_scenarioselect_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
+ ScreenCoordsXY{ window_scenarioselect_widgets[WIDX_SCENARIOLIST].right + 4,
|
||||
window_scenarioselect_widgets[WIDX_TABCONTENT].top + 5 };
|
||||
DrawTextEllipsised(
|
||||
dpi, screenPos + ScreenCoordsXY{ 85, 0 }, 170, STR_SCENARIO_LOCKED, {}, COLOUR_BLACK, TextAlignment::CENTRE);
|
||||
dpi, screenPos + ScreenCoordsXY{ 85, 0 }, 170, STR_SCENARIO_LOCKED, {}, { TextAlignment::CENTRE });
|
||||
DrawTextWrapped(dpi, screenPos + ScreenCoordsXY{ 0, 15 }, 170, STR_SCENARIO_LOCKED_DESC);
|
||||
}
|
||||
return;
|
||||
|
@ -482,8 +483,7 @@ static void window_scenarioselect_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
{
|
||||
utf8 path[MAX_PATH];
|
||||
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
shorten_path(path, sizeof(path), scenario->path, w->width - 6);
|
||||
shorten_path(path, sizeof(path), scenario->path, w->width - 6, FontSpriteBase::MEDIUM);
|
||||
|
||||
const utf8* pathPtr = path;
|
||||
DrawTextBasic(
|
||||
|
@ -499,7 +499,7 @@ static void window_scenarioselect_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<const char*>(scenario->name);
|
||||
DrawTextEllipsised(
|
||||
dpi, screenPos + ScreenCoordsXY{ 85, 0 }, 170, STR_WINDOW_COLOUR_2_STRINGID, ft, COLOUR_BLACK, TextAlignment::CENTRE);
|
||||
dpi, screenPos + ScreenCoordsXY{ 85, 0 }, 170, STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::CENTRE });
|
||||
screenPos.y += 15;
|
||||
|
||||
// Scenario details
|
||||
|
@ -607,11 +607,8 @@ static void window_scenarioselect_scrollpaint(rct_window* w, rct_drawpixelinfo*
|
|||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<char*>(buffer);
|
||||
colour_t colour = isDisabled ? w->colours[1] | COLOUR_FLAG_INSET : COLOUR_BLACK;
|
||||
if (isDisabled)
|
||||
{
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM_DARK;
|
||||
}
|
||||
DrawTextBasic(dpi, { wide ? 270 : 210, y + 1 }, format, ft, { colour, TextAlignment::CENTRE });
|
||||
FontSpriteBase fontSpriteBase = isDisabled ? FontSpriteBase::MEDIUM_DARK : FontSpriteBase::MEDIUM;
|
||||
DrawTextBasic(dpi, { wide ? 270 : 210, y + 1 }, format, ft, { colour, fontSpriteBase, TextAlignment::CENTRE });
|
||||
|
||||
// Check if scenario is completed
|
||||
if (isCompleted)
|
||||
|
|
|
@ -1178,8 +1178,7 @@ void window_scenery_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
|
||||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(sceneryEntry != nullptr ? sceneryEntry->name : static_cast<rct_string_id>(STR_UNKNOWN_OBJECT_TYPE));
|
||||
DrawTextEllipsised(
|
||||
dpi, { w->windowPos.x + 3, w->windowPos.y + w->height - 13 }, w->width - 19, STR_BLACK_STRING, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, { w->windowPos.x + 3, w->windowPos.y + w->height - 13 }, w->width - 19, STR_BLACK_STRING, ft);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -442,7 +442,7 @@ static void window_server_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi
|
|||
w->widgets[WIDX_LIST].tooltip = STR_NETWORK_VERSION_TIP;
|
||||
}
|
||||
|
||||
int32_t colour = w->colours[1];
|
||||
colour_t colour = w->colours[1];
|
||||
if (serverDetails.Favourite)
|
||||
{
|
||||
colour = COLOUR_YELLOW;
|
||||
|
@ -475,7 +475,7 @@ static void window_server_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi
|
|||
// Finally, draw the server information.
|
||||
auto ft = Formatter();
|
||||
ft.Add<const char*>(serverInfoToShow);
|
||||
DrawTextEllipsised(dpi, screenCoords + ScreenCoordsXY{ 0, 3 }, spaceAvailableForInfo, STR_STRING, ft, colour);
|
||||
DrawTextEllipsised(dpi, screenCoords + ScreenCoordsXY{ 0, 3 }, spaceAvailableForInfo, STR_STRING, ft, { colour });
|
||||
|
||||
int32_t right = width - 7 - SCROLLBAR_WIDTH;
|
||||
|
||||
|
|
|
@ -526,14 +526,14 @@ private:
|
|||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<const char*>(shortcut.CustomString.c_str());
|
||||
}
|
||||
DrawTextEllipsised(&dpi, { 0, y - 1 }, bindingOffset, format, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(&dpi, { 0, y - 1 }, bindingOffset, format, ft);
|
||||
|
||||
if (!shortcut.Binding.empty())
|
||||
{
|
||||
ft = Formatter();
|
||||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<const char*>(shortcut.Binding.c_str());
|
||||
DrawTextEllipsised(&dpi, { bindingOffset, y - 1 }, 150, format, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(&dpi, { bindingOffset, y - 1 }, 150, format, ft);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -943,7 +943,7 @@ void window_staff_overview_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
rct_widget* widget = &w->widgets[WIDX_BTM_LABEL];
|
||||
auto screenPos = w->windowPos + ScreenCoordsXY{ widget->midX(), widget->top };
|
||||
int32_t width = widget->width();
|
||||
DrawTextEllipsised(dpi, screenPos, width, STR_BLACK_STRING, ft, COLOUR_BLACK, TextAlignment::CENTRE);
|
||||
DrawTextEllipsised(dpi, screenPos, width, STR_BLACK_STRING, ft, { TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -407,11 +407,11 @@ public:
|
|||
|
||||
auto ft = Formatter();
|
||||
peep->FormatNameTo(ft);
|
||||
DrawTextEllipsised(&dpi, { 0, y }, nameColumnSize, format, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(&dpi, { 0, y }, nameColumnSize, format, ft);
|
||||
|
||||
ft = Formatter();
|
||||
peep->FormatActionTo(ft);
|
||||
DrawTextEllipsised(&dpi, { actionOffset, y }, actionColumnSize, format, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(&dpi, { actionOffset, y }, actionColumnSize, format, ft);
|
||||
|
||||
// True if a patrol path is set for the worker
|
||||
if (gStaffModes[peep->StaffId] == StaffMode::Patrol)
|
||||
|
|
|
@ -215,14 +215,12 @@ public:
|
|||
|
||||
screenCoords.y += 25;
|
||||
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
|
||||
char wrapped_string[TEXT_INPUT_SIZE];
|
||||
safe_strcpy(wrapped_string, _buffer.data(), TEXT_INPUT_SIZE);
|
||||
|
||||
// String length needs to add 12 either side of box
|
||||
// +13 for cursor when max length.
|
||||
gfx_wrap_string(wrapped_string, WW - (24 + 13), &no_lines);
|
||||
gfx_wrap_string(wrapped_string, WW - (24 + 13), FontSpriteBase::MEDIUM, &no_lines);
|
||||
|
||||
gfx_fill_rect_inset(
|
||||
&dpi, { { windowPos.x + 10, screenCoords.y }, { windowPos.x + WW - 10, screenCoords.y + 10 * (no_lines + 1) + 3 } },
|
||||
|
@ -239,7 +237,7 @@ public:
|
|||
for (int32_t line = 0; line <= no_lines; line++)
|
||||
{
|
||||
screenCoords.x = windowPos.x + 12;
|
||||
gfx_draw_string_no_formatting(&dpi, wrap_pointer, colours[1], screenCoords);
|
||||
gfx_draw_string_no_formatting(&dpi, screenCoords, wrap_pointer, { colours[1], FontSpriteBase::MEDIUM });
|
||||
|
||||
size_t string_length = get_string_size(wrap_pointer) - 1;
|
||||
|
||||
|
@ -309,7 +307,7 @@ public:
|
|||
|
||||
// String length needs to add 12 either side of box +13 for cursor when max length.
|
||||
int32_t numLines{};
|
||||
gfx_wrap_string(wrappedString.data(), WW - (24 + 13), &numLines);
|
||||
gfx_wrap_string(wrappedString.data(), WW - (24 + 13), FontSpriteBase::MEDIUM, &numLines);
|
||||
return numLines * 10 + WH;
|
||||
}
|
||||
|
||||
|
|
|
@ -833,7 +833,7 @@ void window_themes_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
auto width = w->windowPos.x + window_themes_widgets[WIDX_THEMES_PRESETS_DROPDOWN].left
|
||||
- window_themes_widgets[WIDX_THEMES_PRESETS].left - 4;
|
||||
|
||||
DrawTextEllipsised(dpi, screenPos, width, STR_STRING, ft, w->colours[1]);
|
||||
DrawTextEllipsised(dpi, screenPos, width, STR_STRING, ft, { w->colours[1] });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -911,7 +911,6 @@ void window_themes_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_t sc
|
|||
gfx_fill_rect_inset(dpi, { topLeft, bottomRight }, w->colours[1], INSET_RECT_F_E0);
|
||||
if (colour & COLOUR_FLAG_TRANSLUCENT)
|
||||
{
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM_DARK;
|
||||
gfx_draw_string(
|
||||
dpi, topLeft, static_cast<const char*>(CheckBoxMarkString),
|
||||
{ static_cast<colour_t>(w->colours[1] & 0x7F), FontSpriteBase::MEDIUM_DARK });
|
||||
|
|
|
@ -1712,40 +1712,37 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
{
|
||||
WindowDrawWidgets(w, dpi);
|
||||
|
||||
// Set medium font size
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
|
||||
// Draw column headers
|
||||
rct_widget* widget;
|
||||
if ((widget = &w->widgets[WIDX_COLUMN_TYPE])->type != WindowWidgetType::Empty)
|
||||
{
|
||||
DrawTextEllipsised(
|
||||
dpi, { w->windowPos.x + widget->left + 1, w->windowPos.y + widget->top + 1 }, widget->width(),
|
||||
STR_TILE_INSPECTOR_ELEMENT_TYPE, {}, w->colours[1]);
|
||||
STR_TILE_INSPECTOR_ELEMENT_TYPE, {}, { w->colours[1] });
|
||||
}
|
||||
if ((widget = &w->widgets[WIDX_COLUMN_BASEHEIGHT])->type != WindowWidgetType::Empty)
|
||||
{
|
||||
DrawTextEllipsised(
|
||||
dpi, { w->windowPos.x + widget->left + 1, w->windowPos.y + widget->top + 1 }, widget->width(),
|
||||
STR_TILE_INSPECTOR_BASE_HEIGHT_SHORT, {}, w->colours[1]);
|
||||
STR_TILE_INSPECTOR_BASE_HEIGHT_SHORT, {}, { w->colours[1] });
|
||||
}
|
||||
if ((widget = &w->widgets[WIDX_COLUMN_CLEARANCEHEIGHT])->type != WindowWidgetType::Empty)
|
||||
{
|
||||
DrawTextEllipsised(
|
||||
dpi, { w->windowPos.x + widget->left + 1, w->windowPos.y + widget->top + 1 }, widget->width(),
|
||||
STR_TILE_INSPECTOR_CLEARANGE_HEIGHT_SHORT, {}, w->colours[1]);
|
||||
STR_TILE_INSPECTOR_CLEARANGE_HEIGHT_SHORT, {}, { w->colours[1] });
|
||||
}
|
||||
if ((widget = &w->widgets[WIDX_COLUMN_GHOSTFLAG])->type != WindowWidgetType::Empty)
|
||||
{
|
||||
DrawTextEllipsised(
|
||||
dpi, { w->windowPos.x + widget->left + 1, w->windowPos.y + widget->top + 1 }, widget->width(),
|
||||
STR_TILE_INSPECTOR_FLAG_GHOST_SHORT, {}, w->colours[1]);
|
||||
STR_TILE_INSPECTOR_FLAG_GHOST_SHORT, {}, { w->colours[1] });
|
||||
}
|
||||
if ((widget = &w->widgets[WIDX_COLUMN_LASTFLAG])->type != WindowWidgetType::Empty)
|
||||
{
|
||||
DrawTextEllipsised(
|
||||
dpi, { w->windowPos.x + widget->left + 1, w->windowPos.y + widget->top + 1 }, widget->width(),
|
||||
STR_TILE_INSPECTOR_FLAG_LAST_SHORT, {}, w->colours[1]);
|
||||
STR_TILE_INSPECTOR_FLAG_LAST_SHORT, {}, { w->colours[1] });
|
||||
}
|
||||
|
||||
ScreenCoordsXY screenCoords(w->windowPos.x, w->windowPos.y);
|
||||
|
@ -2247,7 +2244,6 @@ static void window_tile_inspector_scrollpaint(rct_window* w, rct_drawpixelinfo*
|
|||
|
||||
const TileElement* tileElement = map_get_first_element_at(windowTileInspectorToolMap);
|
||||
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
do
|
||||
{
|
||||
if (tileElement == nullptr)
|
||||
|
@ -2333,8 +2329,7 @@ static void window_tile_inspector_scrollpaint(rct_window* w, rct_drawpixelinfo*
|
|||
auto ft = Formatter();
|
||||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<char*>(typeName);
|
||||
DrawTextEllipsised(
|
||||
dpi, screenCoords + ScreenCoordsXY{ COL_X_TYPE + 3, 0 }, COL_X_BH, stringFormat, ft, COLOUR_BLACK); // 3px padding
|
||||
DrawTextEllipsised(dpi, screenCoords + ScreenCoordsXY{ COL_X_TYPE + 3, 0 }, COL_X_BH, stringFormat, ft); // 3px padding
|
||||
|
||||
// Base height
|
||||
ft = Formatter();
|
||||
|
|
|
@ -770,7 +770,7 @@ static void window_title_command_editor_paint(rct_window* w, rct_drawpixelinfo*
|
|||
DrawTextEllipsised(
|
||||
dpi, { w->windowPos.x + w->widgets[WIDX_COMMAND].left + 1, w->windowPos.y + w->widgets[WIDX_COMMAND].top },
|
||||
w->widgets[WIDX_COMMAND_DROPDOWN].left - w->widgets[WIDX_COMMAND].left - 4, command_info.nameStringId, {},
|
||||
w->colours[1]);
|
||||
{ w->colours[1] });
|
||||
|
||||
// Label (e.g. "Location:")
|
||||
DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ WS, BY2 - 14 }, command_info.descStringId, {}, { w->colours[1] });
|
||||
|
@ -780,7 +780,7 @@ static void window_title_command_editor_paint(rct_window* w, rct_drawpixelinfo*
|
|||
DrawTextEllipsised(
|
||||
dpi, { w->windowPos.x + w->widgets[WIDX_INPUT].left + 1, w->windowPos.y + w->widgets[WIDX_INPUT].top },
|
||||
w->widgets[WIDX_INPUT_DROPDOWN].left - w->widgets[WIDX_INPUT].left - 4, SpeedNames[_command.Speed - 1], {},
|
||||
w->colours[1]);
|
||||
{ w->colours[1] });
|
||||
}
|
||||
if (_command.Type == TitleScript::Follow)
|
||||
{
|
||||
|
@ -803,7 +803,7 @@ static void window_title_command_editor_paint(rct_window* w, rct_drawpixelinfo*
|
|||
{ w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_VIEWPORT].right, w->widgets[WIDX_VIEWPORT].bottom } } });
|
||||
DrawTextEllipsised(
|
||||
dpi, { w->windowPos.x + w->widgets[WIDX_VIEWPORT].left + 2, w->windowPos.y + w->widgets[WIDX_VIEWPORT].top + 1 },
|
||||
w->widgets[WIDX_VIEWPORT].width() - 2, spriteString, ft, colour);
|
||||
w->widgets[WIDX_VIEWPORT].width() - 2, spriteString, ft, { colour });
|
||||
}
|
||||
else if (_command.Type == TitleScript::Load)
|
||||
{
|
||||
|
@ -812,7 +812,7 @@ static void window_title_command_editor_paint(rct_window* w, rct_drawpixelinfo*
|
|||
DrawTextEllipsised(
|
||||
dpi, { w->windowPos.x + w->widgets[WIDX_INPUT].left + 1, w->windowPos.y + w->widgets[WIDX_INPUT].top },
|
||||
w->widgets[WIDX_INPUT_DROPDOWN].left - w->widgets[WIDX_INPUT].left - 4,
|
||||
STR_TITLE_COMMAND_EDITOR_NO_SAVE_SELECTED, {}, w->colours[1]);
|
||||
STR_TITLE_COMMAND_EDITOR_NO_SAVE_SELECTED, {}, { w->colours[1] });
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -820,7 +820,7 @@ static void window_title_command_editor_paint(rct_window* w, rct_drawpixelinfo*
|
|||
ft.Add<utf8*>(_sequence->Saves[_command.SaveIndex].c_str());
|
||||
DrawTextEllipsised(
|
||||
dpi, { w->windowPos.x + w->widgets[WIDX_INPUT].left + 1, w->windowPos.y + w->widgets[WIDX_INPUT].top },
|
||||
w->widgets[WIDX_INPUT_DROPDOWN].left - w->widgets[WIDX_INPUT].left - 4, STR_STRING, ft, w->colours[1]);
|
||||
w->widgets[WIDX_INPUT_DROPDOWN].left - w->widgets[WIDX_INPUT].left - 4, STR_STRING, ft, { w->colours[1] });
|
||||
}
|
||||
}
|
||||
else if (_command.Type == TitleScript::LoadSc)
|
||||
|
@ -830,7 +830,7 @@ static void window_title_command_editor_paint(rct_window* w, rct_drawpixelinfo*
|
|||
DrawTextEllipsised(
|
||||
dpi, { w->windowPos.x + w->widgets[WIDX_INPUT].left + 1, w->windowPos.y + w->widgets[WIDX_INPUT].top },
|
||||
w->widgets[WIDX_INPUT_DROPDOWN].left - w->widgets[WIDX_INPUT].left - 4,
|
||||
STR_TITLE_COMMAND_EDITOR_NO_SCENARIO_SELECTED, {}, w->colours[1]);
|
||||
STR_TITLE_COMMAND_EDITOR_NO_SCENARIO_SELECTED, {}, { w->colours[1] });
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -849,7 +849,7 @@ static void window_title_command_editor_paint(rct_window* w, rct_drawpixelinfo*
|
|||
ft.Add<const char*>(name);
|
||||
DrawTextEllipsised(
|
||||
dpi, { w->windowPos.x + w->widgets[WIDX_INPUT].left + 1, w->windowPos.y + w->widgets[WIDX_INPUT].top },
|
||||
w->widgets[WIDX_INPUT_DROPDOWN].left - w->widgets[WIDX_INPUT].left - 4, nameString, ft, w->colours[1]);
|
||||
w->widgets[WIDX_INPUT_DROPDOWN].left - w->widgets[WIDX_INPUT].left - 4, nameString, ft, { w->colours[1] });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -819,7 +819,7 @@ static void window_title_editor_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
auto width = w->windowPos.x + window_title_editor_widgets[WIDX_TITLE_EDITOR_PRESETS_DROPDOWN].left
|
||||
- window_title_editor_widgets[WIDX_TITLE_EDITOR_PRESETS].left - 4;
|
||||
|
||||
DrawTextEllipsised(dpi, screenPos, width, STR_STRING, ft, w->colours[1]);
|
||||
DrawTextEllipsised(dpi, screenPos, width, STR_STRING, ft, { w->colours[1] });
|
||||
break;
|
||||
}
|
||||
case WINDOW_TITLE_EDITOR_TAB_SAVES:
|
||||
|
|
|
@ -56,15 +56,12 @@ static int32_t FormatTextForTooltip(const OpenRCT2String& message)
|
|||
OpenRCT2String formattedMessage{ STR_STRING_TOOLTIP, Formatter() };
|
||||
formattedMessage.args.Add<const char*>(tempBuffer);
|
||||
format_string(_tooltipText, sizeof(_tooltipText), formattedMessage.str, formattedMessage.args.Data());
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
|
||||
auto textWidth = gfx_get_string_width_new_lined(_tooltipText, FontSpriteBase::MEDIUM);
|
||||
auto textWidth = gfx_get_string_width_new_lined(_tooltipText, FontSpriteBase::SMALL);
|
||||
textWidth = std::min(textWidth, 196);
|
||||
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
|
||||
int32_t numLines;
|
||||
textWidth = gfx_wrap_string(_tooltipText, textWidth + 1, &numLines);
|
||||
textWidth = gfx_wrap_string(_tooltipText, textWidth + 1, FontSpriteBase::SMALL, &numLines);
|
||||
_tooltipNumLines = numLines;
|
||||
return textWidth;
|
||||
}
|
||||
|
@ -77,7 +74,7 @@ void window_tooltip_show(const OpenRCT2String& message, ScreenCoordsXY screenCoo
|
|||
|
||||
int32_t textWidth = FormatTextForTooltip(message);
|
||||
int32_t width = textWidth + 3;
|
||||
int32_t height = ((_tooltipNumLines + 1) * font_get_line_height(FontSpriteBase::MEDIUM)) + 4;
|
||||
int32_t height = ((_tooltipNumLines + 1) * font_get_line_height(FontSpriteBase::SMALL)) + 4;
|
||||
window_tooltip_widgets[WIDX_BACKGROUND].right = width;
|
||||
window_tooltip_widgets[WIDX_BACKGROUND].bottom = height;
|
||||
|
||||
|
@ -192,5 +189,5 @@ static void window_tooltip_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
// Text
|
||||
left = w->windowPos.x + ((w->width + 1) / 2) - 1;
|
||||
top = w->windowPos.y + 1;
|
||||
draw_string_centred_raw(dpi, { left, top }, _tooltipNumLines, _tooltipText);
|
||||
draw_string_centred_raw(dpi, { left, top }, _tooltipNumLines, _tooltipText, FontSpriteBase::SMALL);
|
||||
}
|
||||
|
|
|
@ -981,7 +981,6 @@ static void window_top_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
// Draw number of players.
|
||||
auto ft = Formatter();
|
||||
ft.Add<int32_t>(network_get_num_players());
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
DrawTextBasic(
|
||||
dpi, screenPos + ScreenCoordsXY{ 23, 1 }, STR_COMMA16, ft,
|
||||
{ COLOUR_WHITE | COLOUR_FLAG_OUTLINE, TextAlignment::RIGHT });
|
||||
|
|
|
@ -541,7 +541,7 @@ static void window_track_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
&& !(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER))
|
||||
{
|
||||
// Vehicle design not available
|
||||
DrawTextEllipsised(dpi, screenPos, 368, STR_VEHICLE_DESIGN_UNAVAILABLE, {}, COLOUR_BLACK, TextAlignment::CENTRE);
|
||||
DrawTextEllipsised(dpi, screenPos, 368, STR_VEHICLE_DESIGN_UNAVAILABLE, {}, { TextAlignment::CENTRE });
|
||||
screenPos.y -= SCROLLABLE_ROW_HEIGHT;
|
||||
}
|
||||
|
||||
|
@ -551,7 +551,7 @@ static void window_track_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
{
|
||||
// Scenery not available
|
||||
DrawTextEllipsised(
|
||||
dpi, screenPos, 368, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, {}, COLOUR_BLACK, TextAlignment::CENTRE);
|
||||
dpi, screenPos, 368, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, {}, { TextAlignment::CENTRE });
|
||||
screenPos.y -= SCROLLABLE_ROW_HEIGHT;
|
||||
}
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ static void window_track_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
// Track design name
|
||||
auto ft = Formatter();
|
||||
ft.Add<utf8*>(_trackDesigns[trackIndex].name);
|
||||
DrawTextEllipsised(dpi, screenPos, 368, STR_TRACK_PREVIEW_NAME_FORMAT, ft, COLOUR_BLACK, TextAlignment::CENTRE);
|
||||
DrawTextEllipsised(dpi, screenPos, 368, STR_TRACK_PREVIEW_NAME_FORMAT, ft, { TextAlignment::CENTRE });
|
||||
|
||||
// Information
|
||||
screenPos = w->windowPos + ScreenCoordsXY{ widget->left + 1, widget->bottom + 2 };
|
||||
|
@ -606,7 +606,7 @@ static void window_track_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
ft = Formatter();
|
||||
ft.Add<rct_string_id>(STR_RIDE_LENGTH_ENTRY);
|
||||
ft.Add<uint16_t>(_loadedTrackDesign->ride_length);
|
||||
DrawTextEllipsised(dpi, screenPos, 214, STR_TRACK_LIST_RIDE_LENGTH, ft, COLOUR_BLACK);
|
||||
DrawTextEllipsised(dpi, screenPos, 214, STR_TRACK_LIST_RIDE_LENGTH, ft);
|
||||
screenPos.y += LIST_ROW_HEIGHT;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ int32_t gfx_get_string_width_no_formatting(std::string_view text, FontSpriteBase
|
|||
* buffer (esi)
|
||||
* width (edi)
|
||||
*/
|
||||
int32_t gfx_clip_string(utf8* text, int32_t width)
|
||||
int32_t gfx_clip_string(utf8* text, int32_t width, FontSpriteBase fontSpriteBase)
|
||||
{
|
||||
if (width < 6)
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ int32_t gfx_clip_string(utf8* text, int32_t width)
|
|||
}
|
||||
|
||||
// If width of the full string is less than allowed width then we don't need to clip
|
||||
auto clippedWidth = gfx_get_string_width(text, gCurrentFontSpriteBase);
|
||||
auto clippedWidth = gfx_get_string_width(text, fontSpriteBase);
|
||||
if (clippedWidth <= width)
|
||||
{
|
||||
return clippedWidth;
|
||||
|
@ -126,7 +126,7 @@ int32_t gfx_clip_string(utf8* text, int32_t width)
|
|||
// Add the ellipsis before checking the width
|
||||
buffer.append("...");
|
||||
|
||||
auto currentWidth = gfx_get_string_width(buffer, gCurrentFontSpriteBase);
|
||||
auto currentWidth = gfx_get_string_width(buffer, fontSpriteBase);
|
||||
if (currentWidth < width)
|
||||
{
|
||||
bestLength = buffer.size();
|
||||
|
@ -154,7 +154,7 @@ int32_t gfx_clip_string(utf8* text, int32_t width)
|
|||
buffer.append(cb);
|
||||
}
|
||||
}
|
||||
return gfx_get_string_width(text, gCurrentFontSpriteBase);
|
||||
return gfx_get_string_width(text, fontSpriteBase);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -170,7 +170,7 @@ int32_t gfx_clip_string(utf8* text, int32_t width)
|
|||
* num_lines (edi) - out
|
||||
* font_height (ebx) - out
|
||||
*/
|
||||
int32_t gfx_wrap_string(utf8* text, int32_t width, int32_t* outNumLines)
|
||||
int32_t gfx_wrap_string(utf8* text, int32_t width, FontSpriteBase fontSpriteBase, int32_t* outNumLines)
|
||||
{
|
||||
constexpr size_t NULL_INDEX = std::numeric_limits<size_t>::max();
|
||||
thread_local std::string buffer;
|
||||
|
@ -194,7 +194,7 @@ int32_t gfx_wrap_string(utf8* text, int32_t width, int32_t* outNumLines)
|
|||
utf8_write_codepoint(cb, codepoint);
|
||||
buffer.append(cb);
|
||||
|
||||
auto lineWidth = gfx_get_string_width(&buffer[currentLineIndex], gCurrentFontSpriteBase);
|
||||
auto lineWidth = gfx_get_string_width(&buffer[currentLineIndex], fontSpriteBase);
|
||||
if (lineWidth <= width || (splitIndex == NULL_INDEX && bestSplitIndex == NULL_INDEX))
|
||||
{
|
||||
if (codepoint == ' ')
|
||||
|
@ -218,7 +218,7 @@ int32_t gfx_wrap_string(utf8* text, int32_t width, int32_t* outNumLines)
|
|||
buffer.insert(buffer.begin() + splitIndex, '\0');
|
||||
|
||||
// Recalculate the line length after splitting
|
||||
lineWidth = gfx_get_string_width(&buffer[currentLineIndex], gCurrentFontSpriteBase);
|
||||
lineWidth = gfx_get_string_width(&buffer[currentLineIndex], fontSpriteBase);
|
||||
maxWidth = std::max(maxWidth, lineWidth);
|
||||
numLines++;
|
||||
|
||||
|
@ -238,7 +238,7 @@ int32_t gfx_wrap_string(utf8* text, int32_t width, int32_t* outNumLines)
|
|||
{
|
||||
buffer.push_back('\0');
|
||||
|
||||
auto lineWidth = gfx_get_string_width(&buffer[currentLineIndex], gCurrentFontSpriteBase);
|
||||
auto lineWidth = gfx_get_string_width(&buffer[currentLineIndex], fontSpriteBase);
|
||||
maxWidth = std::max(maxWidth, lineWidth);
|
||||
numLines++;
|
||||
|
||||
|
@ -253,7 +253,7 @@ int32_t gfx_wrap_string(utf8* text, int32_t width, int32_t* outNumLines)
|
|||
}
|
||||
{
|
||||
// Final line width calculation
|
||||
auto lineWidth = gfx_get_string_width(&buffer[currentLineIndex], gCurrentFontSpriteBase);
|
||||
auto lineWidth = gfx_get_string_width(&buffer[currentLineIndex], fontSpriteBase);
|
||||
maxWidth = std::max(maxWidth, lineWidth);
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,6 @@ int32_t gfx_wrap_string(utf8* text, int32_t width, int32_t* outNumLines)
|
|||
void gfx_draw_string_left_centred(
|
||||
rct_drawpixelinfo* dpi, rct_string_id format, void* args, colour_t colour, const ScreenCoordsXY& coords)
|
||||
{
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
char* buffer = gCommonStringFormatBuffer;
|
||||
format_string(buffer, 256, format, args);
|
||||
int32_t height = string_get_height_raw(buffer, FontSpriteBase::MEDIUM);
|
||||
|
@ -330,17 +329,17 @@ static void colour_char_window(uint8_t colour, const uint16_t* current_font_flag
|
|||
* text : esi
|
||||
* dpi : edi
|
||||
*/
|
||||
void draw_string_centred_raw(rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, int32_t numLines, char* text)
|
||||
void draw_string_centred_raw(
|
||||
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, int32_t numLines, char* text, FontSpriteBase fontSpriteBase)
|
||||
{
|
||||
ScreenCoordsXY screenCoords(dpi->x, dpi->y);
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
gfx_draw_string(dpi, screenCoords, "", { COLOUR_BLACK });
|
||||
gfx_draw_string(dpi, screenCoords, "", { COLOUR_BLACK, fontSpriteBase });
|
||||
screenCoords = coords;
|
||||
|
||||
for (int32_t i = 0; i <= numLines; i++)
|
||||
{
|
||||
int32_t width = gfx_get_string_width(text, FontSpriteBase::MEDIUM);
|
||||
gfx_draw_string(dpi, screenCoords - ScreenCoordsXY{ width / 2, 0 }, text, { TEXT_COLOUR_254 });
|
||||
int32_t width = gfx_get_string_width(text, fontSpriteBase);
|
||||
gfx_draw_string(dpi, screenCoords - ScreenCoordsXY{ width / 2, 0 }, text, { TEXT_COLOUR_254, fontSpriteBase });
|
||||
|
||||
const utf8* ch = text;
|
||||
const utf8* nextCh = nullptr;
|
||||
|
@ -351,7 +350,7 @@ void draw_string_centred_raw(rct_drawpixelinfo* dpi, const ScreenCoordsXY& coord
|
|||
}
|
||||
text = const_cast<char*>(ch + 1);
|
||||
|
||||
screenCoords.y += font_get_line_height(FontSpriteBase::MEDIUM);
|
||||
screenCoords.y += font_get_line_height(fontSpriteBase);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -431,12 +430,10 @@ void gfx_draw_string_centred_wrapped_partial(
|
|||
utf8* buffer = gCommonStringFormatBuffer;
|
||||
ScreenCoordsXY screenCoords(dpi->x, dpi->y);
|
||||
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
gfx_draw_string(dpi, screenCoords, "", { colour });
|
||||
format_string(buffer, 256, format, args);
|
||||
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
gfx_wrap_string(buffer, width, &numLines);
|
||||
gfx_wrap_string(buffer, width, FontSpriteBase::MEDIUM, &numLines);
|
||||
lineHeight = font_get_line_height(FontSpriteBase::MEDIUM);
|
||||
|
||||
int32_t numCharactersDrawn = 0;
|
||||
|
@ -931,13 +928,14 @@ static void ttf_process_initial_colour(int32_t colour, text_draw_info* info)
|
|||
}
|
||||
|
||||
void ttf_draw_string(
|
||||
rct_drawpixelinfo* dpi, const_utf8string text, int32_t colour, const ScreenCoordsXY& coords, bool noFormatting)
|
||||
rct_drawpixelinfo* dpi, const_utf8string text, int32_t colour, const ScreenCoordsXY& coords, bool noFormatting,
|
||||
FontSpriteBase fontSpriteBase)
|
||||
{
|
||||
if (text == nullptr)
|
||||
return;
|
||||
|
||||
text_draw_info info;
|
||||
info.font_sprite_base = gCurrentFontSpriteBase;
|
||||
info.font_sprite_base = fontSpriteBase;
|
||||
info.flags = 0;
|
||||
info.startX = coords.x;
|
||||
info.startY = coords.y;
|
||||
|
@ -959,8 +957,6 @@ void ttf_draw_string(
|
|||
ttf_process_string(dpi, text, &info);
|
||||
std::memcpy(text_palette, info.palette, sizeof(info.palette));
|
||||
|
||||
gCurrentFontSpriteBase = info.font_sprite_base;
|
||||
|
||||
gLastDrawStringX = info.x;
|
||||
gLastDrawStringY = info.y;
|
||||
}
|
||||
|
@ -999,10 +995,10 @@ static int32_t ttf_get_string_width(std::string_view text, FontSpriteBase fontSp
|
|||
*/
|
||||
void gfx_draw_string_with_y_offsets(
|
||||
rct_drawpixelinfo* dpi, const utf8* text, int32_t colour, const ScreenCoordsXY& coords, const int8_t* yOffsets,
|
||||
bool forceSpriteFont)
|
||||
bool forceSpriteFont, FontSpriteBase fontSpriteBase)
|
||||
{
|
||||
text_draw_info info;
|
||||
info.font_sprite_base = gCurrentFontSpriteBase;
|
||||
info.font_sprite_base = fontSpriteBase;
|
||||
info.flags = 0;
|
||||
info.startX = coords.x;
|
||||
info.startY = coords.y;
|
||||
|
@ -1022,18 +1018,16 @@ void gfx_draw_string_with_y_offsets(
|
|||
ttf_process_string(dpi, text, &info);
|
||||
std::memcpy(text_palette, info.palette, sizeof(info.palette));
|
||||
|
||||
gCurrentFontSpriteBase = info.font_sprite_base;
|
||||
|
||||
gLastDrawStringX = info.x;
|
||||
gLastDrawStringY = info.y;
|
||||
}
|
||||
|
||||
void shorten_path(utf8* buffer, size_t bufferSize, const utf8* path, int32_t availableWidth)
|
||||
void shorten_path(utf8* buffer, size_t bufferSize, const utf8* path, int32_t availableWidth, FontSpriteBase fontSpriteBase)
|
||||
{
|
||||
size_t length = strlen(path);
|
||||
|
||||
// Return full string if it fits
|
||||
if (gfx_get_string_width(const_cast<char*>(path), gCurrentFontSpriteBase) <= availableWidth)
|
||||
if (gfx_get_string_width(const_cast<char*>(path), fontSpriteBase) <= availableWidth)
|
||||
{
|
||||
safe_strcpy(buffer, path, bufferSize);
|
||||
return;
|
||||
|
@ -1062,7 +1056,7 @@ void shorten_path(utf8* buffer, size_t bufferSize, const utf8* path, int32_t ava
|
|||
} while (path[begin] != *PATH_SEPARATOR && path[begin] != '/');
|
||||
|
||||
safe_strcpy(buffer + 3, path + begin, bufferSize - 3);
|
||||
if (gfx_get_string_width(buffer, gCurrentFontSpriteBase) <= availableWidth)
|
||||
if (gfx_get_string_width(buffer, fontSpriteBase) <= availableWidth)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -85,8 +85,6 @@ void PaletteMap::Copy(size_t dstIndex, const PaletteMap& src, size_t srcIndex, s
|
|||
thread_local int32_t gLastDrawStringX;
|
||||
thread_local int32_t gLastDrawStringY;
|
||||
|
||||
thread_local FontSpriteBase gCurrentFontSpriteBase;
|
||||
|
||||
uint8_t gGamePalette[256 * 4];
|
||||
uint32_t gPaletteEffectFrame;
|
||||
|
||||
|
|
|
@ -653,8 +653,6 @@ void FASTCALL BlitPixels(const uint8_t* src, uint8_t* dst, const PaletteMap& pal
|
|||
|
||||
#define MAX_SCROLLING_TEXT_MODES 38
|
||||
|
||||
extern thread_local FontSpriteBase gCurrentFontSpriteBase;
|
||||
|
||||
extern GamePalette gPalette;
|
||||
extern uint8_t gGamePalette[256 * 4];
|
||||
extern uint32_t gPaletteEffectFrame;
|
||||
|
@ -737,27 +735,29 @@ void FASTCALL gfx_draw_sprite_raw_masked_software(
|
|||
// string
|
||||
void gfx_draw_string(rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, const_utf8string buffer, TextPaint textPaint = {});
|
||||
void gfx_draw_string_no_formatting(
|
||||
rct_drawpixelinfo* dpi, const_utf8string buffer, uint8_t colour, const ScreenCoordsXY& coords);
|
||||
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, const_utf8string buffer, TextPaint textPaint);
|
||||
|
||||
void gfx_draw_string_left_centred(
|
||||
rct_drawpixelinfo* dpi, rct_string_id format, void* args, colour_t colour, const ScreenCoordsXY& coords);
|
||||
void draw_string_centred_raw(rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, int32_t numLines, char* text);
|
||||
void draw_string_centred_raw(
|
||||
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, int32_t numLines, char* text, FontSpriteBase fontSpriteBase);
|
||||
void gfx_draw_string_centred_wrapped_partial(
|
||||
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, int32_t width, colour_t colour, rct_string_id format, void* args,
|
||||
int32_t ticks);
|
||||
void gfx_draw_string_with_y_offsets(
|
||||
rct_drawpixelinfo* dpi, const utf8* text, int32_t colour, const ScreenCoordsXY& coords, const int8_t* yOffsets,
|
||||
bool forceSpriteFont);
|
||||
bool forceSpriteFont, FontSpriteBase fontSpriteBase);
|
||||
|
||||
int32_t gfx_wrap_string(char* buffer, int32_t width, int32_t* num_lines);
|
||||
int32_t gfx_wrap_string(char* buffer, int32_t width, FontSpriteBase fontSpriteBase, int32_t* num_lines);
|
||||
int32_t gfx_get_string_width(std::string_view text, FontSpriteBase fontSpriteBase);
|
||||
int32_t gfx_get_string_width_new_lined(std::string_view text, FontSpriteBase fontSpriteBase);
|
||||
int32_t gfx_get_string_width_no_formatting(std::string_view text, FontSpriteBase fontSpriteBase);
|
||||
int32_t string_get_height_raw(std::string_view text, FontSpriteBase fontBase);
|
||||
int32_t gfx_clip_string(char* buffer, int32_t width);
|
||||
void shorten_path(utf8* buffer, size_t bufferSize, const utf8* path, int32_t availableWidth);
|
||||
int32_t gfx_clip_string(char* buffer, int32_t width, FontSpriteBase fontSpriteBase);
|
||||
void shorten_path(utf8* buffer, size_t bufferSize, const utf8* path, int32_t availableWidth, FontSpriteBase fontSpriteBase);
|
||||
void ttf_draw_string(
|
||||
rct_drawpixelinfo* dpi, const_utf8string text, int32_t colour, const ScreenCoordsXY& coords, bool noFormatting);
|
||||
rct_drawpixelinfo* dpi, const_utf8string text, int32_t colour, const ScreenCoordsXY& coords, bool noFormatting,
|
||||
FontSpriteBase fontSpriteBase);
|
||||
|
||||
// scrolling text
|
||||
void scrolling_text_initialise_bitmaps();
|
||||
|
|
|
@ -23,16 +23,13 @@ StaticLayout::StaticLayout(utf8string source, const TextPaint& paint, int32_t wi
|
|||
Buffer = source;
|
||||
Paint = paint;
|
||||
|
||||
gCurrentFontSpriteBase = paint.SpriteBase;
|
||||
MaxWidth = gfx_wrap_string(Buffer, width, &LineCount);
|
||||
MaxWidth = gfx_wrap_string(Buffer, width, paint.SpriteBase, &LineCount);
|
||||
LineCount += 1;
|
||||
LineHeight = font_get_line_height(gCurrentFontSpriteBase);
|
||||
LineHeight = font_get_line_height(paint.SpriteBase);
|
||||
}
|
||||
|
||||
void StaticLayout::Draw(rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords)
|
||||
{
|
||||
gCurrentFontSpriteBase = Paint.SpriteBase;
|
||||
|
||||
TextPaint tempPaint = Paint;
|
||||
|
||||
auto lineCoords = coords;
|
||||
|
@ -91,7 +88,7 @@ static void DrawText(
|
|||
break;
|
||||
}
|
||||
|
||||
ttf_draw_string(dpi, text, paint.Colour, alignedCoords, noFormatting);
|
||||
ttf_draw_string(dpi, text, paint.Colour, alignedCoords, noFormatting, paint.SpriteBase);
|
||||
|
||||
if (paint.UnderlineText == TextUnderline::On)
|
||||
{
|
||||
|
@ -118,7 +115,6 @@ static void DrawText(
|
|||
void DrawTextBasic(
|
||||
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, rct_string_id format, const void* args, TextPaint textPaint)
|
||||
{
|
||||
gCurrentFontSpriteBase = textPaint.SpriteBase;
|
||||
DrawText(dpi, coords, textPaint, format, args);
|
||||
}
|
||||
|
||||
|
@ -130,14 +126,11 @@ void DrawTextBasic(
|
|||
|
||||
void DrawTextEllipsised(
|
||||
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, int32_t width, rct_string_id format, const Formatter& ft,
|
||||
colour_t colour, TextAlignment alignment, bool underline)
|
||||
TextPaint textPaint)
|
||||
{
|
||||
TextPaint textPaint = { colour, FontSpriteBase::MEDIUM, underline ? TextUnderline::On : TextUnderline::Off, alignment };
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
|
||||
utf8 buffer[512];
|
||||
format_string(buffer, sizeof(buffer), format, ft.Data());
|
||||
gfx_clip_string(buffer, width);
|
||||
gfx_clip_string(buffer, width, textPaint.SpriteBase);
|
||||
|
||||
DrawText(dpi, coords, textPaint, buffer);
|
||||
}
|
||||
|
@ -148,9 +141,8 @@ void gfx_draw_string(rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, const
|
|||
}
|
||||
|
||||
void gfx_draw_string_no_formatting(
|
||||
rct_drawpixelinfo* dpi, const_utf8string buffer, uint8_t colour, const ScreenCoordsXY& coords)
|
||||
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, const_utf8string buffer, TextPaint textPaint)
|
||||
{
|
||||
TextPaint textPaint = { colour, gCurrentFontSpriteBase, TextUnderline::Off, TextAlignment::LEFT };
|
||||
DrawText(dpi, coords, textPaint, buffer, true);
|
||||
}
|
||||
|
||||
|
@ -161,8 +153,6 @@ int32_t DrawTextWrapped(
|
|||
utf8 buffer[512];
|
||||
format_string(buffer, sizeof(buffer), format, args);
|
||||
|
||||
gCurrentFontSpriteBase = textPaint.SpriteBase;
|
||||
|
||||
StaticLayout layout(buffer, textPaint, width);
|
||||
|
||||
if (textPaint.Alignment == TextAlignment::CENTRE)
|
||||
|
|
|
@ -151,7 +151,7 @@ void DrawTextBasic(
|
|||
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, rct_string_id format, const void* args, TextPaint textPaint = {});
|
||||
void DrawTextEllipsised(
|
||||
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, int32_t width, rct_string_id format, const Formatter& ft,
|
||||
colour_t colour, TextAlignment alignment = TextAlignment::LEFT, bool underline = false);
|
||||
TextPaint textPaint = {});
|
||||
int32_t DrawTextWrapped(
|
||||
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, int32_t width, rct_string_id format, const Formatter& ft = {},
|
||||
TextPaint textPaint = {});
|
||||
|
|
|
@ -275,8 +275,7 @@ static int32_t chat_history_draw_string(
|
|||
FormatStringToBuffer(gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), "{OUTLINE}{WHITE}{STRING}", text);
|
||||
|
||||
int32_t numLines;
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
gfx_wrap_string(buffer, width, &numLines);
|
||||
gfx_wrap_string(buffer, width, FontSpriteBase::MEDIUM, &numLines);
|
||||
auto lineHeight = font_get_line_height(FontSpriteBase::MEDIUM);
|
||||
|
||||
int32_t expectedY = screenCoords.y - (numLines * lineHeight);
|
||||
|
@ -299,18 +298,14 @@ static int32_t chat_history_draw_string(
|
|||
// Almost the same as gfx_draw_string_left_wrapped
|
||||
int32_t chat_string_wrapped_get_height(void* args, int32_t width)
|
||||
{
|
||||
int32_t lineHeight, lineY, numLines;
|
||||
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
|
||||
char* buffer = gCommonStringFormatBuffer;
|
||||
format_string(buffer, 256, STR_STRING, args);
|
||||
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
gfx_wrap_string(buffer, width, &numLines);
|
||||
lineHeight = font_get_line_height(FontSpriteBase::MEDIUM);
|
||||
int32_t numLines;
|
||||
gfx_wrap_string(buffer, width, FontSpriteBase::MEDIUM, &numLines);
|
||||
int32_t lineHeight = font_get_line_height(FontSpriteBase::MEDIUM);
|
||||
|
||||
lineY = 0;
|
||||
int32_t lineY = 0;
|
||||
for (int32_t line = 0; line <= numLines; ++line)
|
||||
{
|
||||
buffer = get_string_end(buffer) + 1;
|
||||
|
|
|
@ -952,7 +952,6 @@ void PaintDrawMoneyStructs(rct_drawpixelinfo* dpi, paint_string_struct* ps)
|
|||
{
|
||||
char buffer[256]{};
|
||||
format_string(buffer, sizeof(buffer), ps->string_id, &ps->args);
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
|
||||
// Use sprite font unless the currency contains characters unsupported by the sprite font
|
||||
auto forceSpriteFont = false;
|
||||
|
@ -963,6 +962,7 @@ void PaintDrawMoneyStructs(rct_drawpixelinfo* dpi, paint_string_struct* ps)
|
|||
}
|
||||
|
||||
gfx_draw_string_with_y_offsets(
|
||||
dpi, buffer, COLOUR_BLACK, { ps->x, ps->y }, reinterpret_cast<int8_t*>(ps->y_offsets), forceSpriteFont);
|
||||
dpi, buffer, COLOUR_BLACK, { ps->x, ps->y }, reinterpret_cast<int8_t*>(ps->y_offsets), forceSpriteFont,
|
||||
FontSpriteBase::MEDIUM);
|
||||
} while ((ps = ps->next) != nullptr);
|
||||
}
|
||||
|
|
|
@ -113,8 +113,6 @@ void banner_paint(paint_session* session, uint8_t direction, int32_t height, con
|
|||
format_string(gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), STR_BANNER_TEXT_FORMAT, ft.Data());
|
||||
}
|
||||
|
||||
gCurrentFontSpriteBase = FontSpriteBase::TINY;
|
||||
|
||||
uint16_t string_width = gfx_get_string_width(gCommonStringFormatBuffer, FontSpriteBase::TINY);
|
||||
uint16_t scroll = (gCurrentTicks / 2) % string_width;
|
||||
auto scrollIndex = scrolling_text_setup(session, STR_BANNER_TEXT_FORMAT, ft, scroll, scrollingMode, COLOUR_BLACK);
|
||||
|
|
|
@ -183,8 +183,6 @@ static void ride_entrance_exit_paint(paint_session* session, uint8_t direction,
|
|||
format_string(entrance_string, sizeof(entrance_string), STR_BANNER_TEXT_FORMAT, ft.Data());
|
||||
}
|
||||
|
||||
gCurrentFontSpriteBase = FontSpriteBase::TINY;
|
||||
|
||||
uint16_t stringWidth = gfx_get_string_width(entrance_string, FontSpriteBase::TINY);
|
||||
uint16_t scroll = stringWidth > 0 ? (gCurrentTicks / 2) % stringWidth : 0;
|
||||
|
||||
|
@ -291,8 +289,6 @@ static void park_entrance_paint(paint_session* session, uint8_t direction, int32
|
|||
format_string(park_name, sizeof(park_name), STR_BANNER_TEXT_FORMAT, ft.Data());
|
||||
}
|
||||
|
||||
gCurrentFontSpriteBase = FontSpriteBase::TINY;
|
||||
|
||||
uint16_t stringWidth = gfx_get_string_width(park_name, FontSpriteBase::TINY);
|
||||
uint16_t scroll = stringWidth > 0 ? (gCurrentTicks / 2) % stringWidth : 0;
|
||||
|
||||
|
|
|
@ -440,8 +440,6 @@ void large_scenery_paint(paint_session* session, uint8_t direction, uint16_t hei
|
|||
format_string(signString, sizeof(signString), STR_SCROLLING_SIGN_TEXT, ft.Data());
|
||||
}
|
||||
|
||||
gCurrentFontSpriteBase = FontSpriteBase::TINY;
|
||||
|
||||
uint16_t stringWidth = gfx_get_string_width(signString, FontSpriteBase::TINY);
|
||||
uint16_t scroll = stringWidth > 0 ? (gCurrentTicks / 2) % stringWidth : 0;
|
||||
PaintAddImageAsChild(
|
||||
|
|
|
@ -470,8 +470,6 @@ static void sub_6A4101(
|
|||
format_string(gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), STR_BANNER_TEXT_FORMAT, ft.Data());
|
||||
}
|
||||
|
||||
gCurrentFontSpriteBase = FontSpriteBase::TINY;
|
||||
|
||||
uint16_t stringWidth = gfx_get_string_width(gCommonStringFormatBuffer, FontSpriteBase::TINY);
|
||||
uint16_t scroll = stringWidth > 0 ? (gCurrentTicks / 2) % stringWidth : 0;
|
||||
|
||||
|
|
|
@ -446,8 +446,6 @@ void fence_paint(paint_session* session, uint8_t direction, int32_t height, cons
|
|||
format_string(signString, sizeof(signString), STR_SCROLLING_SIGN_TEXT, ft.Data());
|
||||
}
|
||||
|
||||
gCurrentFontSpriteBase = FontSpriteBase::TINY;
|
||||
|
||||
uint16_t stringWidth = gfx_get_string_width(signString, FontSpriteBase::TINY);
|
||||
uint16_t scroll = stringWidth > 0 ? (gCurrentTicks / 2) % stringWidth : 0;
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ void MoneyEffect::CreateAt(money32 value, const CoordsXYZ& effectPos, bool verti
|
|||
auto [stringId, newValue] = moneyEffect->GetStringId();
|
||||
char buffer[128];
|
||||
format_string(buffer, 128, stringId, &newValue);
|
||||
gCurrentFontSpriteBase = FontSpriteBase::MEDIUM;
|
||||
offsetX = -(gfx_get_string_width(buffer, FontSpriteBase::MEDIUM) / 2);
|
||||
}
|
||||
moneyEffect->OffsetX = offsetX;
|
||||
|
|
Loading…
Reference in New Issue