forked from rosebudai/OpenRCT2-Web
Refactor widgets state (#23621)
* Refactor windows to not share widget state * First half of refactoring all the windows * Refactor the remaining windows, compiles but has issues * Fix drawing only every second widget * Remove the need of an terminating widget * Address WidgetIndex signedness issues; use kWidgetIndexNull more * Address constexpr issue with Widget content union * Fix tabs in scenery window * Fix tabs in object selection window * Adjust custom widget index for CustomTool events * Use STR_NONE for default tooltip initialisation * Adjustment for mingw compiler * Fix bottom toolbar using the widget declaration not instance * Remove pointless code in Guest window, handled by SetPage * Prevent out of bounds crash * Move scroll widgets initialization to SetPage in Cheats window * Remove special logic in Options window * Remove special logic in Park window * Remove special logic for Player window * Remove special logic for Research window * Remove special logic for Ride window * Remove special logic for Staff window * Remove special logic for Finances window * Remove special logic for MapGen window * Remove special logic for editor objective options window * Remove special logic for editor scenario options window * Fix widgets not being set since page is initialized to 0 * Remove more redundant code * Fix remaining access to widget declarations * Remove unused variable * Fix editor object selection tabs on successive windows --------- Co-authored-by: Aaron van Geffen <aaron@aaronweb.net>
This commit is contained in:
1 parent
4dac6ff030
commit
b9f6b6f754
92 files changed
+574
-1022
No files matched your search
@@ -420,7 +420,7 @@ public:
|
||||
{
|
||||
auto rideIndex = intent.GetUIntExtra(INTENT_EXTRA_RIDE_ID);
|
||||
auto w = FindByClass(WindowClass::RideConstruction);
|
||||
if (w == nullptr || w->number != rideIndex)
|
||||
if (w == nullptr || w->number != static_cast<int16_t>(rideIndex))
|
||||
{
|
||||
WindowCloseConstructionWindows();
|
||||
_currentRideIndex = RideId::FromUnderlying(rideIndex);
|
||||
@@ -713,7 +713,7 @@ public:
|
||||
if (w->flags & WF_NO_BACKGROUND)
|
||||
{
|
||||
auto widgetIndex = FindWidgetFromPoint(*w.get(), screenCoords);
|
||||
if (widgetIndex == -1)
|
||||
if (widgetIndex == kWidgetIndexNull)
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -736,14 +736,10 @@ public:
|
||||
w.OnPrepareDraw();
|
||||
|
||||
// Find the widget at point x, y
|
||||
WidgetIndex widget_index = -1;
|
||||
for (int32_t i = 0;; i++)
|
||||
WidgetIndex widget_index = kWidgetIndexNull;
|
||||
for (auto i = 0u; i < w.widgets.size(); i++)
|
||||
{
|
||||
const auto& widget = w.widgets[i];
|
||||
if (widget.type == WindowWidgetType::Last)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (widget.type != WindowWidgetType::Empty && widget.IsVisible())
|
||||
{
|
||||
@@ -756,7 +752,7 @@ public:
|
||||
}
|
||||
|
||||
// Return next widget if a dropdown
|
||||
if (widget_index != -1)
|
||||
if (widget_index != kWidgetIndexNull)
|
||||
{
|
||||
const auto& widget = w.widgets[widget_index];
|
||||
if (widget.type == WindowWidgetType::DropdownMenu)
|
||||
|
||||
@@ -290,7 +290,7 @@ static void GameHandleInputMouse(const ScreenCoordsXY& screenCoords, MouseState
|
||||
// Get window and widget under cursor position
|
||||
w = windowMgr->FindFromPoint(screenCoords);
|
||||
widgetIndex = w == nullptr ? -1 : windowMgr->FindWidgetFromPoint(*w, screenCoords);
|
||||
widget = widgetIndex == -1 ? nullptr : &w->widgets[widgetIndex];
|
||||
widget = widgetIndex == kWidgetIndexNull ? nullptr : &w->widgets[widgetIndex];
|
||||
|
||||
switch (_inputState)
|
||||
{
|
||||
@@ -314,7 +314,7 @@ static void GameHandleInputMouse(const ScreenCoordsXY& screenCoords, MouseState
|
||||
w = WindowBringToFront(*w);
|
||||
}
|
||||
|
||||
if (widgetIndex != -1)
|
||||
if (widgetIndex != kWidgetIndexNull)
|
||||
{
|
||||
switch (widget->type)
|
||||
{
|
||||
@@ -960,7 +960,7 @@ static void InputWidgetOver(const ScreenCoordsXY& screenCoords, WindowBase* w, W
|
||||
|
||||
InputWidgetOverChangeCheck(windowClass, windowNumber, widgetIndex);
|
||||
|
||||
if (w != nullptr && widgetIndex != -1 && widget->type == WindowWidgetType::Scroll)
|
||||
if (w != nullptr && widgetIndex != kWidgetIndexNull && widget->type == WindowWidgetType::Scroll)
|
||||
{
|
||||
int32_t scroll_part, scrollId;
|
||||
ScreenCoordsXY newScreenCoords;
|
||||
@@ -987,7 +987,7 @@ static void InputWidgetOver(const ScreenCoordsXY& screenCoords, WindowBase* w, W
|
||||
static void InputWidgetOverChangeCheck(WindowClass windowClass, rct_windownumber windowNumber, WidgetIndex widgetIndex)
|
||||
{
|
||||
// Prevents invalid widgets being clicked source of bug is elsewhere
|
||||
if (widgetIndex == -1)
|
||||
if (widgetIndex == kWidgetIndexNull)
|
||||
return;
|
||||
|
||||
// Check if the widget that the cursor was over, has changed
|
||||
@@ -1051,7 +1051,7 @@ static void InputWidgetLeft(const ScreenCoordsXY& screenCoords, WindowBase* w, W
|
||||
return;
|
||||
|
||||
w = WindowBringToFront(*w);
|
||||
if (widgetIndex == -1)
|
||||
if (widgetIndex == kWidgetIndexNull)
|
||||
return;
|
||||
|
||||
if (windowClass != GetCurrentTextBox().window.classification || windowNumber != GetCurrentTextBox().window.number
|
||||
@@ -1097,7 +1097,6 @@ static void InputWidgetLeft(const ScreenCoordsXY& screenCoords, WindowBase* w, W
|
||||
case WindowWidgetType::Groupbox:
|
||||
case WindowWidgetType::ProgressBar:
|
||||
case WindowWidgetType::Placeholder:
|
||||
case WindowWidgetType::Last:
|
||||
// Non-interactive widget type
|
||||
break;
|
||||
case WindowWidgetType::ImgBtn:
|
||||
@@ -1149,7 +1148,7 @@ void ProcessMouseOver(const ScreenCoordsXY& screenCoords)
|
||||
if (window != nullptr)
|
||||
{
|
||||
WidgetIndex widgetId = windowMgr->FindWidgetFromPoint(*window, screenCoords);
|
||||
if (widgetId != -1)
|
||||
if (widgetId != kWidgetIndexNull)
|
||||
{
|
||||
switch (window->widgets[widgetId].type)
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "Widget.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <openrct2-ui/UiStringIds.h>
|
||||
#include <openrct2/Context.h>
|
||||
@@ -939,9 +940,11 @@ namespace OpenRCT2::Ui
|
||||
int32_t* output_scroll_area, int32_t* scroll_id)
|
||||
{
|
||||
*scroll_id = 0;
|
||||
for (Widget* iterator = w.widgets; iterator != widget; iterator++)
|
||||
auto itLast = std::find_if(
|
||||
w.widgets.begin(), w.widgets.end(), [&](auto& otherWidget) { return &otherWidget == widget; });
|
||||
for (auto it = w.widgets.begin(); it != itLast; it++)
|
||||
{
|
||||
if (iterator->type == WindowWidgetType::Scroll)
|
||||
if (it->type == WindowWidgetType::Scroll)
|
||||
{
|
||||
*scroll_id += 1;
|
||||
}
|
||||
@@ -1044,20 +1047,13 @@ namespace OpenRCT2::Ui
|
||||
|
||||
Widget* GetWidgetByIndex(const WindowBase& w, WidgetIndex widgetIndex)
|
||||
{
|
||||
// Make sure we don't go out of bounds if we are given a bad widget index
|
||||
WidgetIndex index = 0;
|
||||
for (auto* widget = w.widgets; widget->type != WindowWidgetType::Last; widget++)
|
||||
if (widgetIndex >= w.widgets.size())
|
||||
{
|
||||
if (index == widgetIndex)
|
||||
{
|
||||
return widget;
|
||||
}
|
||||
index++;
|
||||
LOG_ERROR("Widget index %i out of bounds for window class %u", widgetIndex, w.classification);
|
||||
}
|
||||
|
||||
LOG_ERROR("Widget index %i out of bounds for window class %u", widgetIndex, w.classification);
|
||||
|
||||
return nullptr;
|
||||
// FIXME: This const_cast is bad.
|
||||
return const_cast<Widget*>(w.widgets.data() + widgetIndex);
|
||||
}
|
||||
|
||||
static void SafeSetWidgetFlag(WindowBase& w, WidgetIndex widgetIndex, WidgetFlags mask, bool value)
|
||||
|
||||
@@ -30,7 +30,6 @@ namespace OpenRCT2::Ui
|
||||
ImageId GetColourButtonImage(colour_t colour);
|
||||
Widget* GetWidgetByIndex(const WindowBase& w, WidgetIndex widgetIndex);
|
||||
|
||||
constexpr auto kWidgetsEnd = Widget{ WindowWidgetType::Last, 0, 0, 0, 0, 0, 0, 0 };
|
||||
constexpr uint32_t kWidgetContentEmpty = 0xFFFFFFFF;
|
||||
constexpr auto kBarBlink = (1u << 31);
|
||||
constexpr uint8_t kScrollBarWidth = 10;
|
||||
|
||||
@@ -214,11 +214,10 @@ static ScreenCoordsXY GetCentrePositionForNewWindow(int32_t width, int32_t heigh
|
||||
|
||||
static int32_t WindowGetWidgetIndex(const WindowBase& w, Widget* widget)
|
||||
{
|
||||
int32_t i = 0;
|
||||
for (Widget* widget2 = w.widgets; widget2->type != WindowWidgetType::Last; widget2++, i++)
|
||||
if (widget == widget2)
|
||||
return i;
|
||||
return -1;
|
||||
const auto it = std::find_if(w.widgets.begin(), w.widgets.end(), [&](auto& otherWidget) { return &otherWidget == widget; });
|
||||
if (it == w.widgets.end())
|
||||
return -1;
|
||||
return std::distance(w.widgets.begin(), it);
|
||||
}
|
||||
|
||||
static int32_t WindowGetScrollIndex(const WindowBase& w, int32_t targetWidgetIndex)
|
||||
@@ -227,12 +226,12 @@ static int32_t WindowGetScrollIndex(const WindowBase& w, int32_t targetWidgetInd
|
||||
return -1;
|
||||
|
||||
int32_t scrollIndex = 0;
|
||||
WidgetIndex widgetIndex = 0;
|
||||
for (Widget* widget = w.widgets; widget->type != WindowWidgetType::Last; widget++, widgetIndex++)
|
||||
for (WidgetIndex widgetIndex = 0; widgetIndex < w.widgets.size(); widgetIndex++)
|
||||
{
|
||||
if (widgetIndex == targetWidgetIndex)
|
||||
break;
|
||||
if (widget->type == WindowWidgetType::Scroll)
|
||||
auto& widget = w.widgets[widgetIndex];
|
||||
if (widget.type == WindowWidgetType::Scroll)
|
||||
scrollIndex++;
|
||||
}
|
||||
|
||||
@@ -241,13 +240,14 @@ static int32_t WindowGetScrollIndex(const WindowBase& w, int32_t targetWidgetInd
|
||||
|
||||
static Widget* WindowGetScrollWidget(const WindowBase& w, int32_t scrollIndex)
|
||||
{
|
||||
for (Widget* widget = w.widgets; widget->type != WindowWidgetType::Last; widget++)
|
||||
for (WidgetIndex widgetIndex = 0; widgetIndex < w.widgets.size(); widgetIndex++)
|
||||
{
|
||||
if (widget->type != WindowWidgetType::Scroll)
|
||||
auto& widget = w.widgets[widgetIndex];
|
||||
if (widget.type != WindowWidgetType::Scroll)
|
||||
continue;
|
||||
|
||||
if (scrollIndex == 0)
|
||||
return widget;
|
||||
return const_cast<Widget*>(&widget);
|
||||
scrollIndex--;
|
||||
}
|
||||
|
||||
@@ -291,20 +291,21 @@ static void WindowScrollWheelInput(WindowBase& w, int32_t scrollIndex, int32_t w
|
||||
*/
|
||||
static int32_t WindowWheelInput(WindowBase& w, int32_t wheel)
|
||||
{
|
||||
int32_t i = 0;
|
||||
for (Widget* widget = w.widgets; widget->type != WindowWidgetType::Last; widget++)
|
||||
int32_t scrollIndex = 0;
|
||||
for (WidgetIndex widgetIndex = 0; widgetIndex < w.widgets.size(); widgetIndex++)
|
||||
{
|
||||
if (widget->type != WindowWidgetType::Scroll)
|
||||
const auto& widget = w.widgets[widgetIndex];
|
||||
if (widget.type != WindowWidgetType::Scroll)
|
||||
continue;
|
||||
|
||||
// Originally always checked first scroll view, bug maybe?
|
||||
const auto& scroll = w.scrolls[i];
|
||||
const auto& scroll = w.scrolls[scrollIndex];
|
||||
if (scroll.flags & (HSCROLLBAR_VISIBLE | VSCROLLBAR_VISIBLE))
|
||||
{
|
||||
WindowScrollWheelInput(w, i, wheel);
|
||||
WindowScrollWheelInput(w, scrollIndex, wheel);
|
||||
return 1;
|
||||
}
|
||||
i++;
|
||||
scrollIndex++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -450,7 +451,7 @@ void WindowAllWheelInput()
|
||||
|
||||
// Check scroll view, cursor is over
|
||||
WidgetIndex widgetIndex = windowMgr->FindWidgetFromPoint(*w, cursorState->position);
|
||||
if (widgetIndex != -1)
|
||||
if (widgetIndex != kWidgetIndexNull)
|
||||
{
|
||||
const auto& widget = w->widgets[widgetIndex];
|
||||
if (widget.type == WindowWidgetType::Scroll)
|
||||
@@ -490,13 +491,10 @@ void ApplyScreenSaverLockSetting()
|
||||
*/
|
||||
static void WindowInvalidatePressedImageButton(const WindowBase& w)
|
||||
{
|
||||
WidgetIndex widgetIndex;
|
||||
Widget* widget;
|
||||
|
||||
widgetIndex = 0;
|
||||
for (widget = w.widgets; widget->type != WindowWidgetType::Last; widget++, widgetIndex++)
|
||||
for (WidgetIndex widgetIndex = 0; widgetIndex < w.widgets.size(); widgetIndex++)
|
||||
{
|
||||
if (widget->type != WindowWidgetType::ImgBtn)
|
||||
auto& widget = w.widgets[widgetIndex];
|
||||
if (widget.type != WindowWidgetType::ImgBtn)
|
||||
continue;
|
||||
|
||||
if (WidgetIsPressed(w, widgetIndex) || isToolActive(w, widgetIndex))
|
||||
@@ -879,7 +877,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
WidgetInvalidate(*w, _currentTextBox.widget_index);
|
||||
}
|
||||
_currentTextBox.widget_index = static_cast<uint16_t>(WindowWidgetType::Last);
|
||||
_currentTextBox.widget_index = kWidgetIndexNull;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -958,14 +956,11 @@ namespace OpenRCT2::Ui::Windows
|
||||
void WindowUpdateScrollWidgets(WindowBase& w)
|
||||
{
|
||||
int32_t scrollIndex, width, height, scrollPositionChanged;
|
||||
WidgetIndex widgetIndex;
|
||||
Widget* widget;
|
||||
|
||||
widgetIndex = 0;
|
||||
scrollIndex = 0;
|
||||
for (widget = w.widgets; widget->type != WindowWidgetType::Last; widget++, widgetIndex++)
|
||||
for (WidgetIndex widgetIndex = 0; widgetIndex < w.widgets.size(); widgetIndex++)
|
||||
{
|
||||
if (widget->type != WindowWidgetType::Scroll)
|
||||
auto& widget = w.widgets[widgetIndex];
|
||||
if (widget.type != WindowWidgetType::Scroll)
|
||||
continue;
|
||||
|
||||
auto& scroll = w.scrolls[scrollIndex];
|
||||
@@ -985,13 +980,13 @@ namespace OpenRCT2::Ui::Windows
|
||||
height++;
|
||||
|
||||
scrollPositionChanged = 0;
|
||||
if ((widget->content & SCROLL_HORIZONTAL) && width != scroll.contentWidth)
|
||||
if ((widget.content & SCROLL_HORIZONTAL) && width != scroll.contentWidth)
|
||||
{
|
||||
scrollPositionChanged = 1;
|
||||
scroll.contentWidth = width;
|
||||
}
|
||||
|
||||
if ((widget->content & SCROLL_VERTICAL) && height != scroll.contentHeight)
|
||||
if ((widget.content & SCROLL_VERTICAL) && height != scroll.contentHeight)
|
||||
{
|
||||
scrollPositionChanged = 1;
|
||||
scroll.contentHeight = height;
|
||||
@@ -1011,16 +1006,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
*/
|
||||
void WindowInitScrollWidgets(WindowBase& w)
|
||||
{
|
||||
Widget* widget;
|
||||
int32_t widget_index, scroll_index;
|
||||
|
||||
widget_index = 0;
|
||||
scroll_index = 0;
|
||||
for (widget = w.widgets; widget->type != WindowWidgetType::Last; widget++)
|
||||
int32_t scroll_index{};
|
||||
for (WidgetIndex widgetIndex = 0; widgetIndex < w.widgets.size(); widgetIndex++)
|
||||
{
|
||||
if (widget->type != WindowWidgetType::Scroll)
|
||||
auto& widget = w.widgets[widgetIndex];
|
||||
if (widget.type != WindowWidgetType::Scroll)
|
||||
{
|
||||
widget_index++;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1032,14 +1023,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
scroll.contentOffsetY = 0;
|
||||
scroll.contentHeight = scrollSize.height + 1;
|
||||
|
||||
if (widget->content & SCROLL_HORIZONTAL)
|
||||
if (widget.content & SCROLL_HORIZONTAL)
|
||||
scroll.flags |= HSCROLLBAR_VISIBLE;
|
||||
if (widget->content & SCROLL_VERTICAL)
|
||||
if (widget.content & SCROLL_VERTICAL)
|
||||
scroll.flags |= VSCROLLBAR_VISIBLE;
|
||||
|
||||
WidgetScrollUpdateThumbs(w, widget_index);
|
||||
|
||||
widget_index++;
|
||||
WidgetScrollUpdateThumbs(w, widgetIndex);
|
||||
scroll_index++;
|
||||
}
|
||||
}
|
||||
@@ -1312,30 +1301,27 @@ namespace OpenRCT2::Ui::Windows
|
||||
*/
|
||||
void WindowDrawWidgets(WindowBase& w, DrawPixelInfo& dpi)
|
||||
{
|
||||
Widget* widget;
|
||||
WidgetIndex widgetIndex;
|
||||
|
||||
if ((w.flags & WF_TRANSPARENT) && !(w.flags & WF_NO_BACKGROUND))
|
||||
GfxFilterRect(
|
||||
dpi, { w.windowPos, w.windowPos + ScreenCoordsXY{ w.width - 1, w.height - 1 } }, FilterPaletteID::Palette51);
|
||||
|
||||
// todo: some code missing here? Between 006EB18C and 006EB260
|
||||
|
||||
widgetIndex = 0;
|
||||
for (widget = w.widgets; widget->type != WindowWidgetType::Last; widget++)
|
||||
for (WidgetIndex widgetIndex = 0; widgetIndex < w.widgets.size(); widgetIndex++)
|
||||
{
|
||||
if (widget->IsVisible())
|
||||
auto& widget = w.widgets[widgetIndex];
|
||||
if (!widget.IsVisible())
|
||||
{
|
||||
// Check if widget is outside the draw region
|
||||
if (w.windowPos.x + widget->left < dpi.x + dpi.width && w.windowPos.x + widget->right >= dpi.x)
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if widget is outside the draw region
|
||||
if (w.windowPos.x + widget.left < dpi.x + dpi.width && w.windowPos.x + widget.right >= dpi.x)
|
||||
{
|
||||
if (w.windowPos.y + widget.top < dpi.y + dpi.height && w.windowPos.y + widget.bottom >= dpi.y)
|
||||
{
|
||||
if (w.windowPos.y + widget->top < dpi.y + dpi.height && w.windowPos.y + widget->bottom >= dpi.y)
|
||||
{
|
||||
w.OnDrawWidget(widgetIndex, dpi);
|
||||
}
|
||||
w.OnDrawWidget(widgetIndex, dpi);
|
||||
}
|
||||
}
|
||||
widgetIndex++;
|
||||
}
|
||||
|
||||
// todo: something missing here too? Between 006EC32B and 006EC369
|
||||
|
||||
@@ -833,13 +833,14 @@ std::optional<RowColumn> CustomListView::GetItemIndexAt(const ScreenCoordsXY& po
|
||||
Widget* CustomListView::GetWidget() const
|
||||
{
|
||||
size_t scrollIndex = 0;
|
||||
for (auto widget = ParentWindow->widgets; widget->type != WindowWidgetType::Last; widget++)
|
||||
for (WidgetIndex widgetIndex = 0; widgetIndex < ParentWindow->widgets.size(); widgetIndex++)
|
||||
{
|
||||
if (widget->type == WindowWidgetType::Scroll)
|
||||
auto& widget = ParentWindow->widgets[widgetIndex];
|
||||
if (widget.type == WindowWidgetType::Scroll)
|
||||
{
|
||||
if (scrollIndex == ScrollIndex)
|
||||
{
|
||||
return widget;
|
||||
return &widget;
|
||||
}
|
||||
scrollIndex++;
|
||||
}
|
||||
|
||||
@@ -272,9 +272,10 @@ namespace OpenRCT2::Scripting
|
||||
auto toolbarWindow = windowMgr->FindByClass(WindowClass::TopToolbar);
|
||||
if (toolbarWindow != nullptr)
|
||||
{
|
||||
// Use a widget that does not exist on top toolbar but also make sure it isn't -1 as that
|
||||
// prevents abort from being called.
|
||||
WidgetIndex widgetIndex = -2;
|
||||
// Use a widget that does not exist on top toolbar but also make sure it isn't
|
||||
// kWidgetIndexNull, as that prevents abort from being called.
|
||||
// TODO: refactor this to not leech on the top toolbar.
|
||||
WidgetIndex widgetIndex = 0xFFFE;
|
||||
ToolCancel();
|
||||
ToolSet(*toolbarWindow, widgetIndex, static_cast<Tool>(customTool.Cursor));
|
||||
ActiveCustomTool = std::move(customTool);
|
||||
|
||||
@@ -474,9 +474,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
// Since the plugin may alter widget positions and sizes during an update event,
|
||||
// we need to force an update for all list view scrollbars
|
||||
WidgetIndex widgetIndex = 0;
|
||||
for (auto widget = widgets; widget->type != WindowWidgetType::Last; widget++)
|
||||
for (auto& widget : widgets)
|
||||
{
|
||||
if (widget->type == WindowWidgetType::Scroll)
|
||||
if (widget.type == WindowWidgetType::Scroll)
|
||||
{
|
||||
WidgetScrollUpdateThumbs(*this, widgetIndex);
|
||||
}
|
||||
@@ -511,13 +511,13 @@ namespace OpenRCT2::Ui::Windows
|
||||
ft.Add<const char*>(desc.Title.c_str());
|
||||
|
||||
size_t scrollIndex = 0;
|
||||
for (auto widget = widgets; widget->type != WindowWidgetType::Last; widget++)
|
||||
for (const auto& widget : widgets)
|
||||
{
|
||||
if (widget->type == WindowWidgetType::Scroll)
|
||||
if (widget.type == WindowWidgetType::Scroll)
|
||||
{
|
||||
auto& listView = _info.ListViews[scrollIndex];
|
||||
auto wwidth = widget->width() + 1 - 2;
|
||||
auto wheight = widget->height() + 1 - 2;
|
||||
auto wwidth = widget.width() + 1 - 2;
|
||||
auto wheight = widget.height() + 1 - 2;
|
||||
if (listView.GetScrollbars() == ScrollbarType::Horizontal
|
||||
|| listView.GetScrollbars() == ScrollbarType::Both)
|
||||
{
|
||||
@@ -780,9 +780,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
std::optional<WidgetIndex> GetViewportWidgetIndex()
|
||||
{
|
||||
WidgetIndex widgetIndex = 0;
|
||||
for (auto widget = widgets; widget->type != WindowWidgetType::Last; widget++)
|
||||
for (auto& widget : widgets)
|
||||
{
|
||||
if (widget->type == WindowWidgetType::Viewport)
|
||||
if (widget.type == WindowWidgetType::Viewport)
|
||||
{
|
||||
return widgetIndex;
|
||||
}
|
||||
@@ -943,8 +943,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
}
|
||||
|
||||
widgetList.push_back(kWidgetsEnd);
|
||||
widgets = widgetList.data();
|
||||
SetWidgets(widgetList);
|
||||
|
||||
WindowInitScrollWidgets(*this);
|
||||
UpdateViewport();
|
||||
|
||||
@@ -117,8 +117,6 @@ namespace OpenRCT2::Scripting
|
||||
return "progress_bar";
|
||||
case WindowWidgetType::Custom:
|
||||
return "custom";
|
||||
case WindowWidgetType::Last:
|
||||
return "last";
|
||||
}
|
||||
}
|
||||
return "unknown";
|
||||
|
||||
@@ -218,11 +218,9 @@ namespace OpenRCT2::Scripting
|
||||
auto w = GetWindow();
|
||||
if (w != nullptr)
|
||||
{
|
||||
WidgetIndex widgetIndex = 0;
|
||||
for (auto widget = w->widgets; widget->type != WindowWidgetType::Last; widget++)
|
||||
for (WidgetIndex widgetIndex = 0; widgetIndex < w->widgets.size(); widgetIndex++)
|
||||
{
|
||||
result.push_back(ScWidget::ToDukValue(ctx, w, widgetIndex));
|
||||
widgetIndex++;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeRemapWidget({ 94, 17 }, { 91, TABHEIGHT - 16 }, WindowWidgetType::Tab, WindowColour::Secondary, SPR_TAB_LARGE)
|
||||
|
||||
// clang-format off
|
||||
static Widget _windowAboutOpenRCT2Widgets[] = {
|
||||
static constexpr Widget _windowAboutOpenRCT2Widgets[] = {
|
||||
WIDGETS_MAIN,
|
||||
MakeWidget({10, 60}, {WW - 20, 20}, WindowWidgetType::LabelCentred, WindowColour::Secondary, STR_ABOUT_OPENRCT2_DESCRIPTION), // Introduction
|
||||
MakeWidget({30, 90}, {128, 128}, WindowWidgetType::Placeholder, WindowColour::Secondary, STR_NONE), // OpenRCT2 Logo
|
||||
@@ -73,16 +73,14 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({168, 115 + 40}, {200, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_CHANGELOG_ELLIPSIS), // changelog button
|
||||
MakeWidget({168, 115 + 60}, {200, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_JOIN_DISCORD ), // "join discord" button
|
||||
MakeWidget({168, 115 + 80}, {200, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_CONTRIBUTORS_WINDOW_BUTTON), // "contributors" button
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static Widget _windowAboutRCT2Widgets[] = {
|
||||
static constexpr Widget _windowAboutRCT2Widgets[] = {
|
||||
WIDGETS_MAIN,
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget* _windowAboutPageWidgets[] = {
|
||||
static constexpr std::span<const Widget> _windowAboutPageWidgets[] = {
|
||||
_windowAboutOpenRCT2Widgets,
|
||||
_windowAboutRCT2Widgets,
|
||||
};
|
||||
@@ -92,9 +90,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _windowAboutOpenRCT2Widgets;
|
||||
|
||||
WindowInitScrollWidgets(*this);
|
||||
SetPage(WINDOW_ABOUT_PAGE_OPENRCT2);
|
||||
}
|
||||
|
||||
@@ -174,7 +169,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
page = p;
|
||||
frame_no = 0;
|
||||
pressed_widgets = 0;
|
||||
widgets = _windowAboutPageWidgets[p];
|
||||
SetWidgets(_windowAboutPageWidgets[p]);
|
||||
|
||||
switch (p)
|
||||
{
|
||||
@@ -186,7 +181,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
break;
|
||||
}
|
||||
|
||||
WindowInitScrollWidgets(*this);
|
||||
InitScrollWidgets();
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
@@ -215,7 +210,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (OpenRCT2::GetContext()->HasNewVersionInfo())
|
||||
{
|
||||
widgets[WIDX_NEW_VERSION].type = WindowWidgetType::Button;
|
||||
_windowAboutOpenRCT2Widgets[WIDX_NEW_VERSION].type = WindowWidgetType::Button;
|
||||
}
|
||||
|
||||
// Draw the rest of the text
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget WindowAssetPacksWidgets[] = {
|
||||
static constexpr Widget WindowAssetPacksWidgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({ 0, 0 }, { 0, 0 }, WindowWidgetType::LabelCentred, WindowColour::Secondary, STR_HIGH_PRIORITY),
|
||||
MakeWidget({ 0, 0 }, { 0, 147 }, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL),
|
||||
@@ -48,7 +48,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({ 0, 0 }, { 0, 0 }, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_ARROW_UP), STR_INCREASE_PRIOTITY_TIP),
|
||||
MakeWidget({ 0, 0 }, { 0, 0 }, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_ARROW_DOWN), STR_DECREASE_PRIOTITY_TIP),
|
||||
MakeWidget({ 0, 0 }, { 0, 0 }, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_RELOAD), STR_RELOAD_ASSET_PACKS_TIP),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -63,7 +62,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = WindowAssetPacksWidgets;
|
||||
SetWidgets(WindowAssetPacksWidgets);
|
||||
WindowInitScrollWidgets(*this);
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
STR_TEXT_COLOUR_PALESILVER,
|
||||
};
|
||||
|
||||
static Widget window_banner_widgets[] = {
|
||||
static constexpr Widget window_banner_widgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({ 3, 17}, {85, 60}, WindowWidgetType::Viewport, WindowColour::Secondary, 0x0FFFFFFFE ), // tab content panel
|
||||
MakeWidget({WW - 25, 19}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RENAME), STR_CHANGE_BANNER_TEXT_TIP ), // change banner button
|
||||
@@ -72,7 +72,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({ 5, WH - 16}, {12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_MAIN_SIGN_COLOUR_TIP), // high money
|
||||
MakeWidget({ 43, WH - 16}, {39, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // high money
|
||||
MakeWidget({ 70, WH - 15}, {11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_TEXT_COLOUR_TIP ), // high money
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -83,10 +82,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void CreateViewport()
|
||||
{
|
||||
Widget* viewportWidget = &window_banner_widgets[WIDX_VIEWPORT];
|
||||
const auto& viewportWidget = window_banner_widgets[WIDX_VIEWPORT];
|
||||
ViewportCreate(
|
||||
this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 },
|
||||
(viewportWidget->width()) - 1, (viewportWidget->height()) - 1, Focus(_bannerViewPos));
|
||||
this, windowPos + ScreenCoordsXY{ viewportWidget.left + 1, viewportWidget.top + 1 },
|
||||
(viewportWidget.width()) - 1, (viewportWidget.height()) - 1, Focus(_bannerViewPos));
|
||||
|
||||
if (viewport != nullptr)
|
||||
viewport->flags = Config::Get().general.AlwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : VIEWPORT_FLAG_NONE;
|
||||
@@ -131,7 +130,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_banner_widgets;
|
||||
SetWidgets(window_banner_widgets);
|
||||
WindowInitScrollWidgets(*this);
|
||||
}
|
||||
|
||||
@@ -279,13 +278,13 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
return;
|
||||
}
|
||||
Widget* colourBtn = &window_banner_widgets[WIDX_MAIN_COLOUR];
|
||||
colourBtn->type = WindowWidgetType::Empty;
|
||||
Widget& colourBtn = widgets[WIDX_MAIN_COLOUR];
|
||||
colourBtn.type = WindowWidgetType::Empty;
|
||||
|
||||
auto* bannerEntry = OpenRCT2::ObjectManager::GetObjectEntry<BannerSceneryEntry>(banner->type);
|
||||
if (bannerEntry != nullptr && (bannerEntry->flags & BANNER_ENTRY_FLAG_HAS_PRIMARY_COLOUR))
|
||||
{
|
||||
colourBtn->type = WindowWidgetType::ColourBtn;
|
||||
colourBtn.type = WindowWidgetType::ColourBtn;
|
||||
}
|
||||
pressed_widgets &= ~(1uLL << WIDX_BANNER_NO_ENTRY);
|
||||
disabled_widgets &= ~(
|
||||
@@ -296,9 +295,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
disabled_widgets |= (1uLL << WIDX_BANNER_TEXT) | (1uLL << WIDX_TEXT_COLOUR_DROPDOWN)
|
||||
| (1uLL << WIDX_TEXT_COLOUR_DROPDOWN_BUTTON);
|
||||
}
|
||||
colourBtn->image = GetColourButtonImage(banner->colour);
|
||||
Widget* dropDownWidget = &window_banner_widgets[WIDX_TEXT_COLOUR_DROPDOWN];
|
||||
dropDownWidget->text = BannerColouredTextFormats[banner->text_colour];
|
||||
colourBtn.image = GetColourButtonImage(banner->colour);
|
||||
Widget& dropDownWidget = widgets[WIDX_TEXT_COLOUR_DROPDOWN];
|
||||
dropDownWidget.text = BannerColouredTextFormats[banner->text_colour];
|
||||
}
|
||||
|
||||
void OnResize() override
|
||||
|
||||
@@ -47,7 +47,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({0, 14}, {500, 382}, WindowWidgetType::Resize, WindowColour::Secondary ), // content panel
|
||||
MakeWidget({3, 16}, {495, 366}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_BOTH ), // scroll area
|
||||
MakeWidget({3, 473}, {300, 14}, WindowWidgetType::Placeholder, WindowColour::Secondary, STR_NEW_RELEASE_DOWNLOAD_PAGE), // changelog button
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -125,7 +124,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _windowChangelogWidgets;
|
||||
SetWidgets(_windowChangelogWidgets);
|
||||
|
||||
WindowInitScrollWidgets(*this);
|
||||
min_width = MIN_WW;
|
||||
|
||||
@@ -219,7 +219,7 @@ static constexpr int32_t TAB_START = 3;
|
||||
MakeTab ({158, 17}, STR_RIDE_CHEATS_TIP ), /* tab 4 */ \
|
||||
MakeTab ({189, 17}, STR_WEATHER_NATURE_CHEATS_TIP ) /* tab 7 */
|
||||
|
||||
static Widget window_cheats_money_widgets[] =
|
||||
static constexpr Widget window_cheats_money_widgets[] =
|
||||
{
|
||||
MAIN_CHEATS_WIDGETS,
|
||||
MakeWidget ({ 11, 48}, CHEAT_BUTTON, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MAKE_PARK_NO_MONEY), // No money
|
||||
@@ -228,10 +228,9 @@ static Widget window_cheats_money_widgets[] =
|
||||
MakeWidget ({ 11, 111}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_ADD_MONEY ), // add money
|
||||
MakeWidget ({127, 111}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_SET_MONEY ), // set money
|
||||
MakeWidget ({ 11, 145}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_CLEAR_LOAN ), // Clear loan
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget window_cheats_date_widgets[] =
|
||||
static constexpr Widget window_cheats_date_widgets[] =
|
||||
{
|
||||
MAIN_CHEATS_WIDGETS,
|
||||
MakeWidget ({ 5, 48}, {238, 99} , WindowWidgetType::Groupbox, WindowColour::Secondary, STR_DATE_SET ), // Date group
|
||||
@@ -240,10 +239,9 @@ static Widget window_cheats_date_widgets[] =
|
||||
MakeSpinnerWidgets({120, 103}, CHEAT_SPINNER, WindowWidgetType::Spinner, WindowColour::Secondary ), // Day box
|
||||
MakeWidget ({ 11, 122}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_DATE_SET ), // Set Date
|
||||
MakeWidget ({127, 122}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_DATE_RESET), // Reset Date
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget window_cheats_guests_widgets[] =
|
||||
static constexpr Widget window_cheats_guests_widgets[] =
|
||||
{
|
||||
MAIN_CHEATS_WIDGETS,
|
||||
MakeWidget({ 11, 48}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_LARGE_TRAM_GUESTS, STR_CHEAT_LARGE_TRAM_GUESTS_TIP), // large tram
|
||||
@@ -278,11 +276,9 @@ static Widget window_cheats_guests_widgets[] =
|
||||
MakeWidget({ 11, 380+1}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_IGNORE_PRICE, STR_CHEAT_IGNORE_PRICE_TIP ), // guests ignore price
|
||||
MakeWidget({ 11, 397+1}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_DISABLE_VANDALISM, STR_CHEAT_DISABLE_VANDALISM_TIP), // disable vandalism
|
||||
MakeWidget({ 11, 414+1}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_DISABLE_LITTERING, STR_CHEAT_DISABLE_LITTERING_TIP), // disable littering
|
||||
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget window_cheats_staff_widgets[] =
|
||||
static constexpr Widget window_cheats_staff_widgets[] =
|
||||
{
|
||||
MAIN_CHEATS_WIDGETS,
|
||||
MakeWidget ({ 5, 357-309}, {238, 35}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CHEAT_STAFF_GROUP ), // Staff group
|
||||
@@ -296,11 +292,9 @@ static Widget window_cheats_staff_widgets[] =
|
||||
MakeWidget ({127, 292-168}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_MOWED_GRASS ), // Mowed grass
|
||||
MakeWidget ({ 11, 313-168}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_WATER_PLANTS ), // Water plants
|
||||
MakeWidget ({ 11, 334-164}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_DISABLE_PLANT_AGING, STR_CHEAT_DISABLE_PLANT_AGING_TIP ), // Disable plant ageing
|
||||
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget window_cheats_park_widgets[] =
|
||||
static constexpr Widget window_cheats_park_widgets[] =
|
||||
{
|
||||
MAIN_CHEATS_WIDGETS,
|
||||
MakeWidget ({ 5, 48}, {238, 60}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CHEAT_GENERAL_GROUP ), // General group
|
||||
@@ -319,11 +313,9 @@ static Widget window_cheats_park_widgets[] =
|
||||
MakeWidget ({ 11, 207}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_BUILD_IN_PAUSE_MODE, STR_CHEAT_BUILD_IN_PAUSE_MODE_TIP ), // Build in pause mode
|
||||
MakeWidget ({ 11, 224}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_ALLOW_PATH_AS_QUEUE, STR_CHEAT_ALLOW_PATH_AS_QUEUE_TIP ), // Allow regular footpaths as queue path
|
||||
MakeWidget ({ 11, 241}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_ALLOW_SPECIAL_COLOUR_SCHEMES, STR_CHEAT_ALLOW_SPECIAL_COLOUR_SCHEMES_TIP), // Allow special colours in dropdown
|
||||
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget window_cheats_rides_widgets[] =
|
||||
static constexpr Widget window_cheats_rides_widgets[] =
|
||||
{
|
||||
MAIN_CHEATS_WIDGETS,
|
||||
MakeWidget({ 11, 48}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CHEAT_FIX_ALL_RIDES, STR_CHEAT_FIX_ALL_RIDES_TIP ), // Fix all rides
|
||||
@@ -349,10 +341,9 @@ static Widget window_cheats_rides_widgets[] =
|
||||
MakeWidget({ 11, 325}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_SHOW_VEHICLES_FROM_OTHER_TRACK_TYPES ), // Show vehicles from other track types
|
||||
MakeWidget({ 11, 342}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_DISABLE_TRAIN_LENGTH_LIMIT, STR_CHEAT_DISABLE_TRAIN_LENGTH_LIMIT_TIP ), // Disable train length limits
|
||||
MakeWidget({ 11, 359}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_IGNORE_RESEARCH_STATUS, STR_CHEAT_IGNORE_RESEARCH_STATUS_TIP ), // Ignore Research Status
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget window_cheats_weather_widgets[] =
|
||||
static constexpr Widget window_cheats_weather_widgets[] =
|
||||
{
|
||||
MAIN_CHEATS_WIDGETS,
|
||||
MakeWidget ({ 5, 48}, {238, 50}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CHEAT_WEATHER_GROUP ), // Weather group
|
||||
@@ -362,10 +353,9 @@ static Widget window_cheats_weather_widgets[] =
|
||||
MakeWidget ({ 5, 102}, {238, 37}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_FAUNA ), // Fauna group
|
||||
MakeWidget ({ 11, 115}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_CREATE_DUCKS, STR_CREATE_DUCKS_TIP ), // Create ducks
|
||||
MakeWidget ({127, 115}, CHEAT_BUTTON, WindowWidgetType::Button, WindowColour::Secondary, STR_REMOVE_DUCKS, STR_REMOVE_DUCKS_TIP ), // Remove ducks
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget *window_cheats_page_widgets[] =
|
||||
static constexpr std::span<const Widget> window_cheats_page_widgets[] =
|
||||
{
|
||||
window_cheats_money_widgets,
|
||||
window_cheats_date_widgets,
|
||||
@@ -512,13 +502,6 @@ static StringId window_cheats_page_titles[] = {
|
||||
|
||||
void OnPrepareDraw() override
|
||||
{
|
||||
auto* targetWidgets = window_cheats_page_widgets[page];
|
||||
if (widgets != targetWidgets)
|
||||
{
|
||||
widgets = targetWidgets;
|
||||
WindowInitScrollWidgets(*this);
|
||||
}
|
||||
|
||||
pressed_widgets = 0;
|
||||
disabled_widgets = 0;
|
||||
|
||||
@@ -592,11 +575,16 @@ static StringId window_cheats_page_titles[] = {
|
||||
}
|
||||
|
||||
// Current weather
|
||||
window_cheats_weather_widgets[WIDX_WEATHER].text = WeatherTypes[EnumValue(gameState.ClimateCurrent.Weather)];
|
||||
if (page == WINDOW_CHEATS_PAGE_WEATHER)
|
||||
{
|
||||
widgets[WIDX_WEATHER].text = WeatherTypes[EnumValue(gameState.ClimateCurrent.Weather)];
|
||||
}
|
||||
|
||||
// Staff speed
|
||||
window_cheats_staff_widgets[WIDX_STAFF_SPEED].text = _staffSpeedNames[EnumValue(
|
||||
gameState.Cheats.selectedStaffSpeed)];
|
||||
if (page == WINDOW_CHEATS_PAGE_STAFF)
|
||||
{
|
||||
widgets[WIDX_STAFF_SPEED].text = _staffSpeedNames[EnumValue(gameState.Cheats.selectedStaffSpeed)];
|
||||
}
|
||||
|
||||
if (gScreenFlags & SCREEN_FLAGS_EDITOR)
|
||||
{
|
||||
@@ -753,18 +741,18 @@ static StringId window_cheats_page_titles[] = {
|
||||
|
||||
hold_down_widgets = window_cheats_page_hold_down_widgets[p];
|
||||
pressed_widgets = 0;
|
||||
widgets = window_cheats_page_widgets[p];
|
||||
SetWidgets(window_cheats_page_widgets[p]);
|
||||
|
||||
auto maxY = 0;
|
||||
auto* widget = &widgets[WIDX_TAB_CONTENT];
|
||||
while (widget->type != WindowWidgetType::Last)
|
||||
for (WidgetIndex widgetIdx = WIDX_TAB_CONTENT; widgetIdx < widgets.size(); widgetIdx++)
|
||||
{
|
||||
maxY = std::max<int32_t>(maxY, widget->bottom);
|
||||
widget++;
|
||||
auto& widget = widgets[widgetIdx];
|
||||
maxY = std::max<int32_t>(maxY, widget.bottom);
|
||||
}
|
||||
maxY += 6;
|
||||
|
||||
Invalidate();
|
||||
WindowInitScrollWidgets(*this);
|
||||
height = maxY;
|
||||
widgets[WIDX_BACKGROUND].bottom = maxY - 1;
|
||||
widgets[WIDX_PAGE_BACKGROUND].bottom = maxY - 1;
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
static constexpr ScreenSize CLEAR_SCENERY_BUTTON = { 24, 24 };
|
||||
|
||||
static Widget window_clear_scenery_widgets[] = {
|
||||
static constexpr Widget window_clear_scenery_widgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget(
|
||||
{ 27, 17 }, { 44, 32 }, WindowWidgetType::ImgBtn, WindowColour::Primary, SPR_LAND_TOOL_SIZE_0,
|
||||
@@ -64,7 +64,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeRemapWidget(
|
||||
{ 67, 53 }, CLEAR_SCENERY_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_BUTTON_FOOTPATH,
|
||||
STR_CLEAR_SCENERY_REMOVE_FOOTPATHS_TIP), // footpaths
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
class CleanSceneryWindow final : public Window
|
||||
@@ -78,7 +77,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_clear_scenery_widgets;
|
||||
SetWidgets(window_clear_scenery_widgets);
|
||||
hold_down_widgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT);
|
||||
WindowInitScrollWidgets(*this);
|
||||
WindowPushOthersBelow(*this);
|
||||
@@ -178,7 +177,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
| (_clearLargeScenery ? (1uLL << WIDX_LARGE_SCENERY) : 0) | (_clearFootpath ? (1uLL << WIDX_FOOTPATH) : 0);
|
||||
|
||||
// Update the preview image (for tool sizes up to 7)
|
||||
window_clear_scenery_widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize));
|
||||
widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize));
|
||||
}
|
||||
|
||||
void OnDraw(DrawPixelInfo& dpi) override
|
||||
@@ -186,8 +185,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
DrawWidgets(dpi);
|
||||
|
||||
// Draw number for tool sizes bigger than 7
|
||||
ScreenCoordsXY screenCoords = { windowPos.x + window_clear_scenery_widgets[WIDX_PREVIEW].midX(),
|
||||
windowPos.y + window_clear_scenery_widgets[WIDX_PREVIEW].midY() };
|
||||
ScreenCoordsXY screenCoords = { windowPos.x + widgets[WIDX_PREVIEW].midX(),
|
||||
windowPos.y + widgets[WIDX_PREVIEW].midY() };
|
||||
if (gLandToolSize > kLandToolMaximumSizeWithSprite)
|
||||
{
|
||||
auto ft = Formatter();
|
||||
@@ -202,8 +201,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<money64>(_clearSceneryCost);
|
||||
screenCoords.x = window_clear_scenery_widgets[WIDX_PREVIEW].midX() + windowPos.x;
|
||||
screenCoords.y = window_clear_scenery_widgets[WIDX_PREVIEW].bottom + windowPos.y + 5 + 27;
|
||||
screenCoords.x = widgets[WIDX_PREVIEW].midX() + windowPos.x;
|
||||
screenCoords.y = widgets[WIDX_PREVIEW].bottom + windowPos.y + 5 + 27;
|
||||
DrawTextBasic(dpi, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::CENTRE });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget ({120, 50}, { 81, 11}, WindowWidgetType::Button, WindowColour::Secondary, STR_EMPTY ),
|
||||
MakeWidget ({220, 50}, {131, 11}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ),
|
||||
MakeWidget ({339, 51}, { 11, 9}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -54,7 +53,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_custom_currency_widgets;
|
||||
SetWidgets(window_custom_currency_widgets);
|
||||
hold_down_widgets = (1uLL << WIDX_RATE_UP) | (1uLL << WIDX_RATE_DOWN);
|
||||
WindowInitScrollWidgets(*this);
|
||||
colours[0] = COLOUR_LIGHT_BROWN;
|
||||
@@ -208,15 +207,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
DrawTextBasic(dpi, screenCoords, STR_CURRENCY_SYMBOL_TEXT, {}, { colours[1] });
|
||||
|
||||
screenCoords = windowPos
|
||||
+ ScreenCoordsXY{ window_custom_currency_widgets[WIDX_SYMBOL_TEXT].left + 1,
|
||||
window_custom_currency_widgets[WIDX_SYMBOL_TEXT].top };
|
||||
screenCoords = windowPos + ScreenCoordsXY{ widgets[WIDX_SYMBOL_TEXT].left + 1, widgets[WIDX_SYMBOL_TEXT].top };
|
||||
|
||||
DrawText(dpi, screenCoords, { colours[1] }, CurrencyDescriptors[EnumValue(CurrencyType::Custom)].symbol_unicode);
|
||||
|
||||
auto drawPos = windowPos
|
||||
+ ScreenCoordsXY{ window_custom_currency_widgets[WIDX_AFFIX_DROPDOWN].left + 1,
|
||||
window_custom_currency_widgets[WIDX_AFFIX_DROPDOWN].top };
|
||||
+ ScreenCoordsXY{ widgets[WIDX_AFFIX_DROPDOWN].left + 1, widgets[WIDX_AFFIX_DROPDOWN].top };
|
||||
StringId stringId = (CurrencyDescriptors[EnumValue(CurrencyType::Custom)].affix_unicode == CurrencyAffix::Prefix)
|
||||
? STR_PREFIX
|
||||
: STR_SUFFIX;
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
constexpr int32_t WINDOW_HEIGHT = 8 + (15 * 6) + 8;
|
||||
|
||||
// clang-format off
|
||||
static Widget window_debug_paint_widgets[] = {
|
||||
static constexpr Widget window_debug_paint_widgets[] = {
|
||||
MakeWidget({0, 0}, {WINDOW_WIDTH, WINDOW_HEIGHT}, WindowWidgetType::Frame, WindowColour::Primary ),
|
||||
MakeWidget({8, 8 + 15 * 0}, { 185, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_DEBUG_PAINT_SHOW_WIDE_PATHS ),
|
||||
MakeWidget({8, 8 + 15 * 1}, { 185, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_DEBUG_PAINT_SHOW_BLOCKED_TILES ),
|
||||
@@ -42,7 +42,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({8, 8 + 15 * 3}, { 185, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_DEBUG_PAINT_SHOW_BOUND_BOXES ),
|
||||
MakeWidget({8, 8 + 15 * 4}, { 185, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_DEBUG_PAINT_SHOW_DIRTY_VISUALS ),
|
||||
MakeWidget({8, 8 + 15 * 5}, { 185, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_DEBUG_PAINT_STABLE_SORT ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -54,7 +53,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_debug_paint_widgets;
|
||||
SetWidgets(window_debug_paint_widgets);
|
||||
|
||||
InitScrollWidgets();
|
||||
WindowPushOthersBelow(*this);
|
||||
|
||||
@@ -35,12 +35,11 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget window_ride_demolish_widgets[] =
|
||||
static constexpr Widget window_ride_demolish_widgets[] =
|
||||
{
|
||||
WINDOW_SHIM_WHITE(STR_DEMOLISH_RIDE, WW, WH),
|
||||
MakeWidget({ 10, WH - 22}, {85, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_DEMOLISH ),
|
||||
MakeWidget({WW - 95, WH - 22}, {85, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_CANCEL),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -57,7 +56,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_ride_demolish_widgets;
|
||||
SetWidgets(window_ride_demolish_widgets);
|
||||
WindowInitScrollWidgets(*this);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,9 +41,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
WIDX_BACKGROUND,
|
||||
};
|
||||
|
||||
static Widget window_dropdown_widgets[] = {
|
||||
static constexpr Widget window_dropdown_widgets[] = {
|
||||
MakeWidget({ 0, 0 }, { 1, 1 }, WindowWidgetType::ImgBtn, WindowColour::Primary),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
int32_t gDropdownNumItems;
|
||||
@@ -75,7 +74,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_dropdown_widgets;
|
||||
SetWidgets(window_dropdown_widgets);
|
||||
|
||||
// Input state
|
||||
gDropdownHighlightedIndex = -1;
|
||||
@@ -295,8 +294,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
boundedScreenPos.x = std::max(0, screenWidth - ddWidth);
|
||||
if (screenPos.y + ddHeight > screenHeight)
|
||||
boundedScreenPos.y = std::max(0, screenHeight - ddHeight);
|
||||
window_dropdown_widgets[WIDX_BACKGROUND].right = ddWidth;
|
||||
window_dropdown_widgets[WIDX_BACKGROUND].bottom = ddHeight;
|
||||
widgets[WIDX_BACKGROUND].right = ddWidth;
|
||||
widgets[WIDX_BACKGROUND].bottom = ddHeight;
|
||||
|
||||
Invalidate();
|
||||
width = ddWidth + 1;
|
||||
|
||||
@@ -38,12 +38,11 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget _editorBottomToolbarWidgets[] = {
|
||||
static constexpr Widget _editorBottomToolbarWidgets[] = {
|
||||
MakeWidget({ 0, 0}, {200, 34}, WindowWidgetType::ImgBtn, WindowColour::Primary),
|
||||
MakeWidget({ 2, 2}, {196, 30}, WindowWidgetType::FlatBtn, WindowColour::Primary),
|
||||
MakeWidget({440, 0}, {200, 34}, WindowWidgetType::ImgBtn, WindowColour::Primary),
|
||||
MakeWidget({442, 2}, {196, 30}, WindowWidgetType::FlatBtn, WindowColour::Primary),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -62,7 +61,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _editorBottomToolbarWidgets;
|
||||
SetWidgets(_editorBottomToolbarWidgets);
|
||||
|
||||
InitScrollWidgets();
|
||||
SetAllSceneryItemsInvented();
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget _inventionListWidgets[] = {
|
||||
static constexpr Widget _inventionListWidgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({ 0, 43}, {600, 357}, WindowWidgetType::Resize, WindowColour::Secondary ),
|
||||
MakeTab ({ 3, 17} ),
|
||||
@@ -64,12 +64,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({375, 343}, {220, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_MOVE_ALL_TOP ),
|
||||
MakeWidget({375, 358}, {220, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_MOVE_ALL_BOTTOM ),
|
||||
MakeWidget({375, 373}, {220, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RANDOM_SHUFFLE, STR_RANDOM_SHUFFLE_TIP),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget _inventionListDragWidgets[] = {
|
||||
static constexpr Widget _inventionListDragWidgets[] = {
|
||||
MakeWidget({0, 0}, {150, 14}, WindowWidgetType::ImgBtn, WindowColour::Primary),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -154,7 +152,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
ResearchRidesSetup();
|
||||
|
||||
widgets = _inventionListWidgets;
|
||||
SetWidgets(_inventionListWidgets);
|
||||
InitScrollWidgets();
|
||||
selected_tab = 0;
|
||||
_selectedResearchItem = nullptr;
|
||||
@@ -611,7 +609,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _inventionListDragWidgets;
|
||||
SetWidgets(_inventionListDragWidgets);
|
||||
colours[1] = COLOUR_WHITE;
|
||||
}
|
||||
|
||||
|
||||
@@ -226,10 +226,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
validate_global_widx(WC_EDITOR_OBJECT_SELECTION, WIDX_TAB_1);
|
||||
|
||||
static bool _window_editor_object_selection_widgets_initialised;
|
||||
|
||||
// clang-format off
|
||||
static std::vector<Widget> _window_editor_object_selection_widgets = {
|
||||
static constexpr Widget _window_editor_object_selection_widgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget ({ 0, 43}, {WW, 357}, WindowWidgetType::Resize, WindowColour::Secondary ),
|
||||
MakeWidget ({ 4, 60}, {288, 277}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL ),
|
||||
@@ -251,8 +249,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget ({700, 50}, { 24, 24}, WindowWidgetType::ImgBtn, WindowColour::Secondary, SPR_G2_RELOAD, STR_RELOAD_OBJECT_TIP ),
|
||||
MakeTab ({ 3, 17}, STR_STRING_DEFINED_TOOLTIP ),
|
||||
// Copied object type times...
|
||||
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -1138,20 +1134,20 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
|
||||
private:
|
||||
bool tabWidgetsInitialised = false;
|
||||
|
||||
void InitWidgets()
|
||||
{
|
||||
auto& targetWidgets = _window_editor_object_selection_widgets;
|
||||
if (!_window_editor_object_selection_widgets_initialised)
|
||||
SetWidgets(_window_editor_object_selection_widgets);
|
||||
if (!tabWidgetsInitialised)
|
||||
{
|
||||
_window_editor_object_selection_widgets_initialised = true;
|
||||
auto tabWidget = targetWidgets[targetWidgets.size() - 2];
|
||||
tabWidgetsInitialised = true;
|
||||
auto tabWidget = widgets[WIDX_TAB_1];
|
||||
for (size_t i = 1; i < std::size(ObjectSelectionPages); i++)
|
||||
{
|
||||
targetWidgets.insert(targetWidgets.end() - 1, tabWidget);
|
||||
widgets.insert(widgets.end() - 1, tabWidget);
|
||||
}
|
||||
}
|
||||
|
||||
widgets = targetWidgets.data();
|
||||
}
|
||||
|
||||
void SetPage(int32_t _page)
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeTab ({ 3, 17}, STR_SELECT_OBJECTIVE_AND_PARK_NAME_TIP ), \
|
||||
MakeTab ({ 34, 17}, STR_SELECT_RIDES_TO_BE_PRESERVED_TIP )
|
||||
|
||||
static Widget window_editor_objective_options_main_widgets[] = {
|
||||
static constexpr Widget window_editor_objective_options_main_widgets[] = {
|
||||
MAIN_OBJECTIVE_OPTIONS_WIDGETS,
|
||||
MakeWidget ({ 98, 48}, {344, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_NONE, STR_SELECT_OBJECTIVE_FOR_THIS_SCENARIO_TIP ),
|
||||
MakeWidget ({430, 49}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_OBJECTIVE_FOR_THIS_SCENARIO_TIP ),
|
||||
@@ -128,16 +128,14 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget ({ 98, 133}, {180, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_NONE, STR_SELECT_WHICH_GROUP_THIS_SCENARIO_APPEARS_IN),
|
||||
MakeWidget ({266, 134}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_WHICH_GROUP_THIS_SCENARIO_APPEARS_IN),
|
||||
MakeWidget ({370, 150}, { 75, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_CHANGE, STR_CHANGE_DETAIL_NOTES_ABOUT_PARK_SCENARIO_TIP),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget window_editor_objective_options_rides_widgets[] = {
|
||||
static constexpr Widget window_editor_objective_options_rides_widgets[] = {
|
||||
MAIN_OBJECTIVE_OPTIONS_WIDGETS,
|
||||
MakeWidget({ 3, 60}, {374, 161}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget *window_editor_objective_options_widgets[] = {
|
||||
static constexpr std::span<const Widget> window_editor_objective_options_widgets[] = {
|
||||
window_editor_objective_options_main_widgets,
|
||||
window_editor_objective_options_rides_widgets,
|
||||
};
|
||||
@@ -167,14 +165,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_editor_objective_options_main_widgets;
|
||||
pressed_widgets = 0;
|
||||
hold_down_widgets = window_editor_objective_options_page_hold_down_widgets
|
||||
[WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN];
|
||||
InitScrollWidgets();
|
||||
selected_tab = WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN;
|
||||
selected_list_item = -1;
|
||||
UpdateDisabledWidgets();
|
||||
SetPage(WINDOW_EDITOR_OBJECTIVE_OPTIONS_PAGE_MAIN);
|
||||
}
|
||||
|
||||
void OnMouseUp(WidgetIndex widgetIndex) override
|
||||
@@ -313,15 +304,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
*/
|
||||
void SetPage(int32_t newPage)
|
||||
{
|
||||
if (page == newPage)
|
||||
return;
|
||||
|
||||
page = newPage;
|
||||
frame_no = 0;
|
||||
_rideableRides.clear();
|
||||
selected_list_item = -1;
|
||||
hold_down_widgets = window_editor_objective_options_page_hold_down_widgets[newPage];
|
||||
widgets = window_editor_objective_options_widgets[newPage];
|
||||
SetWidgets(window_editor_objective_options_widgets[newPage]);
|
||||
Invalidate();
|
||||
UpdateDisabledWidgets();
|
||||
OnResize();
|
||||
@@ -819,12 +807,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
void OnPrepareDrawMain()
|
||||
{
|
||||
auto& gameState = GetGameState();
|
||||
auto widgetsToSet = window_editor_objective_options_widgets[page];
|
||||
if (widgets != widgetsToSet)
|
||||
{
|
||||
widgets = widgetsToSet;
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
SetPressedTab();
|
||||
|
||||
@@ -832,12 +814,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
case OBJECTIVE_GUESTS_BY:
|
||||
case OBJECTIVE_PARK_VALUE_BY:
|
||||
window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1].type = WindowWidgetType::Spinner;
|
||||
window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1_INCREASE].type = WindowWidgetType::Button;
|
||||
window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1_DECREASE].type = WindowWidgetType::Button;
|
||||
window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2].type = WindowWidgetType::Spinner;
|
||||
window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2_INCREASE].type = WindowWidgetType::Button;
|
||||
window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2_DECREASE].type = WindowWidgetType::Button;
|
||||
widgets[WIDX_OBJECTIVE_ARG_1].type = WindowWidgetType::Spinner;
|
||||
widgets[WIDX_OBJECTIVE_ARG_1_INCREASE].type = WindowWidgetType::Button;
|
||||
widgets[WIDX_OBJECTIVE_ARG_1_DECREASE].type = WindowWidgetType::Button;
|
||||
widgets[WIDX_OBJECTIVE_ARG_2].type = WindowWidgetType::Spinner;
|
||||
widgets[WIDX_OBJECTIVE_ARG_2_INCREASE].type = WindowWidgetType::Button;
|
||||
widgets[WIDX_OBJECTIVE_ARG_2_DECREASE].type = WindowWidgetType::Button;
|
||||
break;
|
||||
case OBJECTIVE_GUESTS_AND_RATING:
|
||||
case OBJECTIVE_MONTHLY_RIDE_INCOME:
|
||||
@@ -845,26 +827,25 @@ namespace OpenRCT2::Ui::Windows
|
||||
case OBJECTIVE_FINISH_5_ROLLERCOASTERS:
|
||||
case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE:
|
||||
case OBJECTIVE_MONTHLY_FOOD_INCOME:
|
||||
window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1].type = WindowWidgetType::Spinner;
|
||||
window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1_INCREASE].type = WindowWidgetType::Button;
|
||||
window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1_DECREASE].type = WindowWidgetType::Button;
|
||||
window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2].type = WindowWidgetType::Empty;
|
||||
window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2_INCREASE].type = WindowWidgetType::Empty;
|
||||
window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2_DECREASE].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_OBJECTIVE_ARG_1].type = WindowWidgetType::Spinner;
|
||||
widgets[WIDX_OBJECTIVE_ARG_1_INCREASE].type = WindowWidgetType::Button;
|
||||
widgets[WIDX_OBJECTIVE_ARG_1_DECREASE].type = WindowWidgetType::Button;
|
||||
widgets[WIDX_OBJECTIVE_ARG_2].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_OBJECTIVE_ARG_2_INCREASE].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_OBJECTIVE_ARG_2_DECREASE].type = WindowWidgetType::Empty;
|
||||
break;
|
||||
default:
|
||||
window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1].type = WindowWidgetType::Empty;
|
||||
window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1_INCREASE].type = WindowWidgetType::Empty;
|
||||
window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_1_DECREASE].type = WindowWidgetType::Empty;
|
||||
window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2].type = WindowWidgetType::Empty;
|
||||
window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2_INCREASE].type = WindowWidgetType::Empty;
|
||||
window_editor_objective_options_main_widgets[WIDX_OBJECTIVE_ARG_2_DECREASE].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_OBJECTIVE_ARG_1].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_OBJECTIVE_ARG_1_INCREASE].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_OBJECTIVE_ARG_1_DECREASE].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_OBJECTIVE_ARG_2].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_OBJECTIVE_ARG_2_INCREASE].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_OBJECTIVE_ARG_2_DECREASE].type = WindowWidgetType::Empty;
|
||||
break;
|
||||
}
|
||||
|
||||
window_editor_objective_options_main_widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
|
||||
? WindowWidgetType::Empty
|
||||
: WindowWidgetType::CloseBox;
|
||||
widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowWidgetType::Empty
|
||||
: WindowWidgetType::CloseBox;
|
||||
|
||||
AnchorBorderWidgets();
|
||||
}
|
||||
@@ -1110,18 +1091,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
*/
|
||||
void OnPrepareDrawRides()
|
||||
{
|
||||
Widget* widgetsToSet = window_editor_objective_options_widgets[page];
|
||||
if (widgets != widgetsToSet)
|
||||
{
|
||||
widgets = widgetsToSet;
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
SetPressedTab();
|
||||
|
||||
window_editor_objective_options_main_widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
|
||||
? WindowWidgetType::Empty
|
||||
: WindowWidgetType::CloseBox;
|
||||
widgets[WIDX_CLOSE].type = (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) ? WindowWidgetType::Empty
|
||||
: WindowWidgetType::CloseBox;
|
||||
|
||||
AnchorBorderWidgets();
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeTab ({ 3, 17 }, STR_NONE ),
|
||||
MakeWidget ({ 2, 45 }, { kScrollWidth, kScrollHeight }, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL ),
|
||||
MakeWidget ({ kWindowWidth - 26, 59 }, { 24, 24 }, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_ROTATE_ARROW), STR_ROTATE_OBJECTS_90 ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -240,7 +239,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _widgets;
|
||||
SetWidgets(_widgets);
|
||||
|
||||
InitScrollWidgets();
|
||||
InitParkEntranceItems();
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget window_editor_scenario_options_financial_widgets[] = {
|
||||
static constexpr Widget window_editor_scenario_options_financial_widgets[] = {
|
||||
WINDOW_SHIM(STR_SCENARIO_OPTIONS_FINANCIAL, WW_FINANCIAL, WH_FINANCIAL),
|
||||
MakeWidget ({ 0, 43}, { WW_FINANCIAL, 106}, WindowWidgetType::Resize, WindowColour::Secondary ),
|
||||
MakeTab ({ 3, 17}, STR_SCENARIO_OPTIONS_FINANCIAL_TIP),
|
||||
@@ -136,10 +136,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeSpinnerWidgets({168, 116}, { 70, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // NB: 3 widgets
|
||||
MakeWidget ({ 8, 133}, {WW_FINANCIAL - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_FORBID_MARKETING, STR_FORBID_MARKETING_TIP ),
|
||||
MakeWidget ({ 8, 116}, {WW_FINANCIAL - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_RCT1_INTEREST, STR_RCT1_INTEREST_TIP ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget window_editor_scenario_options_guests_widgets[] = {
|
||||
static constexpr Widget window_editor_scenario_options_guests_widgets[] = {
|
||||
WINDOW_SHIM(STR_SCENARIO_OPTIONS_GUESTS, WW_GUESTS, WH_GUESTS),
|
||||
MakeWidget ({ 0, 43}, { WW_GUESTS, 106}, WindowWidgetType::Resize, WindowColour::Secondary),
|
||||
MakeRemapWidget ({ 3, 17}, { 31, 27}, WindowWidgetType::Tab, WindowColour::Secondary, SPR_TAB, STR_SCENARIO_OPTIONS_FINANCIAL_TIP ),
|
||||
@@ -151,10 +150,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeSpinnerWidgets({268, 99}, { 70, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // NB: 3 widgets
|
||||
MakeWidget ({ 8, 116}, {WW_GUESTS - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_GUESTS_PREFER_LESS_INTENSE_RIDES, STR_GUESTS_PREFER_LESS_INTENSE_RIDES_TIP),
|
||||
MakeWidget ({ 8, 133}, {WW_GUESTS - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_GUESTS_PREFER_MORE_INTENSE_RIDES, STR_GUESTS_PREFER_MORE_INTENSE_RIDES_TIP),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget window_editor_scenario_options_park_widgets[] = {
|
||||
static constexpr Widget window_editor_scenario_options_park_widgets[] = {
|
||||
WINDOW_SHIM(STR_SCENARIO_OPTIONS_PARK, WW_PARK, WH_PARK),
|
||||
MakeWidget ({ 0, 43}, { WW_PARK, 106}, WindowWidgetType::Resize, WindowColour::Secondary ),
|
||||
MakeRemapWidget ({ 3, 17}, { 31, 27}, WindowWidgetType::Tab, WindowColour::Secondary, SPR_TAB, STR_SCENARIO_OPTIONS_FINANCIAL_TIP),
|
||||
@@ -172,10 +170,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget ({ 8, 150}, {WW_PARK - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_FORBID_HIGH_CONSTRUCTION, STR_FORBID_HIGH_CONSTRUCTION_TIP ),
|
||||
MakeWidget ({ 8, 167}, {WW_PARK - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_HARD_PARK_RATING, STR_HARD_PARK_RATING_TIP ),
|
||||
MakeWidget ({ 8, 184}, {WW_PARK - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_HARD_GUEST_GENERATION, STR_HARD_GUEST_GENERATION_TIP ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget *window_editor_scenario_options_widgets[] = {
|
||||
static constexpr std::span<const Widget> window_editor_scenario_options_widgets[] = {
|
||||
window_editor_scenario_options_financial_widgets,
|
||||
window_editor_scenario_options_guests_widgets,
|
||||
window_editor_scenario_options_park_widgets,
|
||||
@@ -218,11 +215,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_editor_scenario_options_widgets[WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL];
|
||||
hold_down_widgets = window_editor_scenario_options_page_hold_down_widgets
|
||||
[WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL];
|
||||
WindowInitScrollWidgets(*this);
|
||||
page = 0;
|
||||
SetPage(WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_FINANCIAL);
|
||||
}
|
||||
|
||||
void OnMouseUp(WidgetIndex widgetIndex) override
|
||||
@@ -355,17 +348,14 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void SetPage(int32_t newPage)
|
||||
{
|
||||
if (page == newPage)
|
||||
return;
|
||||
|
||||
page = newPage;
|
||||
frame_no = 0;
|
||||
hold_down_widgets = window_editor_scenario_options_page_hold_down_widgets[page];
|
||||
widgets = window_editor_scenario_options_widgets[page];
|
||||
SetWidgets(window_editor_scenario_options_widgets[page]);
|
||||
Invalidate();
|
||||
OnResize();
|
||||
OnPrepareDraw();
|
||||
WindowInitScrollWidgets(*this);
|
||||
InitScrollWidgets();
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
@@ -561,13 +551,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void FinancialPrepareDraw()
|
||||
{
|
||||
Widget* newWidgets = window_editor_scenario_options_widgets[page];
|
||||
if (widgets != newWidgets)
|
||||
{
|
||||
widgets = newWidgets;
|
||||
WindowInitScrollWidgets(*this);
|
||||
}
|
||||
|
||||
SetPressedTab();
|
||||
|
||||
auto& gameState = GetGameState();
|
||||
@@ -841,13 +824,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void GuestsPrepareDraw()
|
||||
{
|
||||
Widget* newWidgets = window_editor_scenario_options_widgets[page];
|
||||
if (widgets != newWidgets)
|
||||
{
|
||||
widgets = newWidgets;
|
||||
WindowInitScrollWidgets(*this);
|
||||
}
|
||||
|
||||
SetPressedTab();
|
||||
|
||||
auto& gameState = GetGameState();
|
||||
@@ -1147,13 +1123,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void ParkPrepareDraw()
|
||||
{
|
||||
Widget* newWidgets = window_editor_scenario_options_widgets[page];
|
||||
if (widgets != newWidgets)
|
||||
{
|
||||
widgets = newWidgets;
|
||||
WindowInitScrollWidgets(*this);
|
||||
}
|
||||
|
||||
SetPressedTab();
|
||||
|
||||
auto& gameState = GetGameState();
|
||||
|
||||
@@ -30,9 +30,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
static constexpr auto kMaxWidth = 250;
|
||||
static constexpr auto kPadding = 4;
|
||||
|
||||
static Widget window_error_widgets[] = {
|
||||
static constexpr Widget window_error_widgets[] = {
|
||||
MakeWidget({ 0, 0 }, { 200, 42 }, WindowWidgetType::Frame, WindowColour::Primary),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
class ErrorWindow final : public Window
|
||||
@@ -53,10 +52,11 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnOpen() override
|
||||
{
|
||||
window_error_widgets[WIDX_BACKGROUND].right = width - 1;
|
||||
window_error_widgets[WIDX_BACKGROUND].bottom = height - 1;
|
||||
SetWidgets(window_error_widgets);
|
||||
|
||||
widgets[WIDX_BACKGROUND].right = width - 1;
|
||||
widgets[WIDX_BACKGROUND].bottom = height - 1;
|
||||
|
||||
widgets = window_error_widgets;
|
||||
_staleCount = 0;
|
||||
|
||||
if (!gDisableErrorWindowSound)
|
||||
|
||||
@@ -108,33 +108,29 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeTab({ 127, 17 }, STR_FINANCES_SHOW_MARKETING_TAB_TIP), \
|
||||
MakeTab({ 158, 17 }, STR_FINANCES_RESEARCH_TIP)
|
||||
|
||||
static Widget _windowFinancesSummaryWidgets[] =
|
||||
static constexpr Widget _windowFinancesSummaryWidgets[] =
|
||||
{
|
||||
MAIN_FINANCES_WIDGETS(STR_FINANCIAL_SUMMARY, RSW_OTHER_TABS, RSH_SUMMARY, WW_OTHER_TABS, WH_SUMMARY),
|
||||
MakeWidget ({130, 50}, {391, 211}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_HORIZONTAL ),
|
||||
MakeSpinnerWidgets({ 64, 279}, { 97, 14}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_FINANCES_SUMMARY_LOAN_VALUE), // NB: 3 widgets.
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget _windowFinancesCashWidgets[] =
|
||||
static constexpr Widget _windowFinancesCashWidgets[] =
|
||||
{
|
||||
MAIN_FINANCES_WIDGETS(STR_FINANCIAL_GRAPH, RSW_OTHER_TABS, RSH_OTHER_TABS, WW_OTHER_TABS, WH_OTHER_TABS),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget _windowFinancesParkValueWidgets[] =
|
||||
static constexpr Widget _windowFinancesParkValueWidgets[] =
|
||||
{
|
||||
MAIN_FINANCES_WIDGETS(STR_PARK_VALUE_GRAPH, RSW_OTHER_TABS, RSH_OTHER_TABS, WW_OTHER_TABS, WH_OTHER_TABS),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget _windowFinancesProfitWidgets[] =
|
||||
static constexpr Widget _windowFinancesProfitWidgets[] =
|
||||
{
|
||||
MAIN_FINANCES_WIDGETS(STR_PROFIT_GRAPH, RSW_OTHER_TABS, RSH_OTHER_TABS, WW_OTHER_TABS, WH_OTHER_TABS),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget _windowFinancesMarketingWidgets[] =
|
||||
static constexpr Widget _windowFinancesMarketingWidgets[] =
|
||||
{
|
||||
MAIN_FINANCES_WIDGETS(STR_MARKETING, RSW_OTHER_TABS, RSH_OTHER_TABS, WW_OTHER_TABS, WH_OTHER_TABS),
|
||||
MakeWidget({3, 47}, { WW_OTHER_TABS - 6, 45}, WindowWidgetType::Groupbox, WindowColour::Tertiary , STR_MARKETING_CAMPAIGNS_IN_OPERATION ),
|
||||
@@ -145,10 +141,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({8, 0}, {WW_OTHER_TABS - 16, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_START_THIS_MARKETING_CAMPAIGN),
|
||||
MakeWidget({8, 0}, {WW_OTHER_TABS - 16, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_START_THIS_MARKETING_CAMPAIGN),
|
||||
MakeWidget({8, 0}, {WW_OTHER_TABS - 16, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_START_THIS_MARKETING_CAMPAIGN),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget _windowFinancesResearchWidgets[] =
|
||||
static constexpr Widget _windowFinancesResearchWidgets[] =
|
||||
{
|
||||
MAIN_FINANCES_WIDGETS(STR_RESEARCH_FUNDING, RSW_RESEARCH, RSH_RESEARCH, WW_RESEARCH, WH_RESEARCH),
|
||||
MakeWidget({ 3, 47}, { WW_RESEARCH - 6, 45}, WindowWidgetType::Groupbox, WindowColour::Tertiary, STR_RESEARCH_FUNDING_ ),
|
||||
@@ -162,11 +157,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({ 8, 160}, {WW_RESEARCH - 14, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary, STR_RESEARCH_NEW_WATER_RIDES, STR_RESEARCH_NEW_WATER_RIDES_TIP ),
|
||||
MakeWidget({ 8, 173}, {WW_RESEARCH - 14, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary, STR_RESEARCH_NEW_SHOPS_AND_STALLS, STR_RESEARCH_NEW_SHOPS_AND_STALLS_TIP ),
|
||||
MakeWidget({ 8, 186}, {WW_RESEARCH - 14, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary, STR_RESEARCH_NEW_SCENERY_AND_THEMING, STR_RESEARCH_NEW_SCENERY_AND_THEMING_TIP ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static Widget* _windowFinancesPageWidgets[] = {
|
||||
static constexpr std::span<const Widget> _windowFinancesPageWidgets[] = {
|
||||
_windowFinancesSummaryWidgets, // WINDOW_FINANCES_PAGE_SUMMARY
|
||||
_windowFinancesCashWidgets, // WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH
|
||||
_windowFinancesParkValueWidgets, // WINDOW_FINANCES_PAGE_VALUE_GRAPH
|
||||
@@ -314,14 +308,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnPrepareDraw() override
|
||||
{
|
||||
auto* targetWidgets = _windowFinancesPageWidgets[page];
|
||||
|
||||
if (widgets != targetWidgets)
|
||||
{
|
||||
widgets = targetWidgets;
|
||||
WindowInitScrollWidgets(*this);
|
||||
}
|
||||
|
||||
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_6);
|
||||
|
||||
for (auto i = 0; i < WINDOW_FINANCES_PAGE_COUNT; i++)
|
||||
@@ -345,17 +331,17 @@ namespace OpenRCT2::Ui::Windows
|
||||
return;
|
||||
|
||||
case WINDOW_FINANCES_PAGE_VALUE_GRAPH:
|
||||
graphPageWidget = &_windowFinancesParkValueWidgets[WIDX_PAGE_BACKGROUND];
|
||||
graphPageWidget = &widgets[WIDX_PAGE_BACKGROUND];
|
||||
centredGraph = false;
|
||||
_graphProps.series = GetGameState().Park.ValueHistory;
|
||||
break;
|
||||
case WINDOW_FINANCES_PAGE_PROFIT_GRAPH:
|
||||
graphPageWidget = &_windowFinancesProfitWidgets[WIDX_PAGE_BACKGROUND];
|
||||
graphPageWidget = &widgets[WIDX_PAGE_BACKGROUND];
|
||||
centredGraph = true;
|
||||
_graphProps.series = GetGameState().WeeklyProfitHistory;
|
||||
break;
|
||||
case WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH:
|
||||
graphPageWidget = &_windowFinancesCashWidgets[WIDX_PAGE_BACKGROUND];
|
||||
graphPageWidget = &widgets[WIDX_PAGE_BACKGROUND];
|
||||
centredGraph = true;
|
||||
_graphProps.series = GetGameState().CashHistory;
|
||||
break;
|
||||
@@ -500,7 +486,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
hold_down_widgets = _windowFinancesPageHoldDownWidgets[p];
|
||||
pressed_widgets = 0;
|
||||
widgets = _windowFinancesPageWidgets[p];
|
||||
SetWidgets(_windowFinancesPageWidgets[p]);
|
||||
SetDisabledTabs();
|
||||
Invalidate();
|
||||
|
||||
@@ -533,8 +519,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
OnResize();
|
||||
OnPrepareDraw();
|
||||
|
||||
WindowInitScrollWidgets(*this);
|
||||
InitScrollWidgets();
|
||||
|
||||
// Scroll summary all the way to the right, initially.
|
||||
if (p == WINDOW_FINANCES_PAGE_SUMMARY)
|
||||
@@ -688,14 +673,14 @@ namespace OpenRCT2::Ui::Windows
|
||||
int32_t y = std::max(1, numActiveCampaigns) * kListRowHeight + 92;
|
||||
|
||||
// Update group box positions
|
||||
_windowFinancesMarketingWidgets[WIDX_ACTIVE_CAMPAIGNS_GROUP].bottom = y - 22;
|
||||
_windowFinancesMarketingWidgets[WIDX_CAMPAIGNS_AVAILABLE_GROUP].top = y - 13;
|
||||
widgets[WIDX_ACTIVE_CAMPAIGNS_GROUP].bottom = y - 22;
|
||||
widgets[WIDX_CAMPAIGNS_AVAILABLE_GROUP].top = y - 13;
|
||||
|
||||
// Update new campaign button visibility
|
||||
y += 3;
|
||||
for (int32_t i = 0; i < ADVERTISING_CAMPAIGN_COUNT; i++)
|
||||
{
|
||||
auto campaignButton = &_windowFinancesMarketingWidgets[WIDX_CAMPAIGN_1 + i];
|
||||
auto campaignButton = &widgets[WIDX_CAMPAIGN_1 + i];
|
||||
auto marketingCampaign = MarketingGetCampaign(i);
|
||||
if (marketingCampaign == nullptr && MarketingIsCampaignTypeApplicable(i))
|
||||
{
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget window_footpath_widgets[] = {
|
||||
static constexpr Widget window_footpath_widgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW_WINDOW, WH_WINDOW),
|
||||
|
||||
// Type group
|
||||
@@ -152,7 +152,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({ 3, 361}, {100, 54}, WindowWidgetType::Groupbox, WindowColour::Primary ),
|
||||
MakeWidget({13, 372}, { 36, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_CONSTRUCTION_FOOTPATH_LAND), STR_CONSTRUCT_FOOTPATH_ON_LAND_TIP ),
|
||||
MakeWidget({57, 372}, { 36, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_CONSTRUCTION_FOOTPATH_BRIDGE), STR_CONSTRUCT_BRIDGE_OR_TUNNEL_FOOTPATH_TIP ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
#pragma endregion
|
||||
@@ -215,7 +214,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_footpath_widgets;
|
||||
SetWidgets(window_footpath_widgets);
|
||||
|
||||
WindowInitScrollWidgets(*this);
|
||||
WindowPushOthersRight(*this);
|
||||
@@ -275,13 +274,13 @@ namespace OpenRCT2::Ui::Windows
|
||||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_FOOTPATH_TYPE:
|
||||
WindowFootpathShowFootpathTypesDialog(&window_footpath_widgets[widgetIndex], false);
|
||||
WindowFootpathShowFootpathTypesDialog(&widgets[widgetIndex], false);
|
||||
break;
|
||||
case WIDX_QUEUELINE_TYPE:
|
||||
WindowFootpathShowFootpathTypesDialog(&window_footpath_widgets[widgetIndex], true);
|
||||
WindowFootpathShowFootpathTypesDialog(&widgets[widgetIndex], true);
|
||||
break;
|
||||
case WIDX_RAILINGS_TYPE:
|
||||
WindowFootpathShowRailingsTypesDialog(&window_footpath_widgets[widgetIndex]);
|
||||
WindowFootpathShowRailingsTypesDialog(&widgets[widgetIndex]);
|
||||
break;
|
||||
case WIDX_DIRECTION_NW:
|
||||
WindowFootpathMousedownDirection(0);
|
||||
@@ -452,17 +451,17 @@ namespace OpenRCT2::Ui::Windows
|
||||
: (1uLL << WIDX_FOOTPATH_TYPE);
|
||||
|
||||
// Enable / disable construct button
|
||||
window_footpath_widgets[WIDX_CONSTRUCT].type = _footpathConstructionMode == PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL
|
||||
widgets[WIDX_CONSTRUCT].type = _footpathConstructionMode == PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL
|
||||
? WindowWidgetType::ImgBtn
|
||||
: WindowWidgetType::Empty;
|
||||
|
||||
if (gFootpathSelection.LegacyPath == OBJECT_ENTRY_INDEX_NULL)
|
||||
{
|
||||
window_footpath_widgets[WIDX_RAILINGS_TYPE].type = WindowWidgetType::FlatBtn;
|
||||
widgets[WIDX_RAILINGS_TYPE].type = WindowWidgetType::FlatBtn;
|
||||
}
|
||||
else
|
||||
{
|
||||
window_footpath_widgets[WIDX_RAILINGS_TYPE].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_RAILINGS_TYPE].type = WindowWidgetType::Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -517,22 +516,19 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
// Draw construction image
|
||||
screenCoords = this->windowPos
|
||||
+ ScreenCoordsXY{ window_footpath_widgets[WIDX_CONSTRUCT].midX(),
|
||||
window_footpath_widgets[WIDX_CONSTRUCT].bottom - 60 };
|
||||
+ ScreenCoordsXY{ widgets[WIDX_CONSTRUCT].midX(), widgets[WIDX_CONSTRUCT].bottom - 60 };
|
||||
GfxDrawSprite(dpi, ImageId(image), screenCoords);
|
||||
}
|
||||
|
||||
// Draw build this... label
|
||||
screenCoords = this->windowPos
|
||||
+ ScreenCoordsXY{ window_footpath_widgets[WIDX_CONSTRUCT].midX(),
|
||||
window_footpath_widgets[WIDX_CONSTRUCT].bottom - 23 };
|
||||
+ ScreenCoordsXY{ widgets[WIDX_CONSTRUCT].midX(), widgets[WIDX_CONSTRUCT].bottom - 23 };
|
||||
DrawTextBasic(dpi, screenCoords, STR_BUILD_THIS, {}, { TextAlignment::CENTRE });
|
||||
}
|
||||
|
||||
// Draw cost
|
||||
screenCoords = this->windowPos
|
||||
+ ScreenCoordsXY{ window_footpath_widgets[WIDX_CONSTRUCT].midX(),
|
||||
window_footpath_widgets[WIDX_CONSTRUCT].bottom - 12 };
|
||||
+ ScreenCoordsXY{ widgets[WIDX_CONSTRUCT].midX(), widgets[WIDX_CONSTRUCT].bottom - 12 };
|
||||
if (_windowFootpathCost != kMoney64Undefined)
|
||||
{
|
||||
if (!(GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY))
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget window_game_bottom_toolbar_widgets[] =
|
||||
static constexpr Widget window_game_bottom_toolbar_widgets[] =
|
||||
{
|
||||
MakeWidget({ 0, 0}, {142, 34}, WindowWidgetType::ImgBtn, WindowColour::Primary ), // Left outset panel
|
||||
MakeWidget({ 2, 2}, {138, 30}, WindowWidgetType::ImgBtn, WindowColour::Primary ), // Left inset panel
|
||||
@@ -68,7 +68,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({498, 0}, {142, 34}, WindowWidgetType::ImgBtn, WindowColour::Primary ), // Right outset panel
|
||||
MakeWidget({500, 2}, {138, 30}, WindowWidgetType::ImgBtn, WindowColour::Primary ), // Right inset panel
|
||||
MakeWidget({500, 2}, {138, 12}, WindowWidgetType::FlatBtn, WindowColour::Primary ), // Date
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -87,12 +86,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void DrawLeftPanel(DrawPixelInfo& dpi)
|
||||
{
|
||||
const auto topLeft = 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 = windowPos
|
||||
+ ScreenCoordsXY{ window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET].right - 1,
|
||||
window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET].bottom - 1 };
|
||||
const auto& leftPanelWidget = widgets[WIDX_LEFT_OUTSET];
|
||||
|
||||
const auto topLeft = windowPos + ScreenCoordsXY{ leftPanelWidget.left + 1, leftPanelWidget.top + 1 };
|
||||
const auto bottomRight = windowPos + ScreenCoordsXY{ leftPanelWidget.right - 1, leftPanelWidget.bottom - 1 };
|
||||
// Draw green inset rectangle on panel
|
||||
GfxFillRectInset(dpi, { topLeft, bottomRight }, colours[1], INSET_RECT_F_30);
|
||||
|
||||
@@ -104,7 +101,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
// Draw money
|
||||
if (!(gameState.Park.Flags & PARK_FLAGS_NO_MONEY))
|
||||
{
|
||||
Widget widget = window_game_bottom_toolbar_widgets[WIDX_MONEY];
|
||||
const auto& widget = widgets[WIDX_MONEY];
|
||||
auto screenCoords = ScreenCoordsXY{ windowPos.x + widget.midX(),
|
||||
windowPos.y + widget.midY() - (line_height == 10 ? 5 : 6) };
|
||||
|
||||
@@ -129,7 +126,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
// Draw guests
|
||||
{
|
||||
Widget widget = window_game_bottom_toolbar_widgets[WIDX_GUESTS];
|
||||
const auto& widget = widgets[WIDX_GUESTS];
|
||||
auto screenCoords = ScreenCoordsXY{ windowPos.x + widget.midX(), windowPos.y + widget.midY() - 6 };
|
||||
|
||||
StringId stringId = gameState.NumGuestsInPark == 1 ? _guestCountFormatsSingular[gameState.GuestChangeModifier]
|
||||
@@ -142,7 +139,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
// Draw park rating
|
||||
{
|
||||
Widget widget = window_game_bottom_toolbar_widgets[WIDX_PARK_RATING];
|
||||
const auto& widget = widgets[WIDX_PARK_RATING];
|
||||
auto screenCoords = windowPos + ScreenCoordsXY{ widget.left + 11, widget.midY() - 5 };
|
||||
|
||||
DrawParkRating(dpi, colours[3].colour, screenCoords, std::max(10, ((gameState.Park.Rating / 4) * 263) / 256));
|
||||
@@ -171,20 +168,15 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void DrawRightPanel(DrawPixelInfo& dpi)
|
||||
{
|
||||
const auto topLeft = 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 = windowPos
|
||||
+ ScreenCoordsXY{ window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].right - 1,
|
||||
window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].bottom - 1 };
|
||||
const auto& rightPanelWidget = widgets[WIDX_RIGHT_OUTSET];
|
||||
|
||||
const auto topLeft = windowPos + ScreenCoordsXY{ rightPanelWidget.left + 1, rightPanelWidget.top + 1 };
|
||||
const auto bottomRight = windowPos + ScreenCoordsXY{ rightPanelWidget.right - 1, rightPanelWidget.bottom - 1 };
|
||||
// Draw green inset rectangle on panel
|
||||
GfxFillRectInset(dpi, { topLeft, bottomRight }, 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)
|
||||
/ 2
|
||||
+ windowPos.x,
|
||||
window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].top + windowPos.y + 2 };
|
||||
auto screenCoords = ScreenCoordsXY{ (rightPanelWidget.left + rightPanelWidget.right) / 2 + windowPos.x,
|
||||
rightPanelWidget.top + windowPos.y + 2 };
|
||||
|
||||
// Date
|
||||
auto& date = GetDate();
|
||||
@@ -204,8 +196,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
uint32_t line_height = FontGetLineHeight(FontStyle::Medium);
|
||||
|
||||
// Temperature
|
||||
screenCoords = { windowPos.x + window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left + 15,
|
||||
static_cast<int32_t>(screenCoords.y + line_height + 1) };
|
||||
screenCoords = { windowPos.x + rightPanelWidget.left + 15, static_cast<int32_t>(screenCoords.y + line_height + 1) };
|
||||
|
||||
int32_t temperature = GetGameState().ClimateCurrent.Temperature;
|
||||
StringId format = STR_CELSIUS_VALUE;
|
||||
@@ -237,27 +228,26 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void DrawNewsItem(DrawPixelInfo& dpi)
|
||||
{
|
||||
auto* middleOutsetWidget = &window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET];
|
||||
const auto& middleOutsetWidget = widgets[WIDX_MIDDLE_OUTSET];
|
||||
auto* newsItem = News::GetItem(0);
|
||||
|
||||
// Current news item
|
||||
GfxFillRectInset(
|
||||
dpi,
|
||||
|
||||
{ windowPos + ScreenCoordsXY{ middleOutsetWidget->left + 1, middleOutsetWidget->top + 1 },
|
||||
windowPos + ScreenCoordsXY{ middleOutsetWidget->right - 1, middleOutsetWidget->bottom - 1 } },
|
||||
{ windowPos + ScreenCoordsXY{ middleOutsetWidget.left + 1, middleOutsetWidget.top + 1 },
|
||||
windowPos + ScreenCoordsXY{ middleOutsetWidget.right - 1, middleOutsetWidget.bottom - 1 } },
|
||||
colours[2], INSET_RECT_F_30);
|
||||
|
||||
// Text
|
||||
auto screenCoords = windowPos + ScreenCoordsXY{ middleOutsetWidget->midX(), middleOutsetWidget->top + 11 };
|
||||
int32_t itemWidth = middleOutsetWidget->width() - 62;
|
||||
auto screenCoords = windowPos + ScreenCoordsXY{ middleOutsetWidget.midX(), middleOutsetWidget.top + 11 };
|
||||
int32_t itemWidth = middleOutsetWidget.width() - 62;
|
||||
DrawNewsTicker(
|
||||
dpi, screenCoords, itemWidth, COLOUR_BRIGHT_GREEN, STR_BOTTOM_TOOLBAR_NEWS_TEXT, newsItem->Text,
|
||||
newsItem->Ticks);
|
||||
|
||||
screenCoords = windowPos
|
||||
+ ScreenCoordsXY{ window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].left,
|
||||
window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].top };
|
||||
const auto& newsSubjectWidget = widgets[WIDX_NEWS_SUBJECT];
|
||||
screenCoords = windowPos + ScreenCoordsXY{ newsSubjectWidget.left, newsSubjectWidget.top };
|
||||
switch (newsItem->Type)
|
||||
{
|
||||
case News::ItemType::Ride:
|
||||
@@ -342,7 +332,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void DrawMiddlePanel(DrawPixelInfo& dpi)
|
||||
{
|
||||
Widget* middleOutsetWidget = &window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET];
|
||||
Widget* middleOutsetWidget = &widgets[WIDX_MIDDLE_OUTSET];
|
||||
|
||||
GfxFillRectInset(
|
||||
dpi,
|
||||
@@ -411,14 +401,14 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
GameBottomToolbar()
|
||||
{
|
||||
widgets = window_game_bottom_toolbar_widgets;
|
||||
SetWidgets(window_game_bottom_toolbar_widgets);
|
||||
|
||||
frame_no = 0;
|
||||
InitScrollWidgets();
|
||||
|
||||
// Reset the middle widget to not show by default.
|
||||
// If it is required to be shown news_update will reshow it.
|
||||
window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_MIDDLE_OUTSET].type = WindowWidgetType::Empty;
|
||||
}
|
||||
|
||||
void OnMouseUp(WidgetIndex widgetIndex) override
|
||||
@@ -536,56 +526,55 @@ namespace OpenRCT2::Ui::Windows
|
||||
int32_t x = ContextGetWidth();
|
||||
width = x;
|
||||
x--;
|
||||
window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].right = x;
|
||||
widgets[WIDX_RIGHT_OUTSET].right = x;
|
||||
x -= 2;
|
||||
window_game_bottom_toolbar_widgets[WIDX_RIGHT_INSET].right = x;
|
||||
widgets[WIDX_RIGHT_INSET].right = x;
|
||||
x -= 137;
|
||||
window_game_bottom_toolbar_widgets[WIDX_RIGHT_INSET].left = x;
|
||||
widgets[WIDX_RIGHT_INSET].left = x;
|
||||
x -= 2;
|
||||
window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left = x;
|
||||
widgets[WIDX_RIGHT_OUTSET].left = x;
|
||||
x--;
|
||||
window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].right = x;
|
||||
widgets[WIDX_MIDDLE_OUTSET].right = x;
|
||||
x -= 2;
|
||||
window_game_bottom_toolbar_widgets[WIDX_MIDDLE_INSET].right = x;
|
||||
widgets[WIDX_MIDDLE_INSET].right = x;
|
||||
x -= 3;
|
||||
window_game_bottom_toolbar_widgets[WIDX_NEWS_LOCATE].right = x;
|
||||
widgets[WIDX_NEWS_LOCATE].right = x;
|
||||
x -= 23;
|
||||
window_game_bottom_toolbar_widgets[WIDX_NEWS_LOCATE].left = x;
|
||||
window_game_bottom_toolbar_widgets[WIDX_DATE].left = window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].left + 2;
|
||||
window_game_bottom_toolbar_widgets[WIDX_DATE].right = window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].right
|
||||
- 2;
|
||||
widgets[WIDX_NEWS_LOCATE].left = x;
|
||||
widgets[WIDX_DATE].left = widgets[WIDX_RIGHT_OUTSET].left + 2;
|
||||
widgets[WIDX_DATE].right = widgets[WIDX_RIGHT_OUTSET].right - 2;
|
||||
|
||||
window_game_bottom_toolbar_widgets[WIDX_LEFT_INSET].type = WindowWidgetType::Empty;
|
||||
window_game_bottom_toolbar_widgets[WIDX_RIGHT_INSET].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_LEFT_INSET].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_RIGHT_INSET].type = WindowWidgetType::Empty;
|
||||
|
||||
if (News::IsQueueEmpty())
|
||||
{
|
||||
if (!(ThemeGetFlags() & UITHEME_FLAG_USE_FULL_BOTTOM_TOOLBAR))
|
||||
{
|
||||
window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].type = WindowWidgetType::Empty;
|
||||
window_game_bottom_toolbar_widgets[WIDX_MIDDLE_INSET].type = WindowWidgetType::Empty;
|
||||
window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].type = WindowWidgetType::Empty;
|
||||
window_game_bottom_toolbar_widgets[WIDX_NEWS_LOCATE].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_MIDDLE_OUTSET].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_MIDDLE_INSET].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_NEWS_SUBJECT].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_NEWS_LOCATE].type = WindowWidgetType::Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].type = WindowWidgetType::ImgBtn;
|
||||
window_game_bottom_toolbar_widgets[WIDX_MIDDLE_INSET].type = WindowWidgetType::FlatBtn;
|
||||
window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].type = WindowWidgetType::Empty;
|
||||
window_game_bottom_toolbar_widgets[WIDX_NEWS_LOCATE].type = WindowWidgetType::Empty;
|
||||
window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].colour = 0;
|
||||
window_game_bottom_toolbar_widgets[WIDX_MIDDLE_INSET].colour = 0;
|
||||
widgets[WIDX_MIDDLE_OUTSET].type = WindowWidgetType::ImgBtn;
|
||||
widgets[WIDX_MIDDLE_INSET].type = WindowWidgetType::FlatBtn;
|
||||
widgets[WIDX_NEWS_SUBJECT].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_NEWS_LOCATE].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_MIDDLE_OUTSET].colour = 0;
|
||||
widgets[WIDX_MIDDLE_INSET].colour = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
News::Item* newsItem = News::GetItem(0);
|
||||
window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].type = WindowWidgetType::ImgBtn;
|
||||
window_game_bottom_toolbar_widgets[WIDX_MIDDLE_INSET].type = WindowWidgetType::FlatBtn;
|
||||
window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].type = WindowWidgetType::FlatBtn;
|
||||
window_game_bottom_toolbar_widgets[WIDX_NEWS_LOCATE].type = WindowWidgetType::FlatBtn;
|
||||
window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET].colour = 2;
|
||||
window_game_bottom_toolbar_widgets[WIDX_MIDDLE_INSET].colour = 2;
|
||||
widgets[WIDX_MIDDLE_OUTSET].type = WindowWidgetType::ImgBtn;
|
||||
widgets[WIDX_MIDDLE_INSET].type = WindowWidgetType::FlatBtn;
|
||||
widgets[WIDX_NEWS_SUBJECT].type = WindowWidgetType::FlatBtn;
|
||||
widgets[WIDX_NEWS_LOCATE].type = WindowWidgetType::FlatBtn;
|
||||
widgets[WIDX_MIDDLE_OUTSET].colour = 2;
|
||||
widgets[WIDX_MIDDLE_INSET].colour = 2;
|
||||
disabled_widgets &= ~(1uLL << WIDX_NEWS_SUBJECT);
|
||||
disabled_widgets &= ~(1uLL << WIDX_NEWS_LOCATE);
|
||||
|
||||
@@ -598,7 +587,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (!(newsItem->TypeHasSubject()))
|
||||
{
|
||||
disabled_widgets |= (1uLL << WIDX_NEWS_SUBJECT);
|
||||
window_game_bottom_toolbar_widgets[WIDX_NEWS_SUBJECT].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_NEWS_SUBJECT].type = WindowWidgetType::Empty;
|
||||
}
|
||||
|
||||
if (newsItem->HasButton())
|
||||
@@ -611,9 +600,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnDraw(DrawPixelInfo& dpi) override
|
||||
{
|
||||
auto leftWidget = window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET];
|
||||
auto rightWidget = window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET];
|
||||
auto middleWidget = window_game_bottom_toolbar_widgets[WIDX_MIDDLE_OUTSET];
|
||||
auto leftWidget = widgets[WIDX_LEFT_OUTSET];
|
||||
auto rightWidget = widgets[WIDX_RIGHT_OUTSET];
|
||||
auto middleWidget = widgets[WIDX_MIDDLE_OUTSET];
|
||||
|
||||
// Draw panel grey backgrounds
|
||||
auto leftTop = windowPos + ScreenCoordsXY{ leftWidget.left, leftWidget.top };
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeTab({ 189, 17 }, STR_DEBUG_TIP) /* Tab 7 */
|
||||
|
||||
// clang-format off
|
||||
static Widget _guestWindowWidgetsOverview[] = {
|
||||
static constexpr Widget _guestWindowWidgetsOverview[] = {
|
||||
MAIN_GUEST_WIDGETS,
|
||||
MakeWidget({ 3, 45}, {164, 12}, WindowWidgetType::LabelCentred, WindowColour::Secondary ), // Label Thought marquee
|
||||
MakeWidget({ 3, 57}, {164, 87}, WindowWidgetType::Viewport, WindowColour::Secondary ), // Viewport
|
||||
@@ -122,11 +122,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({167, 69}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RENAME), STR_NAME_GUEST_TIP ), // Rename Button
|
||||
MakeWidget({167, 93}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_LOCATE), STR_LOCATE_SUBJECT_TIP ), // Locate Button
|
||||
MakeWidget({167, 117}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_TRACK_PEEP), STR_TOGGLE_GUEST_TRACKING_TIP), // Track Button
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
static Widget _guestWindowWidgetsStats[] = {
|
||||
static constexpr Widget _guestWindowWidgetsStats[] = {
|
||||
MAIN_GUEST_WIDGETS,
|
||||
MakeProgressBar({ 65, (kListRowHeight * 0) + 4 + 43 }, { 119, 10 }, COLOUR_BRIGHT_GREEN, 0, 19), // Happiness
|
||||
MakeProgressBar({ 65, (kListRowHeight * 1) + 4 + 43 }, { 119, 10 }, COLOUR_BRIGHT_GREEN, 0, 19), // Energy
|
||||
@@ -134,37 +133,31 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeProgressBar({ 65, (kListRowHeight * 3) + 4 + 43 }, { 119, 10 }, COLOUR_BRIGHT_RED, 67, 100), // Thirst
|
||||
MakeProgressBar({ 65, (kListRowHeight * 4) + 4 + 43 }, { 119, 10 }, COLOUR_BRIGHT_RED, 47, 100), // Nausea
|
||||
MakeProgressBar({ 65, (kListRowHeight * 5) + 4 + 43 }, { 119, 10 }, COLOUR_BRIGHT_RED, 62, 100), // Toilet
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget _guestWindowWidgetsRides[] = {
|
||||
static constexpr Widget _guestWindowWidgetsRides[] = {
|
||||
MAIN_GUEST_WIDGETS,
|
||||
MakeWidget({ 3, 57 }, { 186, 87 }, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget _guestWindowWidgetsFinance[] = {
|
||||
static constexpr Widget _guestWindowWidgetsFinance[] = {
|
||||
MAIN_GUEST_WIDGETS,
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget _guestWindowWidgetsThoughts[] = {
|
||||
static constexpr Widget _guestWindowWidgetsThoughts[] = {
|
||||
MAIN_GUEST_WIDGETS,
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget _guestWindowWidgetsInventory[] = {
|
||||
static constexpr Widget _guestWindowWidgetsInventory[] = {
|
||||
MAIN_GUEST_WIDGETS,
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget _guestWindowWidgetsDebug[] = {
|
||||
static constexpr Widget _guestWindowWidgetsDebug[] = {
|
||||
MAIN_GUEST_WIDGETS,
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static constexpr std::array _guestWindowPageWidgets = {
|
||||
static constexpr std::span<const Widget> _guestWindowPageWidgets[] = {
|
||||
_guestWindowWidgetsOverview,
|
||||
_guestWindowWidgetsStats,
|
||||
_guestWindowWidgetsRides,
|
||||
@@ -173,7 +166,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
_guestWindowWidgetsInventory,
|
||||
_guestWindowWidgetsDebug,
|
||||
};
|
||||
static_assert(_guestWindowPageWidgets.size() == WINDOW_GUEST_PAGE_COUNT);
|
||||
static_assert(std::size(_guestWindowPageWidgets) == WINDOW_GUEST_PAGE_COUNT);
|
||||
// clang-format on
|
||||
|
||||
static constexpr std::array _guestWindowPageSizes = {
|
||||
@@ -199,7 +192,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _guestWindowWidgetsOverview;
|
||||
SetWidgets(_guestWindowWidgetsOverview);
|
||||
page = WINDOW_GUEST_OVERVIEW;
|
||||
frame_no = 0;
|
||||
_marqueePosition = 0;
|
||||
@@ -448,12 +441,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnPrepareDrawCommon()
|
||||
{
|
||||
if (_guestWindowPageWidgets[page] != widgets)
|
||||
{
|
||||
widgets = _guestWindowPageWidgets[page];
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
pressed_widgets |= 1uLL << (page + WIDX_TAB_1);
|
||||
|
||||
const auto peep = GetGuest();
|
||||
@@ -521,7 +508,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
hold_down_widgets = 0;
|
||||
pressed_widgets = 0;
|
||||
widgets = _guestWindowPageWidgets[page];
|
||||
SetWidgets(_guestWindowPageWidgets[page]);
|
||||
DisableWidgets();
|
||||
Invalidate();
|
||||
OnResize();
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget window_guest_list_widgets[] = {
|
||||
static constexpr Widget window_guest_list_widgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({ 0, 43}, {350, 287}, WindowWidgetType::Resize, WindowColour::Secondary ), // tab content panel
|
||||
MakeWidget({ 5, 59}, { 80, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_ARG_4_PAGE_X ), // page dropdown
|
||||
@@ -71,7 +71,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeTab ({ 3, 17}, STR_INDIVIDUAL_GUESTS_TIP ), // tab 1
|
||||
MakeTab ({ 34, 17}, STR_SUMMARISED_GUESTS_TIP ), // tab 2
|
||||
MakeWidget({ 3, 72}, {344, 255}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_BOTH ), // guest list
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -161,7 +160,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_guest_list_widgets;
|
||||
SetWidgets(window_guest_list_widgets);
|
||||
WindowInitScrollWidgets(*this);
|
||||
|
||||
_selectedTab = TabId::Summarised;
|
||||
|
||||
@@ -50,14 +50,13 @@ namespace OpenRCT2::Ui::Windows
|
||||
constexpr int32_t ACTION_BUTTONS_LEFT = WW - 100;
|
||||
|
||||
// clang-format off
|
||||
static Widget window_install_track_widgets[] = {
|
||||
static constexpr Widget window_install_track_widgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({ 4, 18}, {372, 219}, WindowWidgetType::FlatBtn, WindowColour::Primary ),
|
||||
MakeWidget({PREVIEW_BUTTONS_LEFT, 422}, { 22, 24}, WindowWidgetType::FlatBtn, WindowColour::Primary, ImageId(SPR_ROTATE_ARROW), STR_ROTATE_90_TIP ),
|
||||
MakeWidget({PREVIEW_BUTTONS_LEFT, 398}, { 22, 24}, WindowWidgetType::FlatBtn, WindowColour::Primary, ImageId(SPR_SCENERY), STR_TOGGLE_SCENERY_TIP),
|
||||
MakeWidget({ ACTION_BUTTONS_LEFT, 241}, { 97, 15}, WindowWidgetType::Button, WindowColour::Primary, STR_INSTALL_NEW_TRACK_DESIGN_INSTALL ),
|
||||
MakeWidget({ ACTION_BUTTONS_LEFT, 259}, { 97, 15}, WindowWidgetType::Button, WindowColour::Primary, STR_INSTALL_NEW_TRACK_DESIGN_CANCEL ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -83,7 +82,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_install_track_widgets;
|
||||
SetWidgets(window_install_track_widgets);
|
||||
|
||||
WindowInitScrollWidgets(*this);
|
||||
WindowPushOthersRight(*this);
|
||||
@@ -152,7 +151,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
DrawWidgets(dpi);
|
||||
|
||||
// Track preview
|
||||
Widget* widget = &window_install_track_widgets[WIDX_TRACK_PREVIEW];
|
||||
Widget* widget = &widgets[WIDX_TRACK_PREVIEW];
|
||||
auto screenPos = windowPos + ScreenCoordsXY{ widget->left + 1, widget->top + 1 };
|
||||
int32_t colour = ColourMapA[colours[0].colour].darkest;
|
||||
GfxFillRect(dpi, { screenPos, screenPos + ScreenCoordsXY{ 369, 216 } }, colour);
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget window_land_widgets[] = {
|
||||
static constexpr Widget window_land_widgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget ({19, 19}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RIDE_CONSTRUCTION_SLOPE_UP), STR_ENABLE_MOUNTAIN_TOOL_TIP), // mountain mode
|
||||
MakeWidget ({55, 19}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_PAINTBRUSH), STR_DISABLE_ELEVATION), // paint mode
|
||||
@@ -62,7 +62,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeRemapWidget({54, 63}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Secondary, SPR_LAND_TOOL_INCREASE, STR_ADJUST_LARGER_LAND_TIP), // increment size
|
||||
MakeWidget ({ 2, 106}, {47, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_CHANGE_BASE_LAND_TIP), // floor texture
|
||||
MakeWidget ({49, 106}, {47, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_CHANGE_VERTICAL_LAND_TIP), // wall texture
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -90,7 +89,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_land_widgets;
|
||||
SetWidgets(window_land_widgets);
|
||||
hold_down_widgets = (1uLL << WIDX_DECREMENT) | (1uLL << WIDX_INCREMENT);
|
||||
WindowInitScrollWidgets(*this);
|
||||
WindowPushOthersBelow(*this);
|
||||
@@ -407,7 +406,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
return;
|
||||
|
||||
WidgetIndex widget_index = windowMgr->FindWidgetFromPoint(*window, screenPos);
|
||||
if (widget_index == -1)
|
||||
if (widget_index == kWidgetIndexNull)
|
||||
return;
|
||||
|
||||
const auto& widget = window->widgets[widget_index];
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget window_land_rights_widgets[] = {
|
||||
static constexpr Widget window_land_rights_widgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget ({ 27, 17}, { 44, 32}, WindowWidgetType::ImgBtn, WindowColour::Primary, ImageId(SPR_LAND_TOOL_SIZE_0) ), // preview box
|
||||
MakeRemapWidget({ 28, 18}, { 16, 16}, WindowWidgetType::TrnBtn, WindowColour::Primary, SPR_LAND_TOOL_DECREASE, STR_ADJUST_SMALLER_LAND_RIGHTS_TIP ), // decrement size
|
||||
@@ -69,7 +69,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget ({100, 54}, {170, 12}, WindowWidgetType::Empty, WindowColour::Primary, STR_LAND_OWNED, STR_SET_LAND_TO_BE_OWNED_TIP ),
|
||||
MakeWidget ({100, 70}, {170, 12}, WindowWidgetType::Empty, WindowColour::Primary, STR_CONSTRUCTION_RIGHTS_SALE, STR_SET_CONSTRUCTION_RIGHTS_TO_BE_AVAILABLE_TIP),
|
||||
MakeWidget ({100, 86}, {170, 12}, WindowWidgetType::Empty, WindowColour::Primary, STR_CONSTRUCTION_RIGHTS_OWNED, STR_SET_CONSTRUCTION_RIGHTS_TO_BE_OWNED_TIP ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -126,7 +125,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_land_rights_widgets;
|
||||
SetWidgets(window_land_rights_widgets);
|
||||
hold_down_widgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT);
|
||||
WindowInitScrollWidgets(*this);
|
||||
WindowPushOthersBelow(*this);
|
||||
@@ -287,23 +286,23 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (gLandRemainingOwnershipSales == 0)
|
||||
{
|
||||
SetWidgetDisabled(WIDX_BUY_LAND_RIGHTS, true);
|
||||
window_land_rights_widgets[WIDX_BUY_LAND_RIGHTS].tooltip = STR_NO_LAND_RIGHTS_FOR_SALE_TIP;
|
||||
widgets[WIDX_BUY_LAND_RIGHTS].tooltip = STR_NO_LAND_RIGHTS_FOR_SALE_TIP;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetWidgetDisabled(WIDX_BUY_LAND_RIGHTS, false);
|
||||
window_land_rights_widgets[WIDX_BUY_LAND_RIGHTS].tooltip = STR_BUY_LAND_RIGHTS_TIP;
|
||||
widgets[WIDX_BUY_LAND_RIGHTS].tooltip = STR_BUY_LAND_RIGHTS_TIP;
|
||||
}
|
||||
|
||||
if (gLandRemainingConstructionSales == 0)
|
||||
{
|
||||
SetWidgetDisabled(WIDX_BUY_CONSTRUCTION_RIGHTS, true);
|
||||
window_land_rights_widgets[WIDX_BUY_CONSTRUCTION_RIGHTS].tooltip = STR_NO_CONSTRUCTION_RIGHTS_FOR_SALE_TIP;
|
||||
widgets[WIDX_BUY_CONSTRUCTION_RIGHTS].tooltip = STR_NO_CONSTRUCTION_RIGHTS_FOR_SALE_TIP;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetWidgetDisabled(WIDX_BUY_CONSTRUCTION_RIGHTS, false);
|
||||
window_land_rights_widgets[WIDX_BUY_CONSTRUCTION_RIGHTS].tooltip = STR_BUY_CONSTRUCTION_RIGHTS_TIP;
|
||||
widgets[WIDX_BUY_CONSTRUCTION_RIGHTS].tooltip = STR_BUY_CONSTRUCTION_RIGHTS_TIP;
|
||||
}
|
||||
|
||||
// Position land size tool
|
||||
@@ -359,7 +358,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
void OnPrepareDraw() override
|
||||
{
|
||||
SetWidgetPressed(WIDX_PREVIEW, true);
|
||||
window_land_rights_widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize));
|
||||
widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize));
|
||||
|
||||
if (width != GetModeDimensions().x)
|
||||
OnResize();
|
||||
@@ -393,8 +392,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnDraw(DrawPixelInfo& dpi) override
|
||||
{
|
||||
auto screenCoords = ScreenCoordsXY{ windowPos.x + window_land_rights_widgets[WIDX_PREVIEW].midX(),
|
||||
windowPos.y + window_land_rights_widgets[WIDX_PREVIEW].midY() };
|
||||
auto screenCoords = ScreenCoordsXY{ windowPos.x + widgets[WIDX_PREVIEW].midX(),
|
||||
windowPos.y + widgets[WIDX_PREVIEW].midY() };
|
||||
|
||||
DrawWidgets(dpi);
|
||||
// Draw number for tool sizes bigger than 7
|
||||
@@ -415,8 +414,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
auto offset = widgets[WIDX_BUY_LAND_RIGHTS].type != WindowWidgetType::Empty ? 32 : 8;
|
||||
|
||||
screenCoords = { window_land_rights_widgets[WIDX_PREVIEW].midX() + windowPos.x,
|
||||
window_land_rights_widgets[WIDX_PREVIEW].bottom + windowPos.y + offset };
|
||||
screenCoords = { widgets[WIDX_PREVIEW].midX() + windowPos.x,
|
||||
widgets[WIDX_PREVIEW].bottom + windowPos.y + offset };
|
||||
DrawTextBasic(dpi, screenCoords, STR_COST_AMOUNT, ft, { TextAlignment::CENTRE });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
static constexpr int16_t WH = kWindowSizeInit.height;
|
||||
|
||||
// clang-format off
|
||||
static Widget window_loadsave_widgets[] =
|
||||
static constexpr Widget window_loadsave_widgets[] =
|
||||
{
|
||||
WINDOW_SHIM(STR_NONE, WW, WH),
|
||||
MakeWidget({ 0, 15 }, { WW, WH - 15 }, WindowWidgetType::Resize, WindowColour::Secondary ), // WIDX_RESIZE
|
||||
@@ -96,7 +96,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({ 64, WH - 50 }, { WW - 133, 14 }, WindowWidgetType::TextBox, WindowColour::Secondary ), // WIDX_FILENAME_TEXTBOX
|
||||
MakeWidget({ WW - 65, WH - 50 }, { 60, 14 }, WindowWidgetType::Button, WindowColour::Secondary, STR_FILEBROWSER_SAVE_BUTTON ), // WIDX_SAVE
|
||||
MakeWidget({ 4, WH - 24 }, { 197, 19 }, WindowWidgetType::Button, WindowColour::Primary, STR_FILEBROWSER_USE_SYSTEM_WINDOW ), // WIDX_BROWSE
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -713,7 +712,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_loadsave_widgets;
|
||||
SetWidgets(window_loadsave_widgets);
|
||||
|
||||
const auto uiContext = OpenRCT2::GetContext()->GetUiContext();
|
||||
if (!uiContext->HasFilePicker())
|
||||
@@ -1422,11 +1421,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget window_overwrite_prompt_widgets[] = {
|
||||
static constexpr Widget window_overwrite_prompt_widgets[] = {
|
||||
WINDOW_SHIM_WHITE(STR_FILEBROWSER_OVERWRITE_TITLE, OVERWRITE_WW, OVERWRITE_WH),
|
||||
MakeWidget({ 10, OVERWRITE_WH - 20 }, { 84, 11 }, WindowWidgetType::Button, WindowColour::Primary, STR_FILEBROWSER_OVERWRITE_TITLE),
|
||||
MakeWidget({ OVERWRITE_WW - 95, OVERWRITE_WH - 20 }, { 85, 11 }, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_CANCEL),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -1444,7 +1442,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_overwrite_prompt_widgets;
|
||||
SetWidgets(window_overwrite_prompt_widgets);
|
||||
}
|
||||
|
||||
void OnMouseUp(WidgetIndex widgetIndex) override
|
||||
|
||||
@@ -19,9 +19,8 @@
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
// clang-format off
|
||||
static Widget _mainWidgets[] = {
|
||||
static constexpr Widget _mainWidgets[] = {
|
||||
MakeWidget({0, 0}, {0, 0}, WindowWidgetType::Viewport, WindowColour::Primary),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -30,9 +29,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
_mainWidgets[0].right = width;
|
||||
_mainWidgets[0].bottom = height;
|
||||
widgets = _mainWidgets;
|
||||
SetWidgets(_mainWidgets);
|
||||
widgets[0].right = width;
|
||||
widgets[0].bottom = height;
|
||||
|
||||
ViewportCreate(this, windowPos, width, height, Focus(CoordsXYZ(0x0FFF, 0x0FFF, 0)));
|
||||
if (viewport != nullptr)
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget window_map_widgets[] = {
|
||||
static constexpr Widget window_map_widgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget ({ 0, 43}, {245, 215}, WindowWidgetType::Resize, WindowColour::Secondary ),
|
||||
MakeRemapWidget ({ 3, 17}, { 31, 27}, WindowWidgetType::ColourBtn, WindowColour::Secondary, SPR_TAB, STR_SHOW_PEOPLE_ON_MAP_TIP ),
|
||||
@@ -145,7 +145,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget ({ 4, 70}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_PEEP_SPAWN), STR_SET_STARTING_POSITIONS_TIP ),
|
||||
MakeWidget ({ 28, 94}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_PARK_ENTRANCE), STR_BUILD_PARK_ENTRANCE_TIP ),
|
||||
MakeWidget ({110, 118}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_MAP_GEN_BTN), STR_MAP_GENERATOR_TIP ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -235,7 +234,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_map_widgets;
|
||||
SetWidgets(window_map_widgets);
|
||||
|
||||
hold_down_widgets = (1uLL << WIDX_MAP_SIZE_SPINNER_Y_UP) | (1uLL << WIDX_MAP_SIZE_SPINNER_Y_DOWN)
|
||||
| (1uLL << WIDX_MAP_SIZE_SPINNER_X_UP) | (1uLL << WIDX_MAP_SIZE_SPINNER_X_DOWN);
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({ 185, 200 }, { 109, 14 }, WindowWidgetType::Button, WindowColour::Secondary, STR_MAPGEN_ACTION_GENERATE)
|
||||
|
||||
// clang-format off
|
||||
static Widget BaseWidgets[] = {
|
||||
static constexpr Widget BaseWidgets[] = {
|
||||
SHARED_WIDGETS(STR_MAPGEN_CAPTION_GENERATOR),
|
||||
MakeSpinnerWidgets ({165, 52}, { 50, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_COMMA16 ), // NB: 3 widgets
|
||||
MakeWidget ({216, 52}, { 21, 12}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_LINK_CHAIN), STR_MAINTAIN_SQUARE_MAP_TOOLTIP),
|
||||
@@ -140,10 +140,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget ({ 10, 125}, {150, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MAPGEN_NORMALIZE ), // WIDX_HEIGHTMAP_NORMALIZE
|
||||
MakeWidget ({ 10, 141}, {150, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MAPGEN_SMOOTH_HEIGHTMAP), // WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP
|
||||
MakeSpinnerWidgets({179, 157}, {109, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // WIDX_HEIGHTMAP_STRENGTH{,_UP,_DOWN}
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget TerrainWidgets[] = {
|
||||
static constexpr Widget TerrainWidgets[] = {
|
||||
SHARED_WIDGETS(STR_MAPGEN_CAPTION_TERRAIN),
|
||||
MakeSpinnerWidgets({179, 52}, {109, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // WIDX_HEIGHTMAP_LOW{,_UP,_DOWN}
|
||||
MakeSpinnerWidgets({179, 70}, {109, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // WIDX_HEIGHTMAP_HIGH{,_UP,_DOWN}
|
||||
@@ -151,26 +150,23 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget ({236, 88}, { 47, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_CHANGE_VERTICAL_LAND_TIP),
|
||||
MakeWidget ({ 10, 106}, {150, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MAPGEN_OPTION_RANDOM_TERRAIN ),
|
||||
MakeWidget ({ 10, 122}, {150, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MAPGEN_SMOOTH_TILE), // WIDX_HEIGHTMAP_SMOOTH_TILE_EDGES
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget WaterWidgets[] = {
|
||||
static constexpr Widget WaterWidgets[] = {
|
||||
SHARED_WIDGETS(STR_MAPGEN_CAPTION_WATER),
|
||||
MakeSpinnerWidgets({179, 52}, {109, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // NB: 3 widgets
|
||||
MakeWidget ({ 10, 70}, {195, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_BEACHES_WATER_BODIES),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget ForestsWidgets[] = {
|
||||
static constexpr Widget ForestsWidgets[] = {
|
||||
SHARED_WIDGETS(STR_MAPGEN_CAPTION_FORESTS),
|
||||
MakeWidget ({ 10, 52}, {255, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MAPGEN_OPTION_PLACE_TREES),
|
||||
MakeSpinnerWidgets({179, 70}, {109, 12}, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_TREE_LAND_RATIO{,_UP,_DOWN}
|
||||
MakeSpinnerWidgets({179, 88}, {109, 12}, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_TREE_ALTITUDE_MIN{,_UP,_DOWN}
|
||||
MakeSpinnerWidgets({179, 106}, {109, 12}, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_TREE_ALTITUDE_MAX{,_UP,_DOWN}
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget* PageWidgets[WINDOW_MAPGEN_PAGE_COUNT] = {
|
||||
static std::span<const Widget> PageWidgets[WINDOW_MAPGEN_PAGE_COUNT] = {
|
||||
BaseWidgets,
|
||||
TerrainWidgets,
|
||||
WaterWidgets,
|
||||
@@ -282,7 +278,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
RemoveViewport();
|
||||
|
||||
hold_down_widgets = HoldDownWidgets[newPage];
|
||||
widgets = PageWidgets[newPage];
|
||||
SetWidgets(PageWidgets[newPage]);
|
||||
disabled_widgets = PageDisabledWidgets[newPage];
|
||||
pressed_widgets = PressedWidgets[newPage];
|
||||
|
||||
@@ -515,12 +511,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void BasePrepareDraw()
|
||||
{
|
||||
if (widgets != PageWidgets[WINDOW_MAPGEN_PAGE_BASE])
|
||||
{
|
||||
widgets = PageWidgets[WINDOW_MAPGEN_PAGE_BASE];
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
// Only allow linking the map size when X and Y are the same
|
||||
SetWidgetPressed(WIDX_MAP_SIZE_LINK, _mapWidthAndHeightLinked);
|
||||
SetWidgetDisabled(WIDX_MAP_SIZE_LINK, _settings.mapSize.x != _settings.mapSize.y);
|
||||
@@ -578,26 +568,26 @@ namespace OpenRCT2::Ui::Windows
|
||||
void ToggleSimplexWidgets(bool state)
|
||||
{
|
||||
// clang-format off
|
||||
BaseWidgets[WIDX_SIMPLEX_GROUP].type = state ? WindowWidgetType::Groupbox : WindowWidgetType::Empty;
|
||||
BaseWidgets[WIDX_SIMPLEX_BASE_FREQ].type = state ? WindowWidgetType::Spinner : WindowWidgetType::Empty;
|
||||
BaseWidgets[WIDX_SIMPLEX_BASE_FREQ_UP].type = state ? WindowWidgetType::Button : WindowWidgetType::Empty;
|
||||
BaseWidgets[WIDX_SIMPLEX_BASE_FREQ_DOWN].type = state ? WindowWidgetType::Button : WindowWidgetType::Empty;
|
||||
BaseWidgets[WIDX_SIMPLEX_OCTAVES].type = state ? WindowWidgetType::Spinner : WindowWidgetType::Empty;
|
||||
BaseWidgets[WIDX_SIMPLEX_OCTAVES_UP].type = state ? WindowWidgetType::Button : WindowWidgetType::Empty;
|
||||
BaseWidgets[WIDX_SIMPLEX_OCTAVES_DOWN].type = state ? WindowWidgetType::Button : WindowWidgetType::Empty;
|
||||
widgets[WIDX_SIMPLEX_GROUP].type = state ? WindowWidgetType::Groupbox : WindowWidgetType::Empty;
|
||||
widgets[WIDX_SIMPLEX_BASE_FREQ].type = state ? WindowWidgetType::Spinner : WindowWidgetType::Empty;
|
||||
widgets[WIDX_SIMPLEX_BASE_FREQ_UP].type = state ? WindowWidgetType::Button : WindowWidgetType::Empty;
|
||||
widgets[WIDX_SIMPLEX_BASE_FREQ_DOWN].type = state ? WindowWidgetType::Button : WindowWidgetType::Empty;
|
||||
widgets[WIDX_SIMPLEX_OCTAVES].type = state ? WindowWidgetType::Spinner : WindowWidgetType::Empty;
|
||||
widgets[WIDX_SIMPLEX_OCTAVES_UP].type = state ? WindowWidgetType::Button : WindowWidgetType::Empty;
|
||||
widgets[WIDX_SIMPLEX_OCTAVES_DOWN].type = state ? WindowWidgetType::Button : WindowWidgetType::Empty;
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
void ToggleHeightmapWidgets(bool state)
|
||||
{
|
||||
// clang-format off
|
||||
BaseWidgets[WIDX_HEIGHTMAP_GROUP].type = state ? WindowWidgetType::Groupbox : WindowWidgetType::Empty;
|
||||
BaseWidgets[WIDX_HEIGHTMAP_BROWSE].type = state ? WindowWidgetType::Button : WindowWidgetType::Empty;
|
||||
BaseWidgets[WIDX_HEIGHTMAP_NORMALIZE].type = state ? WindowWidgetType::Checkbox : WindowWidgetType::Empty;
|
||||
BaseWidgets[WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP].type = state ? WindowWidgetType::Checkbox : WindowWidgetType::Empty;
|
||||
BaseWidgets[WIDX_HEIGHTMAP_STRENGTH].type = state ? WindowWidgetType::Spinner : WindowWidgetType::Empty;
|
||||
BaseWidgets[WIDX_HEIGHTMAP_STRENGTH_UP].type = state ? WindowWidgetType::Button : WindowWidgetType::Empty;
|
||||
BaseWidgets[WIDX_HEIGHTMAP_STRENGTH_DOWN].type = state ? WindowWidgetType::Button : WindowWidgetType::Empty;
|
||||
widgets[WIDX_HEIGHTMAP_GROUP].type = state ? WindowWidgetType::Groupbox : WindowWidgetType::Empty;
|
||||
widgets[WIDX_HEIGHTMAP_BROWSE].type = state ? WindowWidgetType::Button : WindowWidgetType::Empty;
|
||||
widgets[WIDX_HEIGHTMAP_NORMALIZE].type = state ? WindowWidgetType::Checkbox : WindowWidgetType::Empty;
|
||||
widgets[WIDX_HEIGHTMAP_SMOOTH_HEIGHTMAP].type = state ? WindowWidgetType::Checkbox : WindowWidgetType::Empty;
|
||||
widgets[WIDX_HEIGHTMAP_STRENGTH].type = state ? WindowWidgetType::Spinner : WindowWidgetType::Empty;
|
||||
widgets[WIDX_HEIGHTMAP_STRENGTH_UP].type = state ? WindowWidgetType::Button : WindowWidgetType::Empty;
|
||||
widgets[WIDX_HEIGHTMAP_STRENGTH_DOWN].type = state ? WindowWidgetType::Button : WindowWidgetType::Empty;
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
@@ -744,12 +734,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void ForestsPrepareDraw()
|
||||
{
|
||||
if (widgets != PageWidgets[WINDOW_MAPGEN_PAGE_FORESTS])
|
||||
{
|
||||
widgets = PageWidgets[WINDOW_MAPGEN_PAGE_FORESTS];
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
pressed_widgets = 0;
|
||||
if (_settings.trees)
|
||||
pressed_widgets |= 1uLL << WIDX_FORESTS_PLACE_TREES;
|
||||
@@ -1221,12 +1205,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void TerrainPrepareDraw()
|
||||
{
|
||||
if (widgets != PageWidgets[WINDOW_MAPGEN_PAGE_TERRAIN])
|
||||
{
|
||||
widgets = PageWidgets[WINDOW_MAPGEN_PAGE_TERRAIN];
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
SetCheckboxValue(WIDX_RANDOM_TERRAIN, _randomTerrain != 0);
|
||||
SetCheckboxValue(WIDX_HEIGHTMAP_SMOOTH_TILE_EDGES, _settings.smoothTileEdges);
|
||||
|
||||
@@ -1348,12 +1326,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void WaterPrepareDraw()
|
||||
{
|
||||
if (widgets != PageWidgets[WINDOW_MAPGEN_PAGE_WATER])
|
||||
{
|
||||
widgets = PageWidgets[WINDOW_MAPGEN_PAGE_WATER];
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
SetCheckboxValue(WIDX_ADD_BEACHES, _settings.beaches != 0);
|
||||
|
||||
SetPressedTab();
|
||||
@@ -1383,11 +1355,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
void OnOpen() override
|
||||
{
|
||||
number = 0;
|
||||
frame_no = 0;
|
||||
|
||||
page = WINDOW_MAPGEN_PAGE_BASE;
|
||||
SetPage(WINDOW_MAPGEN_PAGE_BASE);
|
||||
Invalidate();
|
||||
widgets = PageWidgets[WINDOW_MAPGEN_PAGE_BASE];
|
||||
hold_down_widgets = HoldDownWidgets[WINDOW_MAPGEN_PAGE_BASE];
|
||||
pressed_widgets = PressedWidgets[WINDOW_MAPGEN_PAGE_BASE];
|
||||
disabled_widgets = PageDisabledWidgets[WINDOW_MAPGEN_PAGE_BASE];
|
||||
|
||||
@@ -22,9 +22,8 @@
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
// clang-format off
|
||||
static Widget window_map_tooltip_widgets[] = {
|
||||
static constexpr Widget window_map_tooltip_widgets[] = {
|
||||
MakeWidget({0, 0}, {200, 30}, WindowWidgetType::ImgBtn, WindowColour::Primary),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -40,7 +39,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_map_tooltip_widgets;
|
||||
SetWidgets(window_map_tooltip_widgets);
|
||||
}
|
||||
|
||||
void OnUpdate() override
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
validate_global_widx(WC_MAZE_CONSTRUCTION, WIDX_MAZE_EXIT);
|
||||
|
||||
// clang-format off
|
||||
static Widget window_maze_construction_widgets[] = {
|
||||
static constexpr Widget window_maze_construction_widgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({ 3, 17}, {160, 55}, WindowWidgetType::Groupbox, WindowColour::Primary , STR_RIDE_CONSTRUCTION_MODE ),
|
||||
MakeWidget({ 0, 0}, { 1, 1}, WindowWidgetType::Empty, WindowColour::Primary ),
|
||||
@@ -94,7 +94,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({87, 178}, { 70, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_RIDE_CONSTRUCTION_EXIT, STR_RIDE_CONSTRUCTION_EXIT_TIP ),
|
||||
MakeWidget({ 0, 0}, { 1, 1}, WindowWidgetType::Empty, WindowColour::Primary ),
|
||||
MakeWidget({ 0, 0}, { 1, 1}, WindowWidgetType::Empty, WindowColour::Primary ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -105,7 +104,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_maze_construction_widgets;
|
||||
SetWidgets(window_maze_construction_widgets);
|
||||
WindowInitScrollWidgets(*this);
|
||||
rideId = _currentRideIndex;
|
||||
ShowGridlines();
|
||||
|
||||
@@ -72,22 +72,20 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeTab ({ 65, 17}, STR_GROUPS_TIP ), /* tab */ \
|
||||
MakeTab ({ 96, 17}, STR_OPTIONS_TIP ) /* tab */
|
||||
|
||||
static Widget window_multiplayer_information_widgets[] = {
|
||||
static constexpr Widget window_multiplayer_information_widgets[] = {
|
||||
MAIN_MULTIPLAYER_WIDGETS,
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget window_multiplayer_players_widgets[] = {
|
||||
static constexpr Widget window_multiplayer_players_widgets[] = {
|
||||
MAIN_MULTIPLAYER_WIDGETS,
|
||||
MakeWidget({ 3, 46}, {173, 15}, WindowWidgetType::TableHeader, WindowColour::Primary , STR_PLAYER ), // Player name
|
||||
MakeWidget({176, 46}, { 83, 15}, WindowWidgetType::TableHeader, WindowColour::Primary , STR_GROUP ), // Player name
|
||||
MakeWidget({259, 46}, {100, 15}, WindowWidgetType::TableHeader, WindowColour::Primary , STR_LAST_ACTION), // Player name
|
||||
MakeWidget({359, 46}, { 42, 15}, WindowWidgetType::TableHeader, WindowColour::Primary , STR_PING ), // Player name
|
||||
MakeWidget({ 3, 60}, {334, 177}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL), // list
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget window_multiplayer_groups_widgets[] = {
|
||||
static constexpr Widget window_multiplayer_groups_widgets[] = {
|
||||
MAIN_MULTIPLAYER_WIDGETS,
|
||||
MakeWidget({141, 46}, {175, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // default group
|
||||
MakeWidget({305, 47}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH),
|
||||
@@ -97,18 +95,16 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({ 72, 80}, {175, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // selected group
|
||||
MakeWidget({236, 81}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH),
|
||||
MakeWidget({ 3, 94}, {314, 207}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL ), // permissions list
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget window_multiplayer_options_widgets[] = {
|
||||
static constexpr Widget window_multiplayer_options_widgets[] = {
|
||||
MAIN_MULTIPLAYER_WIDGETS,
|
||||
MakeWidget({3, 50}, {295, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_LOG_CHAT, STR_LOG_CHAT_TIP ),
|
||||
MakeWidget({3, 64}, {295, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_LOG_SERVER_ACTIONS, STR_LOG_SERVER_ACTIONS_TIP ),
|
||||
MakeWidget({3, 78}, {295, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_ALLOW_KNOWN_KEYS_ONLY, STR_ALLOW_KNOWN_KEYS_ONLY_TIP),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget *window_multiplayer_page_widgets[] = {
|
||||
static std::span<const Widget> window_multiplayer_page_widgets[] = {
|
||||
window_multiplayer_information_widgets,
|
||||
window_multiplayer_players_widgets,
|
||||
window_multiplayer_groups_widgets,
|
||||
@@ -214,7 +210,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
hold_down_widgets = 0;
|
||||
pressed_widgets = 0;
|
||||
widgets = window_multiplayer_page_widgets[page];
|
||||
SetWidgets(window_multiplayer_page_widgets[page]);
|
||||
widgets[WIDX_TITLE].text = WindowMultiplayerPageTitles[page];
|
||||
|
||||
OnResize();
|
||||
@@ -405,15 +401,15 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
case WINDOW_MULTIPLAYER_PAGE_PLAYERS:
|
||||
{
|
||||
window_multiplayer_players_widgets[WIDX_LIST].right = width - 4;
|
||||
window_multiplayer_players_widgets[WIDX_LIST].bottom = height - 0x0F;
|
||||
widgets[WIDX_LIST].right = width - 4;
|
||||
widgets[WIDX_LIST].bottom = height - 0x0F;
|
||||
WindowAlignTabs(this, WIDX_TAB1, WIDX_TAB4);
|
||||
break;
|
||||
}
|
||||
case WINDOW_MULTIPLAYER_PAGE_GROUPS:
|
||||
{
|
||||
window_multiplayer_groups_widgets[WIDX_PERMISSIONS_LIST].right = width - 4;
|
||||
window_multiplayer_groups_widgets[WIDX_PERMISSIONS_LIST].bottom = height - 0x0F;
|
||||
widgets[WIDX_PERMISSIONS_LIST].right = width - 4;
|
||||
widgets[WIDX_PERMISSIONS_LIST].bottom = height - 0x0F;
|
||||
WindowAlignTabs(this, WIDX_TAB1, WIDX_TAB4);
|
||||
|
||||
// select other group if one is removed
|
||||
@@ -530,11 +526,11 @@ namespace OpenRCT2::Ui::Windows
|
||||
gDropdownItems[i].Format = STR_OPTIONS_DROPDOWN_ITEM;
|
||||
gDropdownItems[i].Args = reinterpret_cast<uintptr_t>(NetworkGetGroupName(i));
|
||||
}
|
||||
if (widget == &window_multiplayer_groups_widgets[WIDX_DEFAULT_GROUP_DROPDOWN])
|
||||
if (widget == &widgets[WIDX_DEFAULT_GROUP_DROPDOWN])
|
||||
{
|
||||
Dropdown::SetChecked(NetworkGetGroupIndex(NetworkGetDefaultGroup()), true);
|
||||
}
|
||||
else if (widget == &window_multiplayer_groups_widgets[WIDX_SELECTED_GROUP_DROPDOWN])
|
||||
else if (widget == &widgets[WIDX_SELECTED_GROUP_DROPDOWN])
|
||||
{
|
||||
Dropdown::SetChecked(NetworkGetGroupIndex(_selectedGroup), true);
|
||||
}
|
||||
@@ -572,8 +568,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
|
||||
screenSize = { 0, NetworkGetNumPlayers() * kScrollableRowHeight };
|
||||
int32_t i = screenSize.height - window_multiplayer_players_widgets[WIDX_LIST].bottom
|
||||
+ window_multiplayer_players_widgets[WIDX_LIST].top + 21;
|
||||
int32_t i = screenSize.height - widgets[WIDX_LIST].bottom + widgets[WIDX_LIST].top + 21;
|
||||
if (i < 0)
|
||||
i = 0;
|
||||
if (i < scrolls[0].contentOffsetY)
|
||||
@@ -593,8 +588,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
|
||||
screenSize = { 0, NetworkGetNumActions() * kScrollableRowHeight };
|
||||
int32_t i = screenSize.height - window_multiplayer_groups_widgets[WIDX_LIST].bottom
|
||||
+ window_multiplayer_groups_widgets[WIDX_LIST].top + 21;
|
||||
int32_t i = screenSize.height - widgets[WIDX_LIST].bottom + widgets[WIDX_LIST].top + 21;
|
||||
if (i < 0)
|
||||
i = 0;
|
||||
if (i < scrolls[0].contentOffsetY)
|
||||
@@ -842,7 +836,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
thread_local std::string _buffer;
|
||||
|
||||
Widget* widget = &window_multiplayer_groups_widgets[WIDX_DEFAULT_GROUP];
|
||||
Widget* widget = &widgets[WIDX_DEFAULT_GROUP];
|
||||
int32_t group = NetworkGetGroupIndex(NetworkGetDefaultGroup());
|
||||
if (group != -1)
|
||||
{
|
||||
@@ -857,8 +851,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
|
||||
auto screenPos = windowPos
|
||||
+ ScreenCoordsXY{ window_multiplayer_groups_widgets[WIDX_CONTENT_PANEL].left + 4,
|
||||
window_multiplayer_groups_widgets[WIDX_CONTENT_PANEL].top + 4 };
|
||||
+ ScreenCoordsXY{ widgets[WIDX_CONTENT_PANEL].left + 4, widgets[WIDX_CONTENT_PANEL].top + 4 };
|
||||
|
||||
DrawTextBasic(dpi, screenPos, STR_DEFAULT_GROUP, {}, { colours[2] });
|
||||
|
||||
@@ -868,7 +861,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
dpi, { screenPos - ScreenCoordsXY{ 0, 6 }, screenPos + ScreenCoordsXY{ 310, -5 } }, colours[1],
|
||||
INSET_RECT_FLAG_BORDER_INSET);
|
||||
|
||||
widget = &window_multiplayer_groups_widgets[WIDX_SELECTED_GROUP];
|
||||
widget = &widgets[WIDX_SELECTED_GROUP];
|
||||
group = NetworkGetGroupIndex(_selectedGroup);
|
||||
if (group != -1)
|
||||
{
|
||||
|
||||
@@ -26,11 +26,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget window_network_status_widgets[] = {
|
||||
static constexpr Widget window_network_status_widgets[] = {
|
||||
MakeWidget({ 0, 0}, {400, 91}, WindowWidgetType::Frame, WindowColour::Primary ), // panel / background
|
||||
MakeWidget({ 1, 1}, {397, 14}, WindowWidgetType::Caption, WindowColour::Primary, STR_NONE, STR_WINDOW_TITLE_TIP), // title bar
|
||||
MakeWidget({388, 2}, { 11, 12}, WindowWidgetType::CloseBox, WindowColour::Primary, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP), // close x button
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -39,7 +38,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_network_status_widgets;
|
||||
SetWidgets(window_network_status_widgets);
|
||||
WindowInitScrollWidgets(*this);
|
||||
|
||||
frame_no = 0;
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget window_new_campaign_widgets[] = {
|
||||
static constexpr Widget window_new_campaign_widgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget ({ 14, 24}, {126, 12}, WindowWidgetType::Label, WindowColour::Primary, STR_EMPTY ), // ride label
|
||||
MakeWidget ({100, 24}, {242, 12}, WindowWidgetType::DropdownMenu, WindowColour::Primary, STR_EMPTY ), // ride dropdown
|
||||
@@ -58,7 +58,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget ({ 14, 41}, {126, 14}, WindowWidgetType::Label, WindowColour::Primary, STR_LENGTH_OF_TIME ), // weeks label
|
||||
MakeSpinnerWidgets({120, 41}, {100, 14}, WindowWidgetType::Spinner, WindowColour::Primary, STR_EMPTY ), // weeks (3 widgets)
|
||||
MakeWidget ({ 14, 89}, {322, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_MARKETING_START_THIS_MARKETING_CAMPAIGN), // start button
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -175,7 +174,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_new_campaign_widgets;
|
||||
SetWidgets(window_new_campaign_widgets);
|
||||
hold_down_widgets = (1uLL << WIDX_WEEKS_INCREASE_BUTTON) | (1uLL << WIDX_WEEKS_DECREASE_BUTTON);
|
||||
WindowInitScrollWidgets(*this);
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
static constexpr ScreenSize GroupTrackTypeSize{ GroupByTrackTypeWidth, 14 };
|
||||
|
||||
// clang-format off
|
||||
static Widget window_new_ride_widgets[] = {
|
||||
static constexpr Widget window_new_ride_widgets[] = {
|
||||
WINDOW_SHIM(WindowTitle, WindowWidth, WindowHeight),
|
||||
MakeWidget({ 0, 43}, {601, 339}, WindowWidgetType::Resize, WindowColour::Secondary ),
|
||||
MakeTab ({ 3, 17}, STR_TRANSPORT_RIDES_TIP ),
|
||||
@@ -227,7 +227,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({ 4, 46}, {211, 14}, WindowWidgetType::TextBox, WindowColour::Secondary ),
|
||||
MakeWidget({218, 46}, { 70, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_OBJECT_SEARCH_CLEAR ),
|
||||
MakeWidget(GroupByTrackTypeOrigin, GroupTrackTypeSize, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_GROUP_BY_TRACK_TYPE, STR_GROUP_BY_TRACK_TYPE_TIP ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -300,7 +299,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_new_ride_widgets;
|
||||
SetWidgets(window_new_ride_widgets);
|
||||
PopulateRideList();
|
||||
InitScrollWidgets();
|
||||
_filter.clear();
|
||||
|
||||
@@ -39,11 +39,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget window_news_widgets[] = {
|
||||
static constexpr Widget window_news_widgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({372, 18}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Primary, ImageId(SPR_TAB_GEARS_0)), // settings
|
||||
MakeWidget({ 4, 44}, {392, 252}, WindowWidgetType::Scroll, WindowColour::Primary, SCROLL_VERTICAL), // scroll
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -59,7 +58,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_news_widgets;
|
||||
SetWidgets(window_news_widgets);
|
||||
WindowInitScrollWidgets(*this);
|
||||
_pressedNewsItemIndex = -1;
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget WindowNewsOptionsWidgets[] = {
|
||||
static constexpr Widget WindowNewsOptionsWidgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({ 0, 43}, {400, 257}, WindowWidgetType::Resize, WindowColour::Secondary), // Tab content panel
|
||||
MakeTab ({ 3, 17} ), // Park tab
|
||||
@@ -87,7 +87,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({ 0, 0}, {343, 14}, WindowWidgetType::Checkbox, WindowColour::Tertiary ),
|
||||
MakeWidget({ 0, 0}, {343, 14}, WindowWidgetType::Checkbox, WindowColour::Tertiary ),
|
||||
MakeWidget({ 0, 0}, {343, 14}, WindowWidgetType::Checkbox, WindowColour::Tertiary ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -96,7 +95,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = WindowNewsOptionsWidgets;
|
||||
SetWidgets(WindowNewsOptionsWidgets);
|
||||
InitScrollWidgets();
|
||||
colours[0] = COLOUR_GREY;
|
||||
colours[1] = COLOUR_LIGHT_BLUE;
|
||||
@@ -161,7 +160,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
const auto& baseCheckBox = widgets[WIDX_CHECKBOX_0];
|
||||
int32_t y = baseCheckBox.top;
|
||||
|
||||
int32_t checkboxWidgetIndex = WIDX_CHECKBOX_0;
|
||||
uint16_t checkboxWidgetIndex = WIDX_CHECKBOX_0;
|
||||
Widget* checkboxWidget = &widgets[checkboxWidgetIndex];
|
||||
for (size_t i = 0; i < std::size(NewsItemOptionDefinitions); i++)
|
||||
{
|
||||
@@ -185,7 +184,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
|
||||
// Remove unused checkboxes
|
||||
while (checkboxWidget->type != WindowWidgetType::Last)
|
||||
while (checkboxWidgetIndex < widgets.size())
|
||||
{
|
||||
checkboxWidget->type = WindowWidgetType::Empty;
|
||||
checkboxWidgetIndex++;
|
||||
|
||||
@@ -279,7 +279,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
constexpr int32_t TYPE_COL_LEFT = 5 * WW_LESS_PADDING / 8 + 1;
|
||||
|
||||
// clang-format off
|
||||
static Widget window_object_load_error_widgets[] = {
|
||||
static constexpr Widget window_object_load_error_widgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({ NAME_COL_LEFT, 57}, {108, 14}, WindowWidgetType::TableHeader, WindowColour::Primary, STR_OBJECT_NAME ), // 'Object name' header
|
||||
MakeWidget({SOURCE_COL_LEFT, 57}, {166, 14}, WindowWidgetType::TableHeader, WindowColour::Primary, STR_OBJECT_SOURCE ), // 'Object source' header
|
||||
@@ -290,7 +290,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
#ifndef DISABLE_HTTP
|
||||
MakeWidget({ 300, 377}, {146, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_DOWNLOAD_ALL, STR_DOWNLOAD_ALL_TIP ), // Download all button
|
||||
#endif
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -397,7 +396,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_object_load_error_widgets;
|
||||
SetWidgets(window_object_load_error_widgets);
|
||||
|
||||
WindowInitScrollWidgets(*this);
|
||||
colours[0] = COLOUR_LIGHT_BLUE;
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeTab({ 158, 17 }, STR_OPTIONS_MISCELLANEOUS_TIP), \
|
||||
MakeTab({ 189, 17 }, STR_OPTIONS_ADVANCED)
|
||||
|
||||
static Widget window_options_display_widgets[] = {
|
||||
static constexpr Widget window_options_display_widgets[] = {
|
||||
MAIN_OPTIONS_WIDGETS,
|
||||
MakeWidget ({ 5, 53}, {300, 170}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_HARDWARE_GROUP ), // Hardware group
|
||||
MakeWidget ({ 10, 67}, {145, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_FULLSCREEN_MODE, STR_FULLSCREEN_MODE_TIP ), // Fullscreen
|
||||
@@ -257,13 +257,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget ({ 11, 176}, {143, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_USE_VSYNC, STR_USE_VSYNC_TIP ), // Use vsync
|
||||
MakeWidget ({ 11, 191}, {280, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_MINIMISE_FULLSCREEN_ON_FOCUS_LOSS, STR_MINIMISE_FULLSCREEN_ON_FOCUS_LOSS_TIP), // Minimise fullscreen focus loss
|
||||
MakeWidget ({ 11, 206}, {280, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_DISABLE_SCREENSAVER, STR_DISABLE_SCREENSAVER_TIP ), // Disable screensaver
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
constexpr int32_t kFrameRenderingStart = 53;
|
||||
constexpr int32_t kFrameEffectStart = 163;
|
||||
|
||||
static Widget window_options_rendering_widgets[] = {
|
||||
static constexpr Widget window_options_rendering_widgets[] = {
|
||||
MAIN_OPTIONS_WIDGETS,
|
||||
MakeWidget({ 5, kFrameRenderingStart + 0}, {300, 108}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_RENDERING_GROUP ), // Rendering group
|
||||
MakeWidget({ 10, kFrameRenderingStart + 15}, {281, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_SMOOTHING, STR_TILE_SMOOTHING_TIP ), // Landscape smoothing
|
||||
@@ -281,10 +280,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({40, kFrameEffectStart + 45}, {251, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_ENABLE_LIGHTING_VEHICLES, STR_ENABLE_LIGHTING_VEHICLES_TIP), // Enable light fx for vehicles
|
||||
MakeWidget({10, kFrameEffectStart + 60}, {281, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_RENDER_WEATHER_EFFECTS, STR_RENDER_WEATHER_EFFECTS_TIP ), // Render weather effects
|
||||
MakeWidget({25, kFrameEffectStart + 75}, {266, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_DISABLE_LIGHTNING_EFFECT, STR_DISABLE_LIGHTNING_EFFECT_TIP), // Disable lightning effect
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget window_options_culture_widgets[] = {
|
||||
static constexpr Widget window_options_culture_widgets[] = {
|
||||
MAIN_OPTIONS_WIDGETS,
|
||||
MakeWidget({ 10, 53}, {145, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_OPTIONS_LANGUAGE, STR_LANGUAGE_TIP ), // language
|
||||
MakeWidget({155, 53}, {145, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_STRING ),
|
||||
@@ -304,10 +302,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({ 10, 128}, {145, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_DATE_FORMAT, STR_DATE_FORMAT_TIP ), // Date format
|
||||
MakeWidget({155, 128}, {145, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ),
|
||||
MakeWidget({288, 129}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_DATE_FORMAT_TIP ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget window_options_audio_widgets[] = {
|
||||
static constexpr Widget window_options_audio_widgets[] = {
|
||||
MAIN_OPTIONS_WIDGETS,
|
||||
MakeWidget({ 10, 53}, {290, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // Audio device
|
||||
MakeWidget({288, 54}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_AUDIO_DEVICE_TIP ),
|
||||
@@ -321,14 +318,13 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({155, 68}, {145, 13}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_HORIZONTAL ), // Master volume
|
||||
MakeWidget({155, 83}, {145, 13}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_HORIZONTAL ), // Sound effect volume
|
||||
MakeWidget({155, 98}, {145, 13}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_HORIZONTAL ), // Music volume
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
constexpr int32_t kControlsGroupStart = 53;
|
||||
constexpr int32_t kThemesGroupStart = 193;
|
||||
constexpr int32_t kToolbarGroupStart = 245;
|
||||
|
||||
static Widget window_options_controls_and_interface_widgets[] = {
|
||||
static constexpr Widget window_options_controls_and_interface_widgets[] = {
|
||||
MAIN_OPTIONS_WIDGETS,
|
||||
MakeWidget({ 5, kControlsGroupStart + 0}, {300,137}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CONTROLS_GROUP ), // Controls group
|
||||
MakeWidget({ 10, kControlsGroupStart + 13}, {290, 14}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_SCREEN_EDGE_SCROLLING, STR_SCREEN_EDGE_SCROLLING_TIP ), // Edge scrolling
|
||||
@@ -356,7 +352,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({ 24, kToolbarGroupStart + 76}, {162, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_MUTE_BUTTON_ON_TOOLBAR, STR_MUTE_BUTTON_ON_TOOLBAR_TIP ), // Mute
|
||||
MakeWidget({155, kToolbarGroupStart + 76}, {145, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_CHAT_BUTTON_ON_TOOLBAR, STR_CHAT_BUTTON_ON_TOOLBAR_TIP ), // Chat
|
||||
MakeWidget({ 24, kToolbarGroupStart + 91}, {122, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_ZOOM_BUTTON_ON_TOOLBAR, STR_ZOOM_BUTTON_ON_TOOLBAR_TIP ), // Zoom
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
constexpr int32_t kTitleSequenceStart = 53;
|
||||
@@ -364,7 +359,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
constexpr int32_t kScenarioOptionsGroupStart = kScenarioGroupStart + 55;
|
||||
constexpr int32_t kTweaksStart = kScenarioOptionsGroupStart + 39;
|
||||
|
||||
static Widget window_options_misc_widgets[] = {
|
||||
static constexpr Widget window_options_misc_widgets[] = {
|
||||
MAIN_OPTIONS_WIDGETS,
|
||||
MakeWidget( { 5, kTitleSequenceStart + 0}, {300, 31}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_OPTIONS_TITLE_SEQUENCE ),
|
||||
MakeDropdownWidgets({ 10, kTitleSequenceStart + 15}, {290, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_STRINGID, STR_TITLE_SEQUENCE_TIP), // Title sequence dropdown
|
||||
@@ -386,10 +381,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({ 10, kTweaksStart + 77}, {165, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_DEFAULT_INSPECTION_INTERVAL, STR_DEFAULT_INSPECTION_INTERVAL_TIP),
|
||||
MakeWidget({175, kTweaksStart + 76}, {125, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // Default inspection time dropdown
|
||||
MakeWidget({288, kTweaksStart + 77}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_DEFAULT_INSPECTION_INTERVAL_TIP ), // Default inspection time dropdown button
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget window_options_advanced_widgets[] = {
|
||||
static constexpr Widget window_options_advanced_widgets[] = {
|
||||
MAIN_OPTIONS_WIDGETS,
|
||||
MakeWidget ({ 10, 54}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary, STR_ENABLE_DEBUGGING_TOOLS, STR_ENABLE_DEBUGGING_TOOLS_TIP ), // Enable debugging tools
|
||||
MakeWidget ({ 10, 69}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary, STR_SAVE_PLUGIN_DATA, STR_SAVE_PLUGIN_DATA_TIP ), // Export plug-in objects with saved games
|
||||
@@ -404,10 +398,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget ({ 24, 160}, {266, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_NONE, STR_STRING_TOOLTIP ), // RCT 1 path button
|
||||
MakeWidget ({289, 160}, { 11, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_CLOSE_X, STR_PATH_TO_RCT1_CLEAR_TIP ), // RCT 1 path clear button
|
||||
MakeWidget ({150, 176}, {150, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_EDIT_ASSET_PACKS_BUTTON, STR_NONE ), // Asset packs
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget *window_options_page_widgets[] = {
|
||||
static constexpr std::span<const Widget> window_options_page_widgets[] = {
|
||||
window_options_display_widgets,
|
||||
window_options_rendering_widgets,
|
||||
window_options_culture_widgets,
|
||||
@@ -425,10 +418,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_options_display_widgets;
|
||||
page = WINDOW_OPTIONS_PAGE_DISPLAY;
|
||||
frame_no = 0;
|
||||
InitScrollWidgets();
|
||||
SetPage(WINDOW_OPTIONS_PAGE_DISPLAY);
|
||||
}
|
||||
|
||||
void OnMouseUp(WidgetIndex widgetIndex) override
|
||||
@@ -647,11 +637,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void CommonPrepareDrawBefore()
|
||||
{
|
||||
if (window_options_page_widgets[page] != widgets)
|
||||
{
|
||||
widgets = window_options_page_widgets[page];
|
||||
InitScrollWidgets();
|
||||
}
|
||||
SetPressedTab();
|
||||
|
||||
disabled_widgets = 0;
|
||||
@@ -668,9 +653,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
// Automatically adjust window height to fit widgets
|
||||
int32_t y = 0;
|
||||
for (auto widget = &widgets[WIDX_PAGE_START]; widget->type != WindowWidgetType::Last; widget++)
|
||||
for (WidgetIndex widgetIdx = WIDX_PAGE_START; widgetIdx < widgets.size(); widgetIdx++)
|
||||
{
|
||||
y = std::max<int32_t>(y, widget->bottom);
|
||||
const auto& widget = widgets[widgetIdx];
|
||||
y = std::max<int32_t>(y, widget.bottom);
|
||||
}
|
||||
height = y + 6;
|
||||
ResizeFrameWithPage();
|
||||
@@ -2083,7 +2069,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
page = p;
|
||||
frame_no = 0;
|
||||
pressed_widgets = 0;
|
||||
widgets = window_options_page_widgets[page];
|
||||
SetWidgets(window_options_page_widgets[page]);
|
||||
|
||||
Invalidate();
|
||||
OnResize();
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeTab({ 189, 17 }, STR_PARK_AWARDS_TAB_TIP) /* tab 7 */
|
||||
|
||||
// clang-format off
|
||||
static Widget _entranceWidgets[] = {
|
||||
static constexpr Widget _entranceWidgets[] = {
|
||||
MAIN_PARK_WIDGETS(230),
|
||||
MakeWidget({ 3, 46}, {202, 115}, WindowWidgetType::Viewport, WindowColour::Secondary ), // viewport
|
||||
MakeWidget({ 3, 161}, {202, 11}, WindowWidgetType::LabelCentred, WindowColour::Secondary ), // status
|
||||
@@ -110,43 +110,36 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({205, 121}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RENAME), STR_NAME_PARK_TIP ), // rename
|
||||
MakeWidget({210, 51}, { 14, 15}, WindowWidgetType::ImgBtn, WindowColour::Secondary, ImageId(SPR_G2_RCT1_CLOSE_BUTTON_0), STR_CLOSE_PARK_TIP ),
|
||||
MakeWidget({210, 66}, { 14, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, ImageId(SPR_G2_RCT1_OPEN_BUTTON_0), STR_OPEN_PARK_TIP ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget _ratingWidgets[] = {
|
||||
static constexpr Widget _ratingWidgets[] = {
|
||||
MAIN_PARK_WIDGETS(255),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget _guestsWidgets[] = {
|
||||
static constexpr Widget _guestsWidgets[] = {
|
||||
MAIN_PARK_WIDGETS(255),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget _priceWidgets[] = {
|
||||
static constexpr Widget _priceWidgets[] = {
|
||||
MAIN_PARK_WIDGETS(230),
|
||||
MakeWidget ({ 21, 50}, {126, 14}, WindowWidgetType::Label, WindowColour::Secondary, STR_ADMISSION_PRICE),
|
||||
MakeSpinnerWidgets({147, 50}, { 76, 14}, WindowWidgetType::Spinner, WindowColour::Secondary ), // Price (3 widgets)
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget _statsWidgets[] = {
|
||||
static constexpr Widget _statsWidgets[] = {
|
||||
MAIN_PARK_WIDGETS(230),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget _objectiveWidgets[] = {
|
||||
static constexpr Widget _objectiveWidgets[] = {
|
||||
MAIN_PARK_WIDGETS(230),
|
||||
MakeWidget({7, 207}, {216, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_ENTER_NAME_INTO_SCENARIO_CHART), // enter name
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget _awardsWidgets[] = {
|
||||
static constexpr Widget _awardsWidgets[] = {
|
||||
MAIN_PARK_WIDGETS(230),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static std::array<Widget*, WINDOW_PARK_PAGE_COUNT> _pagedWidgets = {
|
||||
static std::span<const Widget> _pagedWidgets[] = {
|
||||
_entranceWidgets,
|
||||
_ratingWidgets,
|
||||
_guestsWidgets,
|
||||
@@ -523,7 +516,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
void OnPrepareDrawEntrance()
|
||||
{
|
||||
const auto& gameState = GetGameState();
|
||||
widgets = _pagedWidgets[page];
|
||||
SetWidgets(_pagedWidgets[page]);
|
||||
InitScrollWidgets();
|
||||
|
||||
SetPressedTab();
|
||||
@@ -701,13 +694,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnPrepareDrawRating()
|
||||
{
|
||||
auto* ratingWidgets = _pagedWidgets[page];
|
||||
if (ratingWidgets != widgets)
|
||||
{
|
||||
widgets = ratingWidgets;
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
SetPressedTab();
|
||||
PrepareWindowTitleText();
|
||||
|
||||
@@ -777,13 +763,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnPrepareDrawGuests()
|
||||
{
|
||||
auto* guestsWidgets = _pagedWidgets[page];
|
||||
if (widgets != guestsWidgets)
|
||||
{
|
||||
widgets = guestsWidgets;
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
SetPressedTab();
|
||||
PrepareWindowTitleText();
|
||||
|
||||
@@ -887,13 +866,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnPrepareDrawPrice()
|
||||
{
|
||||
auto* priceWidgets = _pagedWidgets[page];
|
||||
if (widgets != priceWidgets)
|
||||
{
|
||||
widgets = priceWidgets;
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
SetPressedTab();
|
||||
PrepareWindowTitleText();
|
||||
|
||||
@@ -979,13 +951,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnPrepareDrawStats()
|
||||
{
|
||||
auto* statsWidgets = _pagedWidgets[page];
|
||||
if (widgets != statsWidgets)
|
||||
{
|
||||
widgets = statsWidgets;
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
SetPressedTab();
|
||||
PrepareWindowTitleText();
|
||||
|
||||
@@ -1179,13 +1144,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnPrepareDrawAwards()
|
||||
{
|
||||
auto* awardsWidgets = _pagedWidgets[page];
|
||||
if (widgets != awardsWidgets)
|
||||
{
|
||||
widgets = awardsWidgets;
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
SetPressedTab();
|
||||
PrepareWindowTitleText();
|
||||
|
||||
@@ -1233,9 +1191,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
RemoveViewport();
|
||||
|
||||
hold_down_widgets = _pagedHoldDownWidgets[newPage];
|
||||
widgets = _pagedWidgets[newPage];
|
||||
SetWidgets(_pagedWidgets[newPage]);
|
||||
SetDisabledTabs();
|
||||
Invalidate();
|
||||
InitScrollWidgets();
|
||||
|
||||
OnResize();
|
||||
OnPrepareDraw();
|
||||
|
||||
@@ -45,12 +45,11 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget PatrolAreaWidgets[] = {
|
||||
static constexpr Widget PatrolAreaWidgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget ({27, 17}, {44, 32}, WindowWidgetType::ImgBtn, WindowColour::Primary , ImageId(SPR_LAND_TOOL_SIZE_0) ), // preview box
|
||||
MakeRemapWidget({28, 18}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Tertiary, SPR_LAND_TOOL_DECREASE, STR_ADJUST_SMALLER_PATROL_AREA_TIP), // decrement size
|
||||
MakeRemapWidget({54, 32}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Tertiary, SPR_LAND_TOOL_INCREASE, STR_ADJUST_LARGER_PATROL_AREA_TIP ), // increment size
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -59,7 +58,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = PatrolAreaWidgets;
|
||||
SetWidgets(PatrolAreaWidgets);
|
||||
hold_down_widgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT);
|
||||
WindowInitScrollWidgets(*this);
|
||||
WindowPushOthersBelow(*this);
|
||||
@@ -133,7 +132,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
void OnPrepareDraw() override
|
||||
{
|
||||
SetWidgetPressed(WIDX_PREVIEW, true);
|
||||
PatrolAreaWidgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize));
|
||||
widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize));
|
||||
}
|
||||
|
||||
void OnDraw(DrawPixelInfo& dpi) override
|
||||
@@ -143,8 +142,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
// Draw number for tool sizes bigger than 7
|
||||
if (gLandToolSize > kLandToolMaximumSizeWithSprite)
|
||||
{
|
||||
auto screenCoords = ScreenCoordsXY{ windowPos.x + PatrolAreaWidgets[WIDX_PREVIEW].midX(),
|
||||
windowPos.y + PatrolAreaWidgets[WIDX_PREVIEW].midY() };
|
||||
auto screenCoords = ScreenCoordsXY{ windowPos.x + widgets[WIDX_PREVIEW].midX(),
|
||||
windowPos.y + widgets[WIDX_PREVIEW].midY() };
|
||||
auto ft = Formatter();
|
||||
ft.Add<uint16_t>(gLandToolSize);
|
||||
DrawTextBasic(
|
||||
|
||||
@@ -57,22 +57,20 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeTab({ 3, 17 }), \
|
||||
MakeTab({ 34, 17 })
|
||||
|
||||
static Widget window_player_overview_widgets[] = {
|
||||
static constexpr Widget window_player_overview_widgets[] = {
|
||||
WINDOW_PLAYER_COMMON_WIDGETS,
|
||||
MakeWidget({ 3, 46}, {175, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // Permission group
|
||||
MakeWidget({167, 47}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ),
|
||||
MakeWidget({179, 45}, { 12, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_LOCATE), STR_LOCATE_PLAYER_TIP), // Locate button
|
||||
MakeWidget({179, 69}, { 12, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_KICK_PLAYER_TIP ), // Kick button
|
||||
MakeWidget({ 3, 60}, {175, 61}, WindowWidgetType::Viewport, WindowColour::Secondary ), // Viewport
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget window_player_statistics_widgets[] = {
|
||||
static constexpr Widget window_player_statistics_widgets[] = {
|
||||
WINDOW_PLAYER_COMMON_WIDGETS,
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget *window_player_page_widgets[] = {
|
||||
static constexpr std::span<const Widget> window_player_page_widgets[] = {
|
||||
window_player_overview_widgets,
|
||||
window_player_statistics_widgets,
|
||||
};
|
||||
@@ -104,12 +102,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
min_height = 134;
|
||||
max_width = 500;
|
||||
max_height = 450;
|
||||
|
||||
Invalidate();
|
||||
|
||||
widgets = window_player_page_widgets[WINDOW_PLAYER_PAGE_OVERVIEW];
|
||||
hold_down_widgets = 0;
|
||||
pressed_widgets = 0;
|
||||
SetPage(WINDOW_PLAYER_PAGE_OVERVIEW);
|
||||
}
|
||||
|
||||
void OnResize() override
|
||||
@@ -221,7 +216,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
hold_down_widgets = 0;
|
||||
pressed_widgets = 0;
|
||||
widgets = window_player_page_widgets[newPage];
|
||||
SetWidgets(window_player_page_widgets[newPage]);
|
||||
Invalidate();
|
||||
OnResize();
|
||||
OnPrepareDraw();
|
||||
@@ -376,12 +371,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
return;
|
||||
}
|
||||
|
||||
if (window_player_page_widgets[page] != widgets)
|
||||
{
|
||||
widgets = window_player_page_widgets[page];
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
pressed_widgets &= ~(WIDX_TAB_1);
|
||||
pressed_widgets &= ~(WIDX_TAB_2);
|
||||
pressed_widgets |= 1uLL << (page + WIDX_TAB_1);
|
||||
@@ -406,7 +395,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
if (viewport != nullptr)
|
||||
{
|
||||
Widget* viewportWidget = &window_player_overview_widgets[WIDX_VIEWPORT];
|
||||
Widget* viewportWidget = &widgets[WIDX_VIEWPORT];
|
||||
|
||||
viewport->pos = windowPos + ScreenCoordsXY{ viewportWidget->left, viewportWidget->top };
|
||||
viewport->width = viewportWidget->width();
|
||||
@@ -435,7 +424,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
int32_t groupindex = NetworkGetGroupIndex(NetworkGetPlayerGroup(player));
|
||||
if (groupindex != -1)
|
||||
{
|
||||
Widget* widget = &window_player_overview_widgets[WIDX_GROUP];
|
||||
Widget* widget = &widgets[WIDX_GROUP];
|
||||
|
||||
thread_local std::string _buffer;
|
||||
_buffer.assign("{WINDOW_COLOUR_2}");
|
||||
@@ -594,12 +583,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnPrepareDrawStatistics()
|
||||
{
|
||||
if (window_player_page_widgets[page] != widgets)
|
||||
{
|
||||
widgets = window_player_page_widgets[page];
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
pressed_widgets &= ~(WIDX_TAB_1);
|
||||
pressed_widgets &= ~(WIDX_TAB_2);
|
||||
pressed_widgets |= 1uLL << (page + WIDX_TAB_1);
|
||||
@@ -623,8 +606,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
|
||||
auto screenCoords = windowPos
|
||||
+ ScreenCoordsXY{ window_player_overview_widgets[WIDX_PAGE_BACKGROUND].left + 4,
|
||||
window_player_overview_widgets[WIDX_PAGE_BACKGROUND].top + 4 };
|
||||
+ ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 4 };
|
||||
|
||||
auto ft = Formatter();
|
||||
ft.Add<uint32_t>(NetworkGetPlayerCommandsRan(player));
|
||||
|
||||
@@ -34,11 +34,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
static constexpr int32_t kWindowHeight = 90;
|
||||
|
||||
// clang-format off
|
||||
static Widget kProgressWindowWidgets[] = {
|
||||
static constexpr Widget kProgressWindowWidgets[] = {
|
||||
MakeWidget({ 0, 0}, { kWindowWidth, kWindowHeight}, WindowWidgetType::Frame, WindowColour::Primary ), // panel / background
|
||||
MakeWidget({ 1, 1}, {kWindowWidth - 3, 14}, WindowWidgetType::Caption, WindowColour::Primary, STR_STRINGID, STR_WINDOW_TITLE_TIP), // title bar
|
||||
MakeWidget({kWindowWidth - 12, 2}, { 11, 12}, WindowWidgetType::CloseBox, WindowColour::Primary, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP), // close x button
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
struct LoaderVehicleStyle
|
||||
@@ -85,7 +84,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = kProgressWindowWidgets;
|
||||
SetWidgets(kProgressWindowWidgets);
|
||||
WindowInitScrollWidgets(*this);
|
||||
|
||||
frame_no = 0;
|
||||
|
||||
@@ -34,12 +34,11 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget window_ride_refurbish_widgets[] =
|
||||
static constexpr Widget window_ride_refurbish_widgets[] =
|
||||
{
|
||||
WINDOW_SHIM_WHITE(STR_REFURBISH_RIDE, WW, WH),
|
||||
MakeWidget({ 10, WH - 22 }, { 85, 14 }, WindowWidgetType::Button, WindowColour::Primary, STR_REFURBISH),
|
||||
MakeWidget({ WW - 95, WH - 22 }, { 85, 14 }, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_CANCEL),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -56,7 +55,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_ride_refurbish_widgets;
|
||||
SetWidgets(window_ride_refurbish_widgets);
|
||||
WindowInitScrollWidgets(*this);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
#pragma region Widgets
|
||||
|
||||
// clang-format off
|
||||
static Widget window_research_development_widgets[] = {
|
||||
static constexpr Widget window_research_development_widgets[] = {
|
||||
WINDOW_SHIM(STR_RESEARCH_AND_DEVELOPMENT, WW_DEVELOPMENT, WH_DEVELOPMENT),
|
||||
MakeWidget({ 0, 43}, { WW_DEVELOPMENT, 153}, WindowWidgetType::Resize, WindowColour::Secondary ),
|
||||
MakeTab ({ 3, 17}, STR_RESEARCH_AND_DEVELOPMENT_TIP),
|
||||
@@ -75,10 +75,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({ 3, 47}, {WW_DEVELOPMENT - 10, 70}, WindowWidgetType::Groupbox, WindowColour::Tertiary , STR_CURRENTLY_IN_DEVELOPMENT ),
|
||||
MakeWidget({ 3, 124}, {WW_DEVELOPMENT - 10, 65}, WindowWidgetType::Groupbox, WindowColour::Tertiary , STR_LAST_DEVELOPMENT ),
|
||||
MakeWidget({265, 161}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Tertiary , 0xFFFFFFFF, STR_RESEARCH_SHOW_DETAILS_TIP ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget window_research_funding_widgets[] = {
|
||||
static constexpr Widget window_research_funding_widgets[] = {
|
||||
WINDOW_SHIM(STR_RESEARCH_FUNDING, WW_FUNDING, WH_FUNDING),
|
||||
MakeWidget({ 0, 43}, { WW_FUNDING, 164}, WindowWidgetType::Resize, WindowColour::Secondary ),
|
||||
MakeTab ({ 3, 17}, STR_RESEARCH_AND_DEVELOPMENT_TIP ),
|
||||
@@ -94,10 +93,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({ 8, 160}, {WW_FUNDING - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_RESEARCH_NEW_WATER_RIDES, STR_RESEARCH_NEW_WATER_RIDES_TIP ),
|
||||
MakeWidget({ 8, 173}, {WW_FUNDING - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_RESEARCH_NEW_SHOPS_AND_STALLS, STR_RESEARCH_NEW_SHOPS_AND_STALLS_TIP ),
|
||||
MakeWidget({ 8, 186}, {WW_FUNDING - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_RESEARCH_NEW_SCENERY_AND_THEMING, STR_RESEARCH_NEW_SCENERY_AND_THEMING_TIP ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget *window_research_page_widgets[] = {
|
||||
static constexpr std::span<const Widget> window_research_page_widgets[] = {
|
||||
window_research_development_widgets,
|
||||
window_research_funding_widgets,
|
||||
};
|
||||
@@ -122,7 +120,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_research_page_widgets[WINDOW_RESEARCH_PAGE_DEVELOPMENT];
|
||||
SetPage(WINDOW_RESEARCH_PAGE_DEVELOPMENT);
|
||||
width = WW_DEVELOPMENT;
|
||||
height = WH_DEVELOPMENT;
|
||||
ResearchUpdateUncompletedTypes();
|
||||
@@ -135,7 +133,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
RemoveViewport();
|
||||
|
||||
hold_down_widgets = 0;
|
||||
widgets = window_research_page_widgets[newPageIndex];
|
||||
SetWidgets(window_research_page_widgets[newPageIndex]);
|
||||
disabled_widgets = 0;
|
||||
pressed_widgets = 0;
|
||||
|
||||
@@ -230,14 +228,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnPrepareDraw() override
|
||||
{
|
||||
auto* targetWidgets = window_research_page_widgets[page];
|
||||
|
||||
if (widgets != targetWidgets)
|
||||
{
|
||||
widgets = targetWidgets;
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
for (auto i = 0; i < WINDOW_RESEARCH_PAGE_COUNT; i++)
|
||||
{
|
||||
SetWidgetPressed(WIDX_TAB_1 + i, false);
|
||||
|
||||
@@ -256,7 +256,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeTab({ 282, 17 }, STR_CUSTOMER_INFORMATION_TIP)
|
||||
|
||||
// 0x009ADC34
|
||||
static Widget _mainWidgets[] = {
|
||||
static constexpr Widget _mainWidgets[] = {
|
||||
MAIN_RIDE_WIDGETS,
|
||||
MakeWidget({ 3, 60}, {288, 107}, WindowWidgetType::Viewport, WindowColour::Secondary ),
|
||||
MakeWidget({ 35, 46}, {222, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, kWidgetContentEmpty, STR_VIEW_SELECTION ),
|
||||
@@ -273,11 +273,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({296, 76}, { 14, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, ImageId(SPR_G2_RCT1_OPEN_BUTTON_0), STR_OPEN_RIDE_TIP ),
|
||||
MakeWidget({ 3, 180}, {305, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_ARG_6_STRINGID ),
|
||||
MakeWidget({297, 180}, { 11, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
// 0x009ADDA8
|
||||
static Widget _vehicleWidgets[] = {
|
||||
static constexpr Widget _vehicleWidgets[] = {
|
||||
MAIN_RIDE_WIDGETS,
|
||||
MakeWidget ({ 7, 50}, {302, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ),
|
||||
MakeWidget ({297, 51}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ),
|
||||
@@ -285,11 +284,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget ({ 7, 154}, {302, 43}, WindowWidgetType::Scroll, WindowColour::Secondary, STR_EMPTY ),
|
||||
MakeSpinnerWidgets({ 7, 203}, {145, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_RIDE_VEHICLE_COUNT, STR_MAX_VEHICLES_TIP ),
|
||||
MakeSpinnerWidgets({164, 203}, {145, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_1_CAR_PER_TRAIN, STR_MAX_CARS_PER_TRAIN_TIP),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
// 0x009ADEFC
|
||||
static Widget _operatingWidgets[] = {
|
||||
static constexpr Widget _operatingWidgets[] = {
|
||||
MAIN_RIDE_WIDGETS,
|
||||
MakeSpinnerWidgets({157, 61}, {152, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_ARG_18_STRINGID ), // NB: 3 widgets
|
||||
MakeSpinnerWidgets({157, 75}, {152, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_LIFT_HILL_CHAIN_SPEED_VALUE ), // NB: 3 widgets
|
||||
@@ -308,11 +306,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget ({297, 110}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ),
|
||||
MakeWidget ({ 21, 89}, {129, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_NUMBER_OF_CIRCUITS, STR_NUMBER_OF_CIRCUITS_TIP ),
|
||||
MakeSpinnerWidgets({157, 89}, {152, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_NUMBER_OF_CIRCUITS_VALUE ), // NB: 3 widgets
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
// 0x009AE190
|
||||
static Widget _maintenanceWidgets[] = {
|
||||
static constexpr Widget _maintenanceWidgets[] = {
|
||||
MAIN_RIDE_WIDGETS,
|
||||
MakeWidget({107, 71}, {202, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_EMPTY, STR_SELECT_HOW_OFTEN_A_MECHANIC_SHOULD_CHECK_THIS_RIDE),
|
||||
MakeWidget({297, 72}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_HOW_OFTEN_A_MECHANIC_SHOULD_CHECK_THIS_RIDE),
|
||||
@@ -321,11 +318,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({241, 108}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_NO_ENTRY), STR_DEBUG_FORCE_BREAKDOWN_TIP ),
|
||||
MakeProgressBar({107, 47}, { 147, 10}, COLOUR_BRIGHT_GREEN),
|
||||
MakeProgressBar({107, 58}, { 147, 10}, COLOUR_BRIGHT_RED),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
// 0x009AE2A4
|
||||
static Widget _colourWidgets[] = {
|
||||
static constexpr Widget _colourWidgets[] = {
|
||||
MAIN_RIDE_WIDGETS,
|
||||
MakeWidget({ 3, 47}, { 68, 47}, WindowWidgetType::Spinner, WindowColour::Secondary ),
|
||||
MakeWidget({ 74, 49}, {239, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_ARG_14_STRINGID ),
|
||||
@@ -349,44 +345,40 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({119, 190}, { 12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_ADDITIONAL_COLOUR_2_TIP ),
|
||||
MakeWidget({100, 74}, {239, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_RANDOM_COLOUR ),
|
||||
MakeWidget({139, 190}, {110, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_RANDOMISE_VEHICLE_COLOURS, STR_RANDOMISE_VEHICLE_COLOURS_TIP ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
// 0x009AE4C8
|
||||
static Widget _musicWidgets[] = {
|
||||
static constexpr Widget _musicWidgets[] = {
|
||||
MAIN_RIDE_WIDGETS,
|
||||
MakeWidget({ 7, 47}, {302, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_PLAY_MUSIC, STR_SELECT_MUSIC_TIP ),
|
||||
MakeWidget({ 7, 62}, {302, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_EMPTY ),
|
||||
MakeWidget({297, 63}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_MUSIC_STYLE_TIP),
|
||||
MakeWidget({154, 90}, {114, 114}, WindowWidgetType::FlatBtn, WindowColour::Secondary ),
|
||||
MakeWidget({ 7, 90}, {500, 450}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_BOTH ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
// 0x009AE5DC
|
||||
static Widget _measurementWidgets[] = {
|
||||
static constexpr Widget _measurementWidgets[] = {
|
||||
MAIN_RIDE_WIDGETS,
|
||||
MakeWidget({288, 194}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_FLOPPY), STR_SAVE_TRACK_DESIGN),
|
||||
MakeWidget({ 4, 127}, {154, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_SELECT_NEARBY_SCENERY ),
|
||||
MakeWidget({158, 127}, {154, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RESET_SELECTION ),
|
||||
MakeWidget({ 4, 177}, {154, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_DESIGN_SAVE ),
|
||||
MakeWidget({158, 177}, {154, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_DESIGN_CANCEL ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
// 0x009AE710
|
||||
static Widget _graphsWidgets[] = {
|
||||
static constexpr Widget _graphsWidgets[] = {
|
||||
MAIN_RIDE_WIDGETS,
|
||||
MakeWidget({ 3, 46}, {306, 112}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_HORIZONTAL, STR_LOGGING_DATA_FROM_TIP ),
|
||||
MakeWidget({ 3, 163}, { 73, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RIDE_STATS_VELOCITY, STR_SHOW_GRAPH_OF_VELOCITY_AGAINST_TIME_TIP ),
|
||||
MakeWidget({ 76, 163}, { 73, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RIDE_STATS_ALTITUDE, STR_SHOW_GRAPH_OF_ALTITUDE_AGAINST_TIME_TIP ),
|
||||
MakeWidget({149, 163}, { 73, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RIDE_STATS_VERT_G, STR_SHOW_GRAPH_OF_VERTICAL_ACCELERATION_AGAINST_TIME_TIP),
|
||||
MakeWidget({222, 163}, { 73, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RIDE_STATS_LAT_G, STR_SHOW_GRAPH_OF_LATERAL_ACCELERATION_AGAINST_TIME_TIP ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
// 0x009AE844
|
||||
static Widget _incomeWidgets[] = {
|
||||
static constexpr Widget _incomeWidgets[] = {
|
||||
MAIN_RIDE_WIDGETS,
|
||||
MakeWidget ({ 19, 50}, {126, 14}, WindowWidgetType::Label, WindowColour::Secondary ),
|
||||
MakeSpinnerWidgets({147, 50}, {162, 14}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_ARG_6_CURRENCY2DP ), // NB: 3 widgets
|
||||
@@ -394,19 +386,17 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget ({ 19, 94}, {126, 14}, WindowWidgetType::Label, WindowColour::Secondary ),
|
||||
MakeSpinnerWidgets({147, 94}, {162, 14}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_RIDE_SECONDARY_PRICE_VALUE ), // NB: 3 widgets
|
||||
MakeWidget ({ 5, 106}, {306, 13}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_SAME_PRICE_THROUGHOUT_PARK, STR_SAME_PRICE_THROUGHOUT_PARK_TIP),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
// 0x009AE9C8
|
||||
static Widget _customerWidgets[] = {
|
||||
static constexpr Widget _customerWidgets[] = {
|
||||
MAIN_RIDE_WIDGETS,
|
||||
MakeWidget({289, 54}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_SHOW_GUESTS_THOUGHTS_ABOUT_THIS_RIDE_ATTRACTION), STR_SHOW_GUESTS_THOUGHTS_ABOUT_THIS_RIDE_ATTRACTION_TIP),
|
||||
MakeWidget({289, 78}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_SHOW_GUESTS_ON_THIS_RIDE_ATTRACTION), STR_SHOW_GUESTS_ON_THIS_RIDE_ATTRACTION_TIP ),
|
||||
MakeWidget({289, 102}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_SHOW_GUESTS_QUEUING_FOR_THIS_RIDE_ATTRACTION), STR_SHOW_GUESTS_QUEUING_FOR_THIS_RIDE_ATTRACTION_TIP ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static const std::array PageWidgets = {
|
||||
static constexpr std::span<const Widget> PageWidgets[] = {
|
||||
_mainWidgets,
|
||||
_vehicleWidgets,
|
||||
_operatingWidgets,
|
||||
@@ -756,11 +746,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = PageWidgets[WINDOW_RIDE_PAGE_MAIN];
|
||||
SetWidgets(PageWidgets[WINDOW_RIDE_PAGE_MAIN]);
|
||||
hold_down_widgets = PageHoldDownWidgets[WINDOW_RIDE_PAGE_MAIN];
|
||||
|
||||
page = WINDOW_RIDE_PAGE_MAIN;
|
||||
frame_no = 0;
|
||||
SetPage(WINDOW_RIDE_PAGE_MAIN);
|
||||
list_information_type = 0;
|
||||
picked_peep_frame = 0;
|
||||
DisableTabs();
|
||||
@@ -1177,7 +1166,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
hold_down_widgets = PageHoldDownWidgets[page];
|
||||
pressed_widgets = 0;
|
||||
widgets = PageWidgets[page];
|
||||
SetWidgets(PageWidgets[page]);
|
||||
DisableTabs();
|
||||
Invalidate();
|
||||
|
||||
@@ -1560,7 +1549,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
_viewIndex = 0;
|
||||
}
|
||||
if (number < _rideOverallViewsCache.size())
|
||||
if (static_cast<uint16_t>(number) < _rideOverallViewsCache.size())
|
||||
{
|
||||
const auto& view = _rideOverallViewsCache[number];
|
||||
newFocus = Focus(view.loc, view.zoom);
|
||||
@@ -2329,13 +2318,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
int32_t i, widgetHeight;
|
||||
|
||||
auto* newWidgets = PageWidgets[page];
|
||||
if (widgets != newWidgets)
|
||||
{
|
||||
widgets = newWidgets;
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
SetPressedTab();
|
||||
|
||||
auto ride = GetRide(rideId);
|
||||
@@ -2793,13 +2775,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
StringId stringId;
|
||||
int32_t carsPerTrain;
|
||||
|
||||
auto* newWidgets = PageWidgets[page];
|
||||
if (widgets != newWidgets)
|
||||
{
|
||||
widgets = newWidgets;
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
SetPressedTab();
|
||||
|
||||
auto ride = GetRide(rideId);
|
||||
@@ -3487,13 +3462,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
StringId format, caption, tooltip;
|
||||
|
||||
auto* newWidgets = PageWidgets[page];
|
||||
if (widgets != newWidgets)
|
||||
{
|
||||
widgets = newWidgets;
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
SetPressedTab();
|
||||
|
||||
auto ride = GetRide(rideId);
|
||||
@@ -4021,13 +3989,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void MaintenanceOnPrepareDraw()
|
||||
{
|
||||
auto newWidgets = PageWidgets[page];
|
||||
if (widgets != newWidgets)
|
||||
{
|
||||
widgets = newWidgets;
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
SetPressedTab();
|
||||
|
||||
auto ride = GetRide(rideId);
|
||||
@@ -4604,13 +4565,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
TrackColour trackColour;
|
||||
VehicleColour vehicleColour;
|
||||
|
||||
auto newWidgets = PageWidgets[page];
|
||||
if (widgets != newWidgets)
|
||||
{
|
||||
widgets = newWidgets;
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
SetPressedTab();
|
||||
|
||||
auto ride = GetRide(rideId);
|
||||
@@ -5217,13 +5171,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void MusicOnPrepareDraw()
|
||||
{
|
||||
auto newWidgets = PageWidgets[page];
|
||||
if (widgets != newWidgets)
|
||||
{
|
||||
widgets = newWidgets;
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
SetPressedTab();
|
||||
|
||||
auto ride = GetRide(rideId);
|
||||
@@ -5613,13 +5560,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void MeasurementsOnPrepareDraw()
|
||||
{
|
||||
auto newWidgets = PageWidgets[page];
|
||||
if (widgets != newWidgets)
|
||||
{
|
||||
widgets = newWidgets;
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
SetPressedTab();
|
||||
|
||||
auto ride = GetRide(rideId);
|
||||
@@ -6058,13 +5998,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void GraphsOnPrepareDraw()
|
||||
{
|
||||
auto newWidgets = PageWidgets[page];
|
||||
if (widgets != newWidgets)
|
||||
{
|
||||
widgets = newWidgets;
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
SetPressedTab();
|
||||
|
||||
auto ride = GetRide(rideId);
|
||||
@@ -6573,13 +6506,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void IncomeOnPrepareDraw()
|
||||
{
|
||||
auto newWidgets = PageWidgets[page];
|
||||
if (widgets != newWidgets)
|
||||
{
|
||||
widgets = newWidgets;
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
SetPressedTab();
|
||||
|
||||
auto ride = GetRide(rideId);
|
||||
@@ -6856,13 +6782,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void CustomerOnPrepareDraw()
|
||||
{
|
||||
auto newWidgets = PageWidgets[page];
|
||||
if (widgets != newWidgets)
|
||||
{
|
||||
widgets = newWidgets;
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
SetPressedTab();
|
||||
|
||||
auto ride = GetRide(rideId);
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
validate_global_widx(WC_RIDE_CONSTRUCTION, WIDX_ROTATE);
|
||||
|
||||
// clang-format off
|
||||
static Widget _rideConstructionWidgets[] = {
|
||||
static constexpr Widget _rideConstructionWidgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget ({ 3, 17}, { GW, 57}, WindowWidgetType::Groupbox, WindowColour::Primary , STR_RIDE_CONSTRUCTION_DIRECTION ),
|
||||
MakeWidget ({ 3, 76}, { GW, 41}, WindowWidgetType::Groupbox, WindowColour::Primary , STR_RIDE_CONSTRUCTION_SLOPE ),
|
||||
@@ -179,7 +179,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget ({118, 120}, { 89, 41}, WindowWidgetType::Groupbox, WindowColour::Primary , STR_RIDE_CONSTRUCTION_SEAT_ROT ),
|
||||
MakeSpinnerWidgets({123, 138}, { 58, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, 0, STR_RIDE_CONSTRUCTION_SELECT_SEAT_ROTATION_ANGLE_TIP),
|
||||
MakeWidget ({161, 338}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_SIMULATE), STR_SIMULATE_RIDE_TIP ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -239,7 +238,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
return;
|
||||
}
|
||||
|
||||
widgets = _rideConstructionWidgets;
|
||||
SetWidgets(_rideConstructionWidgets);
|
||||
number = _currentRideIndex.ToUnderlying();
|
||||
|
||||
InitScrollWidgets();
|
||||
@@ -1579,7 +1578,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
currentRide->FormatNameTo(ft);
|
||||
}
|
||||
|
||||
static void OnDrawUpdateCoveredPieces(const TrackDrawerDescriptor& trackDrawerDescriptor, Widget* widgets)
|
||||
static void OnDrawUpdateCoveredPieces(const TrackDrawerDescriptor& trackDrawerDescriptor, std::span<Widget> widgets)
|
||||
{
|
||||
widgets[WIDX_U_TRACK].type = WindowWidgetType::Empty;
|
||||
widgets[WIDX_O_TRACK].type = WindowWidgetType::Empty;
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget _rideListWidgets[] = {
|
||||
static constexpr Widget _rideListWidgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({ 0, 43}, {340, 197}, WindowWidgetType::Resize, WindowColour::Secondary ), // tab page background
|
||||
MakeWidget({315, 60}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_TOGGLE_OPEN_CLOSE), STR_OPEN_OR_CLOSE_ALL_RIDES ), // open / close all toggle
|
||||
@@ -77,7 +77,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({320, 62}, { 14, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, ImageId(SPR_G2_RCT1_CLOSE_BUTTON_0) ),
|
||||
MakeWidget({320, 76}, { 14, 14}, WindowWidgetType::ImgBtn, WindowColour::Secondary, ImageId(SPR_G2_RCT1_OPEN_BUTTON_0) ),
|
||||
MakeWidget({315, 90}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_QUICK_DEMOLISH_RIDE ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -174,7 +173,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _rideListWidgets;
|
||||
SetWidgets(_rideListWidgets);
|
||||
WindowInitScrollWidgets(*this);
|
||||
page = PAGE_RIDES;
|
||||
selected_list_item = -1;
|
||||
|
||||
@@ -40,13 +40,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget _savePromptWidgets[] = {
|
||||
static constexpr Widget _savePromptWidgets[] = {
|
||||
WINDOW_SHIM_WHITE(STR_NONE, WW_SAVE, WH_SAVE),
|
||||
MakeWidget({ 2, 19}, {256, 12}, WindowWidgetType::LabelCentred, WindowColour::Primary, STR_EMPTY ), // question/label
|
||||
MakeWidget({ 8, 35}, { 78, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_SAVE ), // save
|
||||
MakeWidget({ 91, 35}, { 78, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_DONT_SAVE), // don't save
|
||||
MakeWidget({174, 35}, { 78, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_CANCEL ), // cancel
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -60,11 +59,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget _quitPromptWidgets[] = {
|
||||
static constexpr Widget _quitPromptWidgets[] = {
|
||||
WINDOW_SHIM_WHITE(STR_QUIT_GAME_PROMPT_TITLE, WW_QUIT, WH_QUIT),
|
||||
MakeWidget({ 8, 19}, {78, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_OK ), // ok
|
||||
MakeWidget({91, 19}, {78, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_CANCEL), // cancel
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -98,7 +96,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
bool canSave = !(gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER));
|
||||
|
||||
widgets = canSave ? _savePromptWidgets : _quitPromptWidgets;
|
||||
if (canSave)
|
||||
SetWidgets(_savePromptWidgets);
|
||||
else
|
||||
SetWidgets(_quitPromptWidgets);
|
||||
|
||||
InitScrollWidgets();
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget _scenarioSelectWidgets[] = {
|
||||
static constexpr Widget _scenarioSelectWidgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({ TabWidth + 1, WidgetsStart }, { WW, 284 }, WindowWidgetType::Resize, WindowColour::Secondary), // tab content panel
|
||||
MakeRemapWidget({ 3, TabsStart + (TabHeight * 0) }, { TabWidth, TabHeight}, WindowWidgetType::Tab, WindowColour::Secondary, SPR_G2_SIDEWAYS_TAB), // tab 01
|
||||
@@ -106,7 +106,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeRemapWidget({ 3, TabsStart + (TabHeight * 8) }, { TabWidth, TabHeight}, WindowWidgetType::Tab, WindowColour::Secondary, SPR_G2_SIDEWAYS_TAB), // tab 09
|
||||
MakeRemapWidget({ 3, TabsStart + (TabHeight * 8) }, { TabWidth, TabHeight}, WindowWidgetType::Tab, WindowColour::Secondary, SPR_G2_SIDEWAYS_TAB), // tab 10
|
||||
MakeWidget({ TabWidth + 3, WidgetsStart + 1 }, { WW - SidebarWidth, 362 }, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL), // level list
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -126,7 +125,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _scenarioSelectWidgets;
|
||||
SetWidgets(_scenarioSelectWidgets);
|
||||
|
||||
// Load scenario list
|
||||
ScenarioRepositoryScan();
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
validate_global_widx(WC_SCENERY, WIDX_SCENERY_EYEDROPPER_BUTTON);
|
||||
|
||||
// clang-format off
|
||||
static Widget WindowSceneryBaseWidgets[] = {
|
||||
static constexpr Widget WindowSceneryBaseWidgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WINDOW_SCENERY_MIN_WIDTH, WINDOW_SCENERY_MIN_HEIGHT),
|
||||
MakeWidget ({ 0, 43}, {634, 99}, WindowWidgetType::Resize, WindowColour::Secondary ), // 8 0x009DE2C8
|
||||
MakeWidget ({ 2, 62}, {607, 80}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL ), // 1000000 0x009DE418
|
||||
@@ -122,7 +122,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget ({ 4, 46}, {211, 14}, WindowWidgetType::TextBox, WindowColour::Secondary ),
|
||||
MakeWidget ({218, 46}, { 70, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_OBJECT_SEARCH_CLEAR ),
|
||||
MakeWidget ({539, 46}, { 70, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_RESTRICT_SCENERY, STR_RESTRICT_SCENERY_TIP ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -205,7 +204,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
std::vector<SceneryTabInfo> _tabEntries;
|
||||
std::vector<Widget> _widgets;
|
||||
int32_t _requiredWidth;
|
||||
int32_t _actualMinHeight;
|
||||
ScenerySelection _selectedScenery;
|
||||
@@ -1362,15 +1360,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
void PrepareWidgets()
|
||||
{
|
||||
// Add the base widgets
|
||||
_widgets.clear();
|
||||
for (const auto& widget : WindowSceneryBaseWidgets)
|
||||
{
|
||||
_widgets.push_back(widget);
|
||||
}
|
||||
|
||||
// Remove WWT_LAST
|
||||
auto lastWidget = _widgets.back();
|
||||
_widgets.pop_back();
|
||||
SetWidgets(WindowSceneryBaseWidgets);
|
||||
|
||||
// Add tabs
|
||||
_actualMinHeight = WINDOW_SCENERY_MIN_HEIGHT;
|
||||
@@ -1407,7 +1397,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
}
|
||||
|
||||
_widgets.push_back(widget);
|
||||
widgets.push_back(widget);
|
||||
|
||||
tabsInThisRow++;
|
||||
if (tabsInThisRow >= maxTabsInThisRow)
|
||||
@@ -1420,35 +1410,31 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
}
|
||||
|
||||
_widgets.push_back(lastWidget);
|
||||
|
||||
// Shift base widgets based on number of tab rows
|
||||
int32_t shiftAmount = (GetTabRowCount() - 1) * TabHeight;
|
||||
if (shiftAmount > 0)
|
||||
{
|
||||
_widgets[WIDX_SCENERY_LIST].top += shiftAmount;
|
||||
_widgets[WIDX_SCENERY_LIST].bottom += shiftAmount;
|
||||
_widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].top += shiftAmount;
|
||||
_widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].bottom += shiftAmount;
|
||||
_widgets[WIDX_SCENERY_REPAINT_SCENERY_BUTTON].top += shiftAmount;
|
||||
_widgets[WIDX_SCENERY_REPAINT_SCENERY_BUTTON].bottom += shiftAmount;
|
||||
_widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].top += shiftAmount;
|
||||
_widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].bottom += shiftAmount;
|
||||
_widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].top += shiftAmount;
|
||||
_widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].bottom += shiftAmount;
|
||||
_widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].top += shiftAmount;
|
||||
_widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].bottom += shiftAmount;
|
||||
_widgets[WIDX_SCENERY_EYEDROPPER_BUTTON].top += shiftAmount;
|
||||
_widgets[WIDX_SCENERY_EYEDROPPER_BUTTON].bottom += shiftAmount;
|
||||
_widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].top += shiftAmount;
|
||||
_widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].bottom += shiftAmount;
|
||||
_widgets[WIDX_FILTER_TEXT_BOX].top += shiftAmount;
|
||||
_widgets[WIDX_FILTER_TEXT_BOX].bottom += shiftAmount;
|
||||
_widgets[WIDX_FILTER_CLEAR_BUTTON].top += shiftAmount;
|
||||
_widgets[WIDX_FILTER_CLEAR_BUTTON].bottom += shiftAmount;
|
||||
widgets[WIDX_SCENERY_LIST].top += shiftAmount;
|
||||
widgets[WIDX_SCENERY_LIST].bottom += shiftAmount;
|
||||
widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].top += shiftAmount;
|
||||
widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].bottom += shiftAmount;
|
||||
widgets[WIDX_SCENERY_REPAINT_SCENERY_BUTTON].top += shiftAmount;
|
||||
widgets[WIDX_SCENERY_REPAINT_SCENERY_BUTTON].bottom += shiftAmount;
|
||||
widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].top += shiftAmount;
|
||||
widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].bottom += shiftAmount;
|
||||
widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].top += shiftAmount;
|
||||
widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].bottom += shiftAmount;
|
||||
widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].top += shiftAmount;
|
||||
widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].bottom += shiftAmount;
|
||||
widgets[WIDX_SCENERY_EYEDROPPER_BUTTON].top += shiftAmount;
|
||||
widgets[WIDX_SCENERY_EYEDROPPER_BUTTON].bottom += shiftAmount;
|
||||
widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].top += shiftAmount;
|
||||
widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].bottom += shiftAmount;
|
||||
widgets[WIDX_FILTER_TEXT_BOX].top += shiftAmount;
|
||||
widgets[WIDX_FILTER_TEXT_BOX].bottom += shiftAmount;
|
||||
widgets[WIDX_FILTER_CLEAR_BUTTON].top += shiftAmount;
|
||||
widgets[WIDX_FILTER_CLEAR_BUTTON].bottom += shiftAmount;
|
||||
}
|
||||
|
||||
widgets = _widgets.data();
|
||||
}
|
||||
|
||||
ScenerySelection GetSceneryIdByCursorPos(const ScreenCoordsXY& screenCoords) const
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
ScatterToolDensity gWindowSceneryScatterDensity;
|
||||
|
||||
// clang-format off
|
||||
static Widget _sceneryScatterWidgets[] = {
|
||||
static constexpr Widget _sceneryScatterWidgets[] = {
|
||||
MakeWidget ({ 0, 0}, {86, 100}, WindowWidgetType::Frame, WindowColour::Secondary ), // panel / background
|
||||
MakeWidget ({ 1, 1}, {84, 14}, WindowWidgetType::Caption, WindowColour::Primary , STR_SCENERY_SCATTER, STR_WINDOW_TITLE_TIP ), // title bar
|
||||
MakeWidget ({73, 2}, {11, 12}, WindowWidgetType::CloseBox, WindowColour::Primary , STR_CLOSE_X, STR_CLOSE_WINDOW_TIP ), // close x button
|
||||
@@ -53,7 +53,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeRemapWidget({ 7, 68}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_SCENERY_SCATTER_LOW, STR_SCATTER_TOOL_DENSITY_LOW ), // low amount
|
||||
MakeRemapWidget({31, 68}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_SCENERY_SCATTER_MEDIUM, STR_SCATTER_TOOL_DENSITY_MEDIUM), // medium amount
|
||||
MakeRemapWidget({55, 68}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_G2_SCENERY_SCATTER_HIGH, STR_SCATTER_TOOL_DENSITY_HIGH ), // high amount
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -62,7 +61,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _sceneryScatterWidgets;
|
||||
SetWidgets(_sceneryScatterWidgets);
|
||||
hold_down_widgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT);
|
||||
WindowInitScrollWidgets(*this);
|
||||
WindowPushOthersBelow(*this);
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget _serverListWidgets[] = {
|
||||
static constexpr Widget _serverListWidgets[] = {
|
||||
MakeWidget({ 0, 0}, {341, 91}, WindowWidgetType::Frame, WindowColour::Primary ), // panel / background
|
||||
MakeWidget({ 1, 1}, {338, 14}, WindowWidgetType::Caption, WindowColour::Primary, STR_SERVER_LIST, STR_WINDOW_TITLE_TIP), // title bar
|
||||
MakeWidget({327, 2}, { 11, 12}, WindowWidgetType::CloseBox, WindowColour::Primary, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP), // close x button
|
||||
@@ -71,7 +71,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({ 6, 53}, {101, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_FETCH_SERVERS ), // fetch servers button
|
||||
MakeWidget({112, 53}, {101, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_ADD_SERVER ), // add server button
|
||||
MakeWidget({218, 53}, {101, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_START_SERVER ), // start server button
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -95,8 +94,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
void OnOpen() override
|
||||
{
|
||||
_playerName = Config::Get().network.PlayerName;
|
||||
widgets = _serverListWidgets;
|
||||
_serverListWidgets[WIDX_PLAYER_NAME_INPUT].string = const_cast<utf8*>(_playerName.c_str());
|
||||
SetWidgets(_serverListWidgets);
|
||||
widgets[WIDX_PLAYER_NAME_INPUT].string = const_cast<utf8*>(_playerName.c_str());
|
||||
InitScrollWidgets();
|
||||
no_list_items = 0;
|
||||
selected_list_item = -1;
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
static constexpr int32_t WH = 154;
|
||||
|
||||
// clang-format off
|
||||
static Widget _windowServerStartWidgets[] = {
|
||||
static constexpr Widget _windowServerStartWidgets[] = {
|
||||
MakeWidget({ 0, 0 }, { WW, WH }, WindowWidgetType::Frame, WindowColour::Primary), // panel / background
|
||||
MakeWidget({ 1, 1 }, { 298, 14 }, WindowWidgetType::Caption, WindowColour::Primary, STR_START_SERVER,STR_WINDOW_TITLE_TIP), // title bar
|
||||
MakeWidget({ WW - 13, 2 }, { 11, 12 }, WindowWidgetType::CloseBox, WindowColour::Primary, STR_CLOSE_X,STR_CLOSE_WINDOW_TIP), // close x button
|
||||
@@ -58,7 +58,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({ 6, 117 }, { 287, 14 }, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_ADVERTISE,STR_ADVERTISE_SERVER_TIP), // advertise checkbox
|
||||
MakeWidget({ 6, WH - 6 - 13 }, { 101, 14 }, WindowWidgetType::Button, WindowColour::Secondary,STR_NEW_GAME), // start server button
|
||||
MakeWidget({ 112, WH - 6 - 13 }, { 101, 14 }, WindowWidgetType::Button, WindowColour::Secondary, STR_LOAD_GAME), // None
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -67,7 +66,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _windowServerStartWidgets;
|
||||
SetWidgets(_windowServerStartWidgets);
|
||||
widgets[WIDX_PORT_INPUT].string = _port;
|
||||
widgets[WIDX_NAME_INPUT].string = _name;
|
||||
widgets[WIDX_DESCRIPTION_INPUT].string = _description;
|
||||
|
||||
@@ -43,12 +43,11 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget _shortcutWidgets[] = {
|
||||
static constexpr Widget _shortcutWidgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({0, 43}, {350, 287}, WindowWidgetType::Resize, WindowColour::Secondary),
|
||||
MakeWidget({4, 47}, {412, 215}, WindowWidgetType::Scroll, WindowColour::Primary, SCROLL_VERTICAL, STR_SHORTCUT_LIST_TIP ),
|
||||
MakeWidget({4, WH-15}, {150, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_SHORTCUT_ACTION_RESET, STR_SHORTCUT_ACTION_RESET_TIP),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -62,10 +61,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget window_shortcut_change_widgets[] = {
|
||||
static constexpr Widget window_shortcut_change_widgets[] = {
|
||||
WINDOW_SHIM(CHANGE_WINDOW_TITLE, CHANGE_WW, CHANGE_WH),
|
||||
MakeWidget({ 75, 56 }, { 100, 14 }, WindowWidgetType::Button, WindowColour::Primary, STR_SHORTCUT_REMOVE, STR_SHORTCUT_REMOVE_TIP),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -100,7 +98,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = window_shortcut_change_widgets;
|
||||
SetWidgets(window_shortcut_change_widgets);
|
||||
WindowInitScrollWidgets(*this);
|
||||
}
|
||||
|
||||
@@ -450,20 +448,17 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void InitialiseWidgets()
|
||||
{
|
||||
_widgets.clear();
|
||||
_widgets.insert(_widgets.begin(), std::begin(_shortcutWidgets), std::end(_shortcutWidgets) - 1);
|
||||
widgets.clear();
|
||||
widgets.insert(widgets.begin(), std::begin(_shortcutWidgets), std::end(_shortcutWidgets) - 1);
|
||||
|
||||
int32_t x = 3;
|
||||
for (size_t i = 0; i < _tabs.size(); i++)
|
||||
{
|
||||
auto tab = MakeTab({ x, 17 }, STR_NONE);
|
||||
_widgets.push_back(tab);
|
||||
widgets.push_back(tab);
|
||||
x += 31;
|
||||
}
|
||||
|
||||
_widgets.push_back(kWidgetsEnd);
|
||||
widgets = _widgets.data();
|
||||
|
||||
WindowInitScrollWidgets(*this);
|
||||
}
|
||||
|
||||
@@ -581,7 +576,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
WIDX_RESET_PROMPT_CANCEL
|
||||
};
|
||||
|
||||
static Widget WindowResetShortcutKeysPromptWidgets[] = {
|
||||
static constexpr Widget WindowResetShortcutKeysPromptWidgets[] = {
|
||||
WINDOW_SHIM_WHITE(STR_SHORTCUT_ACTION_RESET, RESET_PROMPT_WW, RESET_PROMPT_WH),
|
||||
MakeWidget(
|
||||
{ 2, 30 }, { RESET_PROMPT_WW - 4, 12 }, WindowWidgetType::LabelCentred, WindowColour::Primary,
|
||||
@@ -590,14 +585,13 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget(
|
||||
{ RESET_PROMPT_WW - 95, RESET_PROMPT_WH - 22 }, { 85, 14 }, WindowWidgetType::Button, WindowColour::Primary,
|
||||
STR_SAVE_PROMPT_CANCEL),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
class ResetShortcutKeysPrompt final : public Window
|
||||
{
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = WindowResetShortcutKeysPromptWidgets;
|
||||
SetWidgets(WindowResetShortcutKeysPromptWidgets);
|
||||
}
|
||||
|
||||
void OnMouseUp(WidgetIndex widgetIndex) override
|
||||
|
||||
@@ -48,14 +48,13 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
// clang-format off
|
||||
// 0x9AEE00
|
||||
static Widget _signWidgets[] = {
|
||||
static constexpr Widget _signWidgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({ 3, 17}, {85, 60}, WindowWidgetType::Viewport, WindowColour::Secondary ), // Viewport
|
||||
MakeWidget({WW - 25, 19}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RENAME), STR_CHANGE_SIGN_TEXT_TIP ), // change sign button
|
||||
MakeWidget({WW - 25, 67}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_DEMOLISH_SIGN_TIP ), // demolish button
|
||||
MakeWidget({ 5, WH - 16}, {12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, kWidgetContentEmpty, STR_SELECT_MAIN_SIGN_COLOUR_TIP), // Main colour
|
||||
MakeWidget({ 17, WH - 16}, {12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, kWidgetContentEmpty, STR_SELECT_TEXT_COLOUR_TIP ), // Text colour
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -86,7 +85,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _signWidgets;
|
||||
SetWidgets(_signWidgets);
|
||||
WindowInitScrollWidgets(*this);
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeTab({ 65, 17 }, STR_STAFF_STATS_TIP) /* Tab 3 */
|
||||
|
||||
// clang-format off
|
||||
static Widget _staffOverviewWidgets[] = {
|
||||
static constexpr Widget _staffOverviewWidgets[] = {
|
||||
MAIN_STAFF_WIDGETS,
|
||||
MakeWidget ({ 3, 47}, {162, 120}, WindowWidgetType::Viewport, WindowColour::Secondary ), // Viewport
|
||||
MakeWidget ({ 3, WH - 13}, {162, 11}, WindowWidgetType::LabelCentred, WindowColour::Secondary ), // Label at bottom of viewport
|
||||
@@ -102,11 +102,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget ({WW - 25, 93}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RENAME), STR_NAME_STAFF_TIP ), // Rename Button
|
||||
MakeWidget ({WW - 25, 117}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_LOCATE), STR_LOCATE_SUBJECT_TIP), // Locate Button
|
||||
MakeWidget ({WW - 25, 141}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_FIRE_STAFF_TIP ), // Fire Button
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
//0x9AF910
|
||||
static Widget _staffOptionsWidgets[] = {
|
||||
static constexpr Widget _staffOptionsWidgets[] = {
|
||||
MAIN_STAFF_WIDGETS,
|
||||
MakeWidget ({ 5, 50}, {180, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary ), // Checkbox 1
|
||||
MakeWidget ({ 5, 67}, {180, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary ), // Checkbox 2
|
||||
@@ -114,17 +113,15 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget ({ 5, 101}, {180, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary ), // Checkbox 4
|
||||
MakeWidget ({ 5, 50}, {180, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // Costume Dropdown
|
||||
MakeWidget ({WW - 17, 51}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_COSTUME_TIP), // Costume Dropdown Button
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
// 0x9AF9F4
|
||||
static Widget _staffStatsWidgets[] = {
|
||||
static constexpr Widget _staffStatsWidgets[] = {
|
||||
MAIN_STAFF_WIDGETS,
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget* window_staff_page_widgets[] = {
|
||||
static constexpr std::span<const Widget> window_staff_page_widgets[] = {
|
||||
_staffOverviewWidgets,
|
||||
_staffOptionsWidgets,
|
||||
_staffStatsWidgets,
|
||||
@@ -341,11 +338,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
ColourSchemeUpdateByClass(this, static_cast<WindowClass>(WindowClass::Staff));
|
||||
|
||||
if (window_staff_page_widgets[page] != widgets)
|
||||
{
|
||||
widgets = window_staff_page_widgets[page];
|
||||
InitScrollWidgets();
|
||||
}
|
||||
SetPressedTab();
|
||||
DisableWidgets();
|
||||
|
||||
@@ -1086,7 +1078,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
return;
|
||||
}
|
||||
|
||||
for (WidgetIndex widgetIndex = WIDX_TAB_1; widgets[widgetIndex].type != kWidgetsEnd.type; widgetIndex++)
|
||||
for (WidgetIndex widgetIndex = WIDX_TAB_1; widgetIndex < widgets.size(); widgetIndex++)
|
||||
{
|
||||
SetWidgetDisabled(widgetIndex, false);
|
||||
}
|
||||
@@ -1132,7 +1124,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
frame_no = 0;
|
||||
pressed_widgets = 0;
|
||||
hold_down_widgets = 0;
|
||||
widgets = window_staff_page_widgets[page];
|
||||
SetWidgets(window_staff_page_widgets[page]);
|
||||
|
||||
RemoveViewport();
|
||||
|
||||
|
||||
@@ -34,11 +34,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
// clang-format off
|
||||
// 0x9AFB4C
|
||||
static Widget _staffFireWidgets[] = {
|
||||
static constexpr Widget _staffFireWidgets[] = {
|
||||
WINDOW_SHIM_WHITE(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({ 10, WH - 20}, {85, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_YES ),
|
||||
MakeWidget({WW - 95, WH - 20}, {85, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_SAVE_PROMPT_CANCEL),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -52,7 +51,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _staffFireWidgets;
|
||||
SetWidgets(_staffFireWidgets);
|
||||
WindowInitScrollWidgets(*this);
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
constexpr int32_t MAX_WH = 450;
|
||||
|
||||
// clang-format off
|
||||
static Widget _staffListWidgets[] = {
|
||||
static constexpr Widget _staffListWidgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({ 0, 43}, { WW, WH - 43}, WindowWidgetType::Resize, WindowColour::Secondary ), // tab content panel
|
||||
MakeTab ({ 3, 17}, STR_STAFF_HANDYMEN_TAB_TIP ), // handymen tab
|
||||
@@ -93,7 +93,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({243, 46}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH), STR_QUICK_FIRE_STAFF ), // quick fire staff
|
||||
MakeWidget({267, 46}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_PATROL_BTN), STR_SHOW_PATROL_AREA_TIP ), // show staff patrol area tool
|
||||
MakeWidget({291, 46}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_MAP), STR_SHOW_STAFF_ON_MAP_TIP), // show staff on map button
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -122,7 +121,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _staffListWidgets;
|
||||
SetWidgets(_staffListWidgets);
|
||||
WindowInitScrollWidgets(*this);
|
||||
|
||||
widgets[WIDX_STAFF_LIST_UNIFORM_COLOUR_PICKER].type = WindowWidgetType::Empty;
|
||||
|
||||
@@ -35,11 +35,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
WIDX_OKAY
|
||||
};
|
||||
|
||||
static Widget _textInputWidgets[] = {
|
||||
static constexpr Widget _textInputWidgets[] = {
|
||||
WINDOW_SHIM(STR_NONE, WW, WH),
|
||||
MakeWidget({ 170, 68 }, { 71, 14 }, WindowWidgetType::Button, WindowColour::Secondary, STR_CANCEL),
|
||||
MakeWidget({ 10, 68 }, { 71, 14 }, WindowWidgetType::Button, WindowColour::Secondary, STR_OK),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
class TextInputWindow final : public Window
|
||||
@@ -64,7 +63,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _textInputWidgets;
|
||||
SetWidgets(_textInputWidgets);
|
||||
WindowInitScrollWidgets(*this);
|
||||
SetParentWindow(nullptr, 0);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
const uint16_t kWindowHeaderWidth = 152;
|
||||
|
||||
// clang-format off
|
||||
static Widget _themesWidgets[] = {
|
||||
static constexpr Widget _themesWidgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({ 0, 43}, {320, 64}, WindowWidgetType::Resize, WindowColour::Secondary ), // tab content panel
|
||||
MakeTab ({ 3, 17}, STR_THEMES_TAB_SETTINGS_TIP ), // settings tab
|
||||
@@ -104,7 +104,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({ 10, 69}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_THEMES_OPTION_RCT1_PARK_CONTROLS ), // rct1 park lights
|
||||
MakeWidget({ 10, 84}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_THEMES_OPTION_RCT1_SCENARIO_SELECTION_FONT ), // rct1 scenario font
|
||||
MakeWidget({ 10, 99}, {290, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_THEMES_OPTION_RCT1_BOTTOM_TOOLBAR ), // rct1 bottom toolbar
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -265,7 +264,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _themesWidgets;
|
||||
SetWidgets(_themesWidgets);
|
||||
|
||||
WindowThemesInitVars();
|
||||
|
||||
|
||||
@@ -305,16 +305,15 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({6, 0}, {WW - 12, 0}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_NONE, STR_NONE ), /* Details group box */ \
|
||||
MakeWidget({6, 0}, {WW - 12, 0}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_TILE_INSPECTOR_GROUPBOX_PROPERTIES, STR_NONE ) /* Properties group box */
|
||||
|
||||
static Widget DefaultWidgets[] = {
|
||||
static constexpr Widget DefaultWidgets[] = {
|
||||
MAIN_TILE_INSPECTOR_WIDGETS,
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
constexpr int32_t NumSurfaceProperties = 4;
|
||||
constexpr int32_t NumSurfaceDetails = 4;
|
||||
constexpr int32_t SurfacePropertiesHeight = 16 + NumSurfaceProperties * 21;
|
||||
constexpr int32_t SurfaceDetailsHeight = 20 + NumSurfaceDetails * 11;
|
||||
static Widget SurfaceWidgets[] = {
|
||||
static constexpr Widget SurfaceWidgets[] = {
|
||||
MAIN_TILE_INSPECTOR_WIDGETS,
|
||||
MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 0, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_SURFACE_SPINNER_HEIGHT{,_INCREASE,_DECREASE}
|
||||
MakeWidget(PropertyRowCol({ 12, 0 }, 1, 0), PropertyButtonSize, WindowWidgetType::Button, WindowColour::Secondary, STR_TILE_INSPECTOR_SURFACE_REMOVE_FENCES), // WIDX_SURFACE_BUTTON_REMOVE_FENCES
|
||||
@@ -324,14 +323,13 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 3, 1), 1, 2), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_SURFACE_CHECK_CORNER_S
|
||||
MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 3, 1), 0, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_SURFACE_CHECK_CORNER_W
|
||||
MakeWidget(PropertyRowCol({ 12, 0 }, 4, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_SURFACE_DIAGONAL), // WIDX_SURFACE_CHECK_DIAGONAL
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
constexpr int32_t NumPathProperties = 6;
|
||||
constexpr int32_t NumPathDetails = 3;
|
||||
constexpr int32_t PathPropertiesHeight = 16 + NumPathProperties * 21;
|
||||
constexpr int32_t PathDetailsHeight = 20 + NumPathDetails * 11;
|
||||
static Widget PathWidgets[] = {
|
||||
static constexpr Widget PathWidgets[] = {
|
||||
MAIN_TILE_INSPECTOR_WIDGETS,
|
||||
MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 0, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_PATH_SPINNER_HEIGHT{,_INCREASE,_DECREASE}
|
||||
MakeWidget(PropertyRowCol({ 12, 0 }, 1, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_PATH_BROKEN), // WIDX_PATH_CHECK_BROKEN
|
||||
@@ -345,28 +343,26 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 4, 1), 0, 2), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_PATH_CHECK_EDGE_W
|
||||
MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 4, 1), 1, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_PATH_CHECK_EDGE_NW
|
||||
MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 4, 1), 2, 0), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_PATH_CHECK_EDGE_N
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
constexpr int32_t NumTrackProperties = 5;
|
||||
constexpr int32_t NumTrackDetails = 7;
|
||||
constexpr int32_t TrackPropertiesHeight = 16 + NumTrackProperties * 21;
|
||||
constexpr int32_t TrackDetailsHeight = 20 + NumTrackDetails * 11;
|
||||
static Widget TrackWidgets[] = {
|
||||
static constexpr Widget TrackWidgets[] = {
|
||||
MAIN_TILE_INSPECTOR_WIDGETS,
|
||||
MakeWidget(PropertyRowCol({ 12, 0}, 0, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_TRACK_ENTIRE_TRACK_PIECE), // WIDX_TRACK_CHECK_APPLY_TO_ALL
|
||||
MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 1, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_TRACK_SPINNER_HEIGHT{,_INCREASE,_DECREASE}
|
||||
MakeWidget(PropertyRowCol({ 12, 0}, 2, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_TRACK_CHAIN_LIFT), // WIDX_TRACK_CHECK_CHAIN_LIFT
|
||||
MakeWidget(PropertyRowCol({ 12, 0}, 3, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_TRACK_BRAKE_CLOSED), // WIDX_TRACK_CHECK_BRAKE_CLOSED
|
||||
MakeWidget(PropertyRowCol({ 12, 0}, 4, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_TRACK_IS_INDESTRUCTIBLE), // WIDX_TRACK_CHECK_IS_INDESTRUCTIBLE
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
constexpr int32_t NumSceneryProperties = 4; // The checkbox groups both count for 2 rows
|
||||
constexpr int32_t NumSceneryDetails = 3;
|
||||
constexpr int32_t SceneryPropertiesHeight = 16 + NumSceneryProperties * 21;
|
||||
constexpr int32_t SceneryDetailsHeight = 20 + NumSceneryDetails * 11;
|
||||
static Widget SceneryWidgets[] = {
|
||||
static constexpr Widget SceneryWidgets[] = {
|
||||
MAIN_TILE_INSPECTOR_WIDGETS,
|
||||
MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 0, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_SCENERY_SPINNER_HEIGHT{,_INCREASE,_DECREASE}
|
||||
MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 1, 1), 1, 0), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_SCENERY_CHECK_QUARTER_N
|
||||
@@ -377,60 +373,54 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 2, 1), 2, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_SCENERY_CHECK_COLLISION_E
|
||||
MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 2, 1), 1, 2), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_SCENERY_CHECK_COLLISION_S
|
||||
MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 2, 1), 0, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_SCENERY_CHECK_COLLISION_W
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
constexpr int32_t NumEntranceProperties = 2;
|
||||
constexpr int32_t NumEntranceDetails = 4;
|
||||
constexpr int32_t EntrancePropertiesHeight = 16 + NumEntranceProperties * 21;
|
||||
constexpr int32_t EntranceDetailsHeight = 20 + NumEntranceDetails * 11;
|
||||
static Widget EntranceWidgets[] = {
|
||||
static constexpr Widget EntranceWidgets[] = {
|
||||
MAIN_TILE_INSPECTOR_WIDGETS,
|
||||
MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 0, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_ENTRANCE_SPINNER_HEIGHT{,_INCREASE,_DECREASE}
|
||||
MakeWidget(PropertyRowCol({ 12, 0 }, 1, 0), PropertyButtonSize, WindowWidgetType::Button, WindowColour::Secondary, STR_TILE_INSPECTOR_ENTRANCE_MAKE_USABLE, STR_TILE_INSPECTOR_ENTRANCE_MAKE_USABLE_TIP), // WIDX_ENTRANCE_BUTTON_MAKE_USABLE
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
constexpr int32_t NumWallProperties = 4;
|
||||
constexpr int32_t NumWallDetails = 2;
|
||||
constexpr int32_t WallPropertiesHeight = 16 + NumWallProperties * 21;
|
||||
constexpr int32_t WallDetailsHeight = 20 + NumWallDetails * 11;
|
||||
static Widget WallWidgets[] = {
|
||||
static constexpr Widget WallWidgets[] = {
|
||||
MAIN_TILE_INSPECTOR_WIDGETS,
|
||||
MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 0, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_WALL_SPINNER_HEIGHT{,_INCREASE,_DECREASE}
|
||||
MakeWidget(PropertyRowCol({ 12, 0 }, 1, 1), PropertyButtonSize, WindowWidgetType::DropdownMenu, WindowColour::Secondary), // WIDX_WALL_DROPDOWN_SLOPE
|
||||
MakeWidget(PropertyRowCol({ 12 + PropertyButtonSize.width - 12, 0 }, 1, 1), { 11, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH), // WIDX_WALL_DROPDOWN_SLOPE_BUTTON
|
||||
MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 2, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_WALL_SPINNER_ANIMATION_FRAME{,_INCREASE,_DECREASE}
|
||||
MakeWidget(PropertyRowCol({ 12, 0 }, 3, 0), PropertyFullWidth, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TILE_INSPECTOR_WALL_ANIMATION_IS_BACKWARDS), // WIDX_WALL_ANIMATION_IS_BACKWARDS
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
constexpr int32_t NumLargeSceneryProperties = 1;
|
||||
constexpr int32_t NumLargeSceneryDetails = 3;
|
||||
constexpr int32_t LargeSceneryPropertiesHeight = 16 + NumLargeSceneryProperties * 21;
|
||||
constexpr int32_t LargeSceneryDetailsHeight = 20 + NumLargeSceneryDetails * 11;
|
||||
static Widget LargeSceneryWidgets[] = {
|
||||
static constexpr Widget LargeSceneryWidgets[] = {
|
||||
MAIN_TILE_INSPECTOR_WIDGETS,
|
||||
MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 0, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_LARGE_SCENERY_SPINNER_HEIGHT{,_INCREASE,_DECREASE}
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
constexpr int32_t NumBannerProperties = 3;
|
||||
constexpr int32_t NumBannerDetails = 1;
|
||||
constexpr int32_t BannerPropertiesHeight = 16 + NumBannerProperties * 21;
|
||||
constexpr int32_t BannerDetailsHeight = 20 + NumBannerDetails * 11;
|
||||
static Widget BannerWidgets[] = {
|
||||
static constexpr Widget BannerWidgets[] = {
|
||||
MAIN_TILE_INSPECTOR_WIDGETS,
|
||||
MakeSpinnerWidgets(PropertyRowCol({ 12, 0 }, 0, 1), PropertyButtonSize, WindowWidgetType::Spinner, WindowColour::Secondary), // WIDX_BANNER_SPINNER_HEIGHT{,_INCREASE,_DECREASE}
|
||||
MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 1, 1), 3, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_BANNER_CHECK_BLOCK_NE
|
||||
MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 1, 1), 3, 3), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_BANNER_CHECK_BLOCK_SE
|
||||
MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 1, 1), 1, 3), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_BANNER_CHECK_BLOCK_SW
|
||||
MakeWidget(CheckboxGroupOffset(PropertyRowCol({ 12, 0 }, 1, 1), 1, 1), { 12, 12 }, WindowWidgetType::Checkbox, WindowColour::Secondary), // WIDX_BANNER_CHECK_BLOCK_NW
|
||||
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget *PageWidgets[] = {
|
||||
static constexpr std::span<const Widget> PageWidgets[] = {
|
||||
DefaultWidgets,
|
||||
SurfaceWidgets,
|
||||
PathWidgets,
|
||||
@@ -1794,7 +1784,7 @@ static uint64_t PageDisabledWidgets[] = {
|
||||
}
|
||||
tileInspectorPage = p;
|
||||
auto pageIndex = EnumValue(p);
|
||||
widgets = PageWidgets[pageIndex];
|
||||
SetWidgets(PageWidgets[pageIndex]);
|
||||
hold_down_widgets = PageHoldDownWidgets[pageIndex];
|
||||
disabled_widgets = PageDisabledWidgets[pageIndex];
|
||||
pressed_widgets = 0;
|
||||
|
||||
@@ -19,16 +19,15 @@ namespace OpenRCT2::Ui::Windows
|
||||
WIDX_EXIT,
|
||||
};
|
||||
|
||||
static Widget _titleExitWidgets[] = {
|
||||
static constexpr Widget _titleExitWidgets[] = {
|
||||
MakeWidget({ 0, 0 }, { 40, 64 }, WindowWidgetType::ImgBtn, WindowColour::Tertiary, ImageId(SPR_MENU_EXIT), STR_EXIT),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
class TitleExitWindow final : public Window
|
||||
{
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _titleExitWidgets;
|
||||
SetWidgets(_titleExitWidgets);
|
||||
InitScrollWidgets();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +23,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
WIDX_LOGO
|
||||
};
|
||||
|
||||
static Widget _titleLogoWidgets[] = {
|
||||
static constexpr Widget _titleLogoWidgets[] = {
|
||||
MakeWidget({ 0, 0 }, { WW + 1, WH + 1 }, WindowWidgetType::ImgBtn, WindowColour::Primary),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
class TitleLogoWindow final : public Window
|
||||
@@ -37,7 +36,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
*/
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _titleLogoWidgets;
|
||||
SetWidgets(_titleLogoWidgets);
|
||||
WindowInitScrollWidgets(*this);
|
||||
colours[0] = ColourWithFlags{ COLOUR_GREY }.withFlag(ColourFlag::translucent, true);
|
||||
colours[1] = ColourWithFlags{ COLOUR_GREY }.withFlag(ColourFlag::translucent, true);
|
||||
|
||||
@@ -47,13 +47,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
static constexpr ScreenSize UpdateButtonDims = { MenuButtonDims.width * 4, 28 };
|
||||
|
||||
// clang-format off
|
||||
static Widget _titleMenuWidgets[] = {
|
||||
static constexpr Widget _titleMenuWidgets[] = {
|
||||
MakeWidget({0, UpdateButtonDims.height}, MenuButtonDims, WindowWidgetType::ImgBtn, WindowColour::Tertiary, ImageId(SPR_MENU_NEW_GAME), STR_START_NEW_GAME_TIP),
|
||||
MakeWidget({0, UpdateButtonDims.height}, MenuButtonDims, WindowWidgetType::ImgBtn, WindowColour::Tertiary, ImageId(SPR_MENU_LOAD_GAME), STR_CONTINUE_SAVED_GAME_TIP),
|
||||
MakeWidget({0, UpdateButtonDims.height}, MenuButtonDims, WindowWidgetType::ImgBtn, WindowColour::Tertiary, ImageId(SPR_G2_MENU_MULTIPLAYER), STR_SHOW_MULTIPLAYER_TIP),
|
||||
MakeWidget({0, UpdateButtonDims.height}, MenuButtonDims, WindowWidgetType::ImgBtn, WindowColour::Tertiary, ImageId(SPR_MENU_TOOLBOX), STR_GAME_TOOLS_TIP),
|
||||
MakeWidget({0, 0}, UpdateButtonDims, WindowWidgetType::Empty, WindowColour::Secondary, STR_UPDATE_AVAILABLE),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -93,14 +92,14 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _titleMenuWidgets;
|
||||
SetWidgets(_titleMenuWidgets);
|
||||
|
||||
#ifdef DISABLE_NETWORK
|
||||
widgets[WIDX_MULTIPLAYER].type = WindowWidgetType::Empty;
|
||||
#endif
|
||||
|
||||
int32_t x = 0;
|
||||
for (Widget* widget = widgets; widget != &widgets[WIDX_NEW_VERSION]; widget++)
|
||||
for (Widget* widget = widgets.data(); widget != &widgets[WIDX_NEW_VERSION]; widget++)
|
||||
{
|
||||
if (widget->type != WindowWidgetType::Empty)
|
||||
{
|
||||
|
||||
@@ -18,9 +18,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
WIDX_OPTIONS,
|
||||
};
|
||||
|
||||
static Widget _windowTitleOptionsWidgets[] = {
|
||||
static constexpr Widget _windowTitleOptionsWidgets[] = {
|
||||
MakeWidget({ 0, 0 }, { 80, 15 }, WindowWidgetType::Button, WindowColour::Tertiary, STR_OPTIONS, STR_OPTIONS_TIP),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
class TitleOptionsWindow final : public Window
|
||||
@@ -28,7 +27,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _windowTitleOptionsWidgets;
|
||||
SetWidgets(_windowTitleOptionsWidgets);
|
||||
WindowInitScrollWidgets(*this);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,17 +21,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
static constexpr uint8_t kTextOffset = 8;
|
||||
|
||||
static Widget _widgets[] = {
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
class TitleVersionWindow final : public Window
|
||||
{
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _widgets;
|
||||
}
|
||||
|
||||
void OnDraw(DrawPixelInfo& dpi) override
|
||||
{
|
||||
// Write name and version information
|
||||
|
||||
@@ -24,9 +24,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
WIDX_BACKGROUND
|
||||
};
|
||||
|
||||
static Widget _tooltipWidgets[] = {
|
||||
static constexpr Widget _tooltipWidgets[] = {
|
||||
MakeWidget({ 0, 0 }, { 200, 32 }, WindowWidgetType::ImgBtn, WindowColour::Primary),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
class TooltipWindow final : public Window
|
||||
@@ -44,7 +43,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
width = textWidth + 5;
|
||||
height = textHeight + 4;
|
||||
|
||||
widgets = _tooltipWidgets;
|
||||
SetWidgets(_tooltipWidgets);
|
||||
widgets[WIDX_BACKGROUND].right = width;
|
||||
widgets[WIDX_BACKGROUND].bottom = height;
|
||||
|
||||
@@ -165,7 +164,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void WindowTooltipOpen(WindowBase* widgetWindow, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords)
|
||||
{
|
||||
if (widgetWindow == nullptr || widgetIndex == -1)
|
||||
if (widgetWindow == nullptr || widgetIndex == kWidgetIndexNull)
|
||||
return;
|
||||
|
||||
auto widget = &widgetWindow->widgets[widgetIndex];
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
#pragma endregion
|
||||
|
||||
static Widget _topToolbarWidgets[] = {
|
||||
static constexpr Widget _topToolbarWidgets[] = {
|
||||
MakeRemapWidget({ 0, 0}, {30, kTopToolbarHeight + 1}, WindowWidgetType::TrnBtn, WindowColour::Primary , SPR_TOOLBAR_PAUSE, STR_PAUSE_GAME_TIP ), // Pause
|
||||
MakeRemapWidget({ 60, 0}, {30, kTopToolbarHeight + 1}, WindowWidgetType::TrnBtn, WindowColour::Primary , SPR_TOOLBAR_FILE, STR_DISC_AND_GAME_OPTIONS_TIP ), // File menu
|
||||
MakeRemapWidget({250, 0}, {30, kTopToolbarHeight + 1}, WindowWidgetType::TrnBtn, WindowColour::Primary , SPR_G2_TOOLBAR_MUTE, STR_TOOLBAR_MUTE_TIP ), // Mute
|
||||
@@ -264,7 +264,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeRemapWidget({ 30, 0}, {30, kTopToolbarHeight + 1}, WindowWidgetType::TrnBtn, WindowColour::Primary , SPR_G2_TOOLBAR_MULTIPLAYER, STR_SHOW_MULTIPLAYER_STATUS_TIP ), // Network
|
||||
MakeRemapWidget({ 30, 0}, {30, kTopToolbarHeight + 1}, WindowWidgetType::TrnBtn, WindowColour::Primary , SPR_TAB_TOOLBAR, STR_TOOLBAR_CHAT_TIP ), // Chat
|
||||
MakeWidget ({ 0, 0}, {10, 1}, WindowWidgetType::Empty, WindowColour::Primary ), // Artificial widget separator
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -1003,7 +1002,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
WindowClass::TopToolbar, ScreenCoordsXY(0, 0), ContextGetWidth(), kTopToolbarHeight + 1,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
||||
|
||||
window->widgets = _topToolbarWidgets;
|
||||
window->SetWidgets(_topToolbarWidgets);
|
||||
|
||||
WindowInitScrollWidgets(*window);
|
||||
|
||||
|
||||
@@ -40,18 +40,16 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget _trackManageWidgets[] = {
|
||||
static constexpr Widget _trackManageWidgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({ 10, 24}, {110, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_TRACK_MANAGE_RENAME),
|
||||
MakeWidget({130, 24}, {110, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_TRACK_MANAGE_DELETE),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
|
||||
static Widget _trackDeletePromptWidgets[] = {
|
||||
static constexpr Widget _trackDeletePromptWidgets[] = {
|
||||
WINDOW_SHIM(STR_DELETE_FILE, WW_DELETE_PROMPT, WH_DELETE_PROMPT),
|
||||
MakeWidget({ 10, 54}, {110, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_TRACK_MANAGE_DELETE),
|
||||
MakeWidget({130, 54}, {110, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_CANCEL ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -120,7 +118,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void TrackDesignManageWindow::OnOpen()
|
||||
{
|
||||
widgets = _trackManageWidgets;
|
||||
SetWidgets(_trackManageWidgets);
|
||||
WindowInitScrollWidgets(*this);
|
||||
|
||||
WindowTrackDesignListSetBeingUpdated(true);
|
||||
@@ -205,7 +203,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void TrackDeletePromptWindow::OnOpen()
|
||||
{
|
||||
widgets = _trackDeletePromptWidgets;
|
||||
SetWidgets(_trackDeletePromptWidgets);
|
||||
WindowInitScrollWidgets(*this);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,13 +68,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
validate_global_widx(WC_TRACK_DESIGN_PLACE, WIDX_ROTATE);
|
||||
|
||||
// clang-format off
|
||||
static Widget _trackPlaceWidgets[] = {
|
||||
static constexpr Widget _trackPlaceWidgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({173, 83}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Primary, ImageId(SPR_ROTATE_ARROW), STR_ROTATE_90_TIP ),
|
||||
MakeWidget({173, 59}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Primary, ImageId(SPR_MIRROR_ARROW), STR_MIRROR_IMAGE_TIP ),
|
||||
MakeWidget({ 4, 109}, {192, 12}, WindowWidgetType::Button, WindowColour::Primary, STR_SELECT_A_DIFFERENT_DESIGN, STR_GO_BACK_TO_DESIGN_SELECTION_WINDOW_TIP),
|
||||
MakeWidget({ 0, 0}, { 1, 1}, WindowWidgetType::Empty, WindowColour::Primary),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -103,7 +102,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _trackPlaceWidgets;
|
||||
SetWidgets(_trackPlaceWidgets);
|
||||
WindowInitScrollWidgets(*this);
|
||||
ToolSet(*this, WIDX_PRICE, Tool::Crosshair);
|
||||
InputSetFlag(INPUT_FLAG_6, true);
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
validate_global_widx(WC_TRACK_DESIGN_LIST, WIDX_ROTATE);
|
||||
|
||||
// clang-format off
|
||||
static Widget _trackListWidgets[] = {
|
||||
static constexpr Widget _trackListWidgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({ 4, 18}, {218, 13}, WindowWidgetType::TableHeader, WindowColour::Primary, STR_SELECT_OTHER_RIDE ),
|
||||
MakeWidget({ 4, 32}, {124, 13}, WindowWidgetType::TextBox, WindowColour::Secondary ),
|
||||
@@ -64,7 +64,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({224, 18}, {372, 219}, WindowWidgetType::FlatBtn, WindowColour::Primary ),
|
||||
MakeWidget({572, 405}, { ROTATE_AND_SCENERY_BUTTON_SIZE, ROTATE_AND_SCENERY_BUTTON_SIZE}, WindowWidgetType::FlatBtn, WindowColour::Primary, ImageId(SPR_ROTATE_ARROW), STR_ROTATE_90_TIP ),
|
||||
MakeWidget({572, 381}, { ROTATE_AND_SCENERY_BUTTON_SIZE, ROTATE_AND_SCENERY_BUTTON_SIZE}, WindowWidgetType::FlatBtn, WindowColour::Primary, ImageId(SPR_SCENERY), STR_TOGGLE_SCENERY_TIP ),
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -218,8 +217,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
void OnOpen() override
|
||||
{
|
||||
String::set(_filterString, sizeof(_filterString), "");
|
||||
_trackListWidgets[WIDX_FILTER_STRING].string = _filterString;
|
||||
widgets = _trackListWidgets;
|
||||
SetWidgets(_trackListWidgets);
|
||||
widgets[WIDX_FILTER_STRING].string = _filterString;
|
||||
|
||||
LoadDesignsList(_window_track_list_item);
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
#pragma endregion
|
||||
|
||||
// clang-format off
|
||||
static Widget _transparancyWidgets[] =
|
||||
static constexpr Widget _transparancyWidgets[] =
|
||||
{
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({ 2, 17}, HIDE_SIZE, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_BUTTON_HIDE_VEGETATION), STR_SEE_THROUGH_VEGETATION),
|
||||
@@ -81,8 +81,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({ 77, 42}, INVISIBLE_SIZE, WindowWidgetType::FlatBtn, WindowColour::Tertiary, STR_NONE, STR_INVISIBLE_RIDES),
|
||||
MakeWidget({102, 42}, INVISIBLE_SIZE, WindowWidgetType::FlatBtn, WindowColour::Tertiary, STR_NONE, STR_INVISIBLE_VEHICLES),
|
||||
MakeWidget({127, 42}, INVISIBLE_SIZE, WindowWidgetType::FlatBtn, WindowColour::Tertiary, STR_NONE, STR_INVISIBLE_SUPPORTS),
|
||||
|
||||
{ kWidgetsEnd },
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -92,7 +90,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _transparancyWidgets;
|
||||
SetWidgets(_transparancyWidgets);
|
||||
WindowPushOthersBelow(*this);
|
||||
|
||||
auto* w = WindowGetMain();
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
static constexpr int32_t WH = 155;
|
||||
|
||||
// clang-format off
|
||||
static Widget _viewClippingWidgets[] = {
|
||||
static constexpr Widget _viewClippingWidgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget ({ 11, 19}, { 159, 11}, WindowWidgetType::Checkbox, WindowColour::Primary, STR_VIEW_CLIPPING_HEIGHT_ENABLE, STR_VIEW_CLIPPING_HEIGHT_ENABLE_TIP ), // clip enable/disable check box
|
||||
MakeWidget ({ 5, 36}, {WW - 10, 48}, WindowWidgetType::Groupbox, WindowColour::Primary, STR_VIEW_CLIPPING_VERTICAL_CLIPPING ),
|
||||
@@ -60,8 +60,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget ({ 5, 90}, {WW - 10, 60}, WindowWidgetType::Groupbox, WindowColour::Primary, STR_VIEW_CLIPPING_HORIZONTAL_CLIPPING ),
|
||||
MakeWidget ({ 11, 105}, { 158, 17}, WindowWidgetType::Button, WindowColour::Primary, STR_VIEW_CLIPPING_SELECT_AREA ), // selector
|
||||
MakeWidget ({ 11, 126}, { 158, 18}, WindowWidgetType::Button, WindowColour::Primary, STR_VIEW_CLIPPING_CLEAR_SELECTION ), // clear
|
||||
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -346,7 +344,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnOpen() override
|
||||
{
|
||||
this->widgets = _viewClippingWidgets;
|
||||
SetWidgets(_viewClippingWidgets);
|
||||
this->hold_down_widgets = (1uLL << WIDX_CLIP_HEIGHT_INCREASE) | (1uL << WIDX_CLIP_HEIGHT_DECREASE);
|
||||
WindowInitScrollWidgets(*this);
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
#pragma endregion
|
||||
|
||||
// clang-format off
|
||||
static Widget _viewportWidgets[] =
|
||||
static constexpr Widget _viewportWidgets[] =
|
||||
{
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget({ 0, 14}, { WW - 1, WH - 1}, WindowWidgetType::Resize, WindowColour::Secondary ), // resize
|
||||
@@ -52,7 +52,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget({WW - 25, 41}, VIEWPORT_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Primary , ImageId(SPR_G2_ZOOM_OUT), STR_ZOOM_OUT_TIP ), // zoom out
|
||||
MakeWidget({WW - 25, 65}, VIEWPORT_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Primary , ImageId(SPR_LOCATE), STR_LOCATE_SUBJECT_TIP), // locate
|
||||
MakeWidget({WW - 25, 89}, VIEWPORT_BUTTON, WindowWidgetType::FlatBtn, WindowColour::Primary , ImageId(SPR_ROTATE_ARROW),STR_LOCATE_SUBJECT_TIP), // rotate
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -76,7 +75,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
GetFreeViewportNumber();
|
||||
|
||||
widgets = _viewportWidgets;
|
||||
SetWidgets(_viewportWidgets);
|
||||
|
||||
// Create viewport
|
||||
ViewportCreate(this, windowPos, width, height, Focus(TileCoordsXYZ(128, 128, 0).ToCoordsXYZ()));
|
||||
|
||||
@@ -41,12 +41,11 @@ namespace OpenRCT2::Ui::Windows
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
static Widget _waterWidgets[] = {
|
||||
static constexpr Widget _waterWidgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget ({16, 17}, {44, 32}, WindowWidgetType::ImgBtn, WindowColour::Primary , ImageId(SPR_LAND_TOOL_SIZE_0), STR_NONE), // preview box
|
||||
MakeRemapWidget({17, 18}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Tertiary, SPR_LAND_TOOL_DECREASE, STR_ADJUST_SMALLER_WATER_TIP), // decrement size
|
||||
MakeRemapWidget({43, 32}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Tertiary, SPR_LAND_TOOL_INCREASE, STR_ADJUST_LARGER_WATER_TIP), // increment size
|
||||
kWidgetsEnd,
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -59,7 +58,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
public:
|
||||
void OnOpen() override
|
||||
{
|
||||
widgets = _waterWidgets;
|
||||
SetWidgets(_waterWidgets);
|
||||
hold_down_widgets = (1uLL << WIDX_INCREMENT) | (1uLL << WIDX_DECREMENT);
|
||||
WindowInitScrollWidgets(*this);
|
||||
WindowPushOthersBelow(*this);
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
|
||||
struct WindowBase;
|
||||
|
||||
using WidgetIndex = int16_t;
|
||||
using WidgetIndex = uint16_t;
|
||||
|
||||
constexpr WidgetIndex kWidgetIndexNull = 0xFFFF;
|
||||
|
||||
enum class WindowWidgetType : uint8_t
|
||||
{
|
||||
@@ -41,7 +43,6 @@ enum class WindowWidgetType : uint8_t
|
||||
ProgressBar = 29,
|
||||
Custom = 28,
|
||||
TextBox = 27,
|
||||
Last = 26,
|
||||
};
|
||||
|
||||
constexpr uint8_t kCloseButtonWidth = 10;
|
||||
|
||||
@@ -401,12 +401,13 @@ void WindowInvalidateAll()
|
||||
*/
|
||||
void WidgetInvalidate(WindowBase& w, WidgetIndex widgetIndex)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
for (int32_t i = 0; i <= widgetIndex; i++)
|
||||
if (w.widgets.empty())
|
||||
{
|
||||
assert(w.widgets[i].type != WindowWidgetType::Last);
|
||||
// This might be called before the window is fully created.
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
assert(widgetIndex < w.widgets.size());
|
||||
|
||||
const auto& widget = w.widgets[widgetIndex];
|
||||
if (widget.left == -2)
|
||||
@@ -1051,7 +1052,7 @@ void ToolCancel()
|
||||
// Reset map selection
|
||||
gMapSelectFlags = 0;
|
||||
|
||||
if (gCurrentToolWidget.widget_index != -1)
|
||||
if (gCurrentToolWidget.widget_index != kWidgetIndexNull)
|
||||
{
|
||||
// Invalidate tool widget
|
||||
WidgetInvalidateByNumber(
|
||||
@@ -1132,7 +1133,7 @@ void WindowResizeGuiScenarioEditor(int32_t width, int32_t height)
|
||||
mainWind->height = height;
|
||||
viewport->width = width;
|
||||
viewport->height = height;
|
||||
if (mainWind->widgets != nullptr && mainWind->widgets[WC_MAIN_WINDOW__0].type == WindowWidgetType::Viewport)
|
||||
if (!mainWind->widgets.empty() && mainWind->widgets[WC_MAIN_WINDOW__0].type == WindowWidgetType::Viewport)
|
||||
{
|
||||
mainWind->widgets[WC_MAIN_WINDOW__0].right = width;
|
||||
mainWind->widgets[WC_MAIN_WINDOW__0].bottom = height;
|
||||
|
||||
@@ -39,7 +39,7 @@ enum class VisibilityCache : uint8_t;
|
||||
enum class CursorID : uint8_t;
|
||||
enum class CloseWindowModifier : uint8_t;
|
||||
|
||||
using rct_windownumber = uint16_t;
|
||||
using rct_windownumber = int16_t;
|
||||
|
||||
namespace OpenRCT2
|
||||
{
|
||||
@@ -75,20 +75,20 @@ enum class WindowWidgetType : uint8_t;
|
||||
|
||||
struct Widget
|
||||
{
|
||||
WindowWidgetType type;
|
||||
uint8_t colour;
|
||||
int16_t left;
|
||||
int16_t right;
|
||||
int16_t top;
|
||||
int16_t bottom;
|
||||
WindowWidgetType type{};
|
||||
uint8_t colour{};
|
||||
int16_t left{};
|
||||
int16_t right{};
|
||||
int16_t top{};
|
||||
int16_t bottom{};
|
||||
union
|
||||
{
|
||||
uint32_t content;
|
||||
ImageId image;
|
||||
ImageId image{};
|
||||
StringId text;
|
||||
utf8* string;
|
||||
};
|
||||
StringId tooltip;
|
||||
StringId tooltip{ STR_NONE };
|
||||
|
||||
// New properties
|
||||
WidgetFlags flags{};
|
||||
|
||||
@@ -25,6 +25,12 @@ void WindowBase::RemoveViewport()
|
||||
viewport = nullptr;
|
||||
}
|
||||
|
||||
void WindowBase::SetWidgets(const std::span<const Widget> newWidgets)
|
||||
{
|
||||
widgets.clear();
|
||||
widgets.insert(widgets.end(), newWidgets.begin(), newWidgets.end());
|
||||
}
|
||||
|
||||
CursorID WindowBase::OnCursor(WidgetIndex, const ScreenCoordsXY&, CursorID)
|
||||
{
|
||||
return CursorID::Arrow;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
enum class TileInspectorPage : int16_t;
|
||||
|
||||
@@ -37,7 +38,7 @@ struct WindowBase
|
||||
uint64_t disabled_widgets{};
|
||||
uint64_t pressed_widgets{};
|
||||
uint64_t hold_down_widgets{};
|
||||
Widget* widgets{};
|
||||
std::vector<Widget> widgets{};
|
||||
ScreenCoordsXY windowPos;
|
||||
int16_t width{};
|
||||
int16_t height{};
|
||||
@@ -74,6 +75,7 @@ struct WindowBase
|
||||
void SetLocation(const CoordsXYZ& coords);
|
||||
void Invalidate();
|
||||
void RemoveViewport();
|
||||
void SetWidgets(const std::span<const Widget> newWidgets);
|
||||
|
||||
WindowBase() = default;
|
||||
WindowBase(WindowBase&) = delete;
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace OpenRCT2::Ui
|
||||
}
|
||||
WidgetIndex FindWidgetFromPoint(WindowBase& w, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
return -1;
|
||||
return kWidgetIndexNull;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user