diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index 2aaa3b0e892f..2c93d9a6c189 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -597,7 +597,8 @@ namespace OpenRCT2::Ui::Windows void OnDrawSummary(DrawPixelInfo& dpi) { - auto screenCoords = windowPos + ScreenCoordsXY{ 8, 51 }; + auto titleBarBottom = widgets[WIDX_TITLE].bottom; + auto screenCoords = windowPos + ScreenCoordsXY{ 8, titleBarBottom + 37 }; auto& gameState = GetGameState(); // Expenditure / Income heading @@ -622,23 +623,26 @@ namespace OpenRCT2::Ui::Windows // Horizontal rule below expenditure / income table GfxFillRectInset( - dpi, { windowPos + ScreenCoordsXY{ 8, 272 }, windowPos + ScreenCoordsXY{ 8 + 513, 272 + 1 } }, colours[1], - INSET_RECT_FLAG_BORDER_INSET); + dpi, + { windowPos + ScreenCoordsXY{ 8, titleBarBottom + 258 }, + windowPos + ScreenCoordsXY{ 8 + 513, titleBarBottom + 258 + 1 } }, + colours[1], INSET_RECT_FLAG_BORDER_INSET); // Loan and interest rate - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 8, 279 }, STR_FINANCES_SUMMARY_LOAN); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 8, titleBarBottom + 265 }, STR_FINANCES_SUMMARY_LOAN); if (!(gameState.Park.Flags & PARK_FLAGS_RCT1_INTEREST)) { auto ft = Formatter(); ft.Add(gameState.BankLoanInterestRate); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 167, 279 }, STR_FINANCES_SUMMARY_AT_X_PER_YEAR, ft); + DrawTextBasic( + dpi, windowPos + ScreenCoordsXY{ 167, titleBarBottom + 265 }, STR_FINANCES_SUMMARY_AT_X_PER_YEAR, ft); } // Current cash auto ft = Formatter(); ft.Add(gameState.Cash); StringId stringId = gameState.Cash >= 0 ? STR_CASH_LABEL : STR_CASH_NEGATIVE_LABEL; - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 8, 294 }, stringId, ft); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 8, titleBarBottom + 280 }, stringId, ft); // Objective related financial information if (gameState.ScenarioObjective.Type == OBJECTIVE_MONTHLY_FOOD_INCOME) @@ -647,18 +651,18 @@ namespace OpenRCT2::Ui::Windows ft = Formatter(); ft.Add(lastMonthProfit); DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 280, 279 }, STR_LAST_MONTH_PROFIT_FROM_FOOD_DRINK_MERCHANDISE_SALES_LABEL, - ft); + dpi, windowPos + ScreenCoordsXY{ 280, titleBarBottom + 265 }, + STR_LAST_MONTH_PROFIT_FROM_FOOD_DRINK_MERCHANDISE_SALES_LABEL, ft); } else { // Park value and company value ft = Formatter(); ft.Add(gameState.Park.Value); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 280, 279 }, STR_PARK_VALUE_LABEL, ft); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 280, titleBarBottom + 265 }, STR_PARK_VALUE_LABEL, ft); ft = Formatter(); ft.Add(gameState.CompanyValue); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 280, 294 }, STR_COMPANY_VALUE_LABEL, ft); + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ 280, titleBarBottom + 280 }, STR_COMPANY_VALUE_LABEL, ft); } } diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index b7289daf79d8..3769e74e2143 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -170,362 +170,364 @@ namespace OpenRCT2::Ui::Windows static_assert(_guestWindowPageWidgets.size() == WINDOW_GUEST_PAGE_COUNT); // clang-format on - static constexpr std::array _guestWindowPageSizes = { - std::array{ ScreenSize{ 192, 159 }, ScreenSize{ 500, 450 } }, // WINDOW_GUEST_OVERVIEW - std::array{ ScreenSize{ 192, 180 }, ScreenSize{ 192, 180 } }, // WINDOW_GUEST_STATS - std::array{ ScreenSize{ 192, 180 }, ScreenSize{ 500, 400 } }, // WINDOW_GUEST_RIDES - std::array{ ScreenSize{ 210, 148 }, ScreenSize{ 210, 148 } }, // WINDOW_GUEST_FINANCE - std::array{ ScreenSize{ 192, 159 }, ScreenSize{ 500, 450 } }, // WINDOW_GUEST_THOUGHTS - std::array{ ScreenSize{ 192, 159 }, ScreenSize{ 500, 450 } }, // WINDOW_GUEST_INVENTORY - std::array{ ScreenSize{ 192, 171 }, ScreenSize{ 192, 171 } }, // WINDOW_GUEST_DEBUG - }; - static_assert(_guestWindowPageSizes.size() == WINDOW_GUEST_PAGE_COUNT); - - class GuestWindow final : public Window +// Minimum and maximum sizes, excluding the title bar. +static constexpr std::array _guestWindowPageSizes = { + std::array{ ScreenSize{ 192, 145 }, ScreenSize{ 500, 436 } }, // WINDOW_GUEST_OVERVIEW + std::array{ ScreenSize{ 192, 166 }, ScreenSize{ 192, 166 } }, // WINDOW_GUEST_STATS + std::array{ ScreenSize{ 192, 166 }, ScreenSize{ 500, 386 } }, // WINDOW_GUEST_RIDES + std::array{ ScreenSize{ 210, 134 }, ScreenSize{ 210, 134 } }, // WINDOW_GUEST_FINANCE + std::array{ ScreenSize{ 192, 145 }, ScreenSize{ 500, 436 } }, // WINDOW_GUEST_THOUGHTS + std::array{ ScreenSize{ 192, 145 }, ScreenSize{ 500, 436 } }, // WINDOW_GUEST_INVENTORY + std::array{ ScreenSize{ 192, 157 }, ScreenSize{ 192, 157 } }, // WINDOW_GUEST_DEBUG +}; +static_assert(_guestWindowPageSizes.size() == WINDOW_GUEST_PAGE_COUNT); + +class GuestWindow final : public Window +{ +private: + uint16_t _marqueePosition = 0; + uint16_t _beingWatchedTimer = 0; + uint16_t _guestAnimationFrame = 0; + int16_t _pickedPeepX = kLocationNull; // entity->x gets set to 0x8000 on pickup, this is the old value + std::vector _riddenRides; + +public: + void OnOpen() override { - private: - uint16_t _marqueePosition = 0; - uint16_t _beingWatchedTimer = 0; - uint16_t _guestAnimationFrame = 0; - int16_t _pickedPeepX = kLocationNull; // entity->x gets set to 0x8000 on pickup, this is the old value - std::vector _riddenRides; - - public: - void OnOpen() override - { - widgets = _guestWindowWidgetsOverview; - page = WINDOW_GUEST_OVERVIEW; - frame_no = 0; - _marqueePosition = 0; - picked_peep_frame = 0; - min_width = width; - min_height = 157; - max_width = 500; - max_height = 450; - selected_list_item = -1; - } + widgets = _guestWindowWidgetsOverview; + page = WINDOW_GUEST_OVERVIEW; + frame_no = 0; + _marqueePosition = 0; + picked_peep_frame = 0; + min_width = width; + min_height = 157; + max_width = 500; + max_height = 450; + selected_list_item = -1; + } - void Init(EntityId id) - { - number = id.ToUnderlying(); - page = -1; // Set Page to something invalid so that SetPage doesn't set audio on viewport - SetPage(WINDOW_GUEST_OVERVIEW); - } + void Init(EntityId id) + { + number = id.ToUnderlying(); + page = -1; // Set Page to something invalid so that SetPage doesn't set audio on viewport + SetPage(WINDOW_GUEST_OVERVIEW); + } - void OnClose() override - { + void OnClose() override + { if (isToolActive(classification, number)) ToolCancel(); } - void OnMouseUp(WidgetIndex widx) override + void OnMouseUp(WidgetIndex widx) override + { + switch (widx) { - switch (widx) - { - case WIDX_CLOSE: - Close(); - return; - case WIDX_TAB_1: - case WIDX_TAB_2: - case WIDX_TAB_3: - case WIDX_TAB_4: - case WIDX_TAB_5: - case WIDX_TAB_6: - case WIDX_TAB_7: - SetPage(widx - WIDX_TAB_1); - return; - } + case WIDX_CLOSE: + Close(); + return; + case WIDX_TAB_1: + case WIDX_TAB_2: + case WIDX_TAB_3: + case WIDX_TAB_4: + case WIDX_TAB_5: + case WIDX_TAB_6: + case WIDX_TAB_7: + SetPage(widx - WIDX_TAB_1); + return; + } - switch (page) - { - case WINDOW_GUEST_OVERVIEW: - OnMouseUpOverview(widx); - break; - } + switch (page) + { + case WINDOW_GUEST_OVERVIEW: + OnMouseUpOverview(widx); + break; } - void OnMouseDown(WidgetIndex widx) override + } + void OnMouseDown(WidgetIndex widx) override + { + if (page == WINDOW_GUEST_OVERVIEW) { - if (page == WINDOW_GUEST_OVERVIEW) - { - OnMouseDownOverview(widx); - } + OnMouseDownOverview(widx); } - void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + } + void OnDropdown(WidgetIndex widgetIndex, int32_t selectedIndex) override + { + if (page == WINDOW_GUEST_OVERVIEW) { - if (page == WINDOW_GUEST_OVERVIEW) - { - OnDropdownOverview(widgetIndex, selectedIndex); - } + OnDropdownOverview(widgetIndex, selectedIndex); } - void OnResize() override + } + void OnResize() override + { + switch (page) { - switch (page) - { - case WINDOW_GUEST_OVERVIEW: - OnResizeOverview(); - break; - case WINDOW_GUEST_STATS: - case WINDOW_GUEST_RIDES: - case WINDOW_GUEST_FINANCE: - case WINDOW_GUEST_THOUGHTS: - case WINDOW_GUEST_INVENTORY: - case WINDOW_GUEST_DEBUG: - OnResizeCommon(); - break; - } + case WINDOW_GUEST_OVERVIEW: + OnResizeOverview(); + break; + case WINDOW_GUEST_STATS: + case WINDOW_GUEST_RIDES: + case WINDOW_GUEST_FINANCE: + case WINDOW_GUEST_THOUGHTS: + case WINDOW_GUEST_INVENTORY: + case WINDOW_GUEST_DEBUG: + OnResizeCommon(); + break; } - void OnUpdate() override + } + void OnUpdate() override + { + switch (page) { - switch (page) - { - case WINDOW_GUEST_OVERVIEW: - OnUpdateOverview(); - break; - case WINDOW_GUEST_STATS: - OnUpdateStats(); - break; - case WINDOW_GUEST_RIDES: - OnUpdateRides(); - break; - case WINDOW_GUEST_FINANCE: - OnUpdateFinance(); - break; - case WINDOW_GUEST_THOUGHTS: - OnUpdateThoughts(); - break; - case WINDOW_GUEST_INVENTORY: - OnUpdateInventory(); - break; - case WINDOW_GUEST_DEBUG: - OnUpdateDebug(); - break; - } + case WINDOW_GUEST_OVERVIEW: + OnUpdateOverview(); + break; + case WINDOW_GUEST_STATS: + OnUpdateStats(); + break; + case WINDOW_GUEST_RIDES: + OnUpdateRides(); + break; + case WINDOW_GUEST_FINANCE: + OnUpdateFinance(); + break; + case WINDOW_GUEST_THOUGHTS: + OnUpdateThoughts(); + break; + case WINDOW_GUEST_INVENTORY: + OnUpdateInventory(); + break; + case WINDOW_GUEST_DEBUG: + OnUpdateDebug(); + break; } - void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + } + void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + if (page == WINDOW_GUEST_OVERVIEW) { - if (page == WINDOW_GUEST_OVERVIEW) - { - OnToolUpdateOverview(widgetIndex, screenCoords); - } + OnToolUpdateOverview(widgetIndex, screenCoords); } - void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + } + void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override + { + if (page == WINDOW_GUEST_OVERVIEW) { - if (page == WINDOW_GUEST_OVERVIEW) - { - OnToolDownOverview(widgetIndex, screenCoords); - } + OnToolDownOverview(widgetIndex, screenCoords); } - void OnToolAbort(WidgetIndex widgetIndex) override + } + void OnToolAbort(WidgetIndex widgetIndex) override + { + if (page == WINDOW_GUEST_OVERVIEW) { - if (page == WINDOW_GUEST_OVERVIEW) - { - OnToolAbortOverview(widgetIndex); - } + OnToolAbortOverview(widgetIndex); } - void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + } + void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override + { + if (page == WINDOW_GUEST_OVERVIEW) { - if (page == WINDOW_GUEST_OVERVIEW) - { - OnTextInputOverview(widgetIndex, text); - } + OnTextInputOverview(widgetIndex, text); } - void OnViewportRotate() override + } + void OnViewportRotate() override + { + if (page == WINDOW_GUEST_OVERVIEW) { - if (page == WINDOW_GUEST_OVERVIEW) - { - OnViewportRotateOverview(); - } + OnViewportRotateOverview(); } - void OnDraw(DrawPixelInfo& dpi) override + } + void OnDraw(DrawPixelInfo& dpi) override + { + switch (page) { - switch (page) - { - case WINDOW_GUEST_OVERVIEW: - OnDrawOverview(dpi); - break; - case WINDOW_GUEST_STATS: - OnDrawStats(dpi); - break; - case WINDOW_GUEST_RIDES: - OnDrawRides(dpi); - break; - case WINDOW_GUEST_FINANCE: - OnDrawFinance(dpi); - break; - case WINDOW_GUEST_THOUGHTS: - OnDrawThoughts(dpi); - break; - case WINDOW_GUEST_INVENTORY: - OnDrawInventory(dpi); - break; - case WINDOW_GUEST_DEBUG: - OnDrawDebug(dpi); - break; - } + case WINDOW_GUEST_OVERVIEW: + OnDrawOverview(dpi); + break; + case WINDOW_GUEST_STATS: + OnDrawStats(dpi); + break; + case WINDOW_GUEST_RIDES: + OnDrawRides(dpi); + break; + case WINDOW_GUEST_FINANCE: + OnDrawFinance(dpi); + break; + case WINDOW_GUEST_THOUGHTS: + OnDrawThoughts(dpi); + break; + case WINDOW_GUEST_INVENTORY: + OnDrawInventory(dpi); + break; + case WINDOW_GUEST_DEBUG: + OnDrawDebug(dpi); + break; } - void OnPrepareDraw() override + } + void OnPrepareDraw() override + { + OnPrepareDrawCommon(); + switch (page) { - OnPrepareDrawCommon(); - switch (page) - { - case WINDOW_GUEST_OVERVIEW: - OnPrepareDrawOverview(); - break; - case WINDOW_GUEST_RIDES: - OnPrepareDrawRides(); - break; - } + case WINDOW_GUEST_OVERVIEW: + OnPrepareDrawOverview(); + break; + case WINDOW_GUEST_RIDES: + OnPrepareDrawRides(); + break; } - ScreenSize OnScrollGetSize(int32_t scrollIndex) override + } + ScreenSize OnScrollGetSize(int32_t scrollIndex) override + { + if (page == WINDOW_GUEST_RIDES) { - if (page == WINDOW_GUEST_RIDES) - { - return OnScrollGetSizeRides(scrollIndex); - } - return {}; + return OnScrollGetSizeRides(scrollIndex); } + return {}; + } - void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + if (page == WINDOW_GUEST_RIDES) { - if (page == WINDOW_GUEST_RIDES) - { - OnScrollMouseOverRides(scrollIndex, screenCoords); - } + OnScrollMouseOverRides(scrollIndex, screenCoords); } - void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + } + void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override + { + if (page == WINDOW_GUEST_RIDES) { - if (page == WINDOW_GUEST_RIDES) - { - OnScrollMouseDownRides(scrollIndex, screenCoords); - } + OnScrollMouseDownRides(scrollIndex, screenCoords); } - void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override + } + void OnScrollDraw(int32_t scrollIndex, DrawPixelInfo& dpi) override + { + if (page == WINDOW_GUEST_RIDES) { - if (page == WINDOW_GUEST_RIDES) - { - OnScrollDrawRides(scrollIndex, dpi); - } + OnScrollDrawRides(scrollIndex, dpi); } + } - private: - Guest* GetGuest() +private: + Guest* GetGuest() + { + auto guest = GetEntity(EntityId::FromUnderlying(number)); + if (guest == nullptr) { - auto guest = GetEntity(EntityId::FromUnderlying(number)); - if (guest == nullptr) - { - Close(); - return nullptr; - } - return guest; + Close(); + return nullptr; } + return guest; + } - void OnResizeCommon() - { - // Get page specific min and max size - int32_t minWidth = _guestWindowPageSizes[page][0].width; - int32_t minHeight = _guestWindowPageSizes[page][0].height; - int32_t maxWidth = _guestWindowPageSizes[page][1].width; - int32_t maxHeight = _guestWindowPageSizes[page][1].height; + void OnResizeCommon() + { + // Get page specific min and max size + auto titleBarHeight = widgets[WIDX_TITLE].height(); + int32_t minWidth = _guestWindowPageSizes[page][0].width + titleBarHeight; + int32_t minHeight = _guestWindowPageSizes[page][0].height + titleBarHeight; + int32_t maxWidth = _guestWindowPageSizes[page][1].width + titleBarHeight; + int32_t maxHeight = _guestWindowPageSizes[page][1].height + titleBarHeight; - // Ensure min size is large enough for all tabs to fit - for (int32_t i = WIDX_TAB_1; i <= WIDX_TAB_7; i++) + // Ensure min size is large enough for all tabs to fit + for (int32_t i = WIDX_TAB_1; i <= WIDX_TAB_7; i++) + { + if (!WidgetIsDisabled(*this, i)) { - if (!WidgetIsDisabled(*this, i)) - { - minWidth = std::max(minWidth, widgets[i].right + 3); - } + minWidth = std::max(minWidth, widgets[i].right + 3); } - maxWidth = std::max(minWidth, maxWidth); - - WindowSetResize(*this, minWidth, minHeight, maxWidth, maxHeight); } + maxWidth = std::max(minWidth, maxWidth); + + WindowSetResize(*this, minWidth, minHeight, maxWidth, maxHeight); + } - void OnPrepareDrawCommon() + void OnPrepareDrawCommon() + { + if (_guestWindowPageWidgets[page] != widgets) { - if (_guestWindowPageWidgets[page] != widgets) - { - widgets = _guestWindowPageWidgets[page]; - InitScrollWidgets(); - } + widgets = _guestWindowPageWidgets[page]; + InitScrollWidgets(); + } - pressed_widgets |= 1uLL << (page + WIDX_TAB_1); + pressed_widgets |= 1uLL << (page + WIDX_TAB_1); - const auto peep = GetGuest(); - if (peep == nullptr) - { - return; - } - auto ft = Formatter::Common(); - peep->FormatNameTo(ft); + const auto peep = GetGuest(); + if (peep == nullptr) + { + return; + } + auto ft = Formatter::Common(); + peep->FormatNameTo(ft); - ResizeFrameWithPage(); + ResizeFrameWithPage(); - WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); - } + WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7); + } - void DisableWidgets() + void DisableWidgets() + { + const auto peep = GetGuest(); + if (peep == nullptr) { - const auto peep = GetGuest(); - if (peep == nullptr) - { - return; - } - uint64_t newDisabledWidgets = 0; - - if (peep->CanBePickedUp()) - { - if (WidgetIsDisabled(*this, WIDX_PICKUP)) - Invalidate(); - } - else - { - newDisabledWidgets = (1uLL << WIDX_PICKUP); - if (!WidgetIsDisabled(*this, WIDX_PICKUP)) - Invalidate(); - } - if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) - { - newDisabledWidgets |= (1uLL << WIDX_TAB_4); // Disable finance tab if no money - } - if (!Config::Get().general.DebuggingTools) - { - newDisabledWidgets |= (1uLL << WIDX_TAB_7); // Disable debug tab when debug tools not turned on - } - disabled_widgets = newDisabledWidgets; + return; } + uint64_t newDisabledWidgets = 0; - void SetPage(int32_t newPage) + if (peep->CanBePickedUp()) + { + if (WidgetIsDisabled(*this, WIDX_PICKUP)) + Invalidate(); + } + else + { + newDisabledWidgets = (1uLL << WIDX_PICKUP); + if (!WidgetIsDisabled(*this, WIDX_PICKUP)) + Invalidate(); + } + if (GetGameState().Park.Flags & PARK_FLAGS_NO_MONEY) { + newDisabledWidgets |= (1uLL << WIDX_TAB_4); // Disable finance tab if no money + } + if (!Config::Get().general.DebuggingTools) + { + newDisabledWidgets |= (1uLL << WIDX_TAB_7); // Disable debug tab when debug tools not turned on + } + disabled_widgets = newDisabledWidgets; + } + + void SetPage(int32_t newPage) + { if (isToolActive(classification, number)) ToolCancel(); - int32_t listen = 0; - if (newPage == WINDOW_GUEST_OVERVIEW && page == WINDOW_GUEST_OVERVIEW && viewport != nullptr) - { - if (!(viewport->flags & VIEWPORT_FLAG_SOUND_ON)) - listen = 1; - } + int32_t listen = 0; + if (newPage == WINDOW_GUEST_OVERVIEW && page == WINDOW_GUEST_OVERVIEW && viewport != nullptr) + { + if (!(viewport->flags & VIEWPORT_FLAG_SOUND_ON)) + listen = 1; + } - page = newPage; - frame_no = 0; - _riddenRides.clear(); - selected_list_item = -1; + page = newPage; + frame_no = 0; + _riddenRides.clear(); + selected_list_item = -1; - RemoveViewport(); + RemoveViewport(); - hold_down_widgets = 0; - pressed_widgets = 0; - widgets = _guestWindowPageWidgets[page]; - DisableWidgets(); - Invalidate(); - OnResize(); - OnPrepareDraw(); - InitScrollWidgets(); - Invalidate(); + hold_down_widgets = 0; + pressed_widgets = 0; + widgets = _guestWindowPageWidgets[page]; + DisableWidgets(); + Invalidate(); + OnResize(); + OnPrepareDraw(); + InitScrollWidgets(); + Invalidate(); - if (listen && viewport != nullptr) - viewport->flags |= VIEWPORT_FLAG_SOUND_ON; - } + if (listen && viewport != nullptr) + viewport->flags |= VIEWPORT_FLAG_SOUND_ON; + } #pragma region Overview @@ -605,8 +607,10 @@ namespace OpenRCT2::Ui::Windows if (viewport != nullptr) { - auto reqViewportWidth = width - 30; - auto reqViewportHeight = height - 72; + auto widget = widgets[WIDX_VIEWPORT]; + auto reqViewportWidth = widget.width() - 1; + auto reqViewportHeight = widget.height() - 1; + viewport->pos = windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 }; if (viewport->width != reqViewportWidth || viewport->height != reqViewportHeight) { viewport->width = reqViewportWidth; diff --git a/src/openrct2-ui/windows/NetworkStatus.cpp b/src/openrct2-ui/windows/NetworkStatus.cpp index a42c262512b3..cf98d25d6fa6 100644 --- a/src/openrct2-ui/windows/NetworkStatus.cpp +++ b/src/openrct2-ui/windows/NetworkStatus.cpp @@ -43,7 +43,7 @@ namespace OpenRCT2::Ui::Windows frame_no = 0; min_width = 320; - min_height = 90; + min_height = 76 + widgets[WIDX_TITLE].bottom; max_width = min_width; max_height = min_height; diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index ce7df6f400ed..68ca261a0d86 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -43,6 +43,7 @@ using namespace OpenRCT2::TrackMetaData; namespace OpenRCT2::Ui::Windows { static constexpr StringId WindowTitle = STR_NONE; + static constexpr int32_t WindowBodyHeight = 368; static constexpr int32_t WindowHeight = 382; static constexpr int32_t WindowWidth = 601; static constexpr int32_t RideListItemsMax = 384; @@ -836,7 +837,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_RESEARCH_FUNDING_BUTTON].type = WindowWidgetType::Empty; newWidth = WindowWidth; - newHeight = WindowHeight; + newHeight = WindowBodyHeight + widgets[WIDX_TITLE].bottom; } else { @@ -850,7 +851,7 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_RESEARCH_FUNDING_BUTTON].type = WindowWidgetType::FlatBtn; newWidth = 300; - newHeight = 196; + newHeight = 182 + widgets[WIDX_TITLE].bottom; } // Handle new window size diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index 326993dcd55e..54b895cdd53e 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -209,6 +209,11 @@ namespace OpenRCT2::Ui::Windows ScreenRect _ratingGraphBounds; ScreenRect _guestGraphBounds; + int32_t GetGraphPageWindowHeight() + { + return 168 + widgets[WIDX_TITLE].height(); + } + public: void OnOpen() override { @@ -685,7 +690,8 @@ namespace OpenRCT2::Ui::Windows #pragma region Rating page void OnResizeRating() { - WindowSetResize(*this, 255, 182, 255, 182); + auto pageHeight = GetGraphPageWindowHeight(); + WindowSetResize(*this, 255, pageHeight, 255, pageHeight); } void OnUpdateRating() @@ -748,7 +754,8 @@ namespace OpenRCT2::Ui::Windows #pragma region Guests page void OnResizeGuests() { - WindowSetResize(*this, 255, 182, 255, 182); + auto pageHeight = GetGraphPageWindowHeight(); + WindowSetResize(*this, 255, pageHeight, 255, pageHeight); } void OnUpdateGuests() @@ -1144,7 +1151,8 @@ namespace OpenRCT2::Ui::Windows #pragma region Awards page void OnResizeAwards() { - WindowSetResize(*this, 230, 182, 230, 182); + auto pageHeight = GetGraphPageWindowHeight(); + WindowSetResize(*this, 230, pageHeight, 230, pageHeight); } void OnUpdateAwards() diff --git a/src/openrct2-ui/windows/ProgressWindow.cpp b/src/openrct2-ui/windows/ProgressWindow.cpp index 95adab9b1dd8..01235af4bdb8 100644 --- a/src/openrct2-ui/windows/ProgressWindow.cpp +++ b/src/openrct2-ui/windows/ProgressWindow.cpp @@ -29,7 +29,8 @@ namespace OpenRCT2::Ui::Windows }; static constexpr int32_t kWindowWidth = 400; - static constexpr int32_t kWindowHeight = 90; + static constexpr int32_t kWindowBodyHeight = 76; + static constexpr int32_t kWindowHeight = kWindowBodyHeight + 14; // clang-format off static Widget kProgressWindowWidgets[] = { @@ -88,7 +89,7 @@ namespace OpenRCT2::Ui::Windows frame_no = 0; min_width = kWindowWidth; - min_height = kWindowHeight; + min_height = kWindowBodyHeight + widgets[WIDX_TITLE].bottom; max_width = min_width; max_height = min_height; diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 04312fc83088..e1afeb8eee7e 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -73,9 +73,11 @@ using namespace OpenRCT2::TrackMetaData; namespace OpenRCT2::Ui::Windows { + static constexpr int32_t kMinimumWindowWidth = 316; + static constexpr StringId WINDOW_TITLE = STR_RIDE_WINDOW_TITLE; static constexpr int32_t WH = 207; - static constexpr int32_t WW = 316; + static constexpr int32_t WW = kMinimumWindowWidth; enum { @@ -236,7 +238,7 @@ namespace OpenRCT2::Ui::Windows #define MAIN_RIDE_WIDGETS \ WINDOW_SHIM(WINDOW_TITLE, WW, WH), \ - MakeWidget({ 0, 43 }, { 316, 137 }, WindowWidgetType::Resize, WindowColour::Secondary), \ + MakeWidget({ 0, 43}, {kMinimumWindowWidth, 137}, WindowWidgetType::Resize, WindowColour::Secondary), \ MakeTab({ 3, 17 }, STR_VIEW_OF_RIDE_ATTRACTION_TIP), \ MakeTab({ 34, 17 }, STR_VEHICLE_DETAILS_AND_OPTIONS_TIP), \ MakeTab({ 65, 17 }, STR_OPERATING_OPTIONS_TIP), \ @@ -757,7 +759,7 @@ namespace OpenRCT2::Ui::Windows list_information_type = 0; picked_peep_frame = 0; DisableTabs(); - min_width = 316; + min_width = kMinimumWindowWidth; min_height = 180; max_width = 500; max_height = 450; @@ -1712,7 +1714,7 @@ namespace OpenRCT2::Ui::Windows } flags |= WF_RESIZABLE; - WindowSetResize(*this, 316, minHeight, 500, 450); + WindowSetResize(*this, kMinimumWindowWidth, minHeight, 500, 450); // Unlike with other windows, the focus needs to be recentred so it’s best to just reset it. focus = std::nullopt; InitViewport(); @@ -2419,7 +2421,7 @@ namespace OpenRCT2::Ui::Windows : WindowWidgetType::Empty; widgets[WIDX_OPEN_LIGHT].type = WindowWidgetType::ImgBtn; - widgetHeight = 62; + widgetHeight = widgets[WIDX_PAGE_BACKGROUND].top + 19; if (widgets[WIDX_SIMULATE_LIGHT].type != WindowWidgetType::Empty) { widgets[WIDX_SIMULATE_LIGHT].top = widgetHeight; @@ -2664,7 +2666,7 @@ namespace OpenRCT2::Ui::Windows void VehicleResize() { auto bottom = widgets[WIDX_VEHICLE_TRAINS].bottom + 6; - WindowSetResize(*this, 316, bottom, 316, bottom); + WindowSetResize(*this, kMinimumWindowWidth, bottom, kMinimumWindowWidth, bottom); } void VehicleOnMouseDown(WidgetIndex widgetIndex) @@ -2894,8 +2896,7 @@ namespace OpenRCT2::Ui::Windows if (rideEntry == nullptr) return; - auto screenCoords = windowPos + ScreenCoordsXY{ 8, 64 }; - + auto screenCoords = windowPos + ScreenCoordsXY{ 8, widgets[WIDX_VEHICLE_TYPE_DROPDOWN].bottom + 5 }; // Description auto ft = Formatter(); ft.Add(rideEntry->naming.Description); @@ -3216,7 +3217,8 @@ namespace OpenRCT2::Ui::Windows void OperatingResize() { - WindowSetResize(*this, 316, 186, 316, 186); + auto bottom = widgets[WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX].bottom + 6; + WindowSetResize(*this, kMinimumWindowWidth, bottom, kMinimumWindowWidth, bottom); } void OperatingOnMouseDown(WidgetIndex widgetIndex) @@ -3717,10 +3719,11 @@ namespace OpenRCT2::Ui::Windows return; // Horizontal rule between mode settings and depart settings + auto ruleStart = widgets[WIDX_LOAD_DROPDOWN].top - 8; GfxFillRectInset( dpi, - { windowPos + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, 103 }, - windowPos + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].right - 5, 104 } }, + { windowPos + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, ruleStart }, + windowPos + ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].right - 5, ruleStart + 1 } }, colours[1], INSET_RECT_FLAG_BORDER_INSET); // Number of block sections @@ -3728,9 +3731,10 @@ namespace OpenRCT2::Ui::Windows { auto ft = Formatter(); ft.Add(ride->num_block_brakes + ride->num_stations); + auto underWidget = ride->mode == RideMode::PoweredLaunchBlockSectioned ? WIDX_MODE_TWEAK : WIDX_MODE; DrawTextBasic( - dpi, windowPos + ScreenCoordsXY{ 21, ride->mode == RideMode::PoweredLaunchBlockSectioned ? 89 : 61 }, - STR_BLOCK_SECTIONS, ft, { COLOUR_BLACK }); + dpi, windowPos + ScreenCoordsXY{ 21, widgets[underWidget].bottom + 3 }, STR_BLOCK_SECTIONS, ft, + { COLOUR_BLACK }); } } @@ -3791,7 +3795,8 @@ namespace OpenRCT2::Ui::Windows void MaintenanceResize() { - WindowSetResize(*this, 316, 135, 316, 135); + auto bottom = widgets[WIDX_LOCATE_MECHANIC].bottom + 6; + WindowSetResize(*this, kMinimumWindowWidth, bottom, kMinimumWindowWidth, bottom); } void MaintenanceOnMouseDown(WidgetIndex widgetIndex) @@ -4320,7 +4325,8 @@ namespace OpenRCT2::Ui::Windows void ColourResize() { - WindowSetResize(*this, 316, 207, 316, 207); + auto bottom = widgets[WIDX_VEHICLE_PREVIEW].bottom + 6; + WindowSetResize(*this, kMinimumWindowWidth, bottom, kMinimumWindowWidth, bottom); } void ColourOnMouseDown(WidgetIndex widgetIndex) @@ -5047,9 +5053,10 @@ namespace OpenRCT2::Ui::Windows // Expand the window when music is playing auto isMusicActivated = (ride->lifecycle_flags & RIDE_LIFECYCLE_MUSIC) != 0; - auto minHeight = isMusicActivated ? 214 : 81; - auto maxHeight = isMusicActivated ? 450 : 81; - WindowSetResize(*this, 316, minHeight, 500, maxHeight); + auto standardHeight = widgets[WIDX_MUSIC_DROPDOWN].bottom + 6; + auto minHeight = isMusicActivated ? standardHeight + 133 : standardHeight; + auto maxHeight = isMusicActivated ? standardHeight + 369 : standardHeight; + WindowSetResize(*this, kMinimumWindowWidth, minHeight, 500, maxHeight); } static std::string GetMusicString(ObjectEntryIndex musicObjectIndex) @@ -5494,7 +5501,7 @@ namespace OpenRCT2::Ui::Windows void MeasurementsResize() { - WindowSetResize(*this, 316, 234, 316, 234); + WindowSetResize(*this, kMinimumWindowWidth, 234, kMinimumWindowWidth, 234); } void MeasurementsOnMouseDown(WidgetIndex widgetIndex) @@ -5938,7 +5945,7 @@ namespace OpenRCT2::Ui::Windows void GraphsResize() { - WindowSetResize(*this, 316, 182, 500, 450); + WindowSetResize(*this, kMinimumWindowWidth, 182, 500, 450); } void GraphsOnMouseDown(WidgetIndex widgetIndex) @@ -6497,7 +6504,8 @@ namespace OpenRCT2::Ui::Windows void IncomeResize() { - WindowSetResize(*this, 316, 194, 316, 194); + auto newHeight = widgets[WIDX_TITLE].bottom + 180; + WindowSetResize(*this, kMinimumWindowWidth, newHeight, kMinimumWindowWidth, newHeight); } void IncomeOnMouseDown(WidgetIndex widgetIndex) @@ -6819,7 +6827,7 @@ namespace OpenRCT2::Ui::Windows void CustomerResize() { flags |= WF_RESIZABLE; - WindowSetResize(*this, 316, 163, 316, 163); + WindowSetResize(*this, kMinimumWindowWidth, 163, kMinimumWindowWidth, 163); } void CustomerUpdate() @@ -7005,7 +7013,7 @@ namespace OpenRCT2::Ui::Windows */ static RideWindow* WindowRideOpen(const Ride& ride) { - return WindowCreate(WindowClass::Ride, 316, 207, WF_10 | WF_RESIZABLE, ride); + return WindowCreate(WindowClass::Ride, kMinimumWindowWidth, 207, WF_10 | WF_RESIZABLE, ride); } /** diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 7129e2988b88..c5864e190d95 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -142,9 +142,9 @@ namespace OpenRCT2::Ui::Windows MakeWidget ({117, 88}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RIDE_CONSTRUCTION_SLOPE_UP), STR_RIDE_CONSTRUCTION_SLOPE_UP_TIP ), MakeWidget ({141, 88}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RIDE_CONSTRUCTION_SLOPE_UP_STEEP), STR_RIDE_CONSTRUCTION_STEEP_SLOPE_UP_TIP ), MakeWidget ({178, 88}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_CHAIN_LIFT), STR_RIDE_CONSTRUCTION_CHAIN_LIFT_TIP ), - MakeWidget ({ 69, 132}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RIDE_CONSTRUCTION_LEFT_BANK), STR_RIDE_CONSTRUCTION_ROLL_FOR_LEFT_CURVE_TIP ), - MakeWidget ({ 93, 132}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RIDE_CONSTRUCTION_NO_BANK), STR_RIDE_CONSTRUCTION_NO_ROLL_TIP ), - MakeWidget ({117, 132}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RIDE_CONSTRUCTION_RIGHT_BANK), STR_RIDE_CONSTRUCTION_ROLL_FOR_RIGHT_CURVE_TIP ), + MakeWidget ({ 69, 138}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RIDE_CONSTRUCTION_LEFT_BANK), STR_RIDE_CONSTRUCTION_ROLL_FOR_LEFT_CURVE_TIP ), + MakeWidget ({ 93, 138}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RIDE_CONSTRUCTION_NO_BANK), STR_RIDE_CONSTRUCTION_NO_ROLL_TIP ), + MakeWidget ({117, 138}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RIDE_CONSTRUCTION_RIGHT_BANK), STR_RIDE_CONSTRUCTION_ROLL_FOR_RIGHT_CURVE_TIP ), MakeWidget ({ 3, 164}, { GW, 170}, WindowWidgetType::ImgBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_RIDE_CONSTRUCTION_CONSTRUCT_SELECTED_SECTION_TIP), MakeWidget ({ 82, 338}, { 46, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_DEMOLISH_CURRENT_SECTION), STR_RIDE_CONSTRUCTION_REMOVE_HIGHLIGHTED_SECTION_TIP), MakeWidget ({ 52, 338}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_PREVIOUS), STR_RIDE_CONSTRUCTION_MOVE_TO_PREVIOUS_SECTION_TIP ), @@ -1842,25 +1842,27 @@ namespace OpenRCT2::Ui::Windows } } + auto top = 118 + widgets[WIDX_TITLE].bottom; + auto bottom = top + 23; widgets[WIDX_BANKING_GROUPBOX].image = ImageId(STR_RIDE_CONSTRUCTION_ROLL_BANKING); widgets[WIDX_BANK_LEFT].image = ImageId(SPR_RIDE_CONSTRUCTION_LEFT_BANK); widgets[WIDX_BANK_LEFT].tooltip = STR_RIDE_CONSTRUCTION_ROLL_FOR_LEFT_CURVE_TIP; widgets[WIDX_BANK_LEFT].left = 69; widgets[WIDX_BANK_LEFT].right = 92; - widgets[WIDX_BANK_LEFT].top = 132; - widgets[WIDX_BANK_LEFT].bottom = 155; + widgets[WIDX_BANK_LEFT].top = top; + widgets[WIDX_BANK_LEFT].bottom = bottom; widgets[WIDX_BANK_STRAIGHT].image = ImageId(SPR_RIDE_CONSTRUCTION_NO_BANK); widgets[WIDX_BANK_STRAIGHT].tooltip = STR_RIDE_CONSTRUCTION_NO_ROLL_TIP; widgets[WIDX_BANK_STRAIGHT].left = 93; widgets[WIDX_BANK_STRAIGHT].right = 116; - widgets[WIDX_BANK_STRAIGHT].top = 132; - widgets[WIDX_BANK_STRAIGHT].bottom = 155; + widgets[WIDX_BANK_STRAIGHT].top = top; + widgets[WIDX_BANK_STRAIGHT].bottom = bottom; widgets[WIDX_BANK_RIGHT].image = ImageId(SPR_RIDE_CONSTRUCTION_RIGHT_BANK); widgets[WIDX_BANK_RIGHT].tooltip = STR_RIDE_CONSTRUCTION_ROLL_FOR_RIGHT_CURVE_TIP; widgets[WIDX_BANK_RIGHT].left = 117; widgets[WIDX_BANK_RIGHT].right = 140; - widgets[WIDX_BANK_RIGHT].top = 132; - widgets[WIDX_BANK_RIGHT].bottom = 155; + widgets[WIDX_BANK_RIGHT].top = top; + widgets[WIDX_BANK_RIGHT].bottom = bottom; widgets[WIDX_BANK_LEFT].type = WindowWidgetType::Empty; widgets[WIDX_BANK_STRAIGHT].type = WindowWidgetType::Empty; widgets[WIDX_BANK_RIGHT].type = WindowWidgetType::Empty; @@ -1942,7 +1944,8 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_SPEED_SETTING_SPINNER_DOWN].type = WindowWidgetType::Button; widgets[WIDX_SPEED_SETTING_SPINNER_DOWN].text = STR_NUMERIC_DOWN; - ResizeSpinner(WIDX_SPEED_SETTING_SPINNER, { 12, 138 }, { 85, kSpinnerHeight }); + auto spinnerStart = 124 + widgets[WIDX_TITLE].bottom; + ResizeSpinner(WIDX_SPEED_SETTING_SPINNER, { 12, spinnerStart }, { 85, kSpinnerHeight }); hold_down_widgets |= (1uLL << WIDX_SPEED_SETTING_SPINNER_UP) | (1uLL << WIDX_SPEED_SETTING_SPINNER_DOWN); } diff --git a/src/openrct2-ui/windows/RideList.cpp b/src/openrct2-ui/windows/RideList.cpp index 7ebd90015203..113930019144 100644 --- a/src/openrct2-ui/windows/RideList.cpp +++ b/src/openrct2-ui/windows/RideList.cpp @@ -210,7 +210,8 @@ namespace OpenRCT2::Ui::Windows widgets[WIDX_SORT].left = width - 60; widgets[WIDX_SORT].right = width - 60 + 54; - ResizeDropdown(WIDX_CURRENT_INFORMATION_TYPE, { 150, 46 }, { width - 216, kDropdownHeight }); + auto dropdownStart = widgets[WIDX_CURRENT_INFORMATION_TYPE].top; + ResizeDropdown(WIDX_CURRENT_INFORMATION_TYPE, { 150, dropdownStart }, { width - 216, kDropdownHeight }); // Refreshing the list can be a very intensive operation // owing to its use of ride_has_any_track_elements(). diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 91b67b579431..0bda2fbe6e0c 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -59,7 +59,7 @@ namespace OpenRCT2::Ui::Windows constexpr int32_t SCENERY_BUTTON_WIDTH = 66; constexpr int32_t SCENERY_BUTTON_HEIGHT = 80; constexpr int32_t InitTabPosX = 3; - constexpr int32_t InitTabPosY = 17; + constexpr int32_t InitTabPosY = 3; constexpr int32_t TabWidth = 31; constexpr int32_t TabHeight = 28; constexpr int32_t ReservedTabCount = 2; @@ -762,13 +762,14 @@ namespace OpenRCT2::Ui::Windows const auto lastTabWidget = &widgets[WIDX_SCENERY_TAB_1 + lastTabIndex]; windowWidth = std::max(windowWidth, lastTabWidget->right + 3); + auto tabTop = InitTabPosY + widgets[WIDX_SCENERY_TITLE].bottom; if (GetSceneryTabInfoForMisc() != nullptr) { auto miscTabWidget = &widgets[WIDX_SCENERY_TAB_1 + _tabEntries.size() - 2]; miscTabWidget->left = windowWidth - 2 * TabWidth - 6; miscTabWidget->right = windowWidth - TabWidth - 7; - miscTabWidget->top = InitTabPosY; - miscTabWidget->bottom = InitTabPosY + TabHeight; + miscTabWidget->top = tabTop; + miscTabWidget->bottom = tabTop + TabHeight; } if (_tabEntries.back().IsAll()) @@ -776,8 +777,8 @@ namespace OpenRCT2::Ui::Windows auto allTabWidget = &widgets[WIDX_SCENERY_TAB_1 + _tabEntries.size() - 1]; allTabWidget->left = windowWidth - TabWidth - 6; allTabWidget->right = windowWidth - 7; - allTabWidget->top = InitTabPosY; - allTabWidget->bottom = InitTabPosY + TabHeight; + allTabWidget->top = tabTop; + allTabWidget->bottom = tabTop + TabHeight; } } @@ -1361,7 +1362,7 @@ namespace OpenRCT2::Ui::Windows auto hasMisc = GetSceneryTabInfoForMisc() != nullptr; auto maxTabsInThisRow = MaxTabsPerRow - 1 - (hasMisc ? 1 : 0); - ScreenCoordsXY pos = { xInit, InitTabPosY }; + ScreenCoordsXY pos = { xInit, InitTabPosY + 14 }; for (const auto& tabInfo : _tabEntries) { auto widget = MakeTab(pos, STR_STRING_DEFINED_TOOLTIP); diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index c875dfc0f858..9efe7f40b075 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -41,6 +41,7 @@ namespace OpenRCT2::Ui::Windows static constexpr StringId WINDOW_TITLE = STR_STRINGID; static constexpr int32_t WW = 190; + static constexpr int32_t _windowBodyHeight = 166; static constexpr int32_t WH = 180; enum WindowStaffPage @@ -593,8 +594,8 @@ namespace OpenRCT2::Ui::Windows { min_width = WW; max_width = 500; - min_height = WH; - max_height = 450; + min_height = _windowBodyHeight + widgets[WIDX_TITLE].height(); + max_height = 436 + widgets[WIDX_TITLE].height(); if (width < min_width) { @@ -619,8 +620,10 @@ namespace OpenRCT2::Ui::Windows if (viewport != nullptr) { - int32_t newWidth = width - 30; - int32_t newHeight = height - 62; + auto widget = widgets[WIDX_VIEWPORT]; + auto newWidth = widget.width() - 1; + auto newHeight = widget.height() - 1; + viewport->pos = windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 }; // Update the viewport size if (viewport->width != newWidth || viewport->height != newHeight) @@ -894,10 +897,11 @@ namespace OpenRCT2::Ui::Windows void OptionsResize() { + auto titleBarHeight = widgets[WIDX_TITLE].height(); min_width = 190; max_width = 190; - min_height = 126; - max_height = 126; + min_height = 112 + titleBarHeight; + max_height = 112 + titleBarHeight; if (width < min_width) { @@ -997,10 +1001,12 @@ namespace OpenRCT2::Ui::Windows void StatsResize() { + auto titleBarHeight = widgets[WIDX_TITLE].height(); min_width = 190; max_width = 190; - min_height = 126; - max_height = 126; + min_height = 112 + titleBarHeight; + max_height = 112 + titleBarHeight; + ; if (width < min_width) { diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index 7be015f82357..e97ccb1ebaf8 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -69,9 +69,11 @@ namespace OpenRCT2::Ui::Windows static constexpr StringId WINDOW_TITLE = STR_STAFF; static constexpr int32_t WW = 320; - static constexpr int32_t WH = 270; + static constexpr int32_t _windowBodyMinHeight = 256; + static constexpr int32_t _windowBodyMaxHeight = 436; + static constexpr int32_t WH = _windowBodyMinHeight + 14; constexpr int32_t MAX_WW = 500; - constexpr int32_t MAX_WH = 450; + constexpr int32_t MAX_WH = _windowBodyMaxHeight + 14; // clang-format off static Widget _staffListWidgets[] = { @@ -297,7 +299,8 @@ namespace OpenRCT2::Ui::Windows { auto ft = Formatter(); ft.Add(GetStaffWage(GetSelectedStaffType())); - DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ width - 155, 32 }, STR_COST_PER_MONTH, ft); + auto y = widgets[WIDX_STAFF_LIST_TITLE].bottom + 18; + DrawTextBasic(dpi, windowPos + ScreenCoordsXY{ width - 155, y }, STR_COST_PER_MONTH, ft); } if (GetSelectedStaffType() != StaffType::Entertainer)