From 904af2cc4ff542b3f34270f5c62520709bebbcce Mon Sep 17 00:00:00 2001 From: Richard Qian Date: Mon, 14 Dec 2020 15:02:43 -0600 Subject: [PATCH 1/7] Enhance the track designer with ability to add scenery and footpaths This brings feature parity with Rollercoaster Tycoon Classic (RCTC) Includes: * Re-enabled buttons: Ride List, Map, Scenery, Path, Clear Scenery * Add all standard footpaths and core scenery objects to the object selection The max limit of 4 rides has not changed; other object types can have more than 4 Only a minimum set of scenery is enabled, as the full set cannot be included --- src/openrct2-ui/windows/TopToolbar.cpp | 16 +++++++++++----- src/openrct2/EditorObjectSelectionSession.cpp | 19 ++++++++++++++++++- src/openrct2/object/DefaultObjects.cpp | 19 +++++++++++++++++++ src/openrct2/object/DefaultObjects.h | 1 + 4 files changed, 49 insertions(+), 6 deletions(-) diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 5a8d7189ed..eb70ed911b 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -675,7 +675,7 @@ static void window_top_toolbar_invalidate(rct_window* w) if (gScreenFlags & SCREEN_FLAGS_EDITOR) { - window_top_toolbar_widgets[WIDX_RIDES].type = WindowWidgetType::Empty; + //window_top_toolbar_widgets[WIDX_RIDES].type = WindowWidgetType::Empty; window_top_toolbar_widgets[WIDX_PARK].type = WindowWidgetType::Empty; window_top_toolbar_widgets[WIDX_STAFF].type = WindowWidgetType::Empty; window_top_toolbar_widgets[WIDX_GUESTS].type = WindowWidgetType::Empty; @@ -686,22 +686,28 @@ static void window_top_toolbar_invalidate(rct_window* w) if (gS6Info.editor_step != EDITOR_STEP_LANDSCAPE_EDITOR) { - window_top_toolbar_widgets[WIDX_MAP].type = WindowWidgetType::Empty; + //window_top_toolbar_widgets[WIDX_MAP].type = WindowWidgetType::Empty; window_top_toolbar_widgets[WIDX_LAND].type = WindowWidgetType::Empty; window_top_toolbar_widgets[WIDX_WATER].type = WindowWidgetType::Empty; - window_top_toolbar_widgets[WIDX_SCENERY].type = WindowWidgetType::Empty; - window_top_toolbar_widgets[WIDX_PATH].type = WindowWidgetType::Empty; - window_top_toolbar_widgets[WIDX_CLEAR_SCENERY].type = WindowWidgetType::Empty; + //window_top_toolbar_widgets[WIDX_SCENERY].type = WindowWidgetType::Empty; + //window_top_toolbar_widgets[WIDX_PATH].type = WindowWidgetType::Empty; + //window_top_toolbar_widgets[WIDX_CLEAR_SCENERY].type = WindowWidgetType::Empty; } if (gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) { + window_top_toolbar_widgets[WIDX_RIDES].type = WindowWidgetType::Empty; window_top_toolbar_widgets[WIDX_CONSTRUCT_RIDE].type = WindowWidgetType::Empty; window_top_toolbar_widgets[WIDX_FASTFORWARD].type = WindowWidgetType::Empty; } if (gS6Info.editor_step != EDITOR_STEP_LANDSCAPE_EDITOR && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) { + window_top_toolbar_widgets[WIDX_MAP].type = WindowWidgetType::Empty; + window_top_toolbar_widgets[WIDX_SCENERY].type = WindowWidgetType::Empty; + window_top_toolbar_widgets[WIDX_PATH].type = WindowWidgetType::Empty; + window_top_toolbar_widgets[WIDX_CLEAR_SCENERY].type = WindowWidgetType::Empty; + window_top_toolbar_widgets[WIDX_ZOOM_OUT].type = WindowWidgetType::Empty; window_top_toolbar_widgets[WIDX_ZOOM_IN].type = WindowWidgetType::Empty; window_top_toolbar_widgets[WIDX_ROTATE].type = WindowWidgetType::Empty; diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index 3fe7a5db7d..0a9c2e9b0b 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -37,6 +37,7 @@ static void setup_in_use_selection_flags(); static void setup_track_designer_objects(); static void setup_track_manager_objects(); static void window_editor_object_selection_select_default_objects(); +static void select_designer_objects(); /** * @@ -75,6 +76,7 @@ static void setup_track_designer_objects() { int32_t numObjects = static_cast(object_repository_get_items_count()); const ObjectRepositoryItem* items = object_repository_get_items(); + select_designer_objects(); for (int32_t i = 0; i < numObjects; i++) { uint8_t* selectionFlags = &_objectSelectionFlags[i]; @@ -353,6 +355,21 @@ static void window_editor_object_selection_select_default_objects() } } +static void select_designer_objects() +{ + if (_numSelectedObjectsForType[0] == 0) + { + for (auto designerSelectedObject : DesignerSelectedObjects) + { + window_editor_object_selection_select_object( + 0, + INPUT_FLAG_EDITOR_OBJECT_SELECT | INPUT_FLAG_EDITOR_OBJECT_1 + | INPUT_FLAG_EDITOR_OBJECT_SELECT_OBJECTS_IN_SCENERY_GROUP, + designerSelectedObject); + } + } +} + /** * * rct2: 0x006AA770 @@ -479,7 +496,7 @@ bool window_editor_object_selection_select_object(uint8_t isMasterObject, int32_ ObjectType objectType = item->ObjectEntry.GetType(); uint16_t maxObjects = object_entry_group_counts[EnumValue(objectType)]; - if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER && objectType == ObjectType::Ride) { maxObjects = 4; } diff --git a/src/openrct2/object/DefaultObjects.cpp b/src/openrct2/object/DefaultObjects.cpp index 0fa523712c..6f112ff6ed 100644 --- a/src/openrct2/object/DefaultObjects.cpp +++ b/src/openrct2/object/DefaultObjects.cpp @@ -49,3 +49,22 @@ const std::string_view DefaultSelectedObjects[] = { "rct2.scgsnow", // Snow and Ice Theming "rct2.scgwater", // Water Feature Theming }; + +const std::string_view DesignerSelectedObjects[] = { + // An initial default selection + all standard footpaths + "rct2.scgtrees", // Scenery: Trees + "rct2.scgshrub", // Scenery: Shrubs and Ornaments + "rct2.scggardn", // Scenery: Gardens + "rct2.scgfence", // Scenery: Fences and Walls + "rct2.scgwalls", // Scenery: Walls and Roofs + "rct2.scgpathx", // Scenery: Signs and Items for Footpaths + "rct2.wtrcyan", // Water: Natural Water + "rct2.pkent1", // Park Entrance: Traditional Park Entrance + "rct2.tarmac", // Footpath: Tarmac + "rct2.tarmacg", // Footpath: Green Tarmac Footpath + "rct2.tarmacb", // Footpath: Brown Tarmac Footpath + "rct2.pathspce", // Footpath: Space Style Footpath + "rct2.pathcrzy", // Footpath: Crazy Paving Footpath + "rct2.pathdirt", // Footpath: Dirt Footpath + "rct2.pathash", // Footpath: Ash Footpath +}; diff --git a/src/openrct2/object/DefaultObjects.h b/src/openrct2/object/DefaultObjects.h index f3006d5398..6453ecd008 100644 --- a/src/openrct2/object/DefaultObjects.h +++ b/src/openrct2/object/DefaultObjects.h @@ -12,3 +12,4 @@ #include "Object.h" extern const std::string_view DefaultSelectedObjects[33]; +extern const std::string_view DesignerSelectedObjects[15]; From 6ee4bec0b10ee775695ace1189af27459f0edfe9 Mon Sep 17 00:00:00 2001 From: Richard Qian Date: Mon, 14 Dec 2020 15:08:13 -0600 Subject: [PATCH 2/7] Cleanup commented code, as testing shows nothing else adversely affected --- src/openrct2-ui/windows/TopToolbar.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index eb70ed911b..af006e5949 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -675,7 +675,6 @@ static void window_top_toolbar_invalidate(rct_window* w) if (gScreenFlags & SCREEN_FLAGS_EDITOR) { - //window_top_toolbar_widgets[WIDX_RIDES].type = WindowWidgetType::Empty; window_top_toolbar_widgets[WIDX_PARK].type = WindowWidgetType::Empty; window_top_toolbar_widgets[WIDX_STAFF].type = WindowWidgetType::Empty; window_top_toolbar_widgets[WIDX_GUESTS].type = WindowWidgetType::Empty; @@ -686,12 +685,8 @@ static void window_top_toolbar_invalidate(rct_window* w) if (gS6Info.editor_step != EDITOR_STEP_LANDSCAPE_EDITOR) { - //window_top_toolbar_widgets[WIDX_MAP].type = WindowWidgetType::Empty; window_top_toolbar_widgets[WIDX_LAND].type = WindowWidgetType::Empty; window_top_toolbar_widgets[WIDX_WATER].type = WindowWidgetType::Empty; - //window_top_toolbar_widgets[WIDX_SCENERY].type = WindowWidgetType::Empty; - //window_top_toolbar_widgets[WIDX_PATH].type = WindowWidgetType::Empty; - //window_top_toolbar_widgets[WIDX_CLEAR_SCENERY].type = WindowWidgetType::Empty; } if (gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) From 84d5fde6bbdf688a3ee6c2bce21d8270c843aca3 Mon Sep 17 00:00:00 2001 From: Richard Qian Date: Tue, 15 Dec 2020 11:46:42 -0600 Subject: [PATCH 3/7] Remove the max limit of 4 rides from the Track Designer --- src/openrct2-ui/windows/EditorObjectSelection.cpp | 2 -- src/openrct2/EditorObjectSelectionSession.cpp | 4 ---- 2 files changed, 6 deletions(-) diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index d07f5deff1..60476832bf 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -1001,8 +1001,6 @@ static void window_editor_object_selection_paint(rct_window* w, rct_drawpixelinf int32_t numSelected = _numSelectedObjectsForType[EnumValue(get_selected_object_type(w))]; int32_t totalSelectable = object_entry_group_counts[EnumValue(get_selected_object_type(w))]; - if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) - totalSelectable = 4; auto ft = Formatter(); ft.Add(numSelected); diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index 0a9c2e9b0b..99354b206e 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -496,10 +496,6 @@ bool window_editor_object_selection_select_object(uint8_t isMasterObject, int32_ ObjectType objectType = item->ObjectEntry.GetType(); uint16_t maxObjects = object_entry_group_counts[EnumValue(objectType)]; - if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER && objectType == ObjectType::Ride) - { - maxObjects = 4; - } if (maxObjects <= _numSelectedObjectsForType[EnumValue(objectType)]) { From 8bdfdad26cbfe4063d394c38b6ff43811d42aa0a Mon Sep 17 00:00:00 2001 From: Richard Qian Date: Wed, 16 Dec 2020 17:47:32 -0600 Subject: [PATCH 4/7] Refactor track designer object setup function to use UpperCamelCase --- src/openrct2/EditorObjectSelectionSession.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index 99354b206e..d3318f30bf 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -37,7 +37,7 @@ static void setup_in_use_selection_flags(); static void setup_track_designer_objects(); static void setup_track_manager_objects(); static void window_editor_object_selection_select_default_objects(); -static void select_designer_objects(); +static void SelectDesignerObjects(); /** * @@ -76,7 +76,7 @@ static void setup_track_designer_objects() { int32_t numObjects = static_cast(object_repository_get_items_count()); const ObjectRepositoryItem* items = object_repository_get_items(); - select_designer_objects(); + SelectDesignerObjects(); for (int32_t i = 0; i < numObjects; i++) { uint8_t* selectionFlags = &_objectSelectionFlags[i]; @@ -355,7 +355,7 @@ static void window_editor_object_selection_select_default_objects() } } -static void select_designer_objects() +static void SelectDesignerObjects() { if (_numSelectedObjectsForType[0] == 0) { From 3c8b7b07dd82303d13d521cfec424d43bfd311ab Mon Sep 17 00:00:00 2001 From: Richard Qian Date: Thu, 17 Dec 2020 16:12:38 -0600 Subject: [PATCH 5/7] Add changelog entry for #13587 --- distribution/changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 515d5c06ab..b80c37970d 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -9,6 +9,7 @@ - Feature: [#13509] [Plugin] Add ability to format strings using OpenRCT2 string framework. - Feature: [#13512] [Plugin] Add item separators to list view. - Feature: [#13583] Add allowed_hosts to plugin section of config. +- Feature: [#13587] Enhanced track designer with ability to add/remove scenery and footpaths. - Change: [#13346] Change FootpathScenery to FootpathAddition in all occurrences. - Fix: [#12895] Mechanics are called to repair rides that have already been fixed. - Fix: [#13257] Rides that are exactly the minimum objective length are not counted. From 3031db3d4eeb68d3576e9e6ba497c9262de9ad79 Mon Sep 17 00:00:00 2001 From: Richard Qian Date: Sat, 19 Dec 2020 13:38:25 -0600 Subject: [PATCH 6/7] Add second changelog entry for #13587 --- distribution/changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index b80c37970d..e1e37c456b 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -24,6 +24,7 @@ - Fix: [#13510] [Plugin] list view scroll resets when items is set. - Improved: [#12917] Changed peep movement so that they stay more spread out over the full width of single tile paths. - Improved: [#13386] A GUI error message is now displayed if the language files are missing. +- Improved: [#13587] Allow up to 128 ride objects to be selected in track designer. - Removed: [#13423] Built-in explode guests cheat (replaced by plug-in). 0.3.2 (2020-11-01) From 157a78c8e67e8bef0b0c5f0670445257b7b1e24f Mon Sep 17 00:00:00 2001 From: Richard Qian Date: Sun, 20 Dec 2020 13:29:46 -0600 Subject: [PATCH 7/7] Enable saving rides with scenery in track designer --- src/openrct2-ui/windows/Ride.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index d130c4daaf..47a3478737 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -5343,11 +5343,7 @@ static void window_ride_measurements_mousedown(rct_window* w, rct_widgetindex wi { w->windowPos.x + widget->left, w->windowPos.y + widget->top }, widget->height() + 1, w->colours[1], Dropdown::Flag::StayOpen, 2); gDropdownDefaultIndex = 0; - if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) - { - Dropdown::SetDisabled(1, true); - } - else if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_HAS_TRACK)) + if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_HAS_TRACK)) { // Disable saving without scenery if we're a flat ride Dropdown::SetDisabled(0, true);