Change all calls to DrawTextBasic to use Formatter

This commit is contained in:
Gymnasiast 2021-07-27 20:32:27 +02:00
parent c97e8d36f1
commit 676ef7205e
No known key found for this signature in database
GPG Key ID: DBFFF47AB2CA3EDD
32 changed files with 558 additions and 384 deletions

View File

@ -162,9 +162,10 @@ namespace Graph
if (history[i] != MONEY64_UNDEFINED && yearOver32 % 4 == 0)
{
// Draw month text
int32_t monthFormat = DateGameShortMonthNames[date_get_month((yearOver32 / 4) + MONTH_COUNT)];
auto ft = Formatter();
ft.Add<rct_string_id>(DateGameShortMonthNames[date_get_month((yearOver32 / 4) + MONTH_COUNT)]);
DrawTextBasic(
dpi, screenCoords - ScreenCoordsXY{ 0, 10 }, STR_GRAPH_LABEL, &monthFormat,
dpi, screenCoords - ScreenCoordsXY{ 0, 10 }, STR_GRAPH_LABEL, ft,
{ FontSpriteBase::SMALL, TextAlignment::CENTRE });
// Draw month mark
@ -260,9 +261,10 @@ namespace Graph
gfx_draw_dashed_line(dpi, { info.coords, { info.coords.x, cursorPosition.y } }, DefaultDashedLength, 0);
}
auto ft = Formatter();
ft.Add<money64>(info.money);
DrawTextBasic(
dpi, info.coords - ScreenCoordsXY{ 0, 16 }, STR_FINANCES_SUMMARY_EXPENDITURE_VALUE, &info.money,
{ TextAlignment::CENTRE });
dpi, info.coords - ScreenCoordsXY{ 0, 16 }, STR_FINANCES_SUMMARY_EXPENDITURE_VALUE, ft, { TextAlignment::CENTRE });
gfx_fill_rect(
dpi, { { info.coords - ScreenCoordsXY{ 2, 2 } }, info.coords + ScreenCoordsXY{ 2, 2 } }, PALETTE_INDEX_10);

View File

@ -710,7 +710,7 @@ void CustomListView::PaintSeperator(
// Draw string
Formatter ft;
ft.Add<const char*>(text);
DrawTextBasic(dpi, { centreX, pos.y }, STR_STRING, ft.Data(), { baseColour, TextAlignment::CENTRE });
DrawTextBasic(dpi, { centreX, pos.y }, STR_STRING, ft, { baseColour, TextAlignment::CENTRE });
// Get string dimensions
format_string(gCommonStringFormatBuffer, sizeof(gCommonStringFormatBuffer), STR_STRING, ft.Data());

View File

@ -222,8 +222,9 @@ static void window_clear_scenery_paint(rct_window* w, rct_drawpixelinfo* dpi)
w->windowPos.y + window_clear_scenery_widgets[WIDX_PREVIEW].midY() };
if (gLandToolSize > MAX_TOOL_SIZE_WITH_SPRITE)
{
DrawTextBasic(
dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, &gLandToolSize, { TextAlignment::CENTRE });
auto ft = Formatter();
ft.Add<uint16_t>(gLandToolSize);
DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE });
}
// Draw cost amount

View File

@ -241,5 +241,5 @@ static void custom_currency_window_paint(rct_window* w, rct_drawpixelinfo* dpi)
rct_string_id stringId = (CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_unicode == CurrencyAffix::Prefix)
? STR_PREFIX
: STR_SUFFIX;
DrawTextBasic(dpi, drawPos, stringId, w, { w->colours[1] });
DrawTextBasic(dpi, drawPos, stringId, {}, { w->colours[1] });
}

View File

@ -497,7 +497,6 @@ static void window_editor_inventions_list_paint(rct_window* w, rct_drawpixelinfo
{
rct_widget* widget;
ResearchItem* researchItem;
rct_string_id stringId;
int32_t width;
WindowDrawWidgets(w, dpi);
@ -566,8 +565,9 @@ static void window_editor_inventions_list_paint(rct_window* w, rct_drawpixelinfo
// Item category
screenPos.x = w->windowPos.x + w->widgets[WIDX_RESEARCH_ORDER_SCROLL].right + 4;
stringId = researchItem->GetCategoryInventionString();
DrawTextBasic(dpi, screenPos, STR_INVENTION_RESEARCH_GROUP, &stringId);
ft = Formatter();
ft.Add<rct_string_id>(researchItem->GetCategoryInventionString());
DrawTextBasic(dpi, screenPos, STR_INVENTION_RESEARCH_GROUP, ft);
}
/**

View File

@ -790,7 +790,6 @@ static void window_editor_objective_options_main_paint(rct_window* w, rct_drawpi
{
int32_t width;
rct_string_id stringId;
uint64_t arg;
WindowDrawWidgets(w, dpi);
window_editor_objective_options_draw_tab_images(w, dpi);
@ -801,8 +800,9 @@ static void window_editor_objective_options_main_paint(rct_window* w, rct_drawpi
// Objective value
screenCoords = w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_OBJECTIVE].left + 1, w->widgets[WIDX_OBJECTIVE].top };
stringId = ObjectiveDropdownOptionNames[gScenarioObjective.Type];
DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, &stringId);
auto ft = Formatter();
ft.Add<rct_string_id>(ObjectiveDropdownOptionNames[gScenarioObjective.Type]);
DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, ft);
if (w->widgets[WIDX_OBJECTIVE_ARG_1].type != WindowWidgetType::Empty)
{
@ -836,34 +836,35 @@ static void window_editor_objective_options_main_paint(rct_window* w, rct_drawpi
// Objective argument 1 value
screenCoords = w->windowPos
+ ScreenCoordsXY{ w->widgets[WIDX_OBJECTIVE_ARG_1].left + 1, w->widgets[WIDX_OBJECTIVE_ARG_1].top };
ft = Formatter();
switch (gScenarioObjective.Type)
{
case OBJECTIVE_GUESTS_BY:
case OBJECTIVE_GUESTS_AND_RATING:
stringId = STR_WINDOW_OBJECTIVE_VALUE_GUEST_COUNT;
arg = gScenarioObjective.NumGuests;
ft.Add<uint16_t>(gScenarioObjective.NumGuests);
break;
case OBJECTIVE_PARK_VALUE_BY:
case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE:
case OBJECTIVE_MONTHLY_RIDE_INCOME:
case OBJECTIVE_MONTHLY_FOOD_INCOME:
stringId = STR_CURRENCY_FORMAT_LABEL;
arg = gScenarioObjective.Currency;
ft.Add<money64>(gScenarioObjective.Currency);
break;
case OBJECTIVE_10_ROLLERCOASTERS_LENGTH:
stringId = STR_WINDOW_OBJECTIVE_VALUE_LENGTH;
arg = gScenarioObjective.MinimumLength;
ft.Add<uint16_t>(gScenarioObjective.MinimumLength);
break;
case OBJECTIVE_FINISH_5_ROLLERCOASTERS:
stringId = STR_WINDOW_OBJECTIVE_VALUE_RATING;
arg = gScenarioObjective.MinimumExcitement;
ft.Add<uint16_t>(gScenarioObjective.MinimumExcitement);
break;
default:
stringId = STR_WINDOW_OBJECTIVE_VALUE_RATING;
arg = gScenarioObjective.Currency;
ft.Add<money64>(gScenarioObjective.Currency);
break;
}
DrawTextBasic(dpi, screenCoords, stringId, &arg, COLOUR_BLACK);
DrawTextBasic(dpi, screenCoords, stringId, ft, COLOUR_BLACK);
}
if (w->widgets[WIDX_OBJECTIVE_ARG_2].type != WindowWidgetType::Empty)
@ -875,8 +876,9 @@ static void window_editor_objective_options_main_paint(rct_window* w, rct_drawpi
// Objective argument 2 value
screenCoords = w->windowPos
+ ScreenCoordsXY{ w->widgets[WIDX_OBJECTIVE_ARG_2].left + 1, w->widgets[WIDX_OBJECTIVE_ARG_2].top };
arg = (gScenarioObjective.Year * MONTH_COUNT) - 1;
DrawTextBasic(dpi, screenCoords, STR_WINDOW_OBJECTIVE_VALUE_DATE, &arg);
ft = Formatter();
ft.Add<uint16_t>((gScenarioObjective.Year * MONTH_COUNT) - 1);
DrawTextBasic(dpi, screenCoords, STR_WINDOW_OBJECTIVE_VALUE_DATE, ft);
}
// Park name
@ -887,7 +889,7 @@ static void window_editor_objective_options_main_paint(rct_window* w, rct_drawpi
auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark();
auto parkName = park.Name.c_str();
auto ft = Formatter();
ft = Formatter();
ft.Add<rct_string_id>(STR_STRING);
ft.Add<const char*>(parkName);
DrawTextEllipsised(dpi, screenCoords, width, STR_WINDOW_PARK_NAME, ft);
@ -897,7 +899,7 @@ static void window_editor_objective_options_main_paint(rct_window* w, rct_drawpi
screenCoords = w->windowPos + ScreenCoordsXY{ 8, w->widgets[WIDX_SCENARIO_NAME].top };
width = w->widgets[WIDX_SCENARIO_NAME].left - 16;
auto ft = Formatter();
ft = Formatter();
ft.Add<rct_string_id>(STR_STRING);
ft.Add<const char*>(gS6Info.name);
DrawTextEllipsised(dpi, screenCoords, width, STR_WINDOW_SCENARIO_NAME, ft);
@ -921,8 +923,9 @@ static void window_editor_objective_options_main_paint(rct_window* w, rct_drawpi
// Scenario category value
screenCoords = w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_CATEGORY].left + 1, w->widgets[WIDX_CATEGORY].top };
stringId = ScenarioCategoryStringIds[gS6Info.category];
DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, &stringId);
ft = Formatter();
ft.Add<rct_string_id>(ScenarioCategoryStringIds[gS6Info.category]);
DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, ft);
}
/**

View File

@ -690,7 +690,9 @@ static void window_editor_scenario_options_financial_paint(rct_window* w, rct_dr
screenCoords = w->windowPos
+ ScreenCoordsXY{ w->widgets[WIDX_INITIAL_CASH].left + 1, w->widgets[WIDX_INITIAL_CASH].top };
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, &gInitialCash);
auto ft = Formatter();
ft.Add<money64>(gInitialCash);
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft);
}
if (w->widgets[WIDX_INITIAL_LOAN].type != WindowWidgetType::Empty)
@ -700,7 +702,9 @@ static void window_editor_scenario_options_financial_paint(rct_window* w, rct_dr
screenCoords = w->windowPos
+ ScreenCoordsXY{ w->widgets[WIDX_INITIAL_LOAN].left + 1, w->widgets[WIDX_INITIAL_LOAN].top };
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, &gBankLoan);
auto ft = Formatter();
ft.Add<money64>(gBankLoan);
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft);
}
if (w->widgets[WIDX_MAXIMUM_LOAN].type != WindowWidgetType::Empty)
@ -710,7 +714,9 @@ static void window_editor_scenario_options_financial_paint(rct_window* w, rct_dr
screenCoords = w->windowPos
+ ScreenCoordsXY{ w->widgets[WIDX_MAXIMUM_LOAN].left + 1, w->widgets[WIDX_MAXIMUM_LOAN].top };
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, &gMaxBankLoan);
auto ft = Formatter();
ft.Add<money64>(gMaxBankLoan);
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft);
}
if (w->widgets[WIDX_INTEREST_RATE].type != WindowWidgetType::Empty)
@ -721,8 +727,9 @@ static void window_editor_scenario_options_financial_paint(rct_window* w, rct_dr
screenCoords = w->windowPos
+ ScreenCoordsXY{ w->widgets[WIDX_INTEREST_RATE].left + 1, w->widgets[WIDX_INTEREST_RATE].top };
int16_t interestRate = std::clamp<int16_t>(static_cast<int16_t>(gBankLoanInterestRate), INT16_MIN, INT16_MAX);
DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, &interestRate);
auto ft = Formatter();
ft.Add<int16_t>(std::clamp<int16_t>(static_cast<int16_t>(gBankLoanInterestRate), INT16_MIN, INT16_MAX));
DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, ft);
}
}
@ -955,7 +962,6 @@ static void window_editor_scenario_options_guests_invalidate(rct_window* w)
*/
static void window_editor_scenario_options_guests_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
int32_t arg;
ScreenCoordsXY screenCoords{};
WindowDrawWidgets(w, dpi);
@ -970,8 +976,9 @@ static void window_editor_scenario_options_guests_paint(rct_window* w, rct_drawp
// Cash per guest value
screenCoords = w->windowPos
+ ScreenCoordsXY{ w->widgets[WIDX_CASH_PER_GUEST].left + 1, w->widgets[WIDX_CASH_PER_GUEST].top };
money64 value = gGuestInitialCash;
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, &value);
auto ft = Formatter();
ft.Add<money64>(gGuestInitialCash);
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft);
}
// Guest initial happiness label
@ -981,8 +988,9 @@ static void window_editor_scenario_options_guests_paint(rct_window* w, rct_drawp
// Guest initial happiness value
screenCoords = w->windowPos
+ ScreenCoordsXY{ w->widgets[WIDX_GUEST_INITIAL_HAPPINESS].left + 1, w->widgets[WIDX_GUEST_INITIAL_HAPPINESS].top };
arg = (gGuestInitialHappiness * 100) / 255;
DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, &arg);
auto ft = Formatter();
ft.Add<uint16_t>((gGuestInitialHappiness * 100) / 255);
DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, ft);
// Guest initial hunger label
screenCoords = w->windowPos + ScreenCoordsXY{ 8, w->widgets[WIDX_GUEST_INITIAL_HUNGER].top };
@ -991,8 +999,9 @@ static void window_editor_scenario_options_guests_paint(rct_window* w, rct_drawp
// Guest initial hunger value
screenCoords = w->windowPos
+ ScreenCoordsXY{ w->widgets[WIDX_GUEST_INITIAL_HUNGER].left + 1, w->widgets[WIDX_GUEST_INITIAL_HUNGER].top };
arg = ((255 - gGuestInitialHunger) * 100) / 255;
DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, &arg);
ft = Formatter();
ft.Add<uint16_t>(((255 - gGuestInitialHunger) * 100) / 255);
DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, ft);
// Guest initial thirst label
screenCoords = w->windowPos + ScreenCoordsXY{ 8, w->widgets[WIDX_GUEST_INITIAL_THIRST].top };
@ -1001,8 +1010,9 @@ static void window_editor_scenario_options_guests_paint(rct_window* w, rct_drawp
// Guest initial thirst value
screenCoords = w->windowPos
+ ScreenCoordsXY{ w->widgets[WIDX_GUEST_INITIAL_THIRST].left + 1, w->widgets[WIDX_GUEST_INITIAL_THIRST].top };
arg = ((255 - gGuestInitialThirst) * 100) / 255;
DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, &arg);
ft = Formatter();
ft.Add<uint16_t>(((255 - gGuestInitialThirst) * 100) / 255);
DrawTextBasic(dpi, screenCoords, STR_PERCENT_FORMAT_LABEL, ft);
}
#pragma endregion
@ -1317,7 +1327,6 @@ static void window_editor_scenario_options_park_invalidate(rct_window* w)
static void window_editor_scenario_options_park_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
ScreenCoordsXY screenCoords{};
rct_string_id stringId;
WindowDrawWidgets(w, dpi);
window_editor_scenario_options_draw_tab_images(w, dpi);
@ -1330,8 +1339,9 @@ static void window_editor_scenario_options_park_paint(rct_window* w, rct_drawpix
// Cost to buy land value
screenCoords = w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_LAND_COST].left + 1, w->widgets[WIDX_LAND_COST].top };
money64 value = gLandPrice;
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, &value);
auto ft = Formatter();
ft.Add<money64>(gLandPrice);
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft);
}
if (w->widgets[WIDX_CONSTRUCTION_RIGHTS_COST].type != WindowWidgetType::Empty)
@ -1344,8 +1354,9 @@ static void window_editor_scenario_options_park_paint(rct_window* w, rct_drawpix
screenCoords = w->windowPos
+ ScreenCoordsXY{ w->widgets[WIDX_CONSTRUCTION_RIGHTS_COST].left + 1,
w->widgets[WIDX_CONSTRUCTION_RIGHTS_COST].top };
money64 value = gConstructionRightsPrice;
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, &value);
auto ft = Formatter();
ft.Add<money64>(gConstructionRightsPrice);
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft);
}
if (w->widgets[WIDX_PAY_FOR_PARK_OR_RIDES].type != WindowWidgetType::Empty)
@ -1354,15 +1365,16 @@ static void window_editor_scenario_options_park_paint(rct_window* w, rct_drawpix
screenCoords = w->windowPos
+ ScreenCoordsXY{ w->widgets[WIDX_PAY_FOR_PARK_OR_RIDES].left + 1, w->widgets[WIDX_PAY_FOR_PARK_OR_RIDES].top };
auto ft = Formatter();
// Pay for park and/or rides value
if (gParkFlags & PARK_FLAGS_UNLOCK_ALL_PRICES)
stringId = STR_PAID_ENTRY_PAID_RIDES;
ft.Add<rct_string_id>(STR_PAID_ENTRY_PAID_RIDES);
else if (gParkFlags & PARK_FLAGS_PARK_FREE_ENTRY)
stringId = STR_FREE_PARK_ENTER;
ft.Add<rct_string_id>(STR_FREE_PARK_ENTER);
else
stringId = STR_PAY_PARK_ENTER;
ft.Add<rct_string_id>(STR_PAY_PARK_ENTER);
DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, &stringId);
DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, ft);
}
if (w->widgets[WIDX_ENTRY_PRICE].type != WindowWidgetType::Empty)
@ -1374,8 +1386,9 @@ static void window_editor_scenario_options_park_paint(rct_window* w, rct_drawpix
// Entry price value
screenCoords = w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_ENTRY_PRICE].left + 1, w->widgets[WIDX_ENTRY_PRICE].top };
money64 value = gParkEntranceFee;
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, &value);
auto ft = Formatter();
ft.Add<money64>(gParkEntranceFee);
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_FORMAT_LABEL, ft);
}
// Climate label
@ -1384,8 +1397,9 @@ static void window_editor_scenario_options_park_paint(rct_window* w, rct_drawpix
// Climate value
screenCoords = w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_CLIMATE].left + 1, w->widgets[WIDX_CLIMATE].top };
stringId = ClimateNames[static_cast<uint8_t>(gClimate)];
DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, &stringId);
auto ft = Formatter();
ft.Add<rct_string_id>(ClimateNames[static_cast<uint8_t>(gClimate)]);
DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, ft);
}
#pragma endregion

View File

@ -560,8 +560,10 @@ static void window_finances_summary_paint(rct_window* w, rct_drawpixelinfo* dpi)
DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 167, 279 }, STR_FINANCES_SUMMARY_AT_X_PER_YEAR, ft);
// Current cash
ft = Formatter();
ft.Add<money64>(gCash);
rct_string_id stringId = gCash >= 0 ? STR_CASH_LABEL : STR_CASH_NEGATIVE_LABEL;
DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 8, 294 }, stringId, &gCash);
DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 8, 294 }, stringId, ft);
// Objective related financial information
if (gScenarioObjective.Type == OBJECTIVE_MONTHLY_FOOD_INCOME)
@ -575,8 +577,12 @@ static void window_finances_summary_paint(rct_window* w, rct_drawpixelinfo* dpi)
else
{
// Park value and company value
DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 280, 279 }, STR_PARK_VALUE_LABEL, &gParkValue);
DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 280, 294 }, STR_COMPANY_VALUE_LABEL, &gCompanyValue);
ft = Formatter();
ft.Add<money64>(gParkValue);
DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 280, 279 }, STR_PARK_VALUE_LABEL, ft);
ft = Formatter();
ft.Add<money64>(gCompanyValue);
DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 280, 294 }, STR_COMPANY_VALUE_LABEL, ft);
}
}
@ -714,12 +720,14 @@ static void window_finances_financial_graph_paint(rct_window* w, rct_drawpixelin
// Cash (less loan)
auto cashLessLoan = gCash - gBankLoan;
auto ft = Formatter();
ft.Add<money64>(cashLessLoan);
DrawTextBasic(
dpi, graphTopLeft - ScreenCoordsXY{ 0, 11 },
cashLessLoan >= 0 ? STR_FINANCES_FINANCIAL_GRAPH_CASH_LESS_LOAN_POSITIVE
: STR_FINANCES_FINANCIAL_GRAPH_CASH_LESS_LOAN_NEGATIVE,
&cashLessLoan);
ft);
// Graph
gfx_fill_rect_inset(dpi, { graphTopLeft, graphBottomRight }, w->colours[1], INSET_RECT_F_30);
@ -747,7 +755,7 @@ static void window_finances_financial_graph_paint(rct_window* w, rct_drawpixelin
for (axisBase = MONEY(12, 00); axisBase >= MONEY(-12, 00); axisBase -= MONEY(6, 00))
{
auto axisValue = axisBase << yAxisScale;
auto ft = Formatter();
ft = Formatter();
ft.Add<money64>(axisValue);
DrawTextBasic(
dpi, coords + ScreenCoordsXY{ 70, 0 }, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, ft,
@ -821,8 +829,9 @@ static void window_finances_park_value_graph_paint(rct_window* w, rct_drawpixeli
auto graphBottomRight = w->windowPos + ScreenCoordsXY{ pageWidget->right - 4, pageWidget->bottom - 4 };
// Park value
auto parkValue = gParkValue;
DrawTextBasic(dpi, graphTopLeft - ScreenCoordsXY{ 0, 11 }, STR_FINANCES_PARK_VALUE, &parkValue);
auto ft = Formatter();
ft.Add<money64>(gParkValue);
DrawTextBasic(dpi, graphTopLeft - ScreenCoordsXY{ 0, 11 }, STR_FINANCES_PARK_VALUE, ft);
// Graph
gfx_fill_rect_inset(dpi, { graphTopLeft, graphBottomRight }, w->colours[1], INSET_RECT_F_30);
@ -850,7 +859,7 @@ static void window_finances_park_value_graph_paint(rct_window* w, rct_drawpixeli
for (axisBase = MONEY(24, 00); axisBase >= MONEY(0, 00); axisBase -= MONEY(6, 00))
{
auto axisValue = axisBase << yAxisScale;
auto ft = Formatter();
ft = Formatter();
ft.Add<money64>(axisValue);
DrawTextBasic(
dpi, coords + ScreenCoordsXY{ 70, 0 }, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, ft,
@ -923,10 +932,11 @@ static void window_finances_profit_graph_paint(rct_window* w, rct_drawpixelinfo*
auto graphBottomRight = w->windowPos + ScreenCoordsXY{ pageWidget->right - 4, pageWidget->bottom - 4 };
// Weekly profit
auto weeklyPofit = gCurrentProfit;
auto ft = Formatter();
ft.Add<money64>(gCurrentProfit);
DrawTextBasic(
dpi, graphTopLeft - ScreenCoordsXY{ 0, 11 },
weeklyPofit >= 0 ? STR_FINANCES_WEEKLY_PROFIT_POSITIVE : STR_FINANCES_WEEKLY_PROFIT_LOSS, &weeklyPofit);
gCurrentProfit >= 0 ? STR_FINANCES_WEEKLY_PROFIT_POSITIVE : STR_FINANCES_WEEKLY_PROFIT_LOSS, ft);
// Graph
gfx_fill_rect_inset(dpi, { graphTopLeft, graphBottomRight }, w->colours[1], INSET_RECT_F_30);
@ -954,7 +964,7 @@ static void window_finances_profit_graph_paint(rct_window* w, rct_drawpixelinfo*
for (axisBase = MONEY(12, 00); axisBase >= MONEY(-12, 00); axisBase -= MONEY(6, 00))
{
money64 axisValue = axisBase << yAxisScale;
auto ft = Formatter();
ft = Formatter();
ft.Add<money64>(axisValue);
DrawTextBasic(
dpi, screenPos + ScreenCoordsXY{ 70, 0 }, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, ft,
@ -1096,9 +1106,11 @@ static void window_finances_marketing_paint(rct_window* w, rct_drawpixelinfo* dp
// Duration
uint16_t weeksRemaining = campaign->WeeksLeft;
ft = Formatter();
ft.Add<uint16_t>(weeksRemaining);
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 304, 0 }, weeksRemaining == 1 ? STR_1_WEEK_REMAINING : STR_X_WEEKS_REMAINING,
&weeksRemaining);
ft);
screenCoords.y += LIST_ROW_HEIGHT;
}
@ -1117,9 +1129,10 @@ static void window_finances_marketing_paint(rct_window* w, rct_drawpixelinfo* dp
if (campaignButton->type != WindowWidgetType::Empty)
{
// Draw button text
money64 pricePerWeek = AdvertisingCampaignPricePerWeek[i];
DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ 4, 0 }, MarketingCampaignNames[i][0]);
DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ WH_SUMMARY, 0 }, STR_MARKETING_PER_WEEK, &pricePerWeek);
auto ft = Formatter();
ft.Add<money64>(AdvertisingCampaignPricePerWeek[i]);
DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ WH_SUMMARY, 0 }, STR_MARKETING_PER_WEEK, ft);
screenCoords.y += BUTTON_FACE_HEIGHT + 2;
}

View File

@ -633,8 +633,9 @@ static void window_footpath_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
if (!(gParkFlags & PARK_FLAGS_NO_MONEY))
{
money64 cost = _window_footpath_cost;
DrawTextBasic(dpi, screenCoords, STR_COST_LABEL, &cost, { TextAlignment::CENTRE });
auto ft = Formatter();
ft.Add<money64>(_window_footpath_cost);
DrawTextBasic(dpi, screenCoords, STR_COST_LABEL, ft, { TextAlignment::CENTRE });
}
}
}

View File

@ -264,10 +264,10 @@ public:
// Draw number for tool sizes bigger than 7
if (gLandToolSize > MAX_TOOL_SIZE_WITH_SPRITE)
{
auto ft = Formatter();
ft.Add<uint16_t>(gLandToolSize);
screenCoords = { windowPos.x + previewWidget->midX(), windowPos.y + previewWidget->midY() };
DrawTextBasic(
&dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, &gLandToolSize,
{ TextAlignment::CENTRE });
DrawTextBasic(&dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE });
}
else if (gLandMountainMode)
{
@ -285,16 +285,18 @@ public:
// Draw raise cost amount
if (gLandToolRaiseCost != MONEY32_UNDEFINED && gLandToolRaiseCost != 0)
{
price = gLandToolRaiseCost;
DrawTextBasic(&dpi, screenCoords, STR_RAISE_COST_AMOUNT, &price, { TextAlignment::CENTRE });
auto ft = Formatter();
ft.Add<money64>(gLandToolRaiseCost);
DrawTextBasic(&dpi, screenCoords, STR_RAISE_COST_AMOUNT, ft, { TextAlignment::CENTRE });
}
screenCoords.y += 10;
// Draw lower cost amount
if (gLandToolLowerCost != MONEY32_UNDEFINED && gLandToolLowerCost != 0)
{
price = gLandToolLowerCost;
DrawTextBasic(&dpi, screenCoords, STR_LOWER_COST_AMOUNT, &price, { TextAlignment::CENTRE });
auto ft = Formatter();
ft.Add<money64>(gLandToolLowerCost);
DrawTextBasic(&dpi, screenCoords, STR_LOWER_COST_AMOUNT, ft, { TextAlignment::CENTRE });
}
screenCoords.y += 50;
@ -319,7 +321,7 @@ public:
{
auto ft = Formatter();
ft.Add<money64>(price);
DrawTextBasic(&dpi, screenCoords, STR_COST_AMOUNT, ft.Data(), { TextAlignment::CENTRE });
DrawTextBasic(&dpi, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::CENTRE });
}
}
}

View File

@ -262,16 +262,19 @@ static void window_land_rights_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Draw number for tool sizes bigger than 7
if (gLandToolSize > MAX_TOOL_SIZE_WITH_SPRITE)
{
DrawTextBasic(
dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, &gLandToolSize, { TextAlignment::CENTRE });
auto ft = Formatter();
ft.Add<uint16_t>(gLandToolSize);
DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE });
}
// Draw cost amount
if (_landRightsCost != MONEY32_UNDEFINED && _landRightsCost != 0 && !(gParkFlags & PARK_FLAGS_NO_MONEY))
{
auto ft = Formatter();
ft.Add<money64>(_landRightsCost);
screenCoords = { window_land_rights_widgets[WIDX_PREVIEW].midX() + w->windowPos.x,
window_land_rights_widgets[WIDX_PREVIEW].bottom + w->windowPos.y + 32 };
DrawTextBasic(dpi, screenCoords, STR_COST_AMOUNT, &_landRightsCost, { TextAlignment::CENTRE });
DrawTextBasic(dpi, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::CENTRE });
}
}

View File

@ -714,8 +714,10 @@ static void window_loadsave_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Draw name button indicator.
rct_widget sort_name_widget = window_loadsave_widgets[WIDX_SORT_NAME];
ft = Formatter();
ft.Add<rct_string_id>(id);
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ sort_name_widget.left + 11, sort_name_widget.top + 1 }, STR_NAME, &id,
dpi, w->windowPos + ScreenCoordsXY{ sort_name_widget.left + 11, sort_name_widget.top + 1 }, STR_NAME, ft,
{ COLOUR_GREY });
// Date button text
@ -727,8 +729,10 @@ static void window_loadsave_paint(rct_window* w, rct_drawpixelinfo* dpi)
id = STR_NONE;
rct_widget sort_date_widget = window_loadsave_widgets[WIDX_SORT_DATE];
ft = Formatter();
ft.Add<rct_string_id>(id);
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ sort_date_widget.left + 5, sort_date_widget.top + 1 }, STR_DATE, &id,
dpi, w->windowPos + ScreenCoordsXY{ sort_date_widget.left + 5, sort_date_widget.top + 1 }, STR_DATE, ft,
{ COLOUR_GREY });
}

View File

@ -822,9 +822,9 @@ static void window_map_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Draw land tool size
if (WidgetIsActiveTool(w, WIDX_SET_LAND_RIGHTS) && _landRightsToolSize > MAX_TOOL_SIZE_WITH_SPRITE)
{
DrawTextBasic(
dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, &_landRightsToolSize,
{ TextAlignment::CENTRE });
auto ft = Formatter();
ft.Add<uint16_t>(_landRightsToolSize);
DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE });
}
screenCoords.y = w->windowPos.y + window_map_widgets[WIDX_LAND_TOOL].bottom + 5;
@ -853,7 +853,7 @@ static void window_map_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
gfx_fill_rect(
dpi, { screenCoords + ScreenCoordsXY{ 0, 2 }, screenCoords + ScreenCoordsXY{ 6, 8 } }, RideKeyColours[i]);
DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ LIST_ROW_HEIGHT, 0 }, mapLabels[i], w);
DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ LIST_ROW_HEIGHT, 0 }, mapLabels[i], {});
screenCoords.y += LIST_ROW_HEIGHT;
if (i == 3)
{

View File

@ -686,8 +686,6 @@ static void window_mapgen_base_invalidate(rct_window* w)
static void window_mapgen_base_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
uint16_t arg;
WindowDrawWidgets(w, dpi);
window_mapgen_draw_tab_images(dpi, w);
@ -705,20 +703,24 @@ static void window_mapgen_base_paint(rct_window* w, rct_drawpixelinfo* dpi)
// The practical map size is 2 lower than the technical map size
// This needs to be cast down to a uint16_t because that's what the STR_RESOLUTION_X_BY_Y string takes.
uint16_t mapSizeArgs[] = { static_cast<uint16_t>(_mapSize - 2), static_cast<uint16_t>(_mapSize - 2) };
auto ft = Formatter();
ft.Add<uint16_t>(static_cast<uint16_t>(_mapSize - 2));
ft.Add<uint16_t>(static_cast<uint16_t>(_mapSize - 2));
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_MAP_SIZE].left + 1, w->widgets[WIDX_MAP_SIZE].top + 1 },
STR_RESOLUTION_X_BY_Y, &mapSizeArgs, { w->colours[1] });
STR_RESOLUTION_X_BY_Y, ft, { w->colours[1] });
arg = (_baseHeight - 12) / 2;
ft = Formatter();
ft.Add<uint16_t>((_baseHeight - 12) / 2);
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_BASE_HEIGHT].left + 1, w->widgets[WIDX_BASE_HEIGHT].top + 1 },
STR_COMMA16, &arg, { w->colours[1] });
STR_COMMA16, ft, { w->colours[1] });
arg = (_waterLevel - 12) / 2;
ft = Formatter();
ft.Add<uint16_t>((_waterLevel - 12) / 2);
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_WATER_LEVEL].left + 1, w->widgets[WIDX_WATER_LEVEL].top + 1 },
STR_COMMA16, &arg, { w->colours[1] });
STR_COMMA16, ft, { w->colours[1] });
}
#pragma endregion
@ -1003,8 +1005,6 @@ static void window_mapgen_simplex_invalidate(rct_window* w)
static void window_mapgen_simplex_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
uint16_t arg;
WindowDrawWidgets(w, dpi);
window_mapgen_draw_tab_images(dpi, w);
@ -1028,21 +1028,29 @@ static void window_mapgen_simplex_paint(rct_window* w, rct_drawpixelinfo* dpi)
dpi, w->windowPos + ScreenCoordsXY{ 5, w->widgets[WIDX_SIMPLEX_WATER_LEVEL].top + 1 }, STR_WATER_LEVEL_LABEL, {},
{ textColour });
auto ft = Formatter();
ft.Add<uint16_t>(_simplex_low);
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_SIMPLEX_LOW].left + 1, w->widgets[WIDX_SIMPLEX_LOW].top + 1 },
STR_COMMA16, &_simplex_low, { textColour });
STR_COMMA16, ft, { textColour });
ft = Formatter();
ft.Add<uint16_t>(_simplex_high);
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_SIMPLEX_HIGH].left + 1, w->widgets[WIDX_SIMPLEX_HIGH].top + 1 },
STR_COMMA16, &_simplex_high, { textColour });
STR_COMMA16, ft, { textColour });
ft = Formatter();
ft.Add<uint16_t>(_simplex_base_freq);
DrawTextBasic(
dpi,
w->windowPos
+ ScreenCoordsXY{ w->widgets[WIDX_SIMPLEX_BASE_FREQ].left + 1, w->widgets[WIDX_SIMPLEX_BASE_FREQ].top + 1 },
STR_WINDOW_OBJECTIVE_VALUE_RATING, &_simplex_base_freq, { textColour });
STR_WINDOW_OBJECTIVE_VALUE_RATING, ft, { textColour });
ft = Formatter();
ft.Add<uint16_t>(_simplex_octaves);
DrawTextBasic(
dpi,
w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_SIMPLEX_OCTAVES].left + 1, w->widgets[WIDX_SIMPLEX_OCTAVES].top + 1 },
STR_COMMA16, &_simplex_octaves, { textColour });
STR_COMMA16, ft, { textColour });
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 5, w->widgets[WIDX_SIMPLEX_RANDOM_TERRAIN_CHECKBOX].top + 1 }, STR_TERRAIN_LABEL,
{}, { textColour });
@ -1052,18 +1060,21 @@ static void window_mapgen_simplex_paint(rct_window* w, rct_drawpixelinfo* dpi)
// The practical map size is 2 lower than the technical map size.
// This needs to be cast down to a uint16_t because that's what the STR_RESOLUTION_X_BY_Y string takes.
uint16_t mapSizeArgs[] = { static_cast<uint16_t>(_mapSize - 2), static_cast<uint16_t>(_mapSize - 2) };
ft = Formatter();
ft.Add<uint16_t>(static_cast<uint16_t>(_mapSize - 2));
ft.Add<uint16_t>(static_cast<uint16_t>(_mapSize - 2));
DrawTextBasic(
dpi,
w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_SIMPLEX_MAP_SIZE].left + 1, w->widgets[WIDX_SIMPLEX_MAP_SIZE].top + 1 },
STR_RESOLUTION_X_BY_Y, &mapSizeArgs, { textColour });
STR_RESOLUTION_X_BY_Y, ft, { textColour });
arg = (_waterLevel - 12) / 2;
ft = Formatter();
ft.Add<uint16_t>((_waterLevel - 12) / 2);
DrawTextBasic(
dpi,
w->windowPos
+ ScreenCoordsXY{ w->widgets[WIDX_SIMPLEX_WATER_LEVEL].left + 1, w->widgets[WIDX_SIMPLEX_WATER_LEVEL].top + 1 },
STR_COMMA16, &arg, { textColour });
STR_COMMA16, ft, { textColour });
}
#pragma endregion
@ -1216,45 +1227,53 @@ static void window_mapgen_heightmap_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Smooth strength label and value
const colour_t strengthColour = _heightmapSmoothMap ? enabledColour : disabledColour;
int16_t strength = _heightmapSmoothStrength;
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 5, w->widgets[WIDX_HEIGHTMAP_STRENGTH].top + 1 }, STR_MAPGEN_SMOOTH_STRENGTH, {},
{ strengthColour });
auto ft = Formatter();
ft.Add<uint16_t>(_heightmapSmoothStrength);
DrawTextBasic(
dpi,
w->windowPos
+ ScreenCoordsXY{ w->widgets[WIDX_HEIGHTMAP_STRENGTH].left + 1, w->widgets[WIDX_HEIGHTMAP_STRENGTH].top + 1 },
STR_COMMA16, &strength, { strengthColour });
STR_COMMA16, ft, { strengthColour });
// Low label and value
const colour_t labelColour = _heightmapLoaded ? enabledColour : disabledColour;
int16_t low = _heightmapLow;
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 5, w->widgets[WIDX_HEIGHTMAP_LOW].top + 1 }, STR_MAPGEN_SIMPLEX_NOISE_LOW_, {},
{ labelColour });
ft = Formatter();
ft.Add<uint16_t>(_heightmapLow);
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_HEIGHTMAP_LOW].left + 1, w->widgets[WIDX_HEIGHTMAP_LOW].top + 1 },
STR_COMMA16, &low, { labelColour });
STR_COMMA16, ft, { labelColour });
// High label and value
int16_t high = _heightmapHigh;
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 5, w->widgets[WIDX_HEIGHTMAP_HIGH].top + 1 }, STR_MAPGEN_SIMPLEX_NOISE_HIGH, {},
{ labelColour });
ft = Formatter();
ft.Add<uint16_t>(_heightmapHigh);
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_HEIGHTMAP_HIGH].left + 1, w->widgets[WIDX_HEIGHTMAP_HIGH].top + 1 },
STR_COMMA16, &high, { labelColour });
STR_COMMA16, ft, { labelColour });
// Water level label and value
int16_t waterLevel = _waterLevel;
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 5, w->widgets[WIDX_HEIGHTMAP_WATER_LEVEL].top + 1 }, STR_WATER_LEVEL_LABEL, {},
{ labelColour });
ft = Formatter();
ft.Add<uint16_t>(_waterLevel);
DrawTextBasic(
dpi,
w->windowPos
+ ScreenCoordsXY{ w->widgets[WIDX_HEIGHTMAP_WATER_LEVEL].left + 1, w->widgets[WIDX_HEIGHTMAP_WATER_LEVEL].top + 1 },
STR_COMMA16, &waterLevel, { labelColour });
STR_COMMA16, ft, { labelColour });
}
#pragma endregion

View File

@ -431,21 +431,27 @@ static void window_multiplayer_information_paint(rct_window* w, rct_drawpixelinf
const utf8* providerName = network_get_server_provider_name();
if (!str_is_null_or_empty(providerName))
{
DrawTextBasic(dpi, screenCoords, STR_PROVIDER_NAME, static_cast<void*>(&providerName));
auto ft = Formatter();
ft.Add<const char*>(providerName);
DrawTextBasic(dpi, screenCoords, STR_PROVIDER_NAME, ft);
screenCoords.y += LIST_ROW_HEIGHT;
}
const utf8* providerEmail = network_get_server_provider_email();
if (!str_is_null_or_empty(providerEmail))
{
DrawTextBasic(dpi, screenCoords, STR_PROVIDER_EMAIL, static_cast<void*>(&providerEmail));
auto ft = Formatter();
ft.Add<const char*>(providerEmail);
DrawTextBasic(dpi, screenCoords, STR_PROVIDER_EMAIL, ft);
screenCoords.y += LIST_ROW_HEIGHT;
}
const utf8* providerWebsite = network_get_server_provider_website();
if (!str_is_null_or_empty(providerWebsite))
{
DrawTextBasic(dpi, screenCoords, STR_PROVIDER_WEBSITE, static_cast<void*>(&providerWebsite));
auto ft = Formatter();
ft.Add<const char*>(providerWebsite);
DrawTextBasic(dpi, screenCoords, STR_PROVIDER_WEBSITE, ft);
}
}
}
@ -558,7 +564,9 @@ static void window_multiplayer_players_paint(rct_window* w, rct_drawpixelinfo* d
// Number of players
stringId = w->no_list_items == 1 ? STR_MULTIPLAYER_PLAYER_COUNT : STR_MULTIPLAYER_PLAYER_COUNT_PLURAL;
auto screenCoords = w->windowPos + ScreenCoordsXY{ 4, w->widgets[WIDX_LIST].bottom + 2 };
DrawTextBasic(dpi, screenCoords, stringId, &w->no_list_items, { w->colours[2] });
auto ft = Formatter();
ft.Add<uint16_t>(w->no_list_items);
DrawTextBasic(dpi, screenCoords, stringId, ft, { w->colours[2] });
}
static void window_multiplayer_players_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_t scrollIndex)

View File

@ -346,20 +346,24 @@ public:
// Number of weeks
rct_widget* spinnerWidget = &widgets[WIDX_WEEKS_SPINNER];
auto ft = Formatter();
ft.Add<int16_t>(campaign.no_weeks);
DrawTextBasic(
&dpi, windowPos + ScreenCoordsXY{ spinnerWidget->left + 1, spinnerWidget->top },
campaign.no_weeks == 1 ? STR_MARKETING_1_WEEK : STR_X_WEEKS, &campaign.no_weeks, { colours[0] });
campaign.no_weeks == 1 ? STR_MARKETING_1_WEEK : STR_X_WEEKS, ft, { colours[0] });
screenCoords = windowPos + ScreenCoordsXY{ 14, 60 };
// Price per week
money64 pricePerWeek = AdvertisingCampaignPricePerWeek[campaign.campaign_type];
DrawTextBasic(&dpi, screenCoords, STR_MARKETING_COST_PER_WEEK, &pricePerWeek);
ft = Formatter();
ft.Add<money64>(AdvertisingCampaignPricePerWeek[campaign.campaign_type]);
DrawTextBasic(&dpi, screenCoords, STR_MARKETING_COST_PER_WEEK, ft);
screenCoords.y += 13;
// Total price
money64 totalPrice = AdvertisingCampaignPricePerWeek[campaign.campaign_type] * campaign.no_weeks;
DrawTextBasic(&dpi, screenCoords, STR_MARKETING_TOTAL_COST, &totalPrice);
ft = Formatter();
ft.Add<money64>(AdvertisingCampaignPricePerWeek[campaign.campaign_type] * campaign.no_weeks);
DrawTextBasic(&dpi, screenCoords, STR_MARKETING_TOTAL_COST, ft);
}
};

View File

@ -896,7 +896,7 @@ static void window_options_display_paint(rct_window* w, rct_drawpixelinfo* dpi)
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 10, window_options_display_widgets[WIDX_FULLSCREEN].top + 1 }, STR_FULLSCREEN_MODE,
w, { w->colours[1] });
{}, { w->colours[1] });
// Disable resolution dropdown on "Windowed" and "Fullscreen (desktop)"
colour_t colour = w->colours[1];
@ -906,19 +906,20 @@ static void window_options_display_paint(rct_window* w, rct_drawpixelinfo* dpi)
}
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 10 + 15, window_options_display_widgets[WIDX_RESOLUTION].top + 1 },
STR_DISPLAY_RESOLUTION, w, { colour });
STR_DISPLAY_RESOLUTION, {}, { colour });
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 10, window_options_display_widgets[WIDX_SCALE].top + 1 }, STR_UI_SCALING_DESC, w,
dpi, w->windowPos + ScreenCoordsXY{ 10, window_options_display_widgets[WIDX_SCALE].top + 1 }, STR_UI_SCALING_DESC, {},
{ w->colours[1] });
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 10, window_options_display_widgets[WIDX_DRAWING_ENGINE].top + 1 },
STR_DRAWING_ENGINE, w, { w->colours[1] });
STR_DRAWING_ENGINE, {}, { w->colours[1] });
int32_t scale = static_cast<int32_t>(gConfigGeneral.window_scale * 100);
auto ft = Formatter();
ft.Add<int32_t>(static_cast<int32_t>(gConfigGeneral.window_scale * 100));
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_SCALE].left + 1, w->widgets[WIDX_SCALE].top + 1 },
STR_WINDOW_OBJECTIVE_VALUE_RATING, &scale, { w->colours[1] });
STR_WINDOW_OBJECTIVE_VALUE_RATING, ft, { w->colours[1] });
colour = w->colours[1];
if (gConfigGeneral.drawing_engine == DrawingEngine::Software
@ -928,7 +929,7 @@ static void window_options_display_paint(rct_window* w, rct_drawpixelinfo* dpi)
}
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 25, window_options_display_widgets[WIDX_SCALE_QUALITY].top + 1 },
STR_SCALING_QUALITY, w, { colour });
STR_SCALING_QUALITY, {}, { colour });
}
#pragma region Rendering Tab
@ -1331,21 +1332,21 @@ static void window_options_culture_paint(rct_window* w, rct_drawpixelinfo* dpi)
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 10, window_options_culture_widgets[WIDX_LANGUAGE].top + 1 }, STR_OPTIONS_LANGUAGE,
w, { w->colours[1] });
{}, { w->colours[1] });
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 10, window_options_culture_widgets[WIDX_CURRENCY].top + 1 }, STR_CURRENCY, w,
dpi, w->windowPos + ScreenCoordsXY{ 10, window_options_culture_widgets[WIDX_CURRENCY].top + 1 }, STR_CURRENCY, {},
{ w->colours[1] });
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 10, window_options_culture_widgets[WIDX_DISTANCE].top + 1 }, STR_DISTANCE_AND_SPEED,
w, { w->colours[1] });
{}, { w->colours[1] });
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 10, window_options_culture_widgets[WIDX_TEMPERATURE].top + 1 }, STR_TEMPERATURE, w,
dpi, w->windowPos + ScreenCoordsXY{ 10, window_options_culture_widgets[WIDX_TEMPERATURE].top + 1 }, STR_TEMPERATURE, {},
{ w->colours[1] });
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 10, window_options_culture_widgets[WIDX_HEIGHT_LABELS].top + 1 }, STR_HEIGHT_LABELS,
w, { w->colours[1] });
{}, { w->colours[1] });
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 10, window_options_culture_widgets[WIDX_DATE_FORMAT].top + 1 }, STR_DATE_FORMAT, w,
dpi, w->windowPos + ScreenCoordsXY{ 10, window_options_culture_widgets[WIDX_DATE_FORMAT].top + 1 }, STR_DATE_FORMAT, {},
{ w->colours[1] });
}
@ -1748,7 +1749,7 @@ static void window_options_controls_paint(rct_window* w, rct_drawpixelinfo* dpi)
DrawTextBasic(
dpi,
w->windowPos + ScreenCoordsXY{ 10, window_options_controls_and_interface_widgets[WIDX_TOOLBAR_BUTTONS_GROUP].top + 15 },
STR_SHOW_TOOLBAR_BUTTONS_FOR, w, { w->colours[1] });
STR_SHOW_TOOLBAR_BUTTONS_FOR, {}, { w->colours[1] });
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 10, window_options_controls_and_interface_widgets[WIDX_THEMES].top + 1 },
STR_THEMES_LABEL_CURRENT_THEME, {}, { w->colours[1] });
@ -1964,13 +1965,13 @@ static void window_options_misc_paint(rct_window* w, rct_drawpixelinfo* dpi)
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 10, window_options_misc_widgets[WIDX_TITLE_SEQUENCE].top + 1 }, STR_TITLE_SEQUENCE,
w, { w->colours[1] });
{}, { w->colours[1] });
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 10, window_options_misc_widgets[WIDX_SCENARIO_GROUPING].top + 1 },
STR_OPTIONS_SCENARIO_GROUPING, {}, { w->colours[1] });
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 10, window_options_misc_widgets[WIDX_DEFAULT_INSPECTION_INTERVAL].top + 1 },
STR_DEFAULT_INSPECTION_INTERVAL, w, { w->colours[1] });
STR_DEFAULT_INSPECTION_INTERVAL, {}, { w->colours[1] });
}
#pragma region Advanced Tab
@ -2130,7 +2131,7 @@ static void window_options_advanced_paint(rct_window* w, rct_drawpixelinfo* dpi)
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 24, window_options_advanced_widgets[WIDX_AUTOSAVE].top + 1 },
STR_OPTIONS_AUTOSAVE_FREQUENCY_LABEL, w, { w->colours[1] });
STR_OPTIONS_AUTOSAVE_FREQUENCY_LABEL, {}, { w->colours[1] });
DrawTextBasic(
dpi,
w->windowPos
@ -2139,14 +2140,15 @@ static void window_options_advanced_paint(rct_window* w, rct_drawpixelinfo* dpi)
window_options_autosave_names[gConfigGeneral.autosave_frequency], {}, { w->colours[1] });
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 24, window_options_advanced_widgets[WIDX_AUTOSAVE_AMOUNT].top + 1 },
STR_AUTOSAVE_AMOUNT, w, { w->colours[1] });
int32_t autosavesToKeep = static_cast<int32_t>(gConfigGeneral.autosave_amount);
STR_AUTOSAVE_AMOUNT, {}, { w->colours[1] });
auto ft = Formatter();
ft.Add<int32_t>(static_cast<int32_t>(gConfigGeneral.autosave_amount));
DrawTextBasic(
dpi,
w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_AUTOSAVE_AMOUNT].left + 1, w->widgets[WIDX_AUTOSAVE_AMOUNT].top + 1 },
STR_WINDOW_OBJECTIVE_VALUE_GUEST_COUNT, &autosavesToKeep, { w->colours[1] });
STR_WINDOW_OBJECTIVE_VALUE_GUEST_COUNT, ft, { w->colours[1] });
auto ft = Formatter();
ft = Formatter();
ft.Add<utf8*>(Platform::StrDecompToPrecomp(gConfigGeneral.rct1_path));
rct_widget pathWidget = window_options_advanced_widgets[WIDX_PATH_TO_RCT1_BUTTON];

View File

@ -898,7 +898,9 @@ static void window_park_rating_paint(rct_window* w, rct_drawpixelinfo* dpi)
rct_widget* widget = &window_park_rating_widgets[WIDX_PAGE_BACKGROUND];
// Current value
DrawTextBasic(dpi, screenPos + ScreenCoordsXY{ widget->left + 3, widget->top + 2 }, STR_PARK_RATING_LABEL, &gParkRating);
auto ft = Formatter();
ft.Add<uint16_t>(gParkRating);
DrawTextBasic(dpi, screenPos + ScreenCoordsXY{ widget->left + 3, widget->top + 2 }, STR_PARK_RATING_LABEL, ft);
// Graph border
gfx_fill_rect_inset(
@ -912,7 +914,7 @@ static void window_park_rating_paint(rct_window* w, rct_drawpixelinfo* dpi)
for (int i = 5; i >= 0; i--)
{
uint32_t axisValue = i * 200;
auto ft = Formatter();
ft = Formatter();
ft.Add<uint32_t>(axisValue);
DrawTextBasic(
dpi, screenPos + ScreenCoordsXY{ 10, 0 }, STR_GRAPH_AXIS_LABEL, ft,
@ -1033,8 +1035,9 @@ static void window_park_guests_paint(rct_window* w, rct_drawpixelinfo* dpi)
rct_widget* widget = &window_park_guests_widgets[WIDX_PAGE_BACKGROUND];
// Current value
DrawTextBasic(
dpi, screenPos + ScreenCoordsXY{ widget->left + 3, widget->top + 2 }, STR_GUESTS_IN_PARK_LABEL, &gNumGuestsInPark);
auto ft = Formatter();
ft.Add<uint32_t>(gNumGuestsInPark);
DrawTextBasic(dpi, screenPos + ScreenCoordsXY{ widget->left + 3, widget->top + 2 }, STR_GUESTS_IN_PARK_LABEL, ft);
// Graph border
gfx_fill_rect_inset(
@ -1048,7 +1051,7 @@ static void window_park_guests_paint(rct_window* w, rct_drawpixelinfo* dpi)
for (int i = 5; i >= 0; i--)
{
uint32_t axisValue = i * 1000;
auto ft = Formatter();
ft = Formatter();
ft.Add<uint32_t>(axisValue);
DrawTextBasic(
dpi, screenPos + ScreenCoordsXY{ 10, 0 }, STR_GRAPH_AXIS_LABEL, ft,
@ -1181,12 +1184,16 @@ static void window_park_price_paint(rct_window* w, rct_drawpixelinfo* dpi)
auto screenCoords = w->windowPos
+ ScreenCoordsXY{ w->widgets[WIDX_PAGE_BACKGROUND].left + 4, w->widgets[WIDX_PAGE_BACKGROUND].top + 30 };
DrawTextBasic(dpi, screenCoords, STR_INCOME_FROM_ADMISSIONS, &gTotalIncomeFromAdmissions);
auto ft = Formatter();
ft.Add<money64>(gTotalIncomeFromAdmissions);
DrawTextBasic(dpi, screenCoords, STR_INCOME_FROM_ADMISSIONS, ft);
money64 parkEntranceFee = park_get_entrance_fee();
auto stringId = parkEntranceFee == 0 ? STR_FREE : STR_BOTTOM_TOOLBAR_CASH;
screenCoords = w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_PRICE].left + 1, w->widgets[WIDX_PRICE].top + 1 };
DrawTextBasic(dpi, screenCoords, stringId, &parkEntranceFee, { w->colours[1] });
ft = Formatter();
ft.Add<money64>(parkEntranceFee);
DrawTextBasic(dpi, screenCoords, stringId, ft, { w->colours[1] });
}
#pragma endregion

View File

@ -561,8 +561,9 @@ void window_research_funding_page_paint(rct_window* w, rct_drawpixelinfo* dpi, r
return;
int32_t currentResearchLevel = gResearchFundingLevel;
money64 currentResearchCostPerWeek = research_cost_table[currentResearchLevel];
DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 10, 77 }, STR_RESEARCH_COST_PER_MONTH, &currentResearchCostPerWeek);
auto ft = Formatter();
ft.Add<money64>(research_cost_table[currentResearchLevel]);
DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 10, 77 }, STR_RESEARCH_COST_PER_MONTH, ft);
}
#pragma endregion

View File

@ -2635,7 +2635,7 @@ static void window_ride_main_paint(rct_window* w, rct_drawpixelinfo* dpi)
widget = &window_ride_main_widgets[WIDX_VIEW];
DrawTextBasic(
dpi, { w->windowPos.x + (widget->left + widget->right - 11) / 2, w->windowPos.y + widget->top },
STR_WINDOW_COLOUR_2_STRINGID, ft.Data(), { TextAlignment::CENTRE });
STR_WINDOW_COLOUR_2_STRINGID, ft, { TextAlignment::CENTRE });
// Status
ft = Formatter();
@ -2922,19 +2922,22 @@ static void window_ride_vehicle_paint(rct_window* w, rct_drawpixelinfo* dpi)
screenCoords.y += 2;
// Capacity
DrawTextBasic(dpi, screenCoords, STR_CAPACITY, &rideEntry->capacity, COLOUR_BLACK);
auto ft = Formatter();
ft.Add<rct_string_id>(rideEntry->capacity);
DrawTextBasic(dpi, screenCoords, STR_CAPACITY, ft);
// Excitement Factor
auto factor = static_cast<int16_t>(rideEntry->excitement_multiplier);
if (factor > 0)
if (rideEntry->excitement_multiplier > 0)
{
screenCoords.y += LIST_ROW_HEIGHT;
DrawTextBasic(dpi, screenCoords, STR_EXCITEMENT_FACTOR, &factor, COLOUR_BLACK);
ft = Formatter();
ft.Add<int16_t>(rideEntry->intensity_multiplier);
DrawTextBasic(dpi, screenCoords, STR_EXCITEMENT_FACTOR, ft);
}
// Intensity Factor
factor = rideEntry->intensity_multiplier;
if (factor > 0)
if (rideEntry->intensity_multiplier > 0)
{
int32_t lineHeight = font_get_line_height(FontSpriteBase::MEDIUM);
if (lineHeight != 10)
@ -2942,18 +2945,22 @@ static void window_ride_vehicle_paint(rct_window* w, rct_drawpixelinfo* dpi)
else
screenCoords.y += LIST_ROW_HEIGHT;
DrawTextBasic(dpi, screenCoords, STR_INTENSITY_FACTOR, &factor, COLOUR_BLACK);
ft = Formatter();
ft.Add<int16_t>(rideEntry->intensity_multiplier);
DrawTextBasic(dpi, screenCoords, STR_INTENSITY_FACTOR, ft);
if (lineHeight != 10)
screenCoords.x -= 150;
}
// Nausea Factor
factor = rideEntry->nausea_multiplier;
if (factor > 0)
if (rideEntry->nausea_multiplier > 0)
{
screenCoords.y += LIST_ROW_HEIGHT;
DrawTextBasic(dpi, screenCoords, STR_NAUSEA_FACTOR, &factor, COLOUR_BLACK);
ft = Formatter();
ft.Add<int16_t>(rideEntry->nausea_multiplier);
DrawTextBasic(dpi, screenCoords, STR_NAUSEA_FACTOR, ft);
}
}
@ -3648,10 +3655,11 @@ static void window_ride_operating_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Number of block sections
if (ride->IsBlockSectioned())
{
auto blockSections = ride->num_block_brakes + ride->num_stations;
auto ft = Formatter();
ft.Add<uint16_t>(ride->num_block_brakes + ride->num_stations);
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 21, ride->mode == RideMode::PoweredLaunchBlockSectioned ? 89 : 61 },
STR_BLOCK_SECTIONS, &blockSections, COLOUR_BLACK);
STR_BLOCK_SECTIONS, ft, COLOUR_BLACK);
}
}
@ -4050,29 +4058,32 @@ static void window_ride_maintenance_paint(rct_window* w, rct_drawpixelinfo* dpi)
screenCoords = w->windowPos + ScreenCoordsXY{ widget->left + 4, widget->top + 4 };
uint16_t reliability = ride->reliability_percentage;
DrawTextBasic(dpi, screenCoords, STR_RELIABILITY_LABEL_1757, &reliability);
auto ft = Formatter();
ft.Add<uint16_t>(reliability);
DrawTextBasic(dpi, screenCoords, STR_RELIABILITY_LABEL_1757, ft);
window_ride_maintenance_draw_bar(
w, dpi, screenCoords + ScreenCoordsXY{ 103, 0 }, std::max<int32_t>(10, reliability), COLOUR_BRIGHT_GREEN);
screenCoords.y += 11;
uint16_t downTime = ride->downtime;
DrawTextBasic(dpi, screenCoords, STR_DOWN_TIME_LABEL_1889, &downTime);
ft = Formatter();
ft.Add<uint16_t>(downTime);
DrawTextBasic(dpi, screenCoords, STR_DOWN_TIME_LABEL_1889, ft);
window_ride_maintenance_draw_bar(w, dpi, screenCoords + ScreenCoordsXY{ 103, 0 }, downTime, COLOUR_BRIGHT_RED);
screenCoords.y += 26;
// Last inspection
uint16_t lastInspection = ride->last_inspection;
// Use singular form for 1 minute of time or less
rct_string_id stringId;
if (lastInspection <= 1)
if (ride->last_inspection <= 1)
stringId = STR_TIME_SINCE_LAST_INSPECTION_MINUTE;
else if (lastInspection <= 240)
else if (ride->last_inspection <= 240)
stringId = STR_TIME_SINCE_LAST_INSPECTION_MINUTES;
else
stringId = STR_TIME_SINCE_LAST_INSPECTION_MORE_THAN_4_HOURS;
DrawTextBasic(dpi, screenCoords, stringId, &lastInspection);
ft = Formatter();
ft.Add<uint16_t>(ride->last_inspection);
DrawTextBasic(dpi, screenCoords, stringId, ft);
screenCoords.y += 12;
// Last / current breakdown
@ -4080,8 +4091,9 @@ static void window_ride_maintenance_paint(rct_window* w, rct_drawpixelinfo* dpi)
return;
stringId = (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN) ? STR_CURRENT_BREAKDOWN : STR_LAST_BREAKDOWN;
rct_string_id breakdownMessage = RideBreakdownReasonNames[ride->breakdown_reason];
DrawTextBasic(dpi, screenCoords, stringId, &breakdownMessage);
ft = Formatter();
ft.Add<rct_string_id>(RideBreakdownReasonNames[ride->breakdown_reason]);
DrawTextBasic(dpi, screenCoords, stringId, ft);
screenCoords.y += 12;
// Mechanic status
@ -4126,7 +4138,7 @@ static void window_ride_maintenance_paint(rct_window* w, rct_drawpixelinfo* dpi)
auto staff = GetEntity<Staff>(ride->mechanic);
if (staff != nullptr && staff->IsMechanic())
{
auto ft = Formatter();
ft = Formatter();
staff->FormatNameTo(ft);
DrawTextWrapped(dpi, screenCoords, 280, stringId, ft, { TextAlignment::LEFT });
}
@ -5524,9 +5536,6 @@ static void window_ride_measurements_invalidate(rct_window* w)
*/
static void window_ride_measurements_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
int16_t holes, maxSpeed, averageSpeed, drops, highestDropHeight, inversions, time;
int32_t maxPositiveVerticalGs, maxNegativeVerticalGs, maxLateralGs, totalAirTime, length;
WindowDrawWidgets(w, dpi);
window_ride_draw_tab_images(dpi, w);
@ -5598,20 +5607,23 @@ static void window_ride_measurements_paint(rct_window* w, rct_drawpixelinfo* dpi
if (ride->type == RIDE_TYPE_MINI_GOLF)
{
// Holes
holes = ride->holes;
DrawTextBasic(dpi, screenCoords, STR_HOLES, &holes);
ft = Formatter();
ft.Add<uint16_t>(ride->holes);
DrawTextBasic(dpi, screenCoords, STR_HOLES, ft);
screenCoords.y += LIST_ROW_HEIGHT;
}
else
{
// Max speed
maxSpeed = (ride->max_speed * 9) >> 18;
DrawTextBasic(dpi, screenCoords, STR_MAX_SPEED, &maxSpeed);
ft = Formatter();
ft.Add<int32_t>((ride->max_speed * 9) >> 18);
DrawTextBasic(dpi, screenCoords, STR_MAX_SPEED, ft);
screenCoords.y += LIST_ROW_HEIGHT;
// Average speed
averageSpeed = (ride->average_speed * 9) >> 18;
DrawTextBasic(dpi, screenCoords, STR_AVERAGE_SPEED, &averageSpeed);
ft = Formatter();
ft.Add<int32_t>((ride->average_speed * 9) >> 18);
DrawTextBasic(dpi, screenCoords, STR_AVERAGE_SPEED, ft);
screenCoords.y += LIST_ROW_HEIGHT;
// Ride time
@ -5619,7 +5631,7 @@ static void window_ride_measurements_paint(rct_window* w, rct_drawpixelinfo* dpi
int32_t numTimes = 0;
for (int32_t i = 0; i < ride->num_stations; i++)
{
time = ride->stations[numTimes].SegmentTime;
auto time = ride->stations[numTimes].SegmentTime;
if (time != 0)
{
ft.Add<uint16_t>(STR_RIDE_TIME_ENTRY_WITH_SEPARATOR);
@ -5656,7 +5668,7 @@ static void window_ride_measurements_paint(rct_window* w, rct_drawpixelinfo* dpi
int32_t numLengths = 0;
for (int32_t i = 0; i < ride->num_stations; i++)
{
length = ride->stations[i].SegmentLength;
auto length = ride->stations[i].SegmentLength;
if (length != 0)
{
length >>= 16;
@ -5692,51 +5704,60 @@ static void window_ride_measurements_paint(rct_window* w, rct_drawpixelinfo* dpi
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_G_FORCES))
{
// Max. positive vertical G's
maxPositiveVerticalGs = ride->max_positive_vertical_g;
stringId = maxPositiveVerticalGs >= RIDE_G_FORCES_RED_POS_VERTICAL ? STR_MAX_POSITIVE_VERTICAL_G_RED
: STR_MAX_POSITIVE_VERTICAL_G;
DrawTextBasic(dpi, screenCoords, stringId, &maxPositiveVerticalGs);
stringId = ride->max_positive_vertical_g >= RIDE_G_FORCES_RED_POS_VERTICAL ? STR_MAX_POSITIVE_VERTICAL_G_RED
: STR_MAX_POSITIVE_VERTICAL_G;
ft = Formatter();
ft.Add<fixed16_2dp>(ride->max_positive_vertical_g);
DrawTextBasic(dpi, screenCoords, stringId, ft);
screenCoords.y += LIST_ROW_HEIGHT;
// Max. negative vertical G's
maxNegativeVerticalGs = ride->max_negative_vertical_g;
stringId = maxNegativeVerticalGs <= RIDE_G_FORCES_RED_NEG_VERTICAL ? STR_MAX_NEGATIVE_VERTICAL_G_RED
: STR_MAX_NEGATIVE_VERTICAL_G;
DrawTextBasic(dpi, screenCoords, stringId, &maxNegativeVerticalGs);
stringId = ride->max_negative_vertical_g <= RIDE_G_FORCES_RED_NEG_VERTICAL ? STR_MAX_NEGATIVE_VERTICAL_G_RED
: STR_MAX_NEGATIVE_VERTICAL_G;
ft = Formatter();
ft.Add<fixed16_2dp>(ride->max_negative_vertical_g);
DrawTextBasic(dpi, screenCoords, stringId, ft);
screenCoords.y += LIST_ROW_HEIGHT;
// Max lateral G's
maxLateralGs = ride->max_lateral_g;
stringId = maxLateralGs >= RIDE_G_FORCES_RED_LATERAL ? STR_MAX_LATERAL_G_RED : STR_MAX_LATERAL_G;
DrawTextBasic(dpi, screenCoords, stringId, &maxLateralGs);
stringId = ride->max_lateral_g >= RIDE_G_FORCES_RED_LATERAL ? STR_MAX_LATERAL_G_RED : STR_MAX_LATERAL_G;
ft = Formatter();
ft.Add<fixed16_2dp>(ride->max_lateral_g);
DrawTextBasic(dpi, screenCoords, stringId, ft);
screenCoords.y += LIST_ROW_HEIGHT;
// Total 'air' time
totalAirTime = ride->total_air_time * 3;
DrawTextBasic(dpi, screenCoords, STR_TOTAL_AIR_TIME, &totalAirTime);
ft = Formatter();
ft.Add<fixed32_2dp>(ride->total_air_time * 3);
DrawTextBasic(dpi, screenCoords, STR_TOTAL_AIR_TIME, ft);
screenCoords.y += LIST_ROW_HEIGHT;
}
if (ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_DROPS))
{
// Drops
drops = ride->drops & 0x3F;
DrawTextBasic(dpi, screenCoords, STR_DROPS, &drops);
auto drops = ride->drops & 0x3F;
ft = Formatter();
ft.Add<uint16_t>(drops);
DrawTextBasic(dpi, screenCoords, STR_DROPS, ft);
screenCoords.y += LIST_ROW_HEIGHT;
// Highest drop height
highestDropHeight = (ride->highest_drop_height * 3) / 4;
DrawTextBasic(dpi, screenCoords, STR_HIGHEST_DROP_HEIGHT, &highestDropHeight);
auto highestDropHeight = (ride->highest_drop_height * 3) / 4;
ft = Formatter();
ft.Add<int32_t>(highestDropHeight);
DrawTextBasic(dpi, screenCoords, STR_HIGHEST_DROP_HEIGHT, ft);
screenCoords.y += LIST_ROW_HEIGHT;
}
if (ride->type != RIDE_TYPE_MINI_GOLF)
{
// Inversions
inversions = ride->inversions;
if (inversions != 0)
if (ride->inversions != 0)
{
DrawTextBasic(dpi, screenCoords, STR_INVERSIONS, &inversions);
ft = Formatter();
ft.Add<uint16_t>(ride->inversions);
DrawTextBasic(dpi, screenCoords, STR_INVERSIONS, ft);
screenCoords.y += LIST_ROW_HEIGHT;
}
}
@ -6077,15 +6098,20 @@ static void window_ride_graphs_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi
if (listType == GRAPH_ALTITUDE)
scaled_yUnit /= 2;
DrawTextBasic(dpi, { w->scrolls[0].h_left + 1, y - 4 }, stringID, &scaled_yUnit, { FontSpriteBase::SMALL });
auto ft = Formatter();
ft.Add<int16_t>(scaled_yUnit);
DrawTextBasic(dpi, { w->scrolls[0].h_left + 1, y - 4 }, stringID, ft, { FontSpriteBase::SMALL });
}
// Time marks
time = 0;
for (int32_t x = 0; x < dpi->x + dpi->width; x += 80)
{
auto ft = Formatter();
ft.Add<int32_t>(time);
if (x + 80 >= dpi->x)
DrawTextBasic(dpi, { x + 2, 1 }, STR_RIDE_STATS_TIME, &time, { FontSpriteBase::SMALL });
DrawTextBasic(dpi, { x + 2, 1 }, STR_RIDE_STATS_TIME, ft, { FontSpriteBase::SMALL });
time += 5;
}
@ -6608,7 +6634,7 @@ static void window_ride_income_invalidate(rct_window* w)
static void window_ride_income_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
rct_string_id stringId;
money64 profit, costPerHour;
money64 profit;
ShopItem primaryItem, secondaryItem;
WindowDrawWidgets(w, dpi);
@ -6640,7 +6666,10 @@ static void window_ride_income_paint(rct_window* w, rct_drawpixelinfo* dpi)
stringId = STR_LOSS_PER_ITEM_SOLD;
}
DrawTextBasic(dpi, screenCoords, stringId, &profit);
auto ft = Formatter();
ft.Add<money64>(profit);
DrawTextBasic(dpi, screenCoords, stringId, ft);
}
screenCoords.y += 44;
@ -6661,33 +6690,45 @@ static void window_ride_income_paint(rct_window* w, rct_drawpixelinfo* dpi)
stringId = STR_LOSS_PER_ITEM_SOLD;
}
DrawTextBasic(dpi, screenCoords, stringId, &profit);
auto ft = Formatter();
ft.Add<money64>(profit);
DrawTextBasic(dpi, screenCoords, stringId, ft);
}
screenCoords.y += 18;
// Income per hour
if (ride->income_per_hour != MONEY64_UNDEFINED)
{
DrawTextBasic(dpi, screenCoords, STR_INCOME_PER_HOUR, &ride->income_per_hour);
auto ft = Formatter();
ft.Add<money64>(ride->income_per_hour);
DrawTextBasic(dpi, screenCoords, STR_INCOME_PER_HOUR, ft);
screenCoords.y += LIST_ROW_HEIGHT;
}
// Running cost per hour
costPerHour = ride->upkeep_cost * 16;
money64 costPerHour = ride->upkeep_cost * 16;
stringId = ride->upkeep_cost == MONEY16_UNDEFINED ? STR_RUNNING_COST_UNKNOWN : STR_RUNNING_COST_PER_HOUR;
DrawTextBasic(dpi, screenCoords, stringId, &costPerHour);
auto ft = Formatter();
ft.Add<money64>(costPerHour);
DrawTextBasic(dpi, screenCoords, stringId, ft);
screenCoords.y += LIST_ROW_HEIGHT;
// Profit per hour
if (ride->profit != MONEY64_UNDEFINED)
{
DrawTextBasic(dpi, screenCoords, STR_PROFIT_PER_HOUR, &ride->profit);
ft = Formatter();
ft.Add<money64>(ride->profit);
DrawTextBasic(dpi, screenCoords, STR_PROFIT_PER_HOUR, ft);
screenCoords.y += LIST_ROW_HEIGHT;
}
screenCoords.y += 5;
// Total profit
DrawTextBasic(dpi, screenCoords, STR_TOTAL_PROFIT, &ride->total_profit);
ft = Formatter();
ft.Add<money64>(ride->total_profit);
DrawTextBasic(dpi, screenCoords, STR_TOTAL_PROFIT, ft);
}
#pragma endregion
@ -6821,7 +6862,6 @@ static void window_ride_customer_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
ShopItem shopItem;
int16_t popularity, satisfaction, queueTime;
int32_t customersPerHour;
rct_string_id stringId;
WindowDrawWidgets(w, dpi);
@ -6838,14 +6878,16 @@ static void window_ride_customer_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Customers currently on ride
if (ride->IsRide())
{
int16_t customersOnRide = ride->num_riders;
DrawTextBasic(dpi, screenCoords, STR_CUSTOMERS_ON_RIDE, &customersOnRide);
auto ft = Formatter();
ft.Add<int16_t>(ride->num_riders);
DrawTextBasic(dpi, screenCoords, STR_CUSTOMERS_ON_RIDE, ft);
screenCoords.y += LIST_ROW_HEIGHT;
}
// Customers per hour
customersPerHour = ride_customers_per_hour(ride);
DrawTextBasic(dpi, screenCoords, STR_CUSTOMERS_PER_HOUR, &customersPerHour);
auto ft = Formatter();
ft.Add<int32_t>(ride_customers_per_hour(ride));
DrawTextBasic(dpi, screenCoords, STR_CUSTOMERS_PER_HOUR, ft);
screenCoords.y += LIST_ROW_HEIGHT;
// Popularity
@ -6859,7 +6901,9 @@ static void window_ride_customer_paint(rct_window* w, rct_drawpixelinfo* dpi)
stringId = STR_POPULARITY_PERCENT;
popularity *= 4;
}
DrawTextBasic(dpi, screenCoords, stringId, &popularity);
ft = Formatter();
ft.Add<int16_t>(popularity);
DrawTextBasic(dpi, screenCoords, stringId, ft);
screenCoords.y += LIST_ROW_HEIGHT;
// Satisfaction
@ -6873,7 +6917,9 @@ static void window_ride_customer_paint(rct_window* w, rct_drawpixelinfo* dpi)
stringId = STR_SATISFACTION_PERCENT;
satisfaction *= 5;
}
DrawTextBasic(dpi, screenCoords, stringId, &satisfaction);
ft = Formatter();
ft.Add<int16_t>(satisfaction);
DrawTextBasic(dpi, screenCoords, stringId, ft);
screenCoords.y += LIST_ROW_HEIGHT;
// Queue time
@ -6889,7 +6935,7 @@ static void window_ride_customer_paint(rct_window* w, rct_drawpixelinfo* dpi)
shopItem = ride->GetRideEntry()->shop_item[0];
if (shopItem != ShopItem::None)
{
auto ft = Formatter();
ft = Formatter();
ft.Add<rct_string_id>(GetShopItemDescriptor(shopItem).Naming.Plural);
ft.Add<uint32_t>(ride->no_primary_items_sold);
DrawTextBasic(dpi, screenCoords, STR_ITEMS_SOLD, ft);
@ -6901,7 +6947,7 @@ static void window_ride_customer_paint(rct_window* w, rct_drawpixelinfo* dpi)
: ride->GetRideEntry()->shop_item[1];
if (shopItem != ShopItem::None)
{
auto ft = Formatter();
ft = Formatter();
ft.Add<rct_string_id>(GetShopItemDescriptor(shopItem).Naming.Plural);
ft.Add<uint32_t>(ride->no_secondary_items_sold);
DrawTextBasic(dpi, screenCoords, STR_ITEMS_SOLD, ft);
@ -6909,14 +6955,18 @@ static void window_ride_customer_paint(rct_window* w, rct_drawpixelinfo* dpi)
}
// Total customers
DrawTextBasic(dpi, screenCoords, STR_TOTAL_CUSTOMERS, &ride->total_customers);
ft = Formatter();
ft.Add<uint32_t>(ride->total_customers);
DrawTextBasic(dpi, screenCoords, STR_TOTAL_CUSTOMERS, ft);
screenCoords.y += LIST_ROW_HEIGHT;
// Guests favourite
if (ride->IsRide())
{
ft = Formatter();
ft.Add<uint16_t>(ride->guests_favourite);
stringId = ride->guests_favourite == 1 ? STR_FAVOURITE_RIDE_OF_GUEST : STR_FAVOURITE_RIDE_OF_GUESTS;
DrawTextBasic(dpi, screenCoords, stringId, &ride->guests_favourite);
DrawTextBasic(dpi, screenCoords, stringId, ft);
screenCoords.y += LIST_ROW_HEIGHT;
}
screenCoords.y += 2;
@ -6925,7 +6975,9 @@ static void window_ride_customer_paint(rct_window* w, rct_drawpixelinfo* dpi)
// If the ride has a build date that is in the future, show it as built this year.
int16_t age = std::max(date_get_year(ride->GetAge()), 0);
stringId = age == 0 ? STR_BUILT_THIS_YEAR : age == 1 ? STR_BUILT_LAST_YEAR : STR_BUILT_YEARS_AGO;
DrawTextBasic(dpi, screenCoords, stringId, &age);
ft = Formatter();
ft.Add<int16_t>(age);
DrawTextBasic(dpi, screenCoords, stringId, ft);
}
#pragma endregion

View File

@ -2324,13 +2324,14 @@ static void window_ride_construction_paint(rct_window* w, rct_drawpixelinfo* dpi
// Draw cost
screenCoords = { w->windowPos.x + widget->midX(), w->windowPos.y + widget->bottom - 23 };
if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_PLACE)
DrawTextBasic(dpi, screenCoords, STR_BUILD_THIS, w, { TextAlignment::CENTRE });
DrawTextBasic(dpi, screenCoords, STR_BUILD_THIS, {}, { TextAlignment::CENTRE });
screenCoords.y += 11;
if (_currentTrackPrice != MONEY32_UNDEFINED && !(gParkFlags & PARK_FLAGS_NO_MONEY))
{
money64 value = _currentTrackPrice;
DrawTextBasic(dpi, screenCoords, STR_COST_LABEL, &value, { TextAlignment::CENTRE });
auto ft = Formatter();
ft.Add<money64>(_currentTrackPrice);
DrawTextBasic(dpi, screenCoords, STR_COST_LABEL, ft, { TextAlignment::CENTRE });
}
}

View File

@ -560,9 +560,11 @@ static void window_ride_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
window_ride_list_draw_tab_images(dpi, w);
// Draw number of attractions on bottom
auto ft = Formatter();
ft.Add<uint16_t>(w->no_list_items);
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 4, w->widgets[WIDX_LIST].bottom + 2 }, ride_list_statusbar_count_strings[w->page],
&w->no_list_items);
ft);
}
/**

View File

@ -493,9 +493,9 @@ static void window_scenarioselect_paint(rct_window* w, rct_drawpixelinfo* dpi)
shorten_path(path, sizeof(path), scenario->path, w->width - 6, FontSpriteBase::MEDIUM);
const utf8* pathPtr = path;
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 3, w->height - 3 - 11 }, STR_STRING, static_cast<void*>(&pathPtr),
{ w->colours[1] });
auto ft = Formatter();
ft.Add<const char*>(pathPtr);
DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 3, w->height - 3 - 11 }, STR_STRING, ft, { w->colours[1] });
}
// Scenario name

View File

@ -216,8 +216,8 @@ static void window_scenery_scatter_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
auto preview = window_scenery_scatter_widgets[WIDX_PREVIEW];
auto screenCoords = ScreenCoordsXY{ w->windowPos.x + preview.midX(), w->windowPos.y + preview.midY() };
DrawTextBasic(
dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, &gWindowSceneryScatterSize,
{ TextAlignment::CENTRE });
auto ft = Formatter();
ft.Add<uint16_t>(gWindowSceneryScatterSize);
DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE });
}
}

View File

@ -401,19 +401,19 @@ static void window_server_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
WindowDrawWidgets(w, dpi);
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 6, w->widgets[WIDX_PLAYER_NAME_INPUT].top }, STR_PLAYER_NAME, nullptr,
{ COLOUR_WHITE });
dpi, w->windowPos + ScreenCoordsXY{ 6, w->widgets[WIDX_PLAYER_NAME_INPUT].top }, STR_PLAYER_NAME, {}, { COLOUR_WHITE });
// Draw version number
std::string version = network_get_version();
const char* versionCStr = version.c_str();
auto ft = Formatter();
ft.Add<const char*>(version.c_str());
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 324, w->widgets[WIDX_START_SERVER].top + 1 }, STR_NETWORK_VERSION,
static_cast<void*>(&versionCStr), { COLOUR_WHITE });
DrawTextBasic(
dpi, w->windowPos + ScreenCoordsXY{ 8, w->height - 15 }, _statusText, static_cast<void*>(&_numPlayersOnline),
dpi, w->windowPos + ScreenCoordsXY{ 324, w->widgets[WIDX_START_SERVER].top + 1 }, STR_NETWORK_VERSION, ft,
{ COLOUR_WHITE });
ft = Formatter();
ft.Add<uint32_t>(_numPlayersOnline);
DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 8, w->height - 15 }, _statusText, ft, { COLOUR_WHITE });
}
static void window_server_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_t scrollIndex)

View File

@ -1805,7 +1805,9 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
terrainNameId = surfaceStyle->NameStringId;
}
DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_SURFACE_TERAIN, &terrainNameId, { COLOUR_WHITE });
auto ft = Formatter();
ft.Add<rct_string_id>(terrainNameId);
DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_SURFACE_TERAIN, ft, { COLOUR_WHITE });
// Edge texture name
rct_string_id terrainEdgeNameId = STR_EMPTY;
@ -1814,9 +1816,10 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
terrainEdgeNameId = edgeStyle->NameStringId;
}
ft = Formatter();
ft.Add<rct_string_id>(terrainEdgeNameId);
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_SURFACE_EDGE, &terrainEdgeNameId,
{ COLOUR_WHITE });
dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_SURFACE_EDGE, ft, { COLOUR_WHITE });
// Land ownership
rct_string_id landOwnership;
@ -1830,15 +1833,16 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
landOwnership = STR_CONSTRUCTION_RIGHTS_SALE;
else
landOwnership = STR_TILE_INSPECTOR_LAND_NOT_OWNED_AND_NOT_AVAILABLE;
ft = Formatter();
ft.Add<rct_string_id>(landOwnership);
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_SURFACE_OWNERSHIP, &landOwnership,
{ COLOUR_WHITE });
dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_SURFACE_OWNERSHIP, ft, { COLOUR_WHITE });
// Water level
uint32_t waterLevel = tileElement->AsSurface()->GetWaterHeight();
ft = Formatter();
ft.Add<uint32_t>(tileElement->AsSurface()->GetWaterHeight());
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 0, 33 }, STR_TILE_INSPECTOR_SURFACE_WATER_LEVEL, &waterLevel,
{ COLOUR_WHITE });
dpi, screenCoords + ScreenCoordsXY{ 0, 33 }, STR_TILE_INSPECTOR_SURFACE_WATER_LEVEL, ft, { COLOUR_WHITE });
// Properties
// Raise / lower label
@ -1848,8 +1852,9 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Current base height
screenCoords.x = w->windowPos.x + w->widgets[WIDX_SURFACE_SPINNER_HEIGHT].left + 3;
int32_t baseHeight = tileElement->base_height;
DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, &baseHeight, { COLOUR_WHITE });
ft = Formatter();
ft.Add<int32_t>(tileElement->base_height);
DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { COLOUR_WHITE });
// Raised corners
screenCoords = w->windowPos
@ -1862,8 +1867,9 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
// Details
// Path name
rct_string_id pathNameId = tileElement->AsPath()->GetSurfaceEntry()->string_idx;
DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_PATH_NAME, &pathNameId, { COLOUR_WHITE });
auto ft = Formatter();
ft.Add<rct_string_id>(tileElement->AsPath()->GetSurfaceEntry()->string_idx);
DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_PATH_NAME, ft, { COLOUR_WHITE });
// Path addition
if (tileElement->AsPath()->HasAddition())
@ -1873,9 +1879,10 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
rct_string_id additionNameId = pathBitEntry != nullptr
? pathBitEntry->name
: static_cast<rct_string_id>(STR_UNKNOWN_OBJECT_TYPE);
ft = Formatter();
ft.Add<rct_string_id>(additionNameId);
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_PATH_ADDITIONS, &additionNameId,
{ COLOUR_WHITE });
dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_PATH_ADDITIONS, ft, { COLOUR_WHITE });
}
else
DrawTextBasic(
@ -1890,8 +1897,9 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Current base height
screenCoords.x = w->windowPos.x + w->widgets[WIDX_PATH_SPINNER_HEIGHT].left + 3;
int32_t baseHeight = tileElement->base_height;
DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, &baseHeight, { COLOUR_WHITE });
ft = Formatter();
ft.Add<int32_t>(tileElement->base_height);
DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { COLOUR_WHITE });
// Path connections
screenCoords = w->windowPos
@ -1909,31 +1917,35 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
auto ride = get_ride(rideId);
if (ride != nullptr)
{
auto rideName = ride->GetRideTypeDescriptor().Naming.Name;
DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_TRACK_RIDE_TYPE, &rideName, { COLOUR_WHITE });
auto ft = Formatter();
ft.Add<rct_string_id>(ride->GetRideTypeDescriptor().Naming.Name);
DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_TRACK_RIDE_TYPE, ft, { COLOUR_WHITE });
}
auto ft = Formatter();
ft.Add<int16_t>(trackElement->GetRideIndex());
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_TRACK_RIDE_ID, &rideId, { COLOUR_WHITE });
dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_TRACK_RIDE_ID, ft, { COLOUR_WHITE });
if (ride != nullptr)
{
auto ft = Formatter();
ft = Formatter();
ride->FormatNameTo(ft);
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_TRACK_RIDE_NAME, ft, { COLOUR_WHITE });
}
// Track
auto trackType = trackElement->GetTrackType();
int16_t sequenceNumber = trackElement->GetSequenceIndex();
ft = Formatter();
ft.Add<track_type_t>(trackElement->GetTrackType());
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 0, 33 }, STR_TILE_INSPECTOR_TRACK_PIECE_ID, &trackType,
{ COLOUR_WHITE });
dpi, screenCoords + ScreenCoordsXY{ 0, 33 }, STR_TILE_INSPECTOR_TRACK_PIECE_ID, ft, { COLOUR_WHITE });
ft = Formatter();
ft.Add<track_type_t>(trackElement->GetSequenceIndex());
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 0, 44 }, STR_TILE_INSPECTOR_TRACK_SEQUENCE, &sequenceNumber,
{ COLOUR_WHITE });
dpi, screenCoords + ScreenCoordsXY{ 0, 44 }, STR_TILE_INSPECTOR_TRACK_SEQUENCE, ft, { COLOUR_WHITE });
if (trackElement->IsStation())
{
int16_t stationIndex = trackElement->GetStationIndex();
auto ft = Formatter();
ft = Formatter();
ft.Add<rct_string_id>(STR_COMMA16);
ft.Add<int16_t>(stationIndex);
DrawTextBasic(
@ -1942,17 +1954,17 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
else
{
const char* stationNone = "-";
auto ft = Formatter();
ft = Formatter();
ft.Add<rct_string_id>(STR_STRING);
ft.Add<char*>(stationNone);
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 0, 55 }, STR_TILE_INSPECTOR_STATION_INDEX, ft, { COLOUR_WHITE });
}
rct_string_id colourScheme = ColourSchemeNames[trackElement->GetColourScheme()];
ft = Formatter();
ft.Add<rct_string_id>(ColourSchemeNames[trackElement->GetColourScheme()]);
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 0, 66 }, STR_TILE_INSPECTOR_COLOUR_SCHEME, &colourScheme,
{ COLOUR_WHITE });
dpi, screenCoords + ScreenCoordsXY{ 0, 66 }, STR_TILE_INSPECTOR_COLOUR_SCHEME, ft, { COLOUR_WHITE });
// Properties
// Raise / lower label
@ -1961,8 +1973,8 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Current base height
screenCoords.x = w->windowPos.x + w->widgets[WIDX_TRACK_SPINNER_HEIGHT].left + 3;
int32_t baseHeight = tileElement->base_height;
DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, &baseHeight, { COLOUR_WHITE });
ft.Add<int32_t>(tileElement->base_height);
DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { COLOUR_WHITE });
break;
}
@ -1970,8 +1982,9 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
// Details
// Age
int16_t age = tileElement->AsSmallScenery()->GetAge();
DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_SCENERY_AGE, &age, { COLOUR_WHITE });
auto ft = Formatter();
ft.Add<int16_t>(tileElement->AsSmallScenery()->GetAge());
DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_SCENERY_AGE, ft, { COLOUR_WHITE });
// Quadrant value
const auto* sceneryEntry = tileElement->AsSmallScenery()->GetEntry();
@ -1982,15 +1995,17 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
STR_TILE_INSPECTOR_SCENERY_QUADRANT_NW,
STR_TILE_INSPECTOR_SCENERY_QUADRANT_NE,
STR_TILE_INSPECTOR_SCENERY_QUADRANT_SE };
ft = Formatter();
ft.Add<rct_string_id>(quadrant_string_idx[quadrant]);
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_SCENERY_QUADRANT,
&quadrant_string_idx[quadrant], { COLOUR_WHITE });
dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_SCENERY_QUADRANT, ft, { COLOUR_WHITE });
}
// Scenery ID
int16_t idx = tileElement->AsSmallScenery()->GetEntryIndex();
ft = Formatter();
ft.Add<ObjectEntryIndex>(tileElement->AsSmallScenery()->GetEntryIndex());
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_SCENERY_ENTRY_IDX, &idx, { COLOUR_WHITE });
dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_SCENERY_ENTRY_IDX, ft, { COLOUR_WHITE });
// Properties
// Raise / Lower
@ -1999,8 +2014,9 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Current base height
screenCoords.x = w->windowPos.x + w->widgets[WIDX_SCENERY_SPINNER_HEIGHT].left + 3;
int32_t baseHeight = tileElement->base_height;
DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, &baseHeight, { COLOUR_WHITE });
ft = Formatter();
ft.Add<int32_t>(tileElement->base_height);
DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { COLOUR_WHITE });
// Quarter tile
screenCoords = w->windowPos
@ -2018,55 +2034,57 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
// Details
// Entrance type
rct_string_id entranceType = EntranceTypeStringIds[tileElement->AsEntrance()->GetEntranceType()];
DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_ENTRANCE_TYPE, &entranceType, { COLOUR_WHITE });
auto ft = Formatter();
ft.Add<rct_string_id>(EntranceTypeStringIds[tileElement->AsEntrance()->GetEntranceType()]);
DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_ENTRANCE_TYPE, ft, { COLOUR_WHITE });
if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE)
{
// TODO: Make this work with Left/Right park entrance parts
int16_t parkEntranceIndex = park_entrance_get_index(
{ windowTileInspectorToolMap, tileElement->GetBaseZ() });
ft = Formatter();
ft.Add<rct_string_id>(park_entrance_get_index({ windowTileInspectorToolMap, tileElement->GetBaseZ() }));
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_ENTRANCE_ENTRANCE_ID,
&parkEntranceIndex, { COLOUR_WHITE });
dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_ENTRANCE_ENTRANCE_ID, ft,
{ COLOUR_WHITE });
}
else
{
int16_t rideEntranceIndex = tileElement->AsEntrance()->GetStationIndex();
ft = Formatter();
ft.Add<int16_t>(tileElement->AsEntrance()->GetStationIndex());
if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE)
{
// Ride entrance ID
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_ENTRANCE_ENTRANCE_ID,
&rideEntranceIndex, { COLOUR_WHITE });
dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_ENTRANCE_ENTRANCE_ID, ft,
{ COLOUR_WHITE });
}
else
{
// Ride exit ID
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_ENTRANCE_EXIT_ID,
&rideEntranceIndex, { COLOUR_WHITE });
dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_ENTRANCE_EXIT_ID, ft,
{ COLOUR_WHITE });
}
}
if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE)
{
// Entrance part
rct_string_id entrancePart = ParkEntrancePartStringIds[tileElement->AsEntrance()->GetSequenceIndex()];
ft = Formatter();
ft.Add<rct_string_id>(ParkEntrancePartStringIds[tileElement->AsEntrance()->GetSequenceIndex()]);
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_ENTRANCE_PART, &entrancePart,
{ COLOUR_WHITE });
dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_ENTRANCE_PART, ft, { COLOUR_WHITE });
}
else
{
// Ride ID
int16_t rideId = tileElement->AsEntrance()->GetRideIndex();
ft = Formatter();
ft.Add<ride_id_t>(tileElement->AsEntrance()->GetRideIndex());
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_ENTRANCE_RIDE_ID, &rideId,
{ COLOUR_WHITE });
dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_ENTRANCE_RIDE_ID, ft, { COLOUR_WHITE });
// Station index
int16_t stationIndex = tileElement->AsEntrance()->GetStationIndex();
auto ft = Formatter();
ft = Formatter();
ft.Add<rct_string_id>(STR_COMMA16);
ft.Add<int16_t>(stationIndex);
DrawTextBasic(
@ -2080,7 +2098,7 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Current base height
screenCoords.x = w->windowPos.x + w->widgets[WIDX_ENTRANCE_SPINNER_HEIGHT].left + 3;
auto ft = Formatter();
ft = Formatter();
ft.Add<int32_t>(tileElement->base_height);
DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { COLOUR_WHITE });
break;
@ -2090,14 +2108,15 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
// Details
// Type
int16_t wallType = tileElement->AsWall()->GetEntryIndex();
DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_WALL_TYPE, &wallType, { COLOUR_WHITE });
auto ft = Formatter();
ft.Add<ObjectEntryIndex>(tileElement->AsWall()->GetEntryIndex());
DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_WALL_TYPE, ft, { COLOUR_WHITE });
// Banner info
auto banner = tileElement->AsWall()->GetBanner();
if (banner != nullptr)
{
Formatter ft;
ft = Formatter();
banner->FormatTextTo(ft);
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT, ft,
@ -2117,8 +2136,9 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Current base height
screenCoords.x = w->windowPos.x + w->widgets[WIDX_WALL_SPINNER_HEIGHT].left + 3;
int32_t baseHeight = tileElement->base_height;
DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, &baseHeight, { COLOUR_WHITE });
ft = Formatter();
ft.Add<int32_t>(tileElement->base_height);
DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { COLOUR_WHITE });
// Slope label
screenCoords = w->windowPos
@ -2136,8 +2156,9 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
colour = w->colours[0] | COLOUR_FLAG_INSET;
}
screenCoords.x = w->windowPos.x + w->widgets[WIDX_WALL_SPINNER_ANIMATION_FRAME].left + 3;
int32_t animationFrame = tileElement->AsWall()->GetAnimationFrame();
DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, &animationFrame, { colour });
ft = Formatter();
ft.Add<int32_t>(tileElement->AsWall()->GetAnimationFrame());
DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { colour });
break;
}
@ -2146,13 +2167,16 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Details
// Type
auto sceneryElement = tileElement->AsLargeScenery();
int16_t largeSceneryType = sceneryElement->GetEntryIndex();
DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_LARGE_SCENERY_TYPE, &largeSceneryType, { COLOUR_WHITE });
ObjectEntryIndex largeSceneryType = sceneryElement->GetEntryIndex();
auto ft = Formatter();
ft.Add<ObjectEntryIndex>(largeSceneryType);
DrawTextBasic(dpi, screenCoords, STR_TILE_INSPECTOR_LARGE_SCENERY_TYPE, ft, { COLOUR_WHITE });
// Part ID
int16_t pieceID = sceneryElement->GetSequenceIndex();
ft = Formatter();
ft.Add<int16_t>(sceneryElement->GetSequenceIndex());
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_LARGE_SCENERY_PIECE_ID, &pieceID,
dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_LARGE_SCENERY_PIECE_ID, ft,
{ COLOUR_WHITE });
// Banner info
@ -2162,7 +2186,7 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
auto banner = sceneryElement->GetBanner();
if (banner != nullptr)
{
Formatter ft;
ft = Formatter();
banner->FormatTextTo(ft);
DrawTextBasic(
dpi, screenCoords + ScreenCoordsXY{ 0, 22 }, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT, ft,
@ -2183,8 +2207,9 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Current base height
screenCoords.x = w->windowPos.x + w->widgets[WIDX_LARGE_SCENERY_SPINNER_HEIGHT].left + 3;
int32_t baseHeight = tileElement->base_height;
DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, &baseHeight, { COLOUR_WHITE });
ft = Formatter();
ft.Add<int32_t>(tileElement->base_height);
DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { COLOUR_WHITE });
break;
}
@ -2207,8 +2232,9 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Current base height
screenCoords.x = w->windowPos.x + w->widgets[WIDX_BANNER_SPINNER_HEIGHT].left + 3;
int32_t baseHeight = tileElement->base_height;
DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, &baseHeight, { COLOUR_WHITE });
auto ft = Formatter();
ft.Add<int32_t>(tileElement->base_height);
DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { COLOUR_WHITE });
// Blocked paths
screenCoords.y += 28;
@ -2226,8 +2252,9 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Current base height
screenCoords.x = w->windowPos.x + w->widgets[WIDX_CORRUPT_SPINNER_HEIGHT].left + 3;
int32_t baseHeight = tileElement->base_height;
DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, &baseHeight, { COLOUR_WHITE });
auto ft = Formatter();
ft.Add<int32_t>(tileElement->base_height);
DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { COLOUR_WHITE });
break;
}
@ -2329,7 +2356,6 @@ static void window_tile_inspector_scrollpaint(rct_window* w, rct_drawpixelinfo*
typeName = buffer;
}
const int32_t baseHeight = tileElement->base_height;
const int32_t clearanceHeight = tileElement->clearance_height;
const bool ghost = tileElement->IsGhost();
const bool last = tileElement->IsLastForTile();
@ -2346,7 +2372,7 @@ static void window_tile_inspector_scrollpaint(rct_window* w, rct_drawpixelinfo*
// Base height
ft = Formatter();
ft.Add<rct_string_id>(STR_FORMAT_INTEGER);
ft.Add<int32_t>(baseHeight);
ft.Add<int32_t>(tileElement->base_height);
DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ COL_X_BH, 0 }, stringFormat, ft);
// Clearance height

View File

@ -497,8 +497,9 @@ static void window_track_place_paint(rct_window* w, rct_drawpixelinfo* dpi)
// Price
if (_window_track_place_last_cost != MONEY32_UNDEFINED && !(gParkFlags & PARK_FLAGS_NO_MONEY))
{
money64 value = _window_track_place_last_cost;
DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 88, 94 }, STR_COST_LABEL, &value, { TextAlignment::CENTRE });
ft = Formatter();
ft.Add<money64>(_window_track_place_last_cost);
DrawTextBasic(dpi, w->windowPos + ScreenCoordsXY{ 88, 94 }, STR_COST_LABEL, ft, { TextAlignment::CENTRE });
}
}

View File

@ -591,16 +591,19 @@ static void window_track_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
screenPos = w->windowPos + ScreenCoordsXY{ widget->left + 1, widget->bottom + 2 };
// Stats
fixed32_2dp rating = _loadedTrackDesign->excitement * 10;
DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_EXCITEMENT_RATING, &rating);
ft = Formatter();
ft.Add<fixed32_2dp>(_loadedTrackDesign->excitement * 10);
DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_EXCITEMENT_RATING, ft);
screenPos.y += LIST_ROW_HEIGHT;
rating = _loadedTrackDesign->intensity * 10;
DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_INTENSITY_RATING, &rating);
ft = Formatter();
ft.Add<fixed32_2dp>(_loadedTrackDesign->intensity * 10);
DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_INTENSITY_RATING, ft);
screenPos.y += LIST_ROW_HEIGHT;
rating = _loadedTrackDesign->nausea * 10;
DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_NAUSEA_RATING, &rating);
ft = Formatter();
ft.Add<fixed32_2dp>(_loadedTrackDesign->nausea * 10);
DrawTextBasic(dpi, screenPos, STR_TRACK_LIST_NAUSEA_RATING, ft);
screenPos.y += LIST_ROW_HEIGHT + 4;
// Information for tracked rides.
@ -611,20 +614,23 @@ static void window_track_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
if (_loadedTrackDesign->type == RIDE_TYPE_MINI_GOLF)
{
// Holes
uint16_t holes = _loadedTrackDesign->holes & 0x1F;
DrawTextBasic(dpi, screenPos, STR_HOLES, &holes);
ft = Formatter();
ft.Add<uint16_t>(_loadedTrackDesign->holes & 0x1F);
DrawTextBasic(dpi, screenPos, STR_HOLES, ft);
screenPos.y += LIST_ROW_HEIGHT;
}
else
{
// Maximum speed
uint16_t speed = ((_loadedTrackDesign->max_speed << 16) * 9) >> 18;
DrawTextBasic(dpi, screenPos, STR_MAX_SPEED, &speed);
ft = Formatter();
ft.Add<uint16_t>(((_loadedTrackDesign->max_speed << 16) * 9) >> 18);
DrawTextBasic(dpi, screenPos, STR_MAX_SPEED, ft);
screenPos.y += LIST_ROW_HEIGHT;
// Average speed
speed = ((_loadedTrackDesign->average_speed << 16) * 9) >> 18;
DrawTextBasic(dpi, screenPos, STR_AVERAGE_SPEED, &speed);
ft = Formatter();
ft.Add<uint16_t>(((_loadedTrackDesign->average_speed << 16) * 9) >> 18);
DrawTextBasic(dpi, screenPos, STR_AVERAGE_SPEED, ft);
screenPos.y += LIST_ROW_HEIGHT;
}
@ -639,25 +645,29 @@ static void window_track_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
if (GetRideTypeDescriptor(_loadedTrackDesign->type).HasFlag(RIDE_TYPE_FLAG_HAS_G_FORCES))
{
// Maximum positive vertical Gs
int32_t gForces = _loadedTrackDesign->max_positive_vertical_g * 32;
DrawTextBasic(dpi, screenPos, STR_MAX_POSITIVE_VERTICAL_G, &gForces);
ft = Formatter();
ft.Add<int32_t>(_loadedTrackDesign->max_positive_vertical_g * 32);
DrawTextBasic(dpi, screenPos, STR_MAX_POSITIVE_VERTICAL_G, ft);
screenPos.y += LIST_ROW_HEIGHT;
// Maximum negative vertical Gs
gForces = _loadedTrackDesign->max_negative_vertical_g * 32;
DrawTextBasic(dpi, screenPos, STR_MAX_NEGATIVE_VERTICAL_G, &gForces);
ft = Formatter();
ft.Add<int32_t>(_loadedTrackDesign->max_negative_vertical_g * 32);
DrawTextBasic(dpi, screenPos, STR_MAX_NEGATIVE_VERTICAL_G, ft);
screenPos.y += LIST_ROW_HEIGHT;
// Maximum lateral Gs
gForces = _loadedTrackDesign->max_lateral_g * 32;
DrawTextBasic(dpi, screenPos, STR_MAX_LATERAL_G, &gForces);
ft = Formatter();
ft.Add<int32_t>(_loadedTrackDesign->max_lateral_g * 32);
DrawTextBasic(dpi, screenPos, STR_MAX_LATERAL_G, ft);
screenPos.y += LIST_ROW_HEIGHT;
if (_loadedTrackDesign->total_air_time != 0)
{
// Total air time
int32_t airTime = _loadedTrackDesign->total_air_time * 25;
DrawTextBasic(dpi, screenPos, STR_TOTAL_AIR_TIME, &airTime);
ft = Formatter();
ft.Add<int32_t>(_loadedTrackDesign->total_air_time * 25);
DrawTextBasic(dpi, screenPos, STR_TOTAL_AIR_TIME, ft);
screenPos.y += LIST_ROW_HEIGHT;
}
}
@ -665,13 +675,15 @@ static void window_track_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
if (GetRideTypeDescriptor(_loadedTrackDesign->type).HasFlag(RIDE_TYPE_FLAG_HAS_DROPS))
{
// Drops
uint16_t drops = _loadedTrackDesign->drops & 0x3F;
DrawTextBasic(dpi, screenPos, STR_DROPS, &drops);
ft = Formatter();
ft.Add<uint16_t>(_loadedTrackDesign->drops & 0x3F);
DrawTextBasic(dpi, screenPos, STR_DROPS, ft);
screenPos.y += LIST_ROW_HEIGHT;
// Drop height is multiplied by 0.75
uint16_t highestDropHeight = (_loadedTrackDesign->highest_drop_height * 3) / 4;
DrawTextBasic(dpi, screenPos, STR_HIGHEST_DROP_HEIGHT, &highestDropHeight);
ft = Formatter();
ft.Add<uint16_t>((_loadedTrackDesign->highest_drop_height * 3) / 4);
DrawTextBasic(dpi, screenPos, STR_HIGHEST_DROP_HEIGHT, ft);
screenPos.y += LIST_ROW_HEIGHT;
}
@ -680,8 +692,10 @@ static void window_track_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
uint16_t inversions = _loadedTrackDesign->inversions & 0x1F;
if (inversions != 0)
{
ft = Formatter();
ft.Add<uint16_t>(inversions);
// Inversions
DrawTextBasic(dpi, screenPos, STR_INVERSIONS, &inversions);
DrawTextBasic(dpi, screenPos, STR_INVERSIONS, ft);
screenPos.y += LIST_ROW_HEIGHT;
}
}
@ -743,8 +757,9 @@ static void window_track_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi,
stringId = STR_BLACK_STRING;
}
rct_string_id stringId2 = STR_BUILD_CUSTOM_DESIGN;
DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 1 }, stringId, &stringId2);
auto ft = Formatter();
ft.Add<rct_string_id>(STR_BUILD_CUSTOM_DESIGN);
DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 1 }, stringId, ft);
screenCoords.y += SCROLLABLE_ROW_HEIGHT;
listIndex++;
}

View File

@ -386,27 +386,25 @@ static void window_view_clipping_paint(rct_window* w, rct_drawpixelinfo* dpi)
screenCoords = w->windowPos
+ ScreenCoordsXY{ w->widgets[WIDX_CLIP_HEIGHT_VALUE].left + 1, w->widgets[WIDX_CLIP_HEIGHT_VALUE].top };
fixed16_1dp clipHeightValueInUnits;
fixed32_2dp clipHeightValueInMeters;
fixed16_1dp clipHeightValueInFeet;
int32_t clipHeightRawValue = static_cast<int32_t>(gClipHeight);
switch (gClipHeightDisplayType)
{
case DISPLAY_TYPE::DISPLAY_RAW:
default:
DrawTextBasic(
dpi, screenCoords, STR_FORMAT_INTEGER, &clipHeightRawValue, { w->colours[0] }); // Printing the raw value.
{
auto ft = Formatter();
ft.Add<int32_t>(static_cast<int32_t>(gClipHeight));
DrawTextBasic(dpi, screenCoords, STR_FORMAT_INTEGER, ft, { w->colours[0] }); // Printing the raw value.
break;
}
case DISPLAY_TYPE::DISPLAY_UNITS:
// Print the value in the configured height label type:
if (gConfigGeneral.show_height_as_units == 1)
{
// Height label is Units.
clipHeightValueInUnits = static_cast<fixed16_1dp>(FIXED_1DP(gClipHeight, 0) / 2 - FIXED_1DP(7, 0));
auto ft = Formatter();
ft.Add<fixed16_1dp>(static_cast<fixed16_1dp>(FIXED_1DP(gClipHeight, 0) / 2 - FIXED_1DP(7, 0)));
DrawTextBasic(
dpi, screenCoords, STR_UNIT1DP_NO_SUFFIX, &clipHeightValueInUnits,
{ w->colours[0] }); // Printing the value in Height Units.
dpi, screenCoords, STR_UNIT1DP_NO_SUFFIX, ft, { w->colours[0] }); // Printing the value in Height Units.
}
else
{
@ -416,16 +414,19 @@ static void window_view_clipping_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
case MeasurementFormat::Metric:
case MeasurementFormat::SI:
clipHeightValueInMeters = static_cast<fixed32_2dp>(
FIXED_2DP(gClipHeight, 0) / 2 * 1.5f - FIXED_2DP(10, 50));
DrawTextBasic(
dpi, screenCoords, STR_UNIT2DP_SUFFIX_METRES, &clipHeightValueInMeters, { w->colours[0] });
{
auto ft = Formatter();
ft.Add<fixed32_2dp>(static_cast<fixed32_2dp>(FIXED_2DP(gClipHeight, 0) / 2 * 1.5f - FIXED_2DP(10, 50)));
DrawTextBasic(dpi, screenCoords, STR_UNIT2DP_SUFFIX_METRES, ft, { w->colours[0] });
break;
}
case MeasurementFormat::Imperial:
clipHeightValueInFeet = static_cast<fixed16_1dp>(
FIXED_1DP(gClipHeight, 0) / 2.0f * 5 - FIXED_1DP(35, 0));
DrawTextBasic(dpi, screenCoords, STR_UNIT1DP_SUFFIX_FEET, &clipHeightValueInFeet, { w->colours[0] });
{
auto ft = Formatter();
ft.Add<fixed16_1dp>(static_cast<fixed16_1dp>(FIXED_1DP(gClipHeight, 0) / 2.0f * 5 - FIXED_1DP(35, 0)));
DrawTextBasic(dpi, screenCoords, STR_UNIT1DP_SUFFIX_FEET, ft, { w->colours[0] });
break;
}
}
}
}

View File

@ -146,9 +146,9 @@ public:
// Draw number for tool sizes bigger than 7
if (gLandToolSize > MAX_TOOL_SIZE_WITH_SPRITE)
{
DrawTextBasic(
&dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, &gLandToolSize,
{ TextAlignment::CENTRE });
auto ft = Formatter();
ft.Add<uint16_t>(gLandToolSize);
DrawTextBasic(&dpi, screenCoords - ScreenCoordsXY{ 0, 2 }, STR_LAND_TOOL_SIZE_VALUE, ft, { TextAlignment::CENTRE });
}
if (!(gParkFlags & PARK_FLAGS_NO_MONEY))

View File

@ -112,16 +112,10 @@ static void DrawText(
DrawText(dpi, coords, paint, buffer);
}
void DrawTextBasic(
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, rct_string_id format, const void* args, TextPaint textPaint)
{
DrawText(dpi, coords, textPaint, format, args);
}
void DrawTextBasic(
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, rct_string_id format, const Formatter& ft, TextPaint textPaint)
{
DrawTextBasic(dpi, coords, format, ft.Data(), textPaint);
DrawText(dpi, coords, textPaint, format, ft.Data());
}
void DrawTextEllipsised(

View File

@ -147,8 +147,6 @@ public:
void DrawTextBasic(
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, rct_string_id format, const Formatter& ft = {},
TextPaint textPaint = {});
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,
TextPaint textPaint = {});