mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-31 10:45:16 +01:00
Improve scenery window (minimum) height (#24317)
* Add constant for max scenery window height * Let scenery window minimum height depend on number of tab strips * Hide eyedropper and cluster buttons if window is too small * Amend changelog
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
- Change: [#24235] Small changes to RCT1 theme.
|
||||
- Change: [#24236] Controls and Interface options now both have their own tabs in the Options window.
|
||||
- Change: [#24308] “Software” and “Software (hardware display)” renderers have been merged into a single “Software” renderer.
|
||||
- Change: [#24317] The scenery window now shows at least one row of scenery objects, even if there are multiple rows of tabs.
|
||||
- Fix: [#19782] Game stops counting inversions and golf holes after 31 (original bug).
|
||||
- Fix: [#21207] Track List window gets positioned incorrectly.
|
||||
- Fix: [#21919] Non-recolourable cars still show colour picker (original bug).
|
||||
|
||||
@@ -71,6 +71,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
constexpr int32_t WINDOW_SCENERY_MIN_HEIGHT = 195 - kTitleHeightNormal;
|
||||
constexpr int32_t SCENERY_BUTTON_WIDTH = 66;
|
||||
constexpr int32_t SCENERY_BUTTON_HEIGHT = 80;
|
||||
constexpr int32_t kDescriptionHeight = 24;
|
||||
constexpr int32_t kInputMargin = 2;
|
||||
constexpr int32_t kMaxWindowHeight = 473;
|
||||
constexpr int32_t kTabMargin = 3;
|
||||
constexpr int32_t TabWidth = 31;
|
||||
constexpr int32_t TabHeight = 28;
|
||||
@@ -112,7 +115,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
MakeWidget ({ 2, 62}, {607, 80}, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL ), // 1000000 0x009DE418
|
||||
MakeWidget ({609, 59}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_ROTATE_ARROW), STR_ROTATE_OBJECTS_90 ), // 2000000 0x009DE428
|
||||
MakeWidget ({609, 83}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_PAINTBRUSH), STR_SCENERY_PAINTBRUSH_TIP ), // 4000000 0x009DE438
|
||||
MakeWidget ({615, 108}, { 12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_COLOUR ), // 8000000 0x009DE448
|
||||
MakeWidget ({615, 108}, { 12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_COLOUR ), // 8000000 0x009DE448
|
||||
MakeWidget ({615, 120}, { 12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_SECONDARY_COLOUR), // 10000000 0x009DE458
|
||||
MakeWidget ({615, 132}, { 12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_TERTIARY_COLOUR ), // 20000000 0x009DE468
|
||||
MakeWidget ({609, 145}, { 24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_G2_EYEDROPPER), STR_SCENERY_EYEDROPPER_TIP ), // 40000000 0x009DE478
|
||||
@@ -477,12 +480,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
else
|
||||
{
|
||||
const auto& listWidget = widgets[WIDX_SCENERY_LIST];
|
||||
const auto nonListHeight = height - listWidget.height() + 12;
|
||||
const auto nonListHeight = height - listWidget.height() + 2;
|
||||
|
||||
const auto numRows = static_cast<int32_t>(CountRows());
|
||||
const auto maxContentHeight = numRows * SCENERY_BUTTON_HEIGHT;
|
||||
const auto maxWindowHeight = maxContentHeight + nonListHeight;
|
||||
const auto windowHeight = std::clamp(maxWindowHeight, _actualMinHeight, 473);
|
||||
const auto expandedWindowHeight = maxContentHeight + nonListHeight;
|
||||
const auto windowHeight = std::clamp(expandedWindowHeight, _actualMinHeight, kMaxWindowHeight);
|
||||
|
||||
min_height = windowHeight;
|
||||
max_height = windowHeight;
|
||||
@@ -636,7 +639,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void OnPrepareDraw() override
|
||||
{
|
||||
_actualMinHeight = WINDOW_SCENERY_MIN_HEIGHT + getTitleBarTargetHeight();
|
||||
// Minimum window height: title, one scenery button, status bar, padding
|
||||
_actualMinHeight = getTitleBarTargetHeight() + SCENERY_BUTTON_HEIGHT + kDescriptionHeight + 2 * kTabMargin;
|
||||
_actualMinHeight += static_cast<int32_t>(1 + (_tabEntries.size() / GetMaxTabCountInARow())) * TabHeight;
|
||||
_actualMinHeight += widgets[WIDX_FILTER_TEXT_BOX].height() + 2 * kInputMargin;
|
||||
|
||||
// Set the window title
|
||||
StringId titleStringId = STR_MISCELLANEOUS;
|
||||
@@ -805,7 +811,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
ResizeFrame();
|
||||
widgets[WIDX_SCENERY_LIST].right = windowWidth - 26;
|
||||
widgets[WIDX_SCENERY_LIST].bottom = height - 24;
|
||||
widgets[WIDX_SCENERY_LIST].bottom = height - kDescriptionHeight;
|
||||
|
||||
widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].left = windowWidth - 25;
|
||||
widgets[WIDX_SCENERY_REPAINT_SCENERY_BUTTON].left = windowWidth - 25;
|
||||
@@ -822,6 +828,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].right = windowWidth - 8;
|
||||
widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].right = windowWidth - 8;
|
||||
widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].right = windowWidth - 8;
|
||||
|
||||
const bool canFit = widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].top < height;
|
||||
widgets[WIDX_SCENERY_EYEDROPPER_BUTTON].type = canFit ? WindowWidgetType::FlatBtn : WindowWidgetType::Empty;
|
||||
widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].type = canFit ? WindowWidgetType::FlatBtn : WindowWidgetType::Empty;
|
||||
}
|
||||
|
||||
void OnDraw(DrawPixelInfo& dpi) override
|
||||
|
||||
Reference in New Issue
Block a user