mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #14394 from tupaschoal/coords1
Use more ScreenCoordsXY on openrct2-ui
This commit is contained in:
commit
465bcf768c
|
@ -14,15 +14,13 @@
|
|||
|
||||
namespace Graph
|
||||
{
|
||||
static void DrawMonths(rct_drawpixelinfo* dpi, const uint8_t* history, int32_t count, int32_t baseX, int32_t baseY)
|
||||
static void DrawMonths(rct_drawpixelinfo* dpi, const uint8_t* history, int32_t count, const ScreenCoordsXY& origCoords)
|
||||
{
|
||||
int32_t i, yearOver32, currentMonth, currentDay;
|
||||
|
||||
currentMonth = date_get_month(gDateMonthsElapsed);
|
||||
currentDay = gDateMonthTicks;
|
||||
yearOver32 = (currentMonth * 4) + (currentDay >> 14) - 31;
|
||||
auto screenCoords = ScreenCoordsXY{ baseX, baseY };
|
||||
for (i = count - 1; i >= 0; i--)
|
||||
int32_t currentMonth = date_get_month(gDateMonthsElapsed);
|
||||
int32_t currentDay = gDateMonthTicks;
|
||||
int32_t yearOver32 = (currentMonth * 4) + (currentDay >> 14) - 31;
|
||||
auto screenCoords = origCoords;
|
||||
for (int32_t i = count - 1; i >= 0; i--)
|
||||
{
|
||||
if (history[i] != 255 && yearOver32 % 4 == 0)
|
||||
{
|
||||
|
@ -42,71 +40,64 @@ namespace Graph
|
|||
}
|
||||
}
|
||||
|
||||
static void DrawLineA(rct_drawpixelinfo* dpi, const uint8_t* history, int32_t count, int32_t baseX, int32_t baseY)
|
||||
static void DrawLineA(rct_drawpixelinfo* dpi, const uint8_t* history, int32_t count, const ScreenCoordsXY& origCoords)
|
||||
{
|
||||
int32_t i, x, y, lastX, lastY;
|
||||
lastX = -1;
|
||||
lastY = -1;
|
||||
x = baseX;
|
||||
for (i = count - 1; i >= 0; i--)
|
||||
auto lastCoords = ScreenCoordsXY{ -1, -1 };
|
||||
auto coords = origCoords;
|
||||
for (int32_t i = count - 1; i >= 0; i--)
|
||||
{
|
||||
if (history[i] != 255)
|
||||
{
|
||||
y = baseY + ((255 - history[i]) * 100) / 256;
|
||||
coords.y = origCoords.y + ((255 - history[i]) * 100) / 256;
|
||||
|
||||
if (lastX != -1)
|
||||
if (lastCoords.x != -1)
|
||||
{
|
||||
auto leftTop1 = ScreenCoordsXY{ lastX + 1, lastY + 1 };
|
||||
auto rightBottom1 = ScreenCoordsXY{ x + 1, y + 1 };
|
||||
auto leftTop2 = ScreenCoordsXY{ lastX, lastY + 1 };
|
||||
auto rightBottom2 = ScreenCoordsXY{ x, y + 1 };
|
||||
auto leftTop1 = lastCoords + ScreenCoordsXY{ 1, 1 };
|
||||
auto rightBottom1 = coords + ScreenCoordsXY{ 1, 1 };
|
||||
auto leftTop2 = lastCoords + ScreenCoordsXY{ 0, 1 };
|
||||
auto rightBottom2 = coords + ScreenCoordsXY{ 0, 1 };
|
||||
gfx_draw_line(dpi, { leftTop1, rightBottom1 }, PALETTE_INDEX_10);
|
||||
gfx_draw_line(dpi, { leftTop2, rightBottom2 }, PALETTE_INDEX_10);
|
||||
}
|
||||
if (i == 0)
|
||||
gfx_fill_rect(dpi, { { x, y }, { x + 2, y + 2 } }, PALETTE_INDEX_10);
|
||||
gfx_fill_rect(dpi, { coords, coords + ScreenCoordsXY{ 2, 2 } }, PALETTE_INDEX_10);
|
||||
|
||||
lastX = x;
|
||||
lastY = y;
|
||||
lastCoords = coords;
|
||||
}
|
||||
x += 6;
|
||||
coords.x += 6;
|
||||
}
|
||||
}
|
||||
|
||||
static void DrawLineB(rct_drawpixelinfo* dpi, const uint8_t* history, int32_t count, int32_t baseX, int32_t baseY)
|
||||
static void DrawLineB(rct_drawpixelinfo* dpi, const uint8_t* history, int32_t count, const ScreenCoordsXY& origCoords)
|
||||
{
|
||||
int32_t i, x, y, lastX, lastY;
|
||||
|
||||
lastX = -1;
|
||||
lastY = -1;
|
||||
x = baseX;
|
||||
for (i = count - 1; i >= 0; i--)
|
||||
auto lastCoords = ScreenCoordsXY{ -1, -1 };
|
||||
auto coords = origCoords;
|
||||
for (int32_t i = count - 1; i >= 0; i--)
|
||||
{
|
||||
if (history[i] != 255)
|
||||
{
|
||||
y = baseY + ((255 - history[i]) * 100) / 256;
|
||||
coords.y = origCoords.y + ((255 - history[i]) * 100) / 256;
|
||||
|
||||
if (lastX != -1)
|
||||
if (lastCoords.x != -1)
|
||||
{
|
||||
auto leftTop = ScreenCoordsXY{ lastX, lastY };
|
||||
auto rightBottom = ScreenCoordsXY{ x, y };
|
||||
auto leftTop = lastCoords;
|
||||
auto rightBottom = coords;
|
||||
gfx_draw_line(dpi, { leftTop, rightBottom }, PALETTE_INDEX_21);
|
||||
}
|
||||
if (i == 0)
|
||||
gfx_fill_rect(dpi, { { x - 1, y - 1 }, { x + 1, y + 1 } }, PALETTE_INDEX_21);
|
||||
gfx_fill_rect(dpi, { coords - ScreenCoordsXY{ 1, 1 }, coords + ScreenCoordsXY{ 1, 1 } }, PALETTE_INDEX_21);
|
||||
|
||||
lastX = x;
|
||||
lastY = y;
|
||||
lastCoords = coords;
|
||||
}
|
||||
x += 6;
|
||||
coords.x += 6;
|
||||
}
|
||||
}
|
||||
|
||||
void Draw(rct_drawpixelinfo* dpi, uint8_t* history, int32_t count, int32_t baseX, int32_t baseY)
|
||||
void Draw(rct_drawpixelinfo* dpi, uint8_t* history, int32_t count, const ScreenCoordsXY& screenPos)
|
||||
{
|
||||
DrawMonths(dpi, history, count, baseX, baseY);
|
||||
DrawLineA(dpi, history, count, baseX, baseY);
|
||||
DrawLineB(dpi, history, count, baseX, baseY);
|
||||
DrawMonths(dpi, history, count, screenPos);
|
||||
DrawLineA(dpi, history, count, screenPos);
|
||||
DrawLineB(dpi, history, count, screenPos);
|
||||
}
|
||||
} // namespace Graph
|
||||
|
||||
|
@ -134,9 +125,8 @@ static const ScreenCoordsXY ScreenCoordsForHistoryIndex(
|
|||
const int32_t index, const money32* history, const int32_t chartX, const int32_t chartY, const int32_t modifier,
|
||||
const int32_t offset)
|
||||
{
|
||||
ScreenCoordsXY coords;
|
||||
coords.x = chartX + ChartDataWidth * (ChartMaxIndex - index);
|
||||
coords.y = chartY + ChartMaxHeight - ((((history[index] >> modifier) + offset) * 170) / 256);
|
||||
auto coords = ScreenCoordsXY{ chartX + ChartDataWidth * (ChartMaxIndex - index),
|
||||
chartY + ChartMaxHeight - ((((history[index] >> modifier) + offset) * 170) / 256) };
|
||||
return coords;
|
||||
}
|
||||
|
||||
|
@ -153,19 +143,19 @@ static const FinancialTooltipInfo finance_tooltip_info_from_money(
|
|||
const auto coords = ScreenCoordsForHistoryIndex(
|
||||
historyIndex, history, chartFrame.GetLeft(), chartFrame.GetTop(), modifier, offset);
|
||||
|
||||
return { { coords.x, coords.y }, history[historyIndex] };
|
||||
return { coords, history[historyIndex] };
|
||||
}
|
||||
|
||||
namespace Graph
|
||||
{
|
||||
static void DrawMonths(rct_drawpixelinfo* dpi, const money32* history, int32_t count, int32_t baseX, int32_t baseY)
|
||||
static void DrawMonths(rct_drawpixelinfo* dpi, const money32* history, int32_t count, const ScreenCoordsXY& origCoords)
|
||||
{
|
||||
int32_t i, yearOver32, currentMonth, currentDay;
|
||||
|
||||
currentMonth = date_get_month(gDateMonthsElapsed);
|
||||
currentDay = gDateMonthTicks;
|
||||
yearOver32 = (currentMonth * 4) + (currentDay >> 14) - 31;
|
||||
auto screenCoords = ScreenCoordsXY{ baseX, baseY };
|
||||
auto screenCoords = origCoords;
|
||||
for (i = count - 1; i >= 0; i--)
|
||||
{
|
||||
if (history[i] != MONEY32_UNDEFINED && yearOver32 % 4 == 0)
|
||||
|
@ -186,75 +176,68 @@ namespace Graph
|
|||
}
|
||||
|
||||
static void DrawLineA(
|
||||
rct_drawpixelinfo* dpi, const money32* history, int32_t count, int32_t baseX, int32_t baseY, int32_t modifier,
|
||||
rct_drawpixelinfo* dpi, const money32* history, int32_t count, const ScreenCoordsXY& origCoords, int32_t modifier,
|
||||
int32_t offset)
|
||||
{
|
||||
int32_t i, x, y, lastX, lastY;
|
||||
lastX = -1;
|
||||
lastY = -1;
|
||||
x = baseX;
|
||||
for (i = count - 1; i >= 0; i--)
|
||||
auto lastCoords = ScreenCoordsXY{ -1, -1 };
|
||||
auto coords = origCoords;
|
||||
for (int32_t i = count - 1; i >= 0; i--)
|
||||
{
|
||||
if (history[i] != MONEY32_UNDEFINED)
|
||||
{
|
||||
y = baseY + 170 - 6 - ((((history[i] >> modifier) + offset) * 170) / 256);
|
||||
coords.y = origCoords.y + 170 - 6 - ((((history[i] >> modifier) + offset) * 170) / 256);
|
||||
|
||||
if (lastX != -1)
|
||||
if (lastCoords.x != -1)
|
||||
{
|
||||
auto leftTop1 = ScreenCoordsXY{ lastX + 1, lastY + 1 };
|
||||
auto rightBottom1 = ScreenCoordsXY{ x + 1, y + 1 };
|
||||
auto leftTop2 = ScreenCoordsXY{ lastX, lastY + 1 };
|
||||
auto rightBottom2 = ScreenCoordsXY{ x, y + 1 };
|
||||
auto leftTop1 = lastCoords + ScreenCoordsXY{ 1, 1 };
|
||||
auto rightBottom1 = coords + ScreenCoordsXY{ 1, 1 };
|
||||
auto leftTop2 = lastCoords + ScreenCoordsXY{ 0, 1 };
|
||||
auto rightBottom2 = coords + ScreenCoordsXY{ 0, 1 };
|
||||
gfx_draw_line(dpi, { leftTop1, rightBottom1 }, PALETTE_INDEX_10);
|
||||
gfx_draw_line(dpi, { leftTop2, rightBottom2 }, PALETTE_INDEX_10);
|
||||
}
|
||||
if (i == 0)
|
||||
gfx_fill_rect(dpi, { { x, y }, { x + 2, y + 2 } }, PALETTE_INDEX_10);
|
||||
gfx_fill_rect(dpi, { coords, coords + ScreenCoordsXY{ 2, 2 } }, PALETTE_INDEX_10);
|
||||
|
||||
lastX = x;
|
||||
lastY = y;
|
||||
lastCoords = coords;
|
||||
}
|
||||
x += 6;
|
||||
coords.x += 6;
|
||||
}
|
||||
}
|
||||
|
||||
static void DrawLineB(
|
||||
rct_drawpixelinfo* dpi, const money32* history, int32_t count, int32_t baseX, int32_t baseY, int32_t modifier,
|
||||
rct_drawpixelinfo* dpi, const money32* history, int32_t count, const ScreenCoordsXY& origCoords, int32_t modifier,
|
||||
int32_t offset)
|
||||
{
|
||||
int32_t i, x, y, lastX, lastY;
|
||||
|
||||
lastX = -1;
|
||||
lastY = -1;
|
||||
x = baseX;
|
||||
for (i = count - 1; i >= 0; i--)
|
||||
auto lastCoords = ScreenCoordsXY{ -1, -1 };
|
||||
auto coords = origCoords;
|
||||
for (int32_t i = count - 1; i >= 0; i--)
|
||||
{
|
||||
if (history[i] != MONEY32_UNDEFINED)
|
||||
{
|
||||
y = baseY + 170 - 6 - ((((history[i] >> modifier) + offset) * 170) / 256);
|
||||
coords.y = origCoords.y + 170 - 6 - ((((history[i] >> modifier) + offset) * 170) / 256);
|
||||
|
||||
if (lastX != -1)
|
||||
if (lastCoords.x != -1)
|
||||
{
|
||||
auto leftTop = ScreenCoordsXY{ lastX, lastY };
|
||||
auto rightBottom = ScreenCoordsXY{ x, y };
|
||||
auto leftTop = lastCoords;
|
||||
auto rightBottom = coords;
|
||||
gfx_draw_line(dpi, { leftTop, rightBottom }, PALETTE_INDEX_21);
|
||||
}
|
||||
if (i == 0)
|
||||
gfx_fill_rect(dpi, { { x - 1, y - 1 }, { x + 1, y + 1 } }, PALETTE_INDEX_21);
|
||||
gfx_fill_rect(dpi, { coords - ScreenCoordsXY{ 1, 1 }, coords + ScreenCoordsXY{ 1, 1 } }, PALETTE_INDEX_21);
|
||||
|
||||
lastX = x;
|
||||
lastY = y;
|
||||
lastCoords = coords;
|
||||
}
|
||||
x += 6;
|
||||
coords.x += 6;
|
||||
}
|
||||
}
|
||||
|
||||
static void DrawHoveredValue(
|
||||
rct_drawpixelinfo* dpi, const money32* history, const int32_t historyCount, const int32_t baseX, const int32_t baseY,
|
||||
rct_drawpixelinfo* dpi, const money32* history, const int32_t historyCount, const ScreenCoordsXY& screenCoords,
|
||||
const int32_t modifier, const int32_t offset)
|
||||
{
|
||||
const auto cursorPosition = context_get_cursor_position_scaled();
|
||||
const ScreenRect chartFrame{ { baseX, baseY }, { baseX + ChartMaxWidth, baseY + ChartMaxHeight } };
|
||||
const ScreenRect chartFrame{ screenCoords, screenCoords + ScreenCoordsXY{ ChartMaxWidth, ChartMaxHeight } };
|
||||
|
||||
if (!chartFrame.Contains(cursorPosition))
|
||||
{
|
||||
|
@ -287,12 +270,12 @@ namespace Graph
|
|||
}
|
||||
|
||||
void Draw(
|
||||
rct_drawpixelinfo* dpi, const money32* history, const int32_t count, const int32_t baseX, const int32_t baseY,
|
||||
rct_drawpixelinfo* dpi, const money32* history, const int32_t count, const ScreenCoordsXY& screenCoords,
|
||||
const int32_t modifier, const int32_t offset)
|
||||
{
|
||||
DrawMonths(dpi, history, count, baseX, baseY);
|
||||
DrawLineA(dpi, history, count, baseX, baseY, modifier, offset);
|
||||
DrawLineB(dpi, history, count, baseX, baseY, modifier, offset);
|
||||
DrawHoveredValue(dpi, history, count, baseX, baseY, modifier, offset);
|
||||
DrawMonths(dpi, history, count, screenCoords);
|
||||
DrawLineA(dpi, history, count, screenCoords, modifier, offset);
|
||||
DrawLineB(dpi, history, count, screenCoords, modifier, offset);
|
||||
DrawHoveredValue(dpi, history, count, screenCoords, modifier, offset);
|
||||
}
|
||||
} // namespace Graph
|
||||
|
|
|
@ -12,12 +12,13 @@
|
|||
|
||||
#include <openrct2/common.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/world/Location.hpp>
|
||||
|
||||
namespace Graph
|
||||
{
|
||||
void Draw(rct_drawpixelinfo* dpi, uint8_t* history, int32_t count, int32_t baseX, int32_t baseY);
|
||||
void Draw(rct_drawpixelinfo* dpi, uint8_t* history, int32_t count, const ScreenCoordsXY& screenPos);
|
||||
void Draw(
|
||||
rct_drawpixelinfo* dpi, const money32* history, const int32_t count, const int32_t baseX, const int32_t baseY,
|
||||
rct_drawpixelinfo* dpi, const money32* history, const int32_t count, const ScreenCoordsXY& coords,
|
||||
const int32_t modifier, const int32_t offset);
|
||||
} // namespace Graph
|
||||
|
||||
|
|
|
@ -237,15 +237,13 @@ void InGameConsole::WriteLine(const std::string& input, FormatToken colourFormat
|
|||
|
||||
void InGameConsole::Invalidate() const
|
||||
{
|
||||
gfx_set_dirty_blocks({ { _consoleLeft, _consoleTop }, { _consoleRight, _consoleBottom } });
|
||||
gfx_set_dirty_blocks({ _consoleTopLeft, _consoleBottomRight });
|
||||
}
|
||||
|
||||
void InGameConsole::Update()
|
||||
{
|
||||
_consoleLeft = 0;
|
||||
_consoleTop = 0;
|
||||
_consoleRight = context_get_width();
|
||||
_consoleBottom = 322;
|
||||
_consoleTopLeft = { 0, 0 };
|
||||
_consoleBottomRight = { context_get_width(), 322 };
|
||||
|
||||
if (_isOpen)
|
||||
{
|
||||
|
@ -298,23 +296,22 @@ void InGameConsole::Draw(rct_drawpixelinfo* dpi) const
|
|||
Invalidate();
|
||||
|
||||
// Give console area a translucent effect.
|
||||
gfx_filter_rect(dpi, { { _consoleLeft, _consoleTop }, { _consoleRight, _consoleBottom } }, FilterPaletteID::Palette51);
|
||||
gfx_filter_rect(dpi, { _consoleTopLeft, _consoleBottomRight }, FilterPaletteID::Palette51);
|
||||
|
||||
// Make input area more opaque.
|
||||
gfx_filter_rect(
|
||||
dpi, { { _consoleLeft, _consoleBottom - lineHeight - 10 }, { _consoleRight, _consoleBottom - 1 } },
|
||||
dpi, { _consoleTopLeft - ScreenCoordsXY{ 0, lineHeight + 10 }, _consoleBottomRight - ScreenCoordsXY{ 0, 1 } },
|
||||
FilterPaletteID::Palette51);
|
||||
|
||||
// Paint background colour.
|
||||
uint8_t backgroundColour = ThemeGetColour(WC_CONSOLE, 0);
|
||||
gfx_fill_rect_inset(dpi, { _consoleTopLeft, _consoleBottomRight }, backgroundColour, INSET_RECT_FLAG_FILL_NONE);
|
||||
gfx_fill_rect_inset(
|
||||
dpi, _consoleLeft, _consoleTop, _consoleRight, _consoleBottom, backgroundColour, INSET_RECT_FLAG_FILL_NONE);
|
||||
gfx_fill_rect_inset(
|
||||
dpi, _consoleLeft + 1, _consoleTop + 1, _consoleRight - 1, _consoleBottom - 1, backgroundColour,
|
||||
dpi, { _consoleTopLeft + ScreenCoordsXY{ 1, 1 }, _consoleBottomRight - ScreenCoordsXY{ 1, 1 } }, backgroundColour,
|
||||
INSET_RECT_FLAG_BORDER_INSET);
|
||||
|
||||
std::string lineBuffer;
|
||||
auto screenCoords = ScreenCoordsXY{ _consoleLeft + CONSOLE_EDGE_PADDING, _consoleTop + CONSOLE_EDGE_PADDING };
|
||||
auto screenCoords = _consoleTopLeft + ScreenCoordsXY{ CONSOLE_EDGE_PADDING, CONSOLE_EDGE_PADDING };
|
||||
|
||||
// Draw text inside console
|
||||
for (std::size_t i = 0; i < _consoleLines.size() && i < static_cast<size_t>(maxLines); i++)
|
||||
|
@ -325,7 +322,7 @@ void InGameConsole::Draw(rct_drawpixelinfo* dpi) const
|
|||
screenCoords.y += lineHeight;
|
||||
}
|
||||
|
||||
screenCoords.y = _consoleBottom - lineHeight - CONSOLE_EDGE_PADDING - 1;
|
||||
screenCoords.y = _consoleBottomRight.y - lineHeight - CONSOLE_EDGE_PADDING - 1;
|
||||
|
||||
// Draw current line
|
||||
lineBuffer = colourFormatStr + _consoleCurrentLine;
|
||||
|
@ -345,22 +342,25 @@ void InGameConsole::Draw(rct_drawpixelinfo* dpi) const
|
|||
|
||||
// Input area top border
|
||||
gfx_fill_rect(
|
||||
dpi, { { _consoleLeft, _consoleBottom - lineHeight - 11 }, { _consoleRight, _consoleBottom - lineHeight - 11 } },
|
||||
dpi,
|
||||
{ _consoleTopLeft - ScreenCoordsXY{ 0, lineHeight + 11 }, _consoleBottomRight - ScreenCoordsXY{ 0, lineHeight + 11 } },
|
||||
borderColour1);
|
||||
gfx_fill_rect(
|
||||
dpi, { { _consoleLeft, _consoleBottom - lineHeight - 10 }, { _consoleRight, _consoleBottom - lineHeight - 10 } },
|
||||
dpi,
|
||||
{ _consoleTopLeft - ScreenCoordsXY{ 0, lineHeight + 10 }, _consoleBottomRight - ScreenCoordsXY{ 0, lineHeight + 10 } },
|
||||
borderColour2);
|
||||
|
||||
// Input area bottom border
|
||||
gfx_fill_rect(dpi, { { _consoleLeft, _consoleBottom - 1 }, { _consoleRight, _consoleBottom - 1 } }, borderColour1);
|
||||
gfx_fill_rect(dpi, { { _consoleLeft, _consoleBottom }, { _consoleRight, _consoleBottom } }, borderColour2);
|
||||
gfx_fill_rect(
|
||||
dpi, { _consoleTopLeft - ScreenCoordsXY{ 0, 1 }, _consoleBottomRight - ScreenCoordsXY{ 0, 1 } }, borderColour1);
|
||||
gfx_fill_rect(dpi, { _consoleTopLeft, _consoleBottomRight }, borderColour2);
|
||||
}
|
||||
|
||||
// Calculates the amount of visible lines, based on the console size, excluding the input line.
|
||||
int32_t InGameConsole::GetNumVisibleLines() const
|
||||
{
|
||||
const int32_t lineHeight = InGameConsoleGetLineHeight();
|
||||
const int32_t consoleHeight = _consoleBottom - _consoleTop;
|
||||
const int32_t consoleHeight = _consoleBottomRight.y - _consoleTopLeft.y;
|
||||
if (consoleHeight == 0)
|
||||
return 0;
|
||||
const int32_t drawableHeight = consoleHeight - 2 * lineHeight - 4; // input line, separator - padding
|
||||
|
|
|
@ -26,7 +26,8 @@ namespace OpenRCT2::Ui
|
|||
static constexpr int32_t CONSOLE_CARET_WIDTH = 6;
|
||||
|
||||
bool _isOpen = false;
|
||||
int32_t _consoleLeft, _consoleTop, _consoleRight, _consoleBottom;
|
||||
ScreenCoordsXY _consoleTopLeft;
|
||||
ScreenCoordsXY _consoleBottomRight;
|
||||
ScreenCoordsXY _lastMainViewport;
|
||||
std::deque<std::string> _consoleLines;
|
||||
utf8 _consoleCurrentLine[CONSOLE_INPUT_SIZE] = {};
|
||||
|
|
|
@ -650,7 +650,7 @@ void WindowDrawWidgets(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
if (w->flags & WF_WHITE_BORDER_MASK)
|
||||
{
|
||||
gfx_fill_rect_inset(
|
||||
dpi, w->windowPos.x, w->windowPos.y, w->windowPos.x + w->width - 1, w->windowPos.y + w->height - 1, COLOUR_WHITE,
|
||||
dpi, { w->windowPos, w->windowPos + ScreenCoordsXY{ w->width - 1, w->height - 1 } }, COLOUR_WHITE,
|
||||
INSET_RECT_FLAG_FILL_NONE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -671,7 +671,7 @@ void CustomListView::PaintHeading(
|
|||
{
|
||||
boxFlags = INSET_RECT_FLAG_BORDER_INSET;
|
||||
}
|
||||
gfx_fill_rect_inset(dpi, pos.x, pos.y, pos.x + size.width - 1, pos.y + size.height - 1, w->colours[1], boxFlags);
|
||||
gfx_fill_rect_inset(dpi, { pos, pos + ScreenCoordsXY{ size.width - 1, size.height - 1 } }, w->colours[1], boxFlags);
|
||||
if (!text.empty())
|
||||
{
|
||||
PaintCell(dpi, pos, size, text.c_str(), false);
|
||||
|
|
|
@ -409,24 +409,20 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER))
|
||||
{
|
||||
const auto topLeft = w->windowPos
|
||||
+ ScreenCoordsXY{ window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].left + 1,
|
||||
window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + 1 };
|
||||
const auto bottomRight = w->windowPos
|
||||
+ ScreenCoordsXY{ window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right - 1,
|
||||
window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].bottom - 1 };
|
||||
if (drawPreviousButton)
|
||||
{
|
||||
gfx_fill_rect_inset(
|
||||
dpi, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].left + 1 + w->windowPos.x,
|
||||
window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + 1 + w->windowPos.y,
|
||||
window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right - 1 + w->windowPos.x,
|
||||
window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].bottom - 1 + w->windowPos.y, w->colours[1],
|
||||
INSET_RECT_F_30);
|
||||
gfx_fill_rect_inset(dpi, { topLeft, bottomRight }, w->colours[1], INSET_RECT_F_30);
|
||||
}
|
||||
|
||||
if ((drawPreviousButton || drawNextButton) && gS6Info.editor_step != EditorStep::RollercoasterDesigner)
|
||||
{
|
||||
gfx_fill_rect_inset(
|
||||
dpi, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left + 1 + w->windowPos.x,
|
||||
window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].top + 1 + w->windowPos.y,
|
||||
window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].right - 1 + w->windowPos.x,
|
||||
window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].bottom - 1 + w->windowPos.y, w->colours[1],
|
||||
INSET_RECT_F_30);
|
||||
gfx_fill_rect_inset(dpi, { topLeft, bottomRight }, w->colours[1], INSET_RECT_F_30);
|
||||
}
|
||||
|
||||
int16_t stateX = (window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right
|
||||
|
|
|
@ -1140,7 +1140,8 @@ static void window_editor_object_selection_scrollpaint(rct_window* w, rct_drawpi
|
|||
{
|
||||
// Draw checkbox
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && !(*listItem.flags & 0x20))
|
||||
gfx_fill_rect_inset(dpi, 2, screenCoords.y, 11, screenCoords.y + 10, w->colours[1], INSET_RECT_F_E0);
|
||||
gfx_fill_rect_inset(
|
||||
dpi, { { 2, screenCoords.y }, { 11, screenCoords.y + 10 } }, w->colours[1], INSET_RECT_F_E0);
|
||||
|
||||
// Highlight background
|
||||
auto highlighted = listItem.entry == w->object_entry && !(*listItem.flags & OBJECT_SELECTION_FLAG_6);
|
||||
|
|
|
@ -1083,7 +1083,7 @@ static void window_editor_objective_options_rides_scrollpaint(rct_window* w, rct
|
|||
continue;
|
||||
|
||||
// Checkbox
|
||||
gfx_fill_rect_inset(dpi, 2, y, 11, y + 10, w->colours[1], INSET_RECT_F_E0);
|
||||
gfx_fill_rect_inset(dpi, { { 2, y }, { 11, y + 10 } }, w->colours[1], INSET_RECT_F_E0);
|
||||
|
||||
// Highlighted
|
||||
auto stringId = STR_BLACK_STRING;
|
||||
|
|
|
@ -550,7 +550,7 @@ static void window_finances_summary_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
|
||||
// Horizontal rule below expenditure / income table
|
||||
gfx_fill_rect_inset(
|
||||
dpi, w->windowPos.x + 8, w->windowPos.y + 272, w->windowPos.x + 8 + 513, w->windowPos.y + 272 + 1, w->colours[1],
|
||||
dpi, { w->windowPos + ScreenCoordsXY{ 8, 272 }, w->windowPos + ScreenCoordsXY{ 8 + 513, 272 + 1 } }, w->colours[1],
|
||||
INSET_RECT_FLAG_BORDER_INSET);
|
||||
|
||||
// Loan and interest rate
|
||||
|
@ -705,32 +705,28 @@ static void window_finances_financial_graph_invalidate(rct_window* w)
|
|||
*/
|
||||
static void window_finances_financial_graph_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
int32_t i, x, y, graphLeft, graphTop, graphRight, graphBottom;
|
||||
|
||||
WindowDrawWidgets(w, dpi);
|
||||
window_finances_draw_tab_images(dpi, w);
|
||||
|
||||
rct_widget* pageWidget = &_windowFinancesCashWidgets[WIDX_PAGE_BACKGROUND];
|
||||
graphLeft = w->windowPos.x + pageWidget->left + 4;
|
||||
graphTop = w->windowPos.y + pageWidget->top + 15;
|
||||
graphRight = w->windowPos.x + pageWidget->right - 4;
|
||||
graphBottom = w->windowPos.y + pageWidget->bottom - 4;
|
||||
auto graphTopLeft = w->windowPos + ScreenCoordsXY{ pageWidget->left + 4, pageWidget->top + 15 };
|
||||
auto graphBottomRight = w->windowPos + ScreenCoordsXY{ pageWidget->right - 4, pageWidget->bottom - 4 };
|
||||
|
||||
// Cash (less loan)
|
||||
money32 cashLessLoan = gCash - gBankLoan;
|
||||
|
||||
DrawTextBasic(
|
||||
dpi, { graphLeft, graphTop - 11 },
|
||||
dpi, graphTopLeft - ScreenCoordsXY{ 0, 11 },
|
||||
cashLessLoan >= 0 ? STR_FINANCES_FINANCIAL_GRAPH_CASH_LESS_LOAN_POSITIVE
|
||||
: STR_FINANCES_FINANCIAL_GRAPH_CASH_LESS_LOAN_NEGATIVE,
|
||||
&cashLessLoan);
|
||||
|
||||
// Graph
|
||||
gfx_fill_rect_inset(dpi, graphLeft, graphTop, graphRight, graphBottom, w->colours[1], INSET_RECT_F_30);
|
||||
gfx_fill_rect_inset(dpi, { graphTopLeft, graphBottomRight }, w->colours[1], INSET_RECT_F_30);
|
||||
|
||||
// Calculate the Y axis scale (log2 of highest [+/-]balance)
|
||||
int32_t yAxisScale = 0;
|
||||
for (i = 0; i < 64; i++)
|
||||
for (int32_t i = 0; i < 64; i++)
|
||||
{
|
||||
money32 balance = gCashHistory[i];
|
||||
if (balance == MONEY32_UNDEFINED)
|
||||
|
@ -746,8 +742,7 @@ static void window_finances_financial_graph_paint(rct_window* w, rct_drawpixelin
|
|||
}
|
||||
|
||||
// Y axis labels
|
||||
x = graphLeft + 18;
|
||||
y = graphTop + 14;
|
||||
auto coords = graphTopLeft + ScreenCoordsXY{ 18, 14 };
|
||||
money32 axisBase;
|
||||
for (axisBase = MONEY(12, 00); axisBase >= MONEY(-12, 00); axisBase -= MONEY(6, 00))
|
||||
{
|
||||
|
@ -755,15 +750,17 @@ static void window_finances_financial_graph_paint(rct_window* w, rct_drawpixelin
|
|||
auto ft = Formatter();
|
||||
ft.Add<money32>(axisValue);
|
||||
DrawTextBasic(
|
||||
dpi, { x + 70, y }, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, ft, { FontSpriteBase::SMALL, TextAlignment::RIGHT });
|
||||
gfx_fill_rect_inset(dpi, x + 70, y + 5, graphLeft + 482, y + 5, w->colours[2], INSET_RECT_FLAG_BORDER_INSET);
|
||||
y += 39;
|
||||
dpi, coords + ScreenCoordsXY{ 70, 0 }, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, ft,
|
||||
{ FontSpriteBase::SMALL, TextAlignment::RIGHT });
|
||||
gfx_fill_rect_inset(
|
||||
dpi, { coords + ScreenCoordsXY{ 70, 5 }, { graphTopLeft.x + 482, coords.y + 5 } }, w->colours[2],
|
||||
INSET_RECT_FLAG_BORDER_INSET);
|
||||
coords.y += 39;
|
||||
}
|
||||
|
||||
// X axis labels and values
|
||||
x = graphLeft + 98;
|
||||
y = graphTop + 17;
|
||||
Graph::Draw(dpi, gCashHistory, 64, x, y, yAxisScale, 128);
|
||||
coords = graphTopLeft + ScreenCoordsXY{ 98, 17 };
|
||||
Graph::Draw(dpi, gCashHistory, 64, coords, yAxisScale, 128);
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
@ -816,27 +813,23 @@ static void window_finances_park_value_graph_invalidate(rct_window* w)
|
|||
*/
|
||||
static void window_finances_park_value_graph_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
int32_t i, x, y, graphLeft, graphTop, graphRight, graphBottom;
|
||||
|
||||
WindowDrawWidgets(w, dpi);
|
||||
window_finances_draw_tab_images(dpi, w);
|
||||
|
||||
rct_widget* pageWidget = &_windowFinancesCashWidgets[WIDX_PAGE_BACKGROUND];
|
||||
graphLeft = w->windowPos.x + pageWidget->left + 4;
|
||||
graphTop = w->windowPos.y + pageWidget->top + 15;
|
||||
graphRight = w->windowPos.x + pageWidget->right - 4;
|
||||
graphBottom = w->windowPos.y + pageWidget->bottom - 4;
|
||||
auto graphTopLeft = w->windowPos + ScreenCoordsXY{ pageWidget->left + 4, pageWidget->top + 15 };
|
||||
auto graphBottomRight = w->windowPos + ScreenCoordsXY{ pageWidget->right - 4, pageWidget->bottom - 4 };
|
||||
|
||||
// Park value
|
||||
money32 parkValue = gParkValue;
|
||||
DrawTextBasic(dpi, { graphLeft, graphTop - 11 }, STR_FINANCES_PARK_VALUE, &parkValue);
|
||||
DrawTextBasic(dpi, graphTopLeft - ScreenCoordsXY{ 0, 11 }, STR_FINANCES_PARK_VALUE, &parkValue);
|
||||
|
||||
// Graph
|
||||
gfx_fill_rect_inset(dpi, graphLeft, graphTop, graphRight, graphBottom, w->colours[1], INSET_RECT_F_30);
|
||||
gfx_fill_rect_inset(dpi, { graphTopLeft, graphBottomRight }, w->colours[1], INSET_RECT_F_30);
|
||||
|
||||
// Calculate the Y axis scale (log2 of highest [+/-]balance)
|
||||
int32_t yAxisScale = 0;
|
||||
for (i = 0; i < 64; i++)
|
||||
for (int32_t i = 0; i < 64; i++)
|
||||
{
|
||||
money32 balance = gParkValueHistory[i];
|
||||
if (balance == MONEY32_UNDEFINED)
|
||||
|
@ -852,8 +845,7 @@ static void window_finances_park_value_graph_paint(rct_window* w, rct_drawpixeli
|
|||
}
|
||||
|
||||
// Y axis labels
|
||||
x = graphLeft + 18;
|
||||
y = graphTop + 14;
|
||||
auto coords = graphTopLeft + ScreenCoordsXY{ 18, 14 };
|
||||
money32 axisBase;
|
||||
for (axisBase = MONEY(24, 00); axisBase >= MONEY(0, 00); axisBase -= MONEY(6, 00))
|
||||
{
|
||||
|
@ -861,15 +853,17 @@ static void window_finances_park_value_graph_paint(rct_window* w, rct_drawpixeli
|
|||
auto ft = Formatter();
|
||||
ft.Add<money32>(axisValue);
|
||||
DrawTextBasic(
|
||||
dpi, { x + 70, y }, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, ft, { FontSpriteBase::SMALL, TextAlignment::RIGHT });
|
||||
gfx_fill_rect_inset(dpi, x + 70, y + 5, graphLeft + 482, y + 5, w->colours[2], INSET_RECT_FLAG_BORDER_INSET);
|
||||
y += 39;
|
||||
dpi, coords + ScreenCoordsXY{ 70, 0 }, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, ft,
|
||||
{ FontSpriteBase::SMALL, TextAlignment::RIGHT });
|
||||
gfx_fill_rect_inset(
|
||||
dpi, { coords + ScreenCoordsXY{ 70, 5 }, { graphTopLeft.x + 482, coords.y + 5 } }, w->colours[2],
|
||||
INSET_RECT_FLAG_BORDER_INSET);
|
||||
coords.y += 39;
|
||||
}
|
||||
|
||||
// X axis labels and values
|
||||
x = graphLeft + 98;
|
||||
y = graphTop + 17;
|
||||
Graph::Draw(dpi, gParkValueHistory, 64, x, y, yAxisScale, 0);
|
||||
coords = graphTopLeft + ScreenCoordsXY{ 98, 17 };
|
||||
Graph::Draw(dpi, gParkValueHistory, 64, coords, yAxisScale, 0);
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
@ -921,29 +915,25 @@ static void window_finances_profit_graph_invalidate(rct_window* w)
|
|||
*/
|
||||
static void window_finances_profit_graph_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
int32_t i, graphLeft, graphTop, graphRight, graphBottom;
|
||||
|
||||
WindowDrawWidgets(w, dpi);
|
||||
window_finances_draw_tab_images(dpi, w);
|
||||
|
||||
rct_widget* pageWidget = &_windowFinancesCashWidgets[WIDX_PAGE_BACKGROUND];
|
||||
graphLeft = w->windowPos.x + pageWidget->left + 4;
|
||||
graphTop = w->windowPos.y + pageWidget->top + 15;
|
||||
graphRight = w->windowPos.x + pageWidget->right - 4;
|
||||
graphBottom = w->windowPos.y + pageWidget->bottom - 4;
|
||||
auto graphTopLeft = w->windowPos + ScreenCoordsXY{ pageWidget->left + 4, pageWidget->top + 15 };
|
||||
auto graphBottomRight = w->windowPos + ScreenCoordsXY{ pageWidget->right - 4, pageWidget->bottom - 4 };
|
||||
|
||||
// Weekly profit
|
||||
money32 weeklyPofit = gCurrentProfit;
|
||||
DrawTextBasic(
|
||||
dpi, { graphLeft, graphTop - 11 },
|
||||
dpi, graphTopLeft - ScreenCoordsXY{ 0, 11 },
|
||||
weeklyPofit >= 0 ? STR_FINANCES_WEEKLY_PROFIT_POSITIVE : STR_FINANCES_WEEKLY_PROFIT_LOSS, &weeklyPofit);
|
||||
|
||||
// Graph
|
||||
gfx_fill_rect_inset(dpi, graphLeft, graphTop, graphRight, graphBottom, w->colours[1], INSET_RECT_F_30);
|
||||
gfx_fill_rect_inset(dpi, { graphTopLeft, graphBottomRight }, w->colours[1], INSET_RECT_F_30);
|
||||
|
||||
// Calculate the Y axis scale (log2 of highest [+/-]balance)
|
||||
int32_t yAxisScale = 0;
|
||||
for (i = 0; i < 64; i++)
|
||||
for (int32_t i = 0; i < 64; i++)
|
||||
{
|
||||
money32 balance = gWeeklyProfitHistory[i];
|
||||
if (balance == MONEY32_UNDEFINED)
|
||||
|
@ -959,7 +949,7 @@ static void window_finances_profit_graph_paint(rct_window* w, rct_drawpixelinfo*
|
|||
}
|
||||
|
||||
// Y axis labels
|
||||
auto screenPos = ScreenCoordsXY{ graphLeft + 18, graphTop + 14 };
|
||||
auto screenPos = graphTopLeft + ScreenCoordsXY{ 18, 14 };
|
||||
money32 axisBase;
|
||||
for (axisBase = MONEY(12, 00); axisBase >= MONEY(-12, 00); axisBase -= MONEY(6, 00))
|
||||
{
|
||||
|
@ -970,14 +960,14 @@ static void window_finances_profit_graph_paint(rct_window* w, rct_drawpixelinfo*
|
|||
dpi, screenPos + ScreenCoordsXY{ 70, 0 }, STR_FINANCES_FINANCIAL_GRAPH_CASH_VALUE, ft,
|
||||
{ FontSpriteBase::SMALL, TextAlignment::RIGHT });
|
||||
gfx_fill_rect_inset(
|
||||
dpi, screenPos.x + 70, screenPos.y + 5, graphLeft + 482, screenPos.y + 5, w->colours[2],
|
||||
dpi, { screenPos + ScreenCoordsXY{ 70, 5 }, { graphTopLeft.x + 482, screenPos.y + 5 } }, w->colours[2],
|
||||
INSET_RECT_FLAG_BORDER_INSET);
|
||||
screenPos.y += 39;
|
||||
}
|
||||
|
||||
// X axis labels and values
|
||||
screenPos = { graphLeft + 98, graphTop + 17 };
|
||||
Graph::Draw(dpi, gWeeklyProfitHistory, 64, screenPos.x, screenPos.y, yAxisScale, 128);
|
||||
screenPos = graphTopLeft + ScreenCoordsXY{ 98, 17 };
|
||||
Graph::Draw(dpi, gWeeklyProfitHistory, 64, screenPos, yAxisScale, 128);
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
|
|
@ -76,7 +76,7 @@ static void window_game_bottom_toolbar_cursor(rct_window *w, rct_widgetindex wid
|
|||
static void window_game_bottom_toolbar_unknown05(rct_window *w);
|
||||
|
||||
static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo *dpi, rct_window *w);
|
||||
static void window_game_bottom_toolbar_draw_park_rating(rct_drawpixelinfo *dpi, rct_window *w, int32_t colour, int32_t x, int32_t y, uint8_t factor);
|
||||
static void window_game_bottom_toolbar_draw_park_rating(rct_drawpixelinfo *dpi, rct_window *w, int32_t colour, const ScreenCoordsXY& coords, uint8_t factor);
|
||||
static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo *dpi, rct_window *w);
|
||||
static void window_game_bottom_toolbar_draw_news_item(rct_drawpixelinfo *dpi, rct_window *w);
|
||||
static void window_game_bottom_toolbar_draw_middle_panel(rct_drawpixelinfo *dpi, rct_window *w);
|
||||
|
@ -389,12 +389,14 @@ static void window_game_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* d
|
|||
|
||||
static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo* dpi, rct_window* w)
|
||||
{
|
||||
const auto topLeft = w->windowPos
|
||||
+ ScreenCoordsXY{ window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET].left + 1,
|
||||
window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET].top + 1 };
|
||||
const auto bottomRight = w->windowPos
|
||||
+ ScreenCoordsXY{ window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET].right - 1,
|
||||
window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET].bottom - 1 };
|
||||
// Draw green inset rectangle on panel
|
||||
gfx_fill_rect_inset(
|
||||
dpi, w->windowPos.x + window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET].left + 1,
|
||||
w->windowPos.y + window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET].top + 1,
|
||||
w->windowPos.x + window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET].right - 1,
|
||||
w->windowPos.y + window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET].bottom - 1, w->colours[1], INSET_RECT_F_30);
|
||||
gfx_fill_rect_inset(dpi, { topLeft, bottomRight }, w->colours[1], INSET_RECT_F_30);
|
||||
|
||||
// Figure out how much line height we have to work with.
|
||||
uint32_t line_height = font_get_line_height(FontSpriteBase::MEDIUM);
|
||||
|
@ -447,10 +449,10 @@ static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo* dpi, r
|
|||
// Draw park rating
|
||||
{
|
||||
rct_widget widget = window_game_bottom_toolbar_widgets[WIDX_PARK_RATING];
|
||||
int32_t x = w->windowPos.x + widget.left + 11;
|
||||
int32_t y = w->windowPos.y + widget.midY() - 5;
|
||||
auto screenCoords = w->windowPos + ScreenCoordsXY{ widget.left + 11, widget.midY() - 5 };
|
||||
|
||||
window_game_bottom_toolbar_draw_park_rating(dpi, w, w->colours[3], x, y, std::max(10, ((gParkRating / 4) * 263) / 256));
|
||||
window_game_bottom_toolbar_draw_park_rating(
|
||||
dpi, w, w->colours[3], screenCoords, std::max(10, ((gParkRating / 4) * 263) / 256));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -459,31 +461,37 @@ static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo* dpi, r
|
|||
* rct2: 0x0066C76C
|
||||
*/
|
||||
static void window_game_bottom_toolbar_draw_park_rating(
|
||||
rct_drawpixelinfo* dpi, rct_window* w, int32_t colour, int32_t x, int32_t y, uint8_t factor)
|
||||
rct_drawpixelinfo* dpi, rct_window* w, int32_t colour, const ScreenCoordsXY& coords, uint8_t factor)
|
||||
{
|
||||
int16_t bar_width;
|
||||
|
||||
bar_width = (factor * 114) / 255;
|
||||
gfx_fill_rect_inset(dpi, x + 1, y + 1, x + 114, y + 9, w->colours[1], INSET_RECT_F_30);
|
||||
gfx_fill_rect_inset(
|
||||
dpi, { coords + ScreenCoordsXY{ 1, 1 }, coords + ScreenCoordsXY{ 114, 9 } }, w->colours[1], INSET_RECT_F_30);
|
||||
if (!(colour & IMAGE_TYPE_REMAP_2_PLUS) || game_is_paused() || (gCurrentRealTimeTicks & 8))
|
||||
{
|
||||
if (bar_width > 2)
|
||||
gfx_fill_rect_inset(dpi, x + 2, y + 2, x + bar_width - 1, y + 8, colour & 0x7FFFFFFF, 0);
|
||||
{
|
||||
gfx_fill_rect_inset(
|
||||
dpi, { coords + ScreenCoordsXY{ 2, 2 }, coords + ScreenCoordsXY{ bar_width - 1, 8 } }, colour & 0x7FFFFFFF, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw thumbs on the sides
|
||||
gfx_draw_sprite(dpi, ImageId(SPR_RATING_LOW), { x - 14, y });
|
||||
gfx_draw_sprite(dpi, ImageId(SPR_RATING_HIGH), { x + 114, y });
|
||||
gfx_draw_sprite(dpi, ImageId(SPR_RATING_LOW), coords - ScreenCoordsXY{ 14, 0 });
|
||||
gfx_draw_sprite(dpi, ImageId(SPR_RATING_HIGH), coords + ScreenCoordsXY{ 114, 0 });
|
||||
}
|
||||
|
||||
static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo* dpi, rct_window* w)
|
||||
{
|
||||
const auto topLeft = w->windowPos
|
||||
+ ScreenCoordsXY{ window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left + 1,
|
||||
window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].top + 1 };
|
||||
const auto bottomRight = w->windowPos
|
||||
+ ScreenCoordsXY{ window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].right - 1,
|
||||
window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].bottom - 1 };
|
||||
// Draw green inset rectangle on panel
|
||||
gfx_fill_rect_inset(
|
||||
dpi, w->windowPos.x + window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left + 1,
|
||||
w->windowPos.y + window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].top + 1,
|
||||
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);
|
||||
gfx_fill_rect_inset(dpi, { topLeft, bottomRight }, w->colours[1], INSET_RECT_F_30);
|
||||
|
||||
auto screenCoords = ScreenCoordsXY{ (window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left
|
||||
+ window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].right)
|
||||
|
@ -557,9 +565,10 @@ static void window_game_bottom_toolbar_draw_news_item(rct_drawpixelinfo* dpi, rc
|
|||
|
||||
// Current news item
|
||||
gfx_fill_rect_inset(
|
||||
dpi, w->windowPos.x + middleOutsetWidget->left + 1, w->windowPos.y + middleOutsetWidget->top + 1,
|
||||
w->windowPos.x + middleOutsetWidget->right - 1, w->windowPos.y + middleOutsetWidget->bottom - 1, w->colours[2],
|
||||
INSET_RECT_F_30);
|
||||
dpi,
|
||||
{ w->windowPos + ScreenCoordsXY{ middleOutsetWidget->left + 1, middleOutsetWidget->top + 1 },
|
||||
w->windowPos + ScreenCoordsXY{ middleOutsetWidget->right - 1, middleOutsetWidget->bottom - 1 } },
|
||||
w->colours[2], INSET_RECT_F_30);
|
||||
|
||||
// Text
|
||||
const auto* newsItemText = newsItem->Text.c_str();
|
||||
|
@ -646,9 +655,10 @@ static void window_game_bottom_toolbar_draw_middle_panel(rct_drawpixelinfo* dpi,
|
|||
rct_widget* middleOutsetWidget = &window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET];
|
||||
|
||||
gfx_fill_rect_inset(
|
||||
dpi, w->windowPos.x + middleOutsetWidget->left + 1, w->windowPos.y + middleOutsetWidget->top + 1,
|
||||
w->windowPos.x + middleOutsetWidget->right - 1, w->windowPos.y + middleOutsetWidget->bottom - 1, w->colours[1],
|
||||
INSET_RECT_F_30);
|
||||
dpi,
|
||||
{ w->windowPos + ScreenCoordsXY{ middleOutsetWidget->left + 1, middleOutsetWidget->top + 1 },
|
||||
w->windowPos + ScreenCoordsXY{ middleOutsetWidget->right - 1, middleOutsetWidget->bottom - 1 } },
|
||||
w->colours[1], INSET_RECT_F_30);
|
||||
|
||||
// Figure out how much line height we have to work with.
|
||||
uint32_t line_height = font_get_line_height(FontSpriteBase::MEDIUM);
|
||||
|
|
|
@ -1250,14 +1250,16 @@ void window_guest_stats_update(rct_window* w)
|
|||
*
|
||||
*/
|
||||
static void window_guest_stats_bars_paint(
|
||||
int32_t value, int32_t x, int32_t y, rct_window* w, rct_drawpixelinfo* dpi, int32_t colour, bool blinkFlag)
|
||||
int32_t value, const ScreenCoordsXY& origCoords, rct_window* w, rct_drawpixelinfo* dpi, int32_t colour, bool blinkFlag)
|
||||
{
|
||||
auto coords = origCoords;
|
||||
if (font_get_line_height(FontSpriteBase::MEDIUM) > 10)
|
||||
{
|
||||
y += 1;
|
||||
coords.y += 1;
|
||||
}
|
||||
|
||||
gfx_fill_rect_inset(dpi, x + 61, y + 1, x + 61 + 121, y + 9, w->colours[1], INSET_RECT_F_30);
|
||||
gfx_fill_rect_inset(
|
||||
dpi, { coords + ScreenCoordsXY{ 61, 1 }, coords + ScreenCoordsXY{ 61 + 121, 9 } }, w->colours[1], INSET_RECT_F_30);
|
||||
|
||||
if (!blinkFlag || game_is_paused() || (gCurrentRealTimeTicks & 8) == 0)
|
||||
{
|
||||
|
@ -1267,7 +1269,7 @@ static void window_guest_stats_bars_paint(
|
|||
if (value <= 2)
|
||||
return;
|
||||
|
||||
gfx_fill_rect_inset(dpi, x + 63, y + 2, x + 63 + value - 1, y + 8, colour, 0);
|
||||
gfx_fill_rect_inset(dpi, { coords + ScreenCoordsXY{ 63, 2 }, coords + ScreenCoordsXY{ 63 + value - 1, 8 } }, colour, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1315,7 +1317,7 @@ void window_guest_stats_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
int32_t happiness = NormalizeGuestStatValue(peep->Happiness, PEEP_MAX_HAPPINESS, 10);
|
||||
int32_t barColour = COLOUR_BRIGHT_GREEN;
|
||||
bool barBlink = happiness < 50;
|
||||
window_guest_stats_bars_paint(happiness, screenCoords.x, screenCoords.y, w, dpi, barColour, barBlink);
|
||||
window_guest_stats_bars_paint(happiness, screenCoords, w, dpi, barColour, barBlink);
|
||||
|
||||
// Energy
|
||||
screenCoords.y += LIST_ROW_HEIGHT;
|
||||
|
@ -1324,7 +1326,7 @@ void window_guest_stats_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
int32_t energy = NormalizeGuestStatValue(peep->Energy - PEEP_MIN_ENERGY, PEEP_MAX_ENERGY - PEEP_MIN_ENERGY, 10);
|
||||
barColour = COLOUR_BRIGHT_GREEN;
|
||||
barBlink = energy < 50;
|
||||
window_guest_stats_bars_paint(energy, screenCoords.x, screenCoords.y, w, dpi, barColour, barBlink);
|
||||
window_guest_stats_bars_paint(energy, screenCoords, w, dpi, barColour, barBlink);
|
||||
|
||||
// Hunger
|
||||
screenCoords.y += LIST_ROW_HEIGHT;
|
||||
|
@ -1334,7 +1336,7 @@ void window_guest_stats_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
hunger = 255 - hunger; // the bar should be longer when peep->Hunger is low
|
||||
barColour = COLOUR_BRIGHT_RED;
|
||||
barBlink = hunger > 170;
|
||||
window_guest_stats_bars_paint(hunger, screenCoords.x, screenCoords.y, w, dpi, barColour, barBlink);
|
||||
window_guest_stats_bars_paint(hunger, screenCoords, w, dpi, barColour, barBlink);
|
||||
|
||||
// Thirst
|
||||
screenCoords.y += LIST_ROW_HEIGHT;
|
||||
|
@ -1344,7 +1346,7 @@ void window_guest_stats_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
thirst = 255 - thirst; // the bar should be longer when peep->Thirst is low
|
||||
barColour = COLOUR_BRIGHT_RED;
|
||||
barBlink = thirst > 170;
|
||||
window_guest_stats_bars_paint(thirst, screenCoords.x, screenCoords.y, w, dpi, barColour, barBlink);
|
||||
window_guest_stats_bars_paint(thirst, screenCoords, w, dpi, barColour, barBlink);
|
||||
|
||||
// Nausea
|
||||
screenCoords.y += LIST_ROW_HEIGHT;
|
||||
|
@ -1353,7 +1355,7 @@ void window_guest_stats_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
int32_t nausea = NormalizeGuestStatValue(peep->Nausea - 32, 223, 0);
|
||||
barColour = COLOUR_BRIGHT_RED;
|
||||
barBlink = nausea > 120;
|
||||
window_guest_stats_bars_paint(nausea, screenCoords.x, screenCoords.y, w, dpi, barColour, barBlink);
|
||||
window_guest_stats_bars_paint(nausea, screenCoords, w, dpi, barColour, barBlink);
|
||||
|
||||
// Toilet
|
||||
screenCoords.y += LIST_ROW_HEIGHT;
|
||||
|
@ -1362,7 +1364,7 @@ void window_guest_stats_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
int32_t toilet = NormalizeGuestStatValue(peep->Toilet - 64, 178, 0);
|
||||
barColour = COLOUR_BRIGHT_RED;
|
||||
barBlink = toilet > 160;
|
||||
window_guest_stats_bars_paint(toilet, screenCoords.x, screenCoords.y, w, dpi, barColour, barBlink);
|
||||
window_guest_stats_bars_paint(toilet, screenCoords, w, dpi, barColour, barBlink);
|
||||
|
||||
// Time in park
|
||||
screenCoords.y += LIST_ROW_HEIGHT + 1;
|
||||
|
@ -1377,7 +1379,7 @@ void window_guest_stats_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
|
||||
screenCoords.y += LIST_ROW_HEIGHT + 9;
|
||||
gfx_fill_rect_inset(
|
||||
dpi, screenCoords.x, screenCoords.y - 6, screenCoords.x + 179, screenCoords.y - 5, w->colours[1],
|
||||
dpi, { screenCoords - ScreenCoordsXY{ 0, 6 }, screenCoords + ScreenCoordsXY{ 179, -5 } }, w->colours[1],
|
||||
INSET_RECT_FLAG_BORDER_INSET);
|
||||
|
||||
// Preferred Ride
|
||||
|
@ -1664,7 +1666,7 @@ void window_guest_finance_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
}
|
||||
|
||||
gfx_fill_rect_inset(
|
||||
dpi, screenCoords.x, screenCoords.y - 6, screenCoords.x + 179, screenCoords.y - 5, w->colours[1],
|
||||
dpi, { screenCoords - ScreenCoordsXY{ 0, 6 }, screenCoords + ScreenCoordsXY{ 179, -5 } }, w->colours[1],
|
||||
INSET_RECT_FLAG_BORDER_INSET);
|
||||
|
||||
// Paid to enter
|
||||
|
|
|
@ -855,7 +855,8 @@ static void window_multiplayer_groups_paint(rct_window* w, rct_drawpixelinfo* dp
|
|||
screenPos.y += 20;
|
||||
|
||||
gfx_fill_rect_inset(
|
||||
dpi, screenPos.x, screenPos.y - 6, screenPos.x + 310, screenPos.y - 5, w->colours[1], INSET_RECT_FLAG_BORDER_INSET);
|
||||
dpi, { screenPos - ScreenCoordsXY{ 0, 6 }, screenPos + ScreenCoordsXY{ 310, -5 } }, w->colours[1],
|
||||
INSET_RECT_FLAG_BORDER_INSET);
|
||||
|
||||
widget = &window_multiplayer_groups_widgets[WIDX_SELECTED_GROUP];
|
||||
group = network_get_group_index(_selectedGroup);
|
||||
|
|
|
@ -175,7 +175,7 @@ static void window_music_credits_scrollpaint(rct_window* w, rct_drawpixelinfo* d
|
|||
|
||||
// Draw the separator
|
||||
screenCoords.y += 5;
|
||||
gfx_fill_rect_inset(dpi, 4, screenCoords.y, 484, screenCoords.y + 1, w->colours[1], INSET_RECT_FLAG_BORDER_INSET);
|
||||
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++)
|
||||
|
|
|
@ -926,7 +926,7 @@ static void window_park_rating_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
// Graph
|
||||
screenPos = w->windowPos + ScreenCoordsXY{ widget->left + 47, widget->top + 26 };
|
||||
|
||||
Graph::Draw(dpi, gParkRatingHistory, 32, screenPos.x, screenPos.y);
|
||||
Graph::Draw(dpi, gParkRatingHistory, 32, screenPos);
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
@ -1062,7 +1062,7 @@ static void window_park_guests_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
// Graph
|
||||
screenPos = w->windowPos + ScreenCoordsXY{ widget->left + 47, widget->top + 26 };
|
||||
|
||||
Graph::Draw(dpi, gGuestsInParkHistory, 32, screenPos.x, screenPos.y);
|
||||
Graph::Draw(dpi, gGuestsInParkHistory, 32, screenPos);
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
|
|
@ -3692,9 +3692,8 @@ static void window_ride_locate_mechanic(rct_window* w)
|
|||
* rct2: 0x006B7D08
|
||||
*/
|
||||
static void window_ride_maintenance_draw_bar(
|
||||
rct_window* w, rct_drawpixelinfo* dpi, int32_t x, int32_t y, int32_t value, int32_t colour)
|
||||
rct_window* w, rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, int32_t value, int32_t colour)
|
||||
{
|
||||
ScreenCoordsXY coords{ x, y };
|
||||
gfx_fill_rect_inset(dpi, { coords, coords + ScreenCoordsXY{ 149, 8 } }, w->colours[1], INSET_RECT_F_30);
|
||||
if (colour & BAR_BLINK)
|
||||
{
|
||||
|
@ -4054,12 +4053,12 @@ static void window_ride_maintenance_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
uint16_t reliability = ride->reliability_percentage;
|
||||
DrawTextBasic(dpi, screenCoords, STR_RELIABILITY_LABEL_1757, &reliability);
|
||||
window_ride_maintenance_draw_bar(
|
||||
w, dpi, screenCoords.x + 103, screenCoords.y, std::max<int32_t>(10, reliability), COLOUR_BRIGHT_GREEN);
|
||||
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);
|
||||
window_ride_maintenance_draw_bar(w, dpi, screenCoords.x + 103, screenCoords.y, downTime, COLOUR_BRIGHT_RED);
|
||||
window_ride_maintenance_draw_bar(w, dpi, screenCoords + ScreenCoordsXY{ 103, 0 }, downTime, COLOUR_BRIGHT_RED);
|
||||
screenCoords.y += 26;
|
||||
|
||||
// Last inspection
|
||||
|
|
|
@ -694,8 +694,6 @@ void gfx_draw_dashed_line(
|
|||
|
||||
// rect
|
||||
void gfx_fill_rect(rct_drawpixelinfo* dpi, const ScreenRect& rect, int32_t colour);
|
||||
void gfx_fill_rect_inset(
|
||||
rct_drawpixelinfo* dpi, int16_t left, int16_t top, int16_t right, int16_t bottom, int32_t colour, uint8_t flags);
|
||||
void gfx_fill_rect_inset(rct_drawpixelinfo* dpi, const ScreenRect& rect, int32_t colour, uint8_t flags);
|
||||
void gfx_filter_rect(rct_drawpixelinfo* dpi, int32_t left, int32_t top, int32_t right, int32_t bottom, FilterPaletteID palette);
|
||||
void gfx_filter_rect(rct_drawpixelinfo* dpi, const ScreenRect& rect, FilterPaletteID palette);
|
||||
|
|
|
@ -140,9 +140,3 @@ void gfx_fill_rect_inset(rct_drawpixelinfo* dpi, const ScreenRect& rect, int32_t
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void gfx_fill_rect_inset(
|
||||
rct_drawpixelinfo* dpi, int16_t left, int16_t top, int16_t right, int16_t bottom, int32_t colour, uint8_t flags)
|
||||
{
|
||||
gfx_fill_rect_inset(dpi, { left, top, right, bottom }, colour, flags);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue