forked from rosebudai/OpenRCT2-Web
* Fix #11570 - create gfx_draw_string_centered() overload I created the overload, updated all calls from the old function to the new and deleted the old one
This commit is contained in:
1 parent
e87343f9c6
commit
277080de74
20 files changed
+171
-161
No files matched your search
@@ -15,13 +15,12 @@
|
||||
static void graph_draw_months_uint8_t(
|
||||
rct_drawpixelinfo* dpi, const uint8_t* history, int32_t count, int32_t baseX, int32_t baseY)
|
||||
{
|
||||
int32_t i, x, y, yearOver32, currentMonth, currentDay;
|
||||
int32_t i, yearOver32, currentMonth, currentDay;
|
||||
|
||||
currentMonth = date_get_month(gDateMonthsElapsed);
|
||||
currentDay = gDateMonthTicks;
|
||||
yearOver32 = (currentMonth * 4) + (currentDay >> 14) - 31;
|
||||
x = baseX;
|
||||
y = baseY;
|
||||
auto screenCoords = ScreenCoordsXY{ baseX, baseY };
|
||||
for (i = count - 1; i >= 0; i--)
|
||||
{
|
||||
if (history[i] != 255 && yearOver32 % 4 == 0)
|
||||
@@ -29,14 +28,15 @@ static void graph_draw_months_uint8_t(
|
||||
// Draw month text
|
||||
auto ft = Formatter::Common();
|
||||
ft.Add<uint32_t>(DateGameShortMonthNames[date_get_month((yearOver32 / 4) + MONTH_COUNT)]);
|
||||
gfx_draw_string_centred(dpi, STR_GRAPH_LABEL, x, y - 10, COLOUR_BLACK, gCommonFormatArgs);
|
||||
gfx_draw_string_centred(
|
||||
dpi, STR_GRAPH_LABEL, screenCoords - ScreenCoordsXY{ 0, 10 }, COLOUR_BLACK, gCommonFormatArgs);
|
||||
|
||||
// Draw month mark
|
||||
gfx_fill_rect(dpi, x, y, x, y + 3, PALETTE_INDEX_10);
|
||||
gfx_fill_rect(dpi, screenCoords.x, screenCoords.y, screenCoords.x, screenCoords.y + 3, PALETTE_INDEX_10);
|
||||
}
|
||||
|
||||
yearOver32 = (yearOver32 + 1) % 32;
|
||||
x += 6;
|
||||
screenCoords.x += 6;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,27 +104,26 @@ void graph_draw_uint8_t(rct_drawpixelinfo* dpi, uint8_t* history, int32_t count,
|
||||
static void graph_draw_months_money32(
|
||||
rct_drawpixelinfo* dpi, const money32* history, int32_t count, int32_t baseX, int32_t baseY)
|
||||
{
|
||||
int32_t i, x, y, yearOver32, currentMonth, currentDay;
|
||||
int32_t i, yearOver32, currentMonth, currentDay;
|
||||
|
||||
currentMonth = date_get_month(gDateMonthsElapsed);
|
||||
currentDay = gDateMonthTicks;
|
||||
yearOver32 = (currentMonth * 4) + (currentDay >> 14) - 31;
|
||||
x = baseX;
|
||||
y = baseY;
|
||||
auto screenCoords = ScreenCoordsXY{ baseX, baseY };
|
||||
for (i = count - 1; i >= 0; i--)
|
||||
{
|
||||
if (history[i] != MONEY32_UNDEFINED && yearOver32 % 4 == 0)
|
||||
{
|
||||
// Draw month text
|
||||
int32_t monthFormat = DateGameShortMonthNames[date_get_month((yearOver32 / 4) + MONTH_COUNT)];
|
||||
gfx_draw_string_centred(dpi, STR_GRAPH_LABEL, x, y - 10, COLOUR_BLACK, &monthFormat);
|
||||
gfx_draw_string_centred(dpi, STR_GRAPH_LABEL, screenCoords - ScreenCoordsXY{ 0, 10 }, COLOUR_BLACK, &monthFormat);
|
||||
|
||||
// Draw month mark
|
||||
gfx_fill_rect(dpi, x, y, x, y + 3, PALETTE_INDEX_10);
|
||||
gfx_fill_rect(dpi, screenCoords.x, screenCoords.y, screenCoords.x, screenCoords.y + 3, PALETTE_INDEX_10);
|
||||
}
|
||||
|
||||
yearOver32 = (yearOver32 + 1) % 32;
|
||||
x += 6;
|
||||
screenCoords.x += 6;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +293,7 @@ static void graph_draw_hovered_value(
|
||||
}
|
||||
|
||||
gfx_draw_string_centred(
|
||||
dpi, STR_FINANCES_SUMMARY_EXPENDITURE_VALUE, info.coords.x, info.coords.y - 16, COLOUR_BLACK, &info.money);
|
||||
dpi, STR_FINANCES_SUMMARY_EXPENDITURE_VALUE, info.coords - ScreenCoordsXY{ 0, 16 }, COLOUR_BLACK, &info.money);
|
||||
|
||||
gfx_fill_rect(dpi, info.coords.x - 2, info.coords.y - 2, info.coords.x + 2, info.coords.y + 2, PALETTE_INDEX_10);
|
||||
gfx_fill_rect(dpi, info.coords.x - 1, info.coords.y - 1, info.coords.x + 1, info.coords.y + 1, PALETTE_INDEX_21);
|
||||
|
||||
@@ -292,35 +292,34 @@ static void window_about_rct2_mouseup(rct_window* w, rct_widgetindex widgetIndex
|
||||
*/
|
||||
static void window_about_rct2_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
int32_t x, y, yPage;
|
||||
int32_t yPage;
|
||||
|
||||
window_about_openrct2_common_paint(w, dpi);
|
||||
|
||||
yPage = w->windowPos.y + w->widgets[WIDX_PAGE_BACKGROUND].top + 5;
|
||||
|
||||
x = w->windowPos.x + 200;
|
||||
y = yPage + 5;
|
||||
auto screenCoords = ScreenCoordsXY{ w->windowPos.x + 200, yPage + 5 };
|
||||
|
||||
int32_t lineHeight = font_get_line_height(gCurrentFontSpriteBase);
|
||||
|
||||
// Credits
|
||||
gfx_draw_string_centred(dpi, STR_COPYRIGHT_CS, x, y, COLOUR_BLACK, nullptr);
|
||||
y += lineHeight + 74;
|
||||
gfx_draw_string_centred(dpi, STR_DESIGNED_AND_PROGRAMMED_BY_CS, x, y, COLOUR_BLACK, nullptr);
|
||||
y += lineHeight;
|
||||
gfx_draw_string_centred(dpi, STR_GRAPHICS_BY_SF, x, y, COLOUR_BLACK, nullptr);
|
||||
y += lineHeight;
|
||||
gfx_draw_string_centred(dpi, STR_SOUND_AND_MUSIC_BY_AB, x, y, COLOUR_BLACK, nullptr);
|
||||
y += lineHeight;
|
||||
gfx_draw_string_centred(dpi, STR_ADDITIONAL_SOUNDS_RECORDED_BY_DE, x, y, COLOUR_BLACK, nullptr);
|
||||
y += lineHeight + 3;
|
||||
gfx_draw_string_centred(dpi, STR_REPRESENTATION_BY_JL, x, y, COLOUR_BLACK, nullptr);
|
||||
y += 2 * lineHeight + 5;
|
||||
gfx_draw_string_centred(dpi, STR_THANKS_TO, x, y, COLOUR_BLACK, nullptr);
|
||||
y += lineHeight;
|
||||
gfx_draw_string_centred(dpi, STR_THANKS_TO_PEOPLE, x, y, COLOUR_BLACK, nullptr);
|
||||
y += 2 * lineHeight + 5;
|
||||
gfx_draw_string_centred(dpi, STR_LICENSED_TO_INFOGRAMES_INTERACTIVE_INC, x, y, COLOUR_BLACK, nullptr);
|
||||
gfx_draw_string_centred(dpi, STR_COPYRIGHT_CS, screenCoords, COLOUR_BLACK, nullptr);
|
||||
screenCoords.y += lineHeight + 74;
|
||||
gfx_draw_string_centred(dpi, STR_DESIGNED_AND_PROGRAMMED_BY_CS, screenCoords, COLOUR_BLACK, nullptr);
|
||||
screenCoords.y += lineHeight;
|
||||
gfx_draw_string_centred(dpi, STR_GRAPHICS_BY_SF, screenCoords, COLOUR_BLACK, nullptr);
|
||||
screenCoords.y += lineHeight;
|
||||
gfx_draw_string_centred(dpi, STR_SOUND_AND_MUSIC_BY_AB, screenCoords, COLOUR_BLACK, nullptr);
|
||||
screenCoords.y += lineHeight;
|
||||
gfx_draw_string_centred(dpi, STR_ADDITIONAL_SOUNDS_RECORDED_BY_DE, screenCoords, COLOUR_BLACK, nullptr);
|
||||
screenCoords.y += lineHeight + 3;
|
||||
gfx_draw_string_centred(dpi, STR_REPRESENTATION_BY_JL, screenCoords, COLOUR_BLACK, nullptr);
|
||||
screenCoords.y += 2 * lineHeight + 5;
|
||||
gfx_draw_string_centred(dpi, STR_THANKS_TO, screenCoords, COLOUR_BLACK, nullptr);
|
||||
screenCoords.y += lineHeight;
|
||||
gfx_draw_string_centred(dpi, STR_THANKS_TO_PEOPLE, screenCoords, COLOUR_BLACK, nullptr);
|
||||
screenCoords.y += 2 * lineHeight + 5;
|
||||
gfx_draw_string_centred(dpi, STR_LICENSED_TO_INFOGRAMES_INTERACTIVE_INC, screenCoords, COLOUR_BLACK, nullptr);
|
||||
|
||||
// Images
|
||||
gfx_draw_sprite(dpi, SPR_CREDITS_CHRIS_SAWYER_SMALL, w->windowPos.x + 92, yPage + 24, 0);
|
||||
|
||||
@@ -235,26 +235,28 @@ static void window_clear_scenery_invalidate(rct_window* w)
|
||||
*/
|
||||
static void window_clear_scenery_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
int32_t x, y;
|
||||
|
||||
window_draw_widgets(w, dpi);
|
||||
|
||||
// Draw number for tool sizes bigger than 7
|
||||
x = w->windowPos.x
|
||||
+ (window_clear_scenery_widgets[WIDX_PREVIEW].left + window_clear_scenery_widgets[WIDX_PREVIEW].right) / 2;
|
||||
y = w->windowPos.y
|
||||
+ (window_clear_scenery_widgets[WIDX_PREVIEW].top + window_clear_scenery_widgets[WIDX_PREVIEW].bottom) / 2;
|
||||
ScreenCoordsXY screenCoords = {
|
||||
w->windowPos.x
|
||||
+ (window_clear_scenery_widgets[WIDX_PREVIEW].left + window_clear_scenery_widgets[WIDX_PREVIEW].right) / 2,
|
||||
w->windowPos.y
|
||||
+ (window_clear_scenery_widgets[WIDX_PREVIEW].top + window_clear_scenery_widgets[WIDX_PREVIEW].bottom) / 2
|
||||
};
|
||||
if (gLandToolSize > MAX_TOOL_SIZE_WITH_SPRITE)
|
||||
{
|
||||
gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, COLOUR_BLACK, &gLandToolSize);
|
||||
gfx_draw_string_centred(
|
||||
dpi, STR_LAND_TOOL_SIZE_VALUE, screenCoords - ScreenCoordsXY{ 0, 2 }, COLOUR_BLACK, &gLandToolSize);
|
||||
}
|
||||
|
||||
// Draw cost amount
|
||||
if (gClearSceneryCost != MONEY32_UNDEFINED && gClearSceneryCost != 0 && !(gParkFlags & PARK_FLAGS_NO_MONEY))
|
||||
{
|
||||
x = (window_clear_scenery_widgets[WIDX_PREVIEW].left + window_clear_scenery_widgets[WIDX_PREVIEW].right) / 2
|
||||
screenCoords.x = (window_clear_scenery_widgets[WIDX_PREVIEW].left + window_clear_scenery_widgets[WIDX_PREVIEW].right)
|
||||
/ 2
|
||||
+ w->windowPos.x;
|
||||
y = window_clear_scenery_widgets[WIDX_PREVIEW].bottom + w->windowPos.y + 5 + 27;
|
||||
gfx_draw_string_centred(dpi, STR_COST_AMOUNT, x, y, COLOUR_BLACK, &gClearSceneryCost);
|
||||
screenCoords.y = window_clear_scenery_widgets[WIDX_PREVIEW].bottom + w->windowPos.y + 5 + 27;
|
||||
gfx_draw_string_centred(dpi, STR_COST_AMOUNT, screenCoords, COLOUR_BLACK, &gClearSceneryCost);
|
||||
}
|
||||
}
|
||||
@@ -459,7 +459,7 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
+ w->windowPos.x;
|
||||
int16_t stateY = w->height - 0x0C + w->windowPos.y;
|
||||
gfx_draw_string_centred(
|
||||
dpi, EditorStepNames[gS6Info.editor_step], stateX, stateY, NOT_TRANSLUCENT(w->colours[2]) | COLOUR_FLAG_OUTLINE,
|
||||
dpi, EditorStepNames[gS6Info.editor_step], { stateX, stateY }, NOT_TRANSLUCENT(w->colours[2]) | COLOUR_FLAG_OUTLINE,
|
||||
nullptr);
|
||||
|
||||
if (drawPreviousButton)
|
||||
@@ -485,8 +485,8 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
|
||||
stringId = STR_EDITOR_STEP_OBJECT_SELECTION;
|
||||
|
||||
gfx_draw_string_centred(dpi, STR_BACK_TO_PREVIOUS_STEP, textX, textY, textColour, nullptr);
|
||||
gfx_draw_string_centred(dpi, stringId, textX, textY + 10, textColour, nullptr);
|
||||
gfx_draw_string_centred(dpi, STR_BACK_TO_PREVIOUS_STEP, { textX, textY }, textColour, nullptr);
|
||||
gfx_draw_string_centred(dpi, stringId, { textX, textY + 10 }, textColour, nullptr);
|
||||
}
|
||||
|
||||
if ((drawPreviousButton || drawNextButton) && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER)
|
||||
@@ -512,8 +512,8 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
|
||||
stringId = STR_EDITOR_STEP_ROLLERCOASTER_DESIGNER;
|
||||
|
||||
gfx_draw_string_centred(dpi, STR_FORWARD_TO_NEXT_STEP, textX, textY, textColour, nullptr);
|
||||
gfx_draw_string_centred(dpi, stringId, textX, textY + 10, textColour, nullptr);
|
||||
gfx_draw_string_centred(dpi, STR_FORWARD_TO_NEXT_STEP, { textX, textY }, textColour, nullptr);
|
||||
gfx_draw_string_centred(dpi, stringId, { textX, textY + 10 }, textColour, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -596,6 +596,7 @@ static void window_footpath_invalidate(rct_window* w)
|
||||
*/
|
||||
static void window_footpath_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
ScreenCoordsXY screenCoords;
|
||||
window_draw_widgets(w, dpi);
|
||||
|
||||
if (!(w->disabled_widgets & (1 << WIDX_CONSTRUCT)))
|
||||
@@ -618,26 +619,29 @@ static void window_footpath_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
image += pathType->image;
|
||||
|
||||
// Draw construction image
|
||||
int32_t x = w->windowPos.x
|
||||
+ (window_footpath_widgets[WIDX_CONSTRUCT].left + window_footpath_widgets[WIDX_CONSTRUCT].right) / 2;
|
||||
int32_t y = w->windowPos.y + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 60;
|
||||
gfx_draw_sprite(dpi, image, x, y, 0);
|
||||
screenCoords = {
|
||||
w->windowPos.x + (window_footpath_widgets[WIDX_CONSTRUCT].left + window_footpath_widgets[WIDX_CONSTRUCT].right) / 2,
|
||||
w->windowPos.y + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 60
|
||||
};
|
||||
gfx_draw_sprite(dpi, image, screenCoords.x, screenCoords.y, 0);
|
||||
|
||||
// Draw build this... label
|
||||
x = w->windowPos.x + (window_footpath_widgets[WIDX_CONSTRUCT].left + window_footpath_widgets[WIDX_CONSTRUCT].right) / 2;
|
||||
y = w->windowPos.y + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 23;
|
||||
gfx_draw_string_centred(dpi, STR_BUILD_THIS, x, y, COLOUR_BLACK, nullptr);
|
||||
screenCoords = {
|
||||
w->windowPos.x + (window_footpath_widgets[WIDX_CONSTRUCT].left + window_footpath_widgets[WIDX_CONSTRUCT].right) / 2,
|
||||
w->windowPos.y + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 23
|
||||
};
|
||||
gfx_draw_string_centred(dpi, STR_BUILD_THIS, screenCoords, COLOUR_BLACK, nullptr);
|
||||
}
|
||||
|
||||
// Draw cost
|
||||
int32_t x = w->windowPos.x
|
||||
screenCoords.x = w->windowPos.x
|
||||
+ (window_footpath_widgets[WIDX_CONSTRUCT].left + window_footpath_widgets[WIDX_CONSTRUCT].right) / 2;
|
||||
int32_t y = w->windowPos.y + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 12;
|
||||
screenCoords.y = w->windowPos.y + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 12;
|
||||
if (_window_footpath_cost != MONEY32_UNDEFINED)
|
||||
{
|
||||
if (!(gParkFlags & PARK_FLAGS_NO_MONEY))
|
||||
{
|
||||
gfx_draw_string_centred(dpi, STR_COST_LABEL, x, y, COLOUR_BLACK, &_window_footpath_cost);
|
||||
gfx_draw_string_centred(dpi, STR_COST_LABEL, screenCoords, COLOUR_BLACK, &_window_footpath_cost);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,13 +422,13 @@ static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo* dpi, r
|
||||
if (!(gParkFlags & PARK_FLAGS_NO_MONEY))
|
||||
{
|
||||
rct_widget widget = window_game_bottom_toolbar_widgets[WIDX_MONEY];
|
||||
int32_t x = w->windowPos.x + (widget.left + widget.right) / 2;
|
||||
int32_t y = w->windowPos.y + (widget.top + widget.bottom) / 2 - (line_height == 10 ? 5 : 6);
|
||||
auto screenCoords = ScreenCoordsXY{ w->windowPos.x + (widget.left + widget.right) / 2,
|
||||
w->windowPos.y + (widget.top + widget.bottom) / 2 - (line_height == 10 ? 5 : 6) };
|
||||
|
||||
auto ft = Formatter::Common();
|
||||
ft.Add<money32>(gCash);
|
||||
gfx_draw_string_centred(
|
||||
dpi, (gCash < 0 ? STR_BOTTOM_TOOLBAR_CASH_NEGATIVE : STR_BOTTOM_TOOLBAR_CASH), x, y,
|
||||
dpi, (gCash < 0 ? STR_BOTTOM_TOOLBAR_CASH_NEGATIVE : STR_BOTTOM_TOOLBAR_CASH), screenCoords,
|
||||
(gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_MONEY
|
||||
? COLOUR_WHITE
|
||||
: NOT_TRANSLUCENT(w->colours[0])),
|
||||
@@ -450,13 +450,13 @@ static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo* dpi, r
|
||||
// Draw guests
|
||||
{
|
||||
rct_widget widget = window_game_bottom_toolbar_widgets[WIDX_GUESTS];
|
||||
int32_t x = w->windowPos.x + (widget.left + widget.right) / 2;
|
||||
int32_t y = w->windowPos.y + (widget.top + widget.bottom) / 2 - 6;
|
||||
auto screenCoords = ScreenCoordsXY{ w->windowPos.x + (widget.left + widget.right) / 2,
|
||||
w->windowPos.y + (widget.top + widget.bottom) / 2 - 6 };
|
||||
|
||||
gfx_draw_string_centred(
|
||||
dpi,
|
||||
gNumGuestsInPark == 1 ? guestCountFormatsSingular[gGuestChangeModifier] : guestCountFormats[gGuestChangeModifier],
|
||||
x, y,
|
||||
screenCoords,
|
||||
(gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_GUESTS
|
||||
? COLOUR_WHITE
|
||||
: NOT_TRANSLUCENT(w->colours[0])),
|
||||
@@ -504,11 +504,11 @@ static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo* dpi,
|
||||
w->windowPos.x + window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].right - 1,
|
||||
w->windowPos.y + window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].bottom - 1, w->colours[1], INSET_RECT_F_30);
|
||||
|
||||
int32_t x = (window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left
|
||||
+ window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].right)
|
||||
/ 2
|
||||
+ w->windowPos.x;
|
||||
int32_t y = window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].top + w->windowPos.y + 2;
|
||||
auto screenCoords = ScreenCoordsXY{ (window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left
|
||||
+ window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].right)
|
||||
/ 2
|
||||
+ w->windowPos.x,
|
||||
window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].top + w->windowPos.y + 2 };
|
||||
|
||||
// Date
|
||||
int32_t year = date_get_year(gDateMonthsElapsed) + 1;
|
||||
@@ -521,7 +521,7 @@ static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo* dpi,
|
||||
ft.Add<int16_t>(month);
|
||||
ft.Add<int16_t>(year);
|
||||
gfx_draw_string_centred(
|
||||
dpi, stringId, x, y,
|
||||
dpi, stringId, screenCoords,
|
||||
(gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_DATE
|
||||
? COLOUR_WHITE
|
||||
: NOT_TRANSLUCENT(w->colours[0])),
|
||||
@@ -531,8 +531,8 @@ static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo* dpi,
|
||||
uint32_t line_height = font_get_line_height(FONT_SPRITE_BASE_MEDIUM);
|
||||
|
||||
// Temperature
|
||||
x = w->windowPos.x + window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left + 15;
|
||||
y += line_height + 1;
|
||||
screenCoords = { w->windowPos.x + window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left + 15,
|
||||
static_cast<int32_t>(screenCoords.y + line_height + 1) };
|
||||
|
||||
int32_t temperature = gClimateCurrent.Temperature;
|
||||
rct_string_id format = STR_CELSIUS_VALUE;
|
||||
@@ -543,12 +543,12 @@ static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo* dpi,
|
||||
}
|
||||
ft = Formatter::Common();
|
||||
ft.Add<int16_t>(temperature);
|
||||
gfx_draw_string_left(dpi, format, gCommonFormatArgs, COLOUR_BLACK, x, y + 6);
|
||||
x += 30;
|
||||
gfx_draw_string_left(dpi, format, gCommonFormatArgs, COLOUR_BLACK, screenCoords.x, screenCoords.y + 6);
|
||||
screenCoords.x += 30;
|
||||
|
||||
// Current weather
|
||||
auto currentWeatherSpriteId = climate_get_weather_sprite_id(gClimateCurrent);
|
||||
gfx_draw_sprite(dpi, currentWeatherSpriteId, x, y, 0);
|
||||
gfx_draw_sprite(dpi, currentWeatherSpriteId, screenCoords.x, screenCoords.y, 0);
|
||||
|
||||
// Next weather
|
||||
auto nextWeatherSpriteId = climate_get_weather_sprite_id(gClimateNext);
|
||||
@@ -556,8 +556,8 @@ static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo* dpi,
|
||||
{
|
||||
if (gClimateUpdateTimer < 960)
|
||||
{
|
||||
gfx_draw_sprite(dpi, SPR_NEXT_WEATHER, x + 27, y + 5, 0);
|
||||
gfx_draw_sprite(dpi, nextWeatherSpriteId, x + 40, y, 0);
|
||||
gfx_draw_sprite(dpi, SPR_NEXT_WEATHER, screenCoords.x + 27, screenCoords.y + 5, 0);
|
||||
gfx_draw_sprite(dpi, nextWeatherSpriteId, screenCoords.x + 40, screenCoords.y, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,7 +339,8 @@ static void window_land_invalidate(rct_window* w)
|
||||
*/
|
||||
static void window_land_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
int32_t x, y, numTiles;
|
||||
ScreenCoordsXY screenCoords;
|
||||
int32_t numTiles;
|
||||
money32 price;
|
||||
rct_widget* previewWidget = &window_land_widgets[WIDX_PREVIEW];
|
||||
|
||||
@@ -348,34 +349,34 @@ static void window_land_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
// Draw number for tool sizes bigger than 7
|
||||
if (gLandToolSize > MAX_TOOL_SIZE_WITH_SPRITE)
|
||||
{
|
||||
x = w->windowPos.x + (previewWidget->left + previewWidget->right) / 2;
|
||||
y = w->windowPos.y + (previewWidget->top + previewWidget->bottom) / 2;
|
||||
gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, COLOUR_BLACK, &gLandToolSize);
|
||||
screenCoords = { w->windowPos.x + (previewWidget->left + previewWidget->right) / 2,
|
||||
w->windowPos.y + (previewWidget->top + previewWidget->bottom) / 2 };
|
||||
gfx_draw_string_centred(
|
||||
dpi, STR_LAND_TOOL_SIZE_VALUE, screenCoords - ScreenCoordsXY{ 0, 2 }, COLOUR_BLACK, &gLandToolSize);
|
||||
}
|
||||
else if (gLandMountainMode)
|
||||
{
|
||||
x = w->windowPos.x + previewWidget->left;
|
||||
y = w->windowPos.y + previewWidget->top;
|
||||
screenCoords = { w->windowPos.x + previewWidget->left, w->windowPos.y + previewWidget->top };
|
||||
int32_t sprite = gLandToolSize % 2 == 0 ? SPR_G2_MOUNTAIN_TOOL_EVEN : SPR_G2_MOUNTAIN_TOOL_ODD;
|
||||
gfx_draw_sprite(dpi, sprite, x, y, 0);
|
||||
gfx_draw_sprite(dpi, sprite, screenCoords.x, screenCoords.y, 0);
|
||||
widget_draw(dpi, w, WIDX_DECREMENT);
|
||||
widget_draw(dpi, w, WIDX_INCREMENT);
|
||||
}
|
||||
|
||||
x = w->windowPos.x + (previewWidget->left + previewWidget->right) / 2;
|
||||
y = w->windowPos.y + previewWidget->bottom + 5;
|
||||
screenCoords = { w->windowPos.x + (previewWidget->left + previewWidget->right) / 2,
|
||||
w->windowPos.y + previewWidget->bottom + 5 };
|
||||
|
||||
if (!(gParkFlags & PARK_FLAGS_NO_MONEY))
|
||||
{
|
||||
// Draw raise cost amount
|
||||
if (gLandToolRaiseCost != MONEY32_UNDEFINED && gLandToolRaiseCost != 0)
|
||||
gfx_draw_string_centred(dpi, STR_RAISE_COST_AMOUNT, x, y, COLOUR_BLACK, &gLandToolRaiseCost);
|
||||
y += 10;
|
||||
gfx_draw_string_centred(dpi, STR_RAISE_COST_AMOUNT, screenCoords, COLOUR_BLACK, &gLandToolRaiseCost);
|
||||
screenCoords.y += 10;
|
||||
|
||||
// Draw lower cost amount
|
||||
if (gLandToolLowerCost != MONEY32_UNDEFINED && gLandToolLowerCost != 0)
|
||||
gfx_draw_string_centred(dpi, STR_LOWER_COST_AMOUNT, x, y, COLOUR_BLACK, &gLandToolLowerCost);
|
||||
y += 50;
|
||||
gfx_draw_string_centred(dpi, STR_LOWER_COST_AMOUNT, screenCoords, COLOUR_BLACK, &gLandToolLowerCost);
|
||||
screenCoords.y += 50;
|
||||
|
||||
// Draw paint price
|
||||
numTiles = gLandToolSize * gLandToolSize;
|
||||
@@ -398,7 +399,7 @@ static void window_land_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
auto ft = Formatter::Common();
|
||||
ft.Add<money32>(price);
|
||||
gfx_draw_string_centred(dpi, STR_COST_AMOUNT, x, y, COLOUR_BLACK, gCommonFormatArgs);
|
||||
gfx_draw_string_centred(dpi, STR_COST_AMOUNT, screenCoords, COLOUR_BLACK, gCommonFormatArgs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -271,25 +271,26 @@ static void window_land_rights_invalidate(rct_window* w)
|
||||
|
||||
static void window_land_rights_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
int32_t x, y;
|
||||
|
||||
x = w->windowPos.x + (window_land_rights_widgets[WIDX_PREVIEW].left + window_land_rights_widgets[WIDX_PREVIEW].right) / 2;
|
||||
y = w->windowPos.y + (window_land_rights_widgets[WIDX_PREVIEW].top + window_land_rights_widgets[WIDX_PREVIEW].bottom) / 2;
|
||||
auto screenCoords = ScreenCoordsXY{
|
||||
w->windowPos.x + (window_land_rights_widgets[WIDX_PREVIEW].left + window_land_rights_widgets[WIDX_PREVIEW].right) / 2,
|
||||
w->windowPos.y + (window_land_rights_widgets[WIDX_PREVIEW].top + window_land_rights_widgets[WIDX_PREVIEW].bottom) / 2
|
||||
};
|
||||
|
||||
window_draw_widgets(w, dpi);
|
||||
// Draw number for tool sizes bigger than 7
|
||||
if (gLandToolSize > MAX_TOOL_SIZE_WITH_SPRITE)
|
||||
{
|
||||
gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, COLOUR_BLACK, &gLandToolSize);
|
||||
gfx_draw_string_centred(
|
||||
dpi, STR_LAND_TOOL_SIZE_VALUE, screenCoords - ScreenCoordsXY{ 0, 2 }, COLOUR_BLACK, &gLandToolSize);
|
||||
}
|
||||
|
||||
// Draw cost amount
|
||||
if (_landRightsCost != MONEY32_UNDEFINED && _landRightsCost != 0 && !(gParkFlags & PARK_FLAGS_NO_MONEY))
|
||||
{
|
||||
x = (window_land_rights_widgets[WIDX_PREVIEW].left + window_land_rights_widgets[WIDX_PREVIEW].right) / 2
|
||||
+ w->windowPos.x;
|
||||
y = window_land_rights_widgets[WIDX_PREVIEW].bottom + w->windowPos.y + 32;
|
||||
gfx_draw_string_centred(dpi, STR_COST_AMOUNT, x, y, COLOUR_BLACK, &_landRightsCost);
|
||||
screenCoords = { (window_land_rights_widgets[WIDX_PREVIEW].left + window_land_rights_widgets[WIDX_PREVIEW].right) / 2
|
||||
+ w->windowPos.x,
|
||||
window_land_rights_widgets[WIDX_PREVIEW].bottom + w->windowPos.y + 32 };
|
||||
gfx_draw_string_centred(dpi, STR_COST_AMOUNT, screenCoords, COLOUR_BLACK, &_landRightsCost);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -814,24 +814,27 @@ static void window_map_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
window_draw_widgets(w, dpi);
|
||||
window_map_draw_tab_images(w, dpi);
|
||||
|
||||
int32_t x = w->windowPos.x + (window_map_widgets[WIDX_LAND_TOOL].left + window_map_widgets[WIDX_LAND_TOOL].right) / 2;
|
||||
int32_t y = w->windowPos.y + (window_map_widgets[WIDX_LAND_TOOL].top + window_map_widgets[WIDX_LAND_TOOL].bottom) / 2;
|
||||
auto screenCoords = ScreenCoordsXY{
|
||||
w->windowPos.x + (window_map_widgets[WIDX_LAND_TOOL].left + window_map_widgets[WIDX_LAND_TOOL].right) / 2,
|
||||
w->windowPos.y + (window_map_widgets[WIDX_LAND_TOOL].top + window_map_widgets[WIDX_LAND_TOOL].bottom) / 2
|
||||
};
|
||||
|
||||
// Draw land tool size
|
||||
if (widget_is_active_tool(w, WIDX_SET_LAND_RIGHTS) && _landRightsToolSize > MAX_TOOL_SIZE_WITH_SPRITE)
|
||||
{
|
||||
gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, COLOUR_BLACK, &_landRightsToolSize);
|
||||
gfx_draw_string_centred(
|
||||
dpi, STR_LAND_TOOL_SIZE_VALUE, screenCoords - ScreenCoordsXY{ 0, 2 }, COLOUR_BLACK, &_landRightsToolSize);
|
||||
}
|
||||
y = w->windowPos.y + window_map_widgets[WIDX_LAND_TOOL].bottom + 5;
|
||||
screenCoords.y = w->windowPos.y + window_map_widgets[WIDX_LAND_TOOL].bottom + 5;
|
||||
|
||||
// People starting position (scenario editor only)
|
||||
if (w->widgets[WIDX_PEOPLE_STARTING_POSITION].type != WWT_EMPTY)
|
||||
{
|
||||
x = w->windowPos.x + w->widgets[WIDX_PEOPLE_STARTING_POSITION].left + 12;
|
||||
y = w->windowPos.y + w->widgets[WIDX_PEOPLE_STARTING_POSITION].top + 18;
|
||||
screenCoords = { w->windowPos.x + w->widgets[WIDX_PEOPLE_STARTING_POSITION].left + 12,
|
||||
w->windowPos.y + w->widgets[WIDX_PEOPLE_STARTING_POSITION].top + 18 };
|
||||
gfx_draw_sprite(
|
||||
dpi, IMAGE_TYPE_REMAP | IMAGE_TYPE_REMAP_2_PLUS | (COLOUR_LIGHT_BROWN << 24) | (COLOUR_BRIGHT_RED << 19) | SPR_6410,
|
||||
x, y, 0);
|
||||
screenCoords.x, screenCoords.y, 0);
|
||||
}
|
||||
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode)
|
||||
@@ -839,8 +842,7 @@ static void window_map_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
// Render the map legend
|
||||
if (w->selected_tab == PAGE_RIDES)
|
||||
{
|
||||
x = w->windowPos.x + 4;
|
||||
y = w->windowPos.y + w->widgets[WIDX_MAP].bottom + 2;
|
||||
screenCoords = { w->windowPos.x + 4, w->windowPos.y + w->widgets[WIDX_MAP].bottom + 2 };
|
||||
|
||||
static rct_string_id mapLabels[] = {
|
||||
STR_MAP_RIDE, STR_MAP_FOOD_STALL, STR_MAP_DRINK_STALL, STR_MAP_SOUVENIR_STALL,
|
||||
@@ -849,13 +851,14 @@ static void window_map_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
|
||||
for (uint32_t i = 0; i < std::size(RideKeyColours); i++)
|
||||
{
|
||||
gfx_fill_rect(dpi, x, y + 2, x + 6, y + 8, RideKeyColours[i]);
|
||||
gfx_draw_string_left(dpi, mapLabels[i], w, COLOUR_BLACK, x + LIST_ROW_HEIGHT, y);
|
||||
y += LIST_ROW_HEIGHT;
|
||||
gfx_fill_rect(
|
||||
dpi, screenCoords.x, screenCoords.y + 2, screenCoords.x + 6, screenCoords.y + 8, RideKeyColours[i]);
|
||||
gfx_draw_string_left(dpi, mapLabels[i], w, COLOUR_BLACK, screenCoords.x + LIST_ROW_HEIGHT, screenCoords.y);
|
||||
screenCoords.y += LIST_ROW_HEIGHT;
|
||||
if (i == 3)
|
||||
{
|
||||
x += 118;
|
||||
y -= LIST_ROW_HEIGHT * 4;
|
||||
screenCoords.x += 118;
|
||||
screenCoords.y -= LIST_ROW_HEIGHT * 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,28 +183,27 @@ static void window_music_credits_scrollpaint(rct_window* w, rct_drawpixelinfo* d
|
||||
{
|
||||
int32_t lineHeight = font_get_line_height(gCurrentFontSpriteBase);
|
||||
|
||||
int32_t x = 245;
|
||||
int32_t y = 2;
|
||||
auto screenCoords = ScreenCoordsXY{ 245, 2 };
|
||||
|
||||
for (size_t i = 0; i < std::size(music_credits); i++)
|
||||
{
|
||||
gfx_draw_string_centred(dpi, music_credits[i], x, y, COLOUR_BLACK, nullptr);
|
||||
y += lineHeight;
|
||||
gfx_draw_string_centred(dpi, music_credits[i], screenCoords, COLOUR_BLACK, nullptr);
|
||||
screenCoords.y += lineHeight;
|
||||
}
|
||||
|
||||
// Add 4 more space before "Original recordings ...".
|
||||
y += 4;
|
||||
gfx_draw_string_centred(dpi, STR_MUSIC_ACKNOWLEDGEMENTS_ORIGINAL_RECORDINGS, x, y, COLOUR_BLACK, nullptr);
|
||||
y += lineHeight;
|
||||
screenCoords.y += 4;
|
||||
gfx_draw_string_centred(dpi, STR_MUSIC_ACKNOWLEDGEMENTS_ORIGINAL_RECORDINGS, screenCoords, COLOUR_BLACK, nullptr);
|
||||
screenCoords.y += lineHeight;
|
||||
|
||||
// Draw the separator
|
||||
y += 5;
|
||||
gfx_fill_rect_inset(dpi, 4, y, 484, y + 1, w->colours[1], INSET_RECT_FLAG_BORDER_INSET);
|
||||
y += lineHeight + 1;
|
||||
screenCoords.y += 5;
|
||||
gfx_fill_rect_inset(dpi, 4, screenCoords.y, 484, screenCoords.y + 1, w->colours[1], INSET_RECT_FLAG_BORDER_INSET);
|
||||
screenCoords.y += lineHeight + 1;
|
||||
|
||||
for (size_t i = 0; i < std::size(music_credits_rct2); i++)
|
||||
{
|
||||
gfx_draw_string_centred(dpi, music_credits_rct2[i], x, y, COLOUR_BLACK, nullptr);
|
||||
y += lineHeight;
|
||||
gfx_draw_string_centred(dpi, music_credits_rct2[i], screenCoords, COLOUR_BLACK, nullptr);
|
||||
screenCoords.y += lineHeight;
|
||||
}
|
||||
}
|
||||
@@ -2920,8 +2920,9 @@ static void window_ride_main_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
|
||||
widget = &window_ride_main_widgets[WIDX_VIEW];
|
||||
gfx_draw_string_centred(
|
||||
dpi, STR_WINDOW_COLOUR_2_STRINGID, w->windowPos.x + (widget->left + widget->right - 11) / 2,
|
||||
w->windowPos.y + widget->top, COLOUR_BLACK, gCommonFormatArgs);
|
||||
dpi, STR_WINDOW_COLOUR_2_STRINGID,
|
||||
{ w->windowPos.x + (widget->left + widget->right - 11) / 2, w->windowPos.y + widget->top }, COLOUR_BLACK,
|
||||
gCommonFormatArgs);
|
||||
|
||||
// Status
|
||||
widget = &window_ride_main_widgets[WIDX_STATUS];
|
||||
|
||||
@@ -2314,7 +2314,7 @@ static void window_ride_construction_paint(rct_window* w, rct_drawpixelinfo* dpi
|
||||
{
|
||||
rct_drawpixelinfo clipdpi;
|
||||
rct_widget* widget;
|
||||
int32_t x, y, width, height;
|
||||
int32_t width, height;
|
||||
|
||||
window_draw_widgets(w, dpi);
|
||||
|
||||
@@ -2329,26 +2329,24 @@ static void window_ride_construction_paint(rct_window* w, rct_drawpixelinfo* dpi
|
||||
return;
|
||||
|
||||
// Draw track piece
|
||||
x = w->windowPos.x + widget->left + 1;
|
||||
y = w->windowPos.y + widget->top + 1;
|
||||
auto screenCoords = ScreenCoordsXY{ w->windowPos.x + widget->left + 1, w->windowPos.y + widget->top + 1 };
|
||||
width = widget->right - widget->left - 1;
|
||||
height = widget->bottom - widget->top - 1;
|
||||
if (clip_drawpixelinfo(&clipdpi, dpi, x, y, width, height))
|
||||
if (clip_drawpixelinfo(&clipdpi, dpi, screenCoords.x, screenCoords.y, width, height))
|
||||
{
|
||||
window_ride_construction_draw_track_piece(
|
||||
w, &clipdpi, rideIndex, trackType, trackDirection, liftHillAndInvertedState, width, height);
|
||||
}
|
||||
|
||||
// Draw cost
|
||||
x = w->windowPos.x + (widget->left + widget->right) / 2;
|
||||
y = w->windowPos.y + widget->bottom - 23;
|
||||
screenCoords = { w->windowPos.x + (widget->left + widget->right) / 2, w->windowPos.y + widget->bottom - 23 };
|
||||
if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_PLACE)
|
||||
gfx_draw_string_centred(dpi, STR_BUILD_THIS, x, y, COLOUR_BLACK, w);
|
||||
gfx_draw_string_centred(dpi, STR_BUILD_THIS, screenCoords, COLOUR_BLACK, w);
|
||||
|
||||
y += 11;
|
||||
screenCoords.y += 11;
|
||||
if (_currentTrackPrice != MONEY32_UNDEFINED && !(gParkFlags & PARK_FLAGS_NO_MONEY))
|
||||
{
|
||||
gfx_draw_string_centred(dpi, STR_COST_LABEL, x, y, COLOUR_BLACK, static_cast<void*>(&_currentTrackPrice));
|
||||
gfx_draw_string_centred(dpi, STR_COST_LABEL, screenCoords, COLOUR_BLACK, static_cast<void*>(&_currentTrackPrice));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -236,8 +236,9 @@ static void window_scenery_scatter_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
if (gWindowSceneryScatterSize > MAX_TOOL_SIZE_WITH_SPRITE)
|
||||
{
|
||||
auto preview = window_scenery_scatter_widgets[WIDX_PREVIEW];
|
||||
int32_t x = w->windowPos.x + (preview.left + preview.right) / 2;
|
||||
int32_t y = w->windowPos.y + (preview.top + preview.bottom) / 2;
|
||||
gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, COLOUR_BLACK, &gWindowSceneryScatterSize);
|
||||
auto screenCoords = ScreenCoordsXY{ w->windowPos.x + (preview.left + preview.right) / 2,
|
||||
w->windowPos.y + (preview.top + preview.bottom) / 2 };
|
||||
gfx_draw_string_centred(
|
||||
dpi, STR_LAND_TOOL_SIZE_VALUE, screenCoords - ScreenCoordsXY{ 0, 2 }, COLOUR_BLACK, &gWindowSceneryScatterSize);
|
||||
}
|
||||
}
|
||||
@@ -259,7 +259,7 @@ static void window_text_input_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
int32_t font_height = 0;
|
||||
|
||||
gfx_draw_string_centred(
|
||||
dpi, input_text_description, w->windowPos.x + WW / 2, screenCoords.y, w->colours[1], &TextInputDescriptionArgs);
|
||||
dpi, input_text_description, { w->windowPos.x + WW / 2, screenCoords.y }, w->colours[1], &TextInputDescriptionArgs);
|
||||
|
||||
screenCoords.y += 25;
|
||||
|
||||
|
||||
@@ -604,7 +604,7 @@ static void window_scenarioselect_scrollpaint(rct_window* w, rct_drawpixelinfo*
|
||||
{
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM_DARK;
|
||||
}
|
||||
gfx_draw_string_centred(dpi, format, wide ? 270 : 210, y + 1, colour, gCommonFormatArgs);
|
||||
gfx_draw_string_centred(dpi, format, { wide ? 270 : 210, y + 1 }, colour, gCommonFormatArgs);
|
||||
|
||||
// Check if scenario is completed
|
||||
if (isCompleted)
|
||||
@@ -624,7 +624,7 @@ static void window_scenarioselect_scrollpaint(rct_window* w, rct_drawpixelinfo*
|
||||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<char*>(buffer);
|
||||
gfx_draw_string_centred(
|
||||
dpi, format, wide ? 270 : 210, y + scenarioTitleHeight + 1, COLOUR_BLACK, gCommonFormatArgs);
|
||||
dpi, format, { wide ? 270 : 210, y + scenarioTitleHeight + 1 }, COLOUR_BLACK, gCommonFormatArgs);
|
||||
}
|
||||
|
||||
y += scenarioItemHeight;
|
||||
@@ -643,7 +643,7 @@ static void draw_category_heading(
|
||||
|
||||
// Draw string
|
||||
int32_t centreX = (left + right) / 2;
|
||||
gfx_draw_string_centred(dpi, stringId, centreX, y, baseColour, nullptr);
|
||||
gfx_draw_string_centred(dpi, stringId, { centreX, y }, baseColour, nullptr);
|
||||
|
||||
// Get string dimensions
|
||||
utf8* buffer = gCommonStringFormatBuffer;
|
||||
|
||||
@@ -529,7 +529,7 @@ static void window_track_place_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
if (_window_track_place_last_cost != MONEY32_UNDEFINED && !(gParkFlags & PARK_FLAGS_NO_MONEY))
|
||||
{
|
||||
gfx_draw_string_centred(
|
||||
dpi, STR_COST_LABEL, w->windowPos.x + 88, w->windowPos.y + 94, COLOUR_BLACK, &_window_track_place_last_cost);
|
||||
dpi, STR_COST_LABEL, { w->windowPos.x + 88, w->windowPos.y + 94 }, COLOUR_BLACK, &_window_track_place_last_cost);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -211,29 +211,31 @@ static void window_water_invalidate(rct_window* w)
|
||||
*/
|
||||
static void window_water_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
int32_t x, y;
|
||||
|
||||
x = w->windowPos.x + (window_water_widgets[WIDX_PREVIEW].left + window_water_widgets[WIDX_PREVIEW].right) / 2;
|
||||
y = w->windowPos.y + (window_water_widgets[WIDX_PREVIEW].top + window_water_widgets[WIDX_PREVIEW].bottom) / 2;
|
||||
auto screenCoords = ScreenCoordsXY{
|
||||
w->windowPos.x + (window_water_widgets[WIDX_PREVIEW].left + window_water_widgets[WIDX_PREVIEW].right) / 2,
|
||||
w->windowPos.y + (window_water_widgets[WIDX_PREVIEW].top + window_water_widgets[WIDX_PREVIEW].bottom) / 2
|
||||
};
|
||||
|
||||
window_draw_widgets(w, dpi);
|
||||
// Draw number for tool sizes bigger than 7
|
||||
if (gLandToolSize > MAX_TOOL_SIZE_WITH_SPRITE)
|
||||
{
|
||||
gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, COLOUR_BLACK, &gLandToolSize);
|
||||
gfx_draw_string_centred(
|
||||
dpi, STR_LAND_TOOL_SIZE_VALUE, screenCoords - ScreenCoordsXY{ 0, 2 }, COLOUR_BLACK, &gLandToolSize);
|
||||
}
|
||||
|
||||
if (!(gParkFlags & PARK_FLAGS_NO_MONEY))
|
||||
{
|
||||
// Draw raise cost amount
|
||||
x = (window_water_widgets[WIDX_PREVIEW].left + window_water_widgets[WIDX_PREVIEW].right) / 2 + w->windowPos.x;
|
||||
y = window_water_widgets[WIDX_PREVIEW].bottom + w->windowPos.y + 5;
|
||||
screenCoords = { (window_water_widgets[WIDX_PREVIEW].left + window_water_widgets[WIDX_PREVIEW].right) / 2
|
||||
+ w->windowPos.x,
|
||||
window_water_widgets[WIDX_PREVIEW].bottom + w->windowPos.y + 5 };
|
||||
if (gWaterToolRaiseCost != MONEY32_UNDEFINED && gWaterToolRaiseCost != 0)
|
||||
gfx_draw_string_centred(dpi, STR_RAISE_COST_AMOUNT, x, y, COLOUR_BLACK, &gWaterToolRaiseCost);
|
||||
y += 10;
|
||||
gfx_draw_string_centred(dpi, STR_RAISE_COST_AMOUNT, screenCoords, COLOUR_BLACK, &gWaterToolRaiseCost);
|
||||
screenCoords.y += 10;
|
||||
|
||||
// Draw lower cost amount
|
||||
if (gWaterToolLowerCost != MONEY32_UNDEFINED && gWaterToolLowerCost != 0)
|
||||
gfx_draw_string_centred(dpi, STR_LOWER_COST_AMOUNT, x, y, COLOUR_BLACK, &gWaterToolLowerCost);
|
||||
gfx_draw_string_centred(dpi, STR_LOWER_COST_AMOUNT, screenCoords, COLOUR_BLACK, &gWaterToolLowerCost);
|
||||
}
|
||||
}
|
||||
@@ -535,7 +535,7 @@ void gfx_draw_string(rct_drawpixelinfo* dpi, const_utf8string buffer, uint8_t co
|
||||
|
||||
void gfx_draw_string_left(rct_drawpixelinfo* dpi, rct_string_id format, void* args, uint8_t colour, int32_t x, int32_t y);
|
||||
void gfx_draw_string_centred(
|
||||
rct_drawpixelinfo* dpi, rct_string_id format, int32_t x, int32_t y, uint8_t colour, const void* args);
|
||||
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);
|
||||
|
||||
@@ -157,9 +157,9 @@ void gfx_draw_string_left(rct_drawpixelinfo* dpi, rct_string_id format, void* ar
|
||||
}
|
||||
|
||||
void gfx_draw_string_centred(
|
||||
rct_drawpixelinfo* dpi, rct_string_id format, int32_t x, int32_t y, uint8_t colour, const void* args)
|
||||
rct_drawpixelinfo* dpi, rct_string_id format, const ScreenCoordsXY& coords, uint8_t colour, const void* args)
|
||||
{
|
||||
DrawTextCompat(dpi, x, y, format, args, colour, TextAlignment::CENTRE);
|
||||
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)
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "../core/IStream.hpp"
|
||||
#include "../localisation/Language.h"
|
||||
#include "../localisation/StringIds.h"
|
||||
#include "../world/Location.hpp"
|
||||
#include "ObjectJsonHelpers.h"
|
||||
|
||||
#include <memory>
|
||||
@@ -50,9 +51,8 @@ void WaterObject::Unload()
|
||||
void WaterObject::DrawPreview(rct_drawpixelinfo* dpi, int32_t width, int32_t height) const
|
||||
{
|
||||
// Write (no image)
|
||||
int32_t x = width / 2;
|
||||
int32_t y = height / 2;
|
||||
gfx_draw_string_centred(dpi, STR_WINDOW_NO_IMAGE, x, y, COLOUR_BLACK, nullptr);
|
||||
auto screenCoords = ScreenCoordsXY{ width / 2, height / 2 };
|
||||
gfx_draw_string_centred(dpi, STR_WINDOW_NO_IMAGE, screenCoords, COLOUR_BLACK, nullptr);
|
||||
}
|
||||
|
||||
void WaterObject::ReadJson([[maybe_unused]] IReadObjectContext* context, const json_t* root)
|
||||
|
||||
Reference in new issue
Block a user