From fab0ea131f8728dcbac7e4f49a9da3e7c51256ac Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Thu, 11 Jun 2020 09:38:02 -0300 Subject: [PATCH] Part of #11569: Use gfx_draw_string_right with ScreenCoordsXY --- src/openrct2-ui/scripting/CustomListView.cpp | 4 ++-- src/openrct2-ui/windows/Cheats.cpp | 16 ++++++++-------- .../windows/EditorObjectSelection.cpp | 7 ++++--- src/openrct2-ui/windows/Finances.cpp | 6 +++--- src/openrct2-ui/windows/GuestList.cpp | 2 +- src/openrct2-ui/windows/NewRide.cpp | 2 +- src/openrct2-ui/windows/Park.cpp | 4 ++-- src/openrct2-ui/windows/Scenery.cpp | 4 ++-- src/openrct2-ui/windows/TileInspector.cpp | 6 ++++-- src/openrct2-ui/windows/TopToolbar.cpp | 5 +++-- src/openrct2/drawing/Drawing.h | 1 - src/openrct2/drawing/Text.cpp | 5 ----- 12 files changed, 30 insertions(+), 32 deletions(-) diff --git a/src/openrct2-ui/scripting/CustomListView.cpp b/src/openrct2-ui/scripting/CustomListView.cpp index 4407ea4ab7..7cb0fceff5 100644 --- a/src/openrct2-ui/scripting/CustomListView.cpp +++ b/src/openrct2-ui/scripting/CustomListView.cpp @@ -650,13 +650,13 @@ void CustomListView::PaintHeading( { auto ft = Formatter::Common(); ft.Add(STR_UP); - gfx_draw_string_right(dpi, STR_BLACK_STRING, gCommonFormatArgs, COLOUR_BLACK, pos.x + size.width - 1, pos.y); + gfx_draw_string_right(dpi, STR_BLACK_STRING, gCommonFormatArgs, COLOUR_BLACK, { pos.x + size.width - 1, pos.y }); } else if (sortOrder == ColumnSortOrder::Descending) { auto ft = Formatter::Common(); ft.Add(STR_DOWN); - gfx_draw_string_right(dpi, STR_BLACK_STRING, gCommonFormatArgs, COLOUR_BLACK, pos.x + size.width - 1, pos.y); + gfx_draw_string_right(dpi, STR_BLACK_STRING, gCommonFormatArgs, COLOUR_BLACK, { pos.x + size.width - 1, pos.y }); } } diff --git a/src/openrct2-ui/windows/Cheats.cpp b/src/openrct2-ui/windows/Cheats.cpp index a9f99c30c1..a9704f6d0f 100644 --- a/src/openrct2-ui/windows/Cheats.cpp +++ b/src/openrct2-ui/windows/Cheats.cpp @@ -1216,14 +1216,14 @@ static void window_cheats_paint(rct_window* w, rct_drawpixelinfo* dpi) gfx_draw_string_left( dpi, STR_DAY, nullptr, COLOUR_BLACK, w->windowPos.x + XPL(0) + TXTO, w->windowPos.y + YPL(9) + TXTO); gfx_draw_string_right( - dpi, STR_FORMAT_INTEGER, &_yearSpinnerValue, w->colours[1], w->windowPos.x + WPL(1) - 34 - TXTO, - w->windowPos.y + YPL(7) + TXTO); + dpi, STR_FORMAT_INTEGER, &_yearSpinnerValue, w->colours[1], + { w->windowPos.x + WPL(1) - 34 - TXTO, w->windowPos.y + YPL(7) + TXTO }); gfx_draw_string_right( - dpi, STR_FORMAT_MONTH, &actual_month, w->colours[1], w->windowPos.x + WPL(1) - 34 - TXTO, - w->windowPos.y + YPL(8) + TXTO); + dpi, STR_FORMAT_MONTH, &actual_month, w->colours[1], + { w->windowPos.x + WPL(1) - 34 - TXTO, w->windowPos.y + YPL(8) + TXTO }); gfx_draw_string_right( - dpi, STR_FORMAT_INTEGER, &_daySpinnerValue, w->colours[1], w->windowPos.x + WPL(1) - 34 - TXTO, - w->windowPos.y + YPL(9) + TXTO); + dpi, STR_FORMAT_INTEGER, &_daySpinnerValue, w->colours[1], + { w->windowPos.x + WPL(1) - 34 - TXTO, w->windowPos.y + YPL(9) + TXTO }); } else if (w->page == WINDOW_CHEATS_PAGE_MISC) { @@ -1232,8 +1232,8 @@ static void window_cheats_paint(rct_window* w, rct_drawpixelinfo* dpi) gfx_draw_string_left( dpi, STR_FORCE_WEATHER, nullptr, COLOUR_BLACK, w->windowPos.x + XPL(0) + TXTO, w->windowPos.y + YPL(10) + TXTO); gfx_draw_string_right( - dpi, STR_FORMAT_INTEGER, &_parkRatingSpinnerValue, w->colours[1], w->windowPos.x + WPL(1) - 34 - TXTO, - w->windowPos.y + YPL(5) + TXTO); + dpi, STR_FORMAT_INTEGER, &_parkRatingSpinnerValue, w->colours[1], + { w->windowPos.x + WPL(1) - 34 - TXTO, w->windowPos.y + YPL(5) + TXTO }); } else if (w->page == WINDOW_CHEATS_PAGE_GUESTS) { diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index 8021599090..39c5dc56ab 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -1092,14 +1092,14 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf if (get_selected_object_type(w) == OBJECT_TYPE_RIDE) { stringId = get_ride_type_string_id(listItem->repositoryItem); - gfx_draw_string_right(dpi, stringId, nullptr, COLOUR_WHITE, w->windowPos.x + w->width - 5, y); + gfx_draw_string_right(dpi, stringId, nullptr, COLOUR_WHITE, { w->windowPos.x + w->width - 5, y }); } y += 12; // Draw object source stringId = object_manager_get_source_game_string(listItem->repositoryItem->GetFirstSourceGame()); - gfx_draw_string_right(dpi, stringId, nullptr, COLOUR_WHITE, w->windowPos.x + w->width - 5, y); + gfx_draw_string_right(dpi, stringId, nullptr, COLOUR_WHITE, { w->windowPos.x + w->width - 5, y }); y += 12; // Draw object dat name @@ -1107,7 +1107,8 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf ft = Formatter::Common(); ft.Add(STR_STRING); ft.Add(path); - gfx_draw_string_right(dpi, STR_WINDOW_COLOUR_2_STRINGID, gCommonFormatArgs, COLOUR_BLACK, w->windowPos.x + w->width - 5, y); + gfx_draw_string_right( + dpi, STR_WINDOW_COLOUR_2_STRINGID, gCommonFormatArgs, COLOUR_BLACK, { w->windowPos.x + w->width - 5, y }); } /** diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index 9d8d99eac5..ff99d76a23 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -887,7 +887,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)) { money32 axisValue = axisBase << yAxisScale; - gfx_draw_string_right(dpi, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, &axisValue, COLOUR_BLACK, x + 70, y); + gfx_draw_string_right(dpi, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, &axisValue, COLOUR_BLACK, { x + 70, y }); gfx_fill_rect_inset(dpi, x + 70, y + 5, graphLeft + 482, y + 5, w->colours[2], INSET_RECT_FLAG_BORDER_INSET); y += 39; } @@ -990,7 +990,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)) { money32 axisValue = axisBase << yAxisScale; - gfx_draw_string_right(dpi, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, &axisValue, COLOUR_BLACK, x + 70, y); + gfx_draw_string_right(dpi, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, &axisValue, COLOUR_BLACK, { x + 70, y }); gfx_fill_rect_inset(dpi, x + 70, y + 5, graphLeft + 482, y + 5, w->colours[2], INSET_RECT_FLAG_BORDER_INSET); y += 39; } @@ -1094,7 +1094,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)) { money32 axisValue = axisBase << yAxisScale; - gfx_draw_string_right(dpi, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, &axisValue, COLOUR_BLACK, x + 70, y); + gfx_draw_string_right(dpi, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, &axisValue, COLOUR_BLACK, { x + 70, y }); gfx_fill_rect_inset(dpi, x + 70, y + 5, graphLeft + 482, y + 5, w->colours[2], INSET_RECT_FLAG_BORDER_INSET); y += 39; } diff --git a/src/openrct2-ui/windows/GuestList.cpp b/src/openrct2-ui/windows/GuestList.cpp index bb3b4a9370..600f93c045 100644 --- a/src/openrct2-ui/windows/GuestList.cpp +++ b/src/openrct2-ui/windows/GuestList.cpp @@ -852,7 +852,7 @@ static void window_guest_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, auto ft = Formatter::Common(); ft.Add(STR_GUESTS_COUNT_COMMA_SEP); ft.Add(numGuests); - gfx_draw_string_right(dpi, format, gCommonFormatArgs, COLOUR_BLACK, 326, y); + gfx_draw_string_right(dpi, format, gCommonFormatArgs, COLOUR_BLACK, { 326, y }); } y += SUMMARISED_GUEST_ROW_HEIGHT; } diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index 306efc52c6..b63996b9d9 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -1027,7 +1027,7 @@ static void window_new_ride_paint_ride_information( if (!ride_type_has_flag(item.Type, RIDE_TYPE_FLAG_HAS_NO_TRACK)) stringId = STR_NEW_RIDE_COST_FROM; - gfx_draw_string_right(dpi, stringId, &price, COLOUR_BLACK, x + width, y + 51); + gfx_draw_string_right(dpi, stringId, &price, COLOUR_BLACK, { x + width, y + 51 }); } } diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index 584a7be5c5..106a7986ab 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -1064,7 +1064,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; - gfx_draw_string_right(dpi, STR_GRAPH_AXIS_LABEL, &axisValue, COLOUR_BLACK, x + 10, y); + gfx_draw_string_right(dpi, STR_GRAPH_AXIS_LABEL, &axisValue, COLOUR_BLACK, { x + 10, y }); gfx_fill_rect_inset(dpi, x + 15, y + 5, x + w->width - 32, y + 5, w->colours[2], INSET_RECT_FLAG_BORDER_INSET); y += 20; } @@ -1195,7 +1195,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; - gfx_draw_string_right(dpi, STR_GRAPH_AXIS_LABEL, &axisValue, COLOUR_BLACK, x + 10, y); + gfx_draw_string_right(dpi, STR_GRAPH_AXIS_LABEL, &axisValue, COLOUR_BLACK, { x + 10, y }); gfx_fill_rect_inset(dpi, x + 15, y + 5, x + w->width - 32, y + 5, w->colours[2], INSET_RECT_FLAG_BORDER_INSET); y += 20; } diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 14e31e2688..acc9f0cd0d 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -1180,8 +1180,8 @@ void window_scenery_paint(rct_window* w, rct_drawpixelinfo* dpi) // -14 gfx_draw_string_right( - dpi, STR_COST_LABEL, gCommonFormatArgs, COLOUR_BLACK, w->windowPos.x + w->width - 0x1A, - w->windowPos.y + w->height - 13); + dpi, STR_COST_LABEL, gCommonFormatArgs, COLOUR_BLACK, + { w->windowPos.x + w->width - 0x1A, w->windowPos.y + w->height - 13 }); } auto ft = Formatter::Common(); diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index 25af0dd947..9c7a200852 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -1790,8 +1790,10 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi) if (windowTileInspectorTileSelected) { auto tileCoords = TileCoordsXY{ windowTileInspectorToolMap }; - gfx_draw_string_right(dpi, STR_FORMAT_INTEGER, &tileCoords.x, COLOUR_WHITE, w->windowPos.x + 43, w->windowPos.y + 24); - gfx_draw_string_right(dpi, STR_FORMAT_INTEGER, &tileCoords.y, COLOUR_WHITE, w->windowPos.x + 113, w->windowPos.y + 24); + gfx_draw_string_right( + dpi, STR_FORMAT_INTEGER, &tileCoords.x, COLOUR_WHITE, { w->windowPos.x + 43, w->windowPos.y + 24 }); + gfx_draw_string_right( + dpi, STR_FORMAT_INTEGER, &tileCoords.y, COLOUR_WHITE, { w->windowPos.x + 113, w->windowPos.y + 24 }); } else { diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 0eab43fa49..34bf72c966 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -892,7 +892,8 @@ static void window_top_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi) if (gCheatsDisableClearanceChecks) { gfx_draw_string_right( - dpi, STR_OVERLAY_CLEARANCE_CHECKS_DISABLED, nullptr, COLOUR_DARK_ORANGE | COLOUR_FLAG_OUTLINE, x + 26, y + 2); + dpi, STR_OVERLAY_CLEARANCE_CHECKS_DISABLED, nullptr, COLOUR_DARK_ORANGE | COLOUR_FLAG_OUTLINE, + { x + 26, y + 2 }); } } @@ -966,7 +967,7 @@ static void window_top_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi) // Draw number of players. int32_t player_count = network_get_num_players(); gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM; - gfx_draw_string_right(dpi, STR_COMMA16, &player_count, COLOUR_WHITE | COLOUR_FLAG_OUTLINE, x + 23, y + 1); + gfx_draw_string_right(dpi, STR_COMMA16, &player_count, COLOUR_WHITE | COLOUR_FLAG_OUTLINE, { x + 23, y + 1 }); } } diff --git a/src/openrct2/drawing/Drawing.h b/src/openrct2/drawing/Drawing.h index 5fb477218c..21ae6cefdf 100644 --- a/src/openrct2/drawing/Drawing.h +++ b/src/openrct2/drawing/Drawing.h @@ -648,7 +648,6 @@ void gfx_draw_string_centred( rct_drawpixelinfo* dpi, rct_string_id format, const ScreenCoordsXY& coords, uint8_t colour, const void* args); void gfx_draw_string_right( rct_drawpixelinfo* dpi, rct_string_id format, void* args, uint8_t colour, const ScreenCoordsXY& coords); -void gfx_draw_string_right(rct_drawpixelinfo* dpi, rct_string_id format, void* args, uint8_t colour, int32_t x, int32_t y); void draw_string_left_underline( rct_drawpixelinfo* dpi, rct_string_id format, void* args, uint8_t colour, const ScreenCoordsXY& coords); diff --git a/src/openrct2/drawing/Text.cpp b/src/openrct2/drawing/Text.cpp index 44f72f3f66..5a8dc24d3d 100644 --- a/src/openrct2/drawing/Text.cpp +++ b/src/openrct2/drawing/Text.cpp @@ -162,11 +162,6 @@ void gfx_draw_string_centred( DrawTextCompat(dpi, coords.x, coords.y, format, args, colour, TextAlignment::CENTRE); } -void gfx_draw_string_right(rct_drawpixelinfo* dpi, rct_string_id format, void* args, uint8_t colour, int32_t x, int32_t y) -{ - gfx_draw_string_right(dpi, format, args, colour, { x, y }); -} - void gfx_draw_string_right( rct_drawpixelinfo* dpi, rct_string_id format, void* args, uint8_t colour, const ScreenCoordsXY& coords) {