mirror of https://github.com/OpenRCT2/OpenRCT2.git
I created the overload, replaced remaining calls with the new function and removed the old function.
This commit is contained in:
parent
ef5f117373
commit
9efe43fa59
|
@ -1080,7 +1080,7 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf
|
||||||
width = w->windowPos.x + w->width - screenPos.x - 4;
|
width = w->windowPos.x + w->width - screenPos.x - 4;
|
||||||
|
|
||||||
gfx_draw_string_left_wrapped(
|
gfx_draw_string_left_wrapped(
|
||||||
dpi, gCommonFormatArgs, screenPos.x, screenPos.y + 5, width, STR_WINDOW_COLOUR_2_STRINGID, COLOUR_BLACK);
|
dpi, gCommonFormatArgs, screenPos + ScreenCoordsXY{ 0, 5 }, width, STR_WINDOW_COLOUR_2_STRINGID, COLOUR_BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto screenPos = w->windowPos + ScreenCoordsXY{ w->width - 5, w->height - (12 * 4) };
|
auto screenPos = w->windowPos + ScreenCoordsXY{ w->width - 5, w->height - (12 * 4) };
|
||||||
|
|
|
@ -561,7 +561,7 @@ static void window_object_load_error_paint(rct_window* w, rct_drawpixelinfo* dpi
|
||||||
auto ft = Formatter::Common();
|
auto ft = Formatter::Common();
|
||||||
ft.Add<rct_string_id>(STR_OBJECT_ERROR_WINDOW_EXPLANATION);
|
ft.Add<rct_string_id>(STR_OBJECT_ERROR_WINDOW_EXPLANATION);
|
||||||
gfx_draw_string_left_wrapped(
|
gfx_draw_string_left_wrapped(
|
||||||
dpi, gCommonFormatArgs, { w->windowPos.x + 5, w->windowPos.y + 18 }, WW - 10, STR_BLACK_STRING, COLOUR_BLACK);
|
dpi, gCommonFormatArgs, w->windowPos + ScreenCoordsXY{ 5, 18 }, WW - 10, STR_BLACK_STRING, COLOUR_BLACK);
|
||||||
|
|
||||||
// Draw file name
|
// Draw file name
|
||||||
ft = Formatter::Common();
|
ft = Formatter::Common();
|
||||||
|
|
|
@ -348,14 +348,12 @@ void window_research_development_page_paint(rct_window* w, rct_drawpixelinfo* dp
|
||||||
if (gResearchProgressStage == RESEARCH_STAGE_FINISHED_ALL)
|
if (gResearchProgressStage == RESEARCH_STAGE_FINISHED_ALL)
|
||||||
{
|
{
|
||||||
stringId = STR_RESEARCH_UNKNOWN;
|
stringId = STR_RESEARCH_UNKNOWN;
|
||||||
gfx_draw_string_left_wrapped(
|
gfx_draw_string_left_wrapped(dpi, &stringId, screenCoords, 296, STR_RESEARCH_TYPE_LABEL, COLOUR_BLACK);
|
||||||
dpi, &stringId, screenCoords.x, screenCoords.y, 296, STR_RESEARCH_TYPE_LABEL, COLOUR_BLACK);
|
|
||||||
screenCoords.y += 25;
|
screenCoords.y += 25;
|
||||||
|
|
||||||
// Progress
|
// Progress
|
||||||
stringId = STR_RESEARCH_COMPLETED_AL;
|
stringId = STR_RESEARCH_COMPLETED_AL;
|
||||||
gfx_draw_string_left_wrapped(
|
gfx_draw_string_left_wrapped(dpi, &stringId, screenCoords, 296, STR_RESEARCH_PROGRESS_LABEL, COLOUR_BLACK);
|
||||||
dpi, &stringId, screenCoords.x, screenCoords.y, 296, STR_RESEARCH_PROGRESS_LABEL, COLOUR_BLACK);
|
|
||||||
screenCoords.y += 15;
|
screenCoords.y += 15;
|
||||||
|
|
||||||
auto ft = Formatter::Common();
|
auto ft = Formatter::Common();
|
||||||
|
@ -391,13 +389,12 @@ void window_research_development_page_paint(rct_window* w, rct_drawpixelinfo* dp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gfx_draw_string_left_wrapped(dpi, &strings, screenCoords.x, screenCoords.y, 296, label, COLOUR_BLACK);
|
gfx_draw_string_left_wrapped(dpi, &strings, screenCoords, 296, label, COLOUR_BLACK);
|
||||||
screenCoords.y += 25;
|
screenCoords.y += 25;
|
||||||
|
|
||||||
// Progress
|
// Progress
|
||||||
stringId = ResearchStageNames[gResearchProgressStage];
|
stringId = ResearchStageNames[gResearchProgressStage];
|
||||||
gfx_draw_string_left_wrapped(
|
gfx_draw_string_left_wrapped(dpi, &stringId, screenCoords, 296, STR_RESEARCH_PROGRESS_LABEL, COLOUR_BLACK);
|
||||||
dpi, &stringId, screenCoords.x, screenCoords.y, 296, STR_RESEARCH_PROGRESS_LABEL, COLOUR_BLACK);
|
|
||||||
screenCoords.y += 15;
|
screenCoords.y += 15;
|
||||||
|
|
||||||
// Expected
|
// Expected
|
||||||
|
@ -446,7 +443,7 @@ void window_research_development_page_paint(rct_window* w, rct_drawpixelinfo* dp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx_draw_string_left_wrapped(dpi, &strings, screenCoords.x, screenCoords.y, 266, lastDevelopmentFormat, COLOUR_BLACK);
|
gfx_draw_string_left_wrapped(dpi, &strings, screenCoords, 266, lastDevelopmentFormat, COLOUR_BLACK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3192,7 +3192,7 @@ static void window_ride_vehicle_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
screenCoords.y += gfx_draw_string_left_wrapped(
|
screenCoords.y += gfx_draw_string_left_wrapped(
|
||||||
dpi, &rideEntry->naming.Description, screenCoords.x, screenCoords.y, 300, STR_BLACK_STRING, COLOUR_BLACK);
|
dpi, &rideEntry->naming.Description, screenCoords, 300, STR_BLACK_STRING, COLOUR_BLACK);
|
||||||
screenCoords.y += 2;
|
screenCoords.y += 2;
|
||||||
|
|
||||||
// Capacity
|
// Capacity
|
||||||
|
@ -4399,7 +4399,7 @@ static void window_ride_maintenance_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||||
{
|
{
|
||||||
if (stringId == STR_CALLING_MECHANIC || stringId == STR_NO_MECHANICS_ARE_HIRED_MESSAGE)
|
if (stringId == STR_CALLING_MECHANIC || stringId == STR_NO_MECHANICS_ARE_HIRED_MESSAGE)
|
||||||
{
|
{
|
||||||
gfx_draw_string_left_wrapped(dpi, nullptr, screenCoords.x + 4, screenCoords.y, 280, stringId, COLOUR_BLACK);
|
gfx_draw_string_left_wrapped(dpi, nullptr, screenCoords + ScreenCoordsXY{ 4, 0 }, 280, stringId, COLOUR_BLACK);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -4408,7 +4408,7 @@ static void window_ride_maintenance_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||||
{
|
{
|
||||||
peep->FormatNameTo(gCommonFormatArgs);
|
peep->FormatNameTo(gCommonFormatArgs);
|
||||||
gfx_draw_string_left_wrapped(
|
gfx_draw_string_left_wrapped(
|
||||||
dpi, gCommonFormatArgs, screenCoords.x + 4, screenCoords.y, 280, stringId, COLOUR_BLACK);
|
dpi, gCommonFormatArgs, screenCoords + ScreenCoordsXY{ 4, 0 }, 280, stringId, COLOUR_BLACK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7106,8 +7106,7 @@ static void window_ride_customer_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||||
{
|
{
|
||||||
queueTime = ride->GetMaxQueueTime();
|
queueTime = ride->GetMaxQueueTime();
|
||||||
stringId = queueTime == 1 ? STR_QUEUE_TIME_MINUTE : STR_QUEUE_TIME_MINUTES;
|
stringId = queueTime == 1 ? STR_QUEUE_TIME_MINUTE : STR_QUEUE_TIME_MINUTES;
|
||||||
screenCoords.y += gfx_draw_string_left_wrapped(
|
screenCoords.y += gfx_draw_string_left_wrapped(dpi, &queueTime, screenCoords, 308, stringId, COLOUR_BLACK);
|
||||||
dpi, &queueTime, screenCoords.x, screenCoords.y, 308, stringId, COLOUR_BLACK);
|
|
||||||
screenCoords.y += 5;
|
screenCoords.y += 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -479,7 +479,7 @@ static void window_scenarioselect_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||||
gfx_draw_string_centred_clipped(
|
gfx_draw_string_centred_clipped(
|
||||||
dpi, STR_SCENARIO_LOCKED, nullptr, COLOUR_BLACK, screenPos + ScreenCoordsXY{ 85, 0 }, 170);
|
dpi, STR_SCENARIO_LOCKED, nullptr, COLOUR_BLACK, screenPos + ScreenCoordsXY{ 85, 0 }, 170);
|
||||||
gfx_draw_string_left_wrapped(
|
gfx_draw_string_left_wrapped(
|
||||||
dpi, nullptr, screenPos.x, screenPos.y + 15, 170, STR_SCENARIO_LOCKED_DESC, COLOUR_BLACK);
|
dpi, nullptr, screenPos + ScreenCoordsXY{ 0, 15 }, 170, STR_SCENARIO_LOCKED_DESC, COLOUR_BLACK);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -513,9 +513,7 @@ static void window_scenarioselect_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||||
ft = Formatter::Common();
|
ft = Formatter::Common();
|
||||||
ft.Add<rct_string_id>(STR_STRING);
|
ft.Add<rct_string_id>(STR_STRING);
|
||||||
ft.Add<const char*>(scenario->details);
|
ft.Add<const char*>(scenario->details);
|
||||||
screenPos.y += gfx_draw_string_left_wrapped(
|
screenPos.y += gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, screenPos, 170, STR_BLACK_STRING, COLOUR_BLACK) + 5;
|
||||||
dpi, gCommonFormatArgs, screenPos.x, screenPos.y, 170, STR_BLACK_STRING, COLOUR_BLACK)
|
|
||||||
+ 5;
|
|
||||||
|
|
||||||
// Scenario objective
|
// Scenario objective
|
||||||
ft = Formatter::Common();
|
ft = Formatter::Common();
|
||||||
|
@ -523,9 +521,7 @@ static void window_scenarioselect_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||||
ft.Add<int16_t>(scenario->objective_arg_3);
|
ft.Add<int16_t>(scenario->objective_arg_3);
|
||||||
ft.Add<int16_t>(date_get_total_months(MONTH_OCTOBER, scenario->objective_arg_1));
|
ft.Add<int16_t>(date_get_total_months(MONTH_OCTOBER, scenario->objective_arg_1));
|
||||||
ft.Add<int32_t>(scenario->objective_arg_2);
|
ft.Add<int32_t>(scenario->objective_arg_2);
|
||||||
screenPos.y += gfx_draw_string_left_wrapped(
|
screenPos.y += gfx_draw_string_left_wrapped(dpi, gCommonFormatArgs, screenPos, 170, STR_OBJECTIVE, COLOUR_BLACK) + 5;
|
||||||
dpi, gCommonFormatArgs, screenPos.x, screenPos.y, 170, STR_OBJECTIVE, COLOUR_BLACK)
|
|
||||||
+ 5;
|
|
||||||
|
|
||||||
// Scenario score
|
// Scenario score
|
||||||
if (scenario->highscore != nullptr)
|
if (scenario->highscore != nullptr)
|
||||||
|
@ -541,7 +537,7 @@ static void window_scenarioselect_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||||
ft.Add<const char*>(completedByName);
|
ft.Add<const char*>(completedByName);
|
||||||
ft.Add<money32>(scenario->highscore->company_value);
|
ft.Add<money32>(scenario->highscore->company_value);
|
||||||
screenPos.y += gfx_draw_string_left_wrapped(
|
screenPos.y += gfx_draw_string_left_wrapped(
|
||||||
dpi, gCommonFormatArgs, screenPos.x, screenPos.y, 170, STR_COMPLETED_BY_WITH_COMPANY_VALUE, COLOUR_BLACK);
|
dpi, gCommonFormatArgs, screenPos, 170, STR_COMPLETED_BY_WITH_COMPANY_VALUE, COLOUR_BLACK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -664,8 +664,6 @@ void gfx_draw_string_centred_clipped(
|
||||||
void gfx_draw_string_right_clipped(
|
void gfx_draw_string_right_clipped(
|
||||||
rct_drawpixelinfo* dpi, rct_string_id format, void* args, uint8_t colour, const ScreenCoordsXY& coords, int32_t width);
|
rct_drawpixelinfo* dpi, rct_string_id format, void* args, uint8_t colour, const ScreenCoordsXY& coords, int32_t width);
|
||||||
|
|
||||||
int32_t gfx_draw_string_left_wrapped(
|
|
||||||
rct_drawpixelinfo* dpi, void* args, int32_t x, int32_t y, int32_t width, rct_string_id format, uint8_t colour);
|
|
||||||
int32_t gfx_draw_string_left_wrapped(
|
int32_t gfx_draw_string_left_wrapped(
|
||||||
rct_drawpixelinfo* dpi, void* args, const ScreenCoordsXY& coords, int32_t width, rct_string_id format, uint8_t colour);
|
rct_drawpixelinfo* dpi, void* args, const ScreenCoordsXY& coords, int32_t width, rct_string_id format, uint8_t colour);
|
||||||
int32_t gfx_draw_string_centred_wrapped(
|
int32_t gfx_draw_string_centred_wrapped(
|
||||||
|
|
|
@ -207,12 +207,6 @@ void gfx_draw_string_right_clipped(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wrapping
|
// Wrapping
|
||||||
int32_t gfx_draw_string_left_wrapped(
|
|
||||||
rct_drawpixelinfo* dpi, void* args, int32_t x, int32_t y, int32_t width, rct_string_id format, uint8_t colour)
|
|
||||||
{
|
|
||||||
return gfx_draw_string_left_wrapped(dpi, args, { x, y }, width, format, colour);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t gfx_draw_string_left_wrapped(
|
int32_t gfx_draw_string_left_wrapped(
|
||||||
rct_drawpixelinfo* dpi, void* args, const ScreenCoordsXY& coords, int32_t width, rct_string_id format, uint8_t colour)
|
rct_drawpixelinfo* dpi, void* args, const ScreenCoordsXY& coords, int32_t width, rct_string_id format, uint8_t colour)
|
||||||
{
|
{
|
||||||
|
|
|
@ -142,12 +142,11 @@ void chat_draw(rct_drawpixelinfo* dpi, uint8_t chatBackgroundColor)
|
||||||
INSET_RECT_FLAG_BORDER_INSET); // Textbox
|
INSET_RECT_FLAG_BORDER_INSET); // Textbox
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t x = _chatLeft + 5;
|
auto screenCoords = ScreenCoordsXY{ _chatLeft + 5, _chatBottom - inputLineHeight - 20 };
|
||||||
int32_t y = _chatBottom - inputLineHeight - 20;
|
|
||||||
int32_t stringHeight = 0;
|
int32_t stringHeight = 0;
|
||||||
|
|
||||||
// Draw chat history
|
// Draw chat history
|
||||||
for (int32_t i = 0; i < CHAT_HISTORY_SIZE; i++, y -= stringHeight)
|
for (int32_t i = 0; i < CHAT_HISTORY_SIZE; i++, screenCoords.y -= stringHeight)
|
||||||
{
|
{
|
||||||
uint32_t expireTime = chat_history_get_time(i) + 10000;
|
uint32_t expireTime = chat_history_get_time(i) + 10000;
|
||||||
if (!gChatOpen && platform_get_ticks() > expireTime)
|
if (!gChatOpen && platform_get_ticks() > expireTime)
|
||||||
|
@ -157,10 +156,10 @@ void chat_draw(rct_drawpixelinfo* dpi, uint8_t chatBackgroundColor)
|
||||||
|
|
||||||
safe_strcpy(lineBuffer, chat_history_get(i), sizeof(lineBuffer));
|
safe_strcpy(lineBuffer, chat_history_get(i), sizeof(lineBuffer));
|
||||||
|
|
||||||
stringHeight = chat_history_draw_string(dpi, static_cast<void*>(&lineCh), ScreenCoordsXY(x, y), _chatWidth - 10) + 5;
|
stringHeight = chat_history_draw_string(dpi, static_cast<void*>(&lineCh), screenCoords, _chatWidth - 10) + 5;
|
||||||
gfx_set_dirty_blocks(x, y - stringHeight, x + _chatWidth, y + 20);
|
gfx_set_dirty_blocks(screenCoords.x, screenCoords.y - stringHeight, screenCoords.x + _chatWidth, screenCoords.y + 20);
|
||||||
|
|
||||||
if ((y - stringHeight) < 50)
|
if ((screenCoords.y - stringHeight) < 50)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -173,20 +172,22 @@ void chat_draw(rct_drawpixelinfo* dpi, uint8_t chatBackgroundColor)
|
||||||
lineCh = utf8_write_codepoint(lineCh, FORMAT_CELADON);
|
lineCh = utf8_write_codepoint(lineCh, FORMAT_CELADON);
|
||||||
|
|
||||||
safe_strcpy(lineCh, _chatCurrentLine, sizeof(_chatCurrentLine));
|
safe_strcpy(lineCh, _chatCurrentLine, sizeof(_chatCurrentLine));
|
||||||
y = _chatBottom - inputLineHeight - 5;
|
screenCoords.y = _chatBottom - inputLineHeight - 5;
|
||||||
|
|
||||||
lineCh = lineBuffer;
|
lineCh = lineBuffer;
|
||||||
inputLineHeight = gfx_draw_string_left_wrapped(
|
inputLineHeight = gfx_draw_string_left_wrapped(
|
||||||
dpi, static_cast<void*>(&lineCh), x, y + 3, _chatWidth - 10, STR_STRING, TEXT_COLOUR_255);
|
dpi, static_cast<void*>(&lineCh), screenCoords + ScreenCoordsXY{ 0, 3 }, _chatWidth - 10, STR_STRING,
|
||||||
gfx_set_dirty_blocks(x, y, x + _chatWidth, y + inputLineHeight + 15);
|
TEXT_COLOUR_255);
|
||||||
|
gfx_set_dirty_blocks(
|
||||||
|
screenCoords.x, screenCoords.y, screenCoords.x + _chatWidth, screenCoords.y + inputLineHeight + 15);
|
||||||
|
|
||||||
// TODO: Show caret if the input text has multiple lines
|
// TODO: Show caret if the input text has multiple lines
|
||||||
if (_chatCaretTicks < 15 && gfx_get_string_width(lineBuffer) < (_chatWidth - 10))
|
if (_chatCaretTicks < 15 && gfx_get_string_width(lineBuffer) < (_chatWidth - 10))
|
||||||
{
|
{
|
||||||
std::memcpy(lineBuffer, _chatCurrentLine, _chatTextInputSession->SelectionStart);
|
std::memcpy(lineBuffer, _chatCurrentLine, _chatTextInputSession->SelectionStart);
|
||||||
lineBuffer[_chatTextInputSession->SelectionStart] = 0;
|
lineBuffer[_chatTextInputSession->SelectionStart] = 0;
|
||||||
int32_t caretX = x + gfx_get_string_width(lineBuffer);
|
int32_t caretX = screenCoords.x + gfx_get_string_width(lineBuffer);
|
||||||
int32_t caretY = y + 14;
|
int32_t caretY = screenCoords.y + 14;
|
||||||
|
|
||||||
gfx_fill_rect(dpi, caretX, caretY, caretX + 6, caretY + 1, PALETTE_INDEX_56);
|
gfx_fill_rect(dpi, caretX, caretY, caretX + 6, caretY + 1, PALETTE_INDEX_56);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue