1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

Fix #17390: Object selection ride tab uses wrong animations (#22351)

* Object selection ride tab uses wrong animations

* Keep track of currently selected sub-tab

* Add changelog entry
This commit is contained in:
Aaron van Geffen
2024-07-27 21:54:19 +02:00
committed by GitHub
parent b02d461b02
commit 0df7e41f59
2 changed files with 34 additions and 36 deletions

View File

@@ -14,6 +14,7 @@
- Change: [#22230] The plugin/script engine is now initialised off the main thread.
- Change: [#22251] Hide author info in the scenery window unless debug tools are active.
- Change: [#22309] The scenario editor now supports loading landscapes from .sea save files.
- Fix: [#17390] Glitchy animations for the ride type tabs in the object selection window.
- Fix: [#19210] The load/save window executes the loading code twice, resulting in a slowdown.
- Fix: [#22056] Potential crash upon exiting the game.
- Fix: [#22208] Cursor may fail to register hits in some cases (original bug).

View File

@@ -225,22 +225,20 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
#pragma endregion
static constexpr int32_t window_editor_object_selection_animation_loops[] = {
20, // All
32, // Transport
10, // Gentle
72, // Coaster
24, // Thrill
28, // Water
16, // Stall
20, // Transport
32, // Gentle
10, // Coaster
72, // Thrill
24, // Water
28, // Stall
};
static constexpr int32_t window_editor_object_selection_animation_divisor[] = {
4, // All
8, // Transport
2, // Gentle
4, // Coaster
4, // Transport
8, // Gentle
2, // Coaster
4, // Thrill
4, // Water
2, // Stall
4, // Stall
};
static StringId GetRideTypeStringId(const ObjectRepositoryItem* item);
@@ -257,6 +255,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
int32_t _listSortType = RIDE_SORT_TYPE;
bool _listSortDescending = false;
std::unique_ptr<Object> _loadedObject;
uint8_t _selectedSubTab = 0;
public:
/**
@@ -333,18 +332,17 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
WidgetInvalidate(*this, WIDX_FILTER_TEXT_BOX);
}
for (WidgetIndex i = WIDX_FILTER_RIDE_TAB_TRANSPORT; i <= WIDX_FILTER_RIDE_TAB_STALL; i++)
{
if (!IsWidgetPressed(i))
continue;
if (GetSelectedObjectType() != ObjectType::Ride)
return;
frame_no++;
if (frame_no >= window_editor_object_selection_animation_loops[i - WIDX_FILTER_RIDE_TAB_TRANSPORT])
frame_no = 0;
if (_selectedSubTab == 0)
return;
WidgetInvalidate(*this, i);
break;
}
frame_no++;
if (frame_no >= window_editor_object_selection_animation_loops[_selectedSubTab - 1])
frame_no = 0;
WidgetInvalidate(*this, WIDX_FILTER_RIDE_TAB_ALL + _selectedSubTab);
}
/**
@@ -373,25 +371,22 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
}
break;
case WIDX_FILTER_RIDE_TAB_ALL:
_filter_flags |= FILTER_RIDES;
Config::Get().interface.ObjectSelectionFilterFlags = _filter_flags;
Config::Save();
FilterUpdateCounts();
VisibleListRefresh();
selected_list_item = -1;
scrolls[0].v_top = 0;
Invalidate();
break;
case WIDX_FILTER_RIDE_TAB_TRANSPORT:
case WIDX_FILTER_RIDE_TAB_GENTLE:
case WIDX_FILTER_RIDE_TAB_COASTER:
case WIDX_FILTER_RIDE_TAB_THRILL:
case WIDX_FILTER_RIDE_TAB_WATER:
case WIDX_FILTER_RIDE_TAB_STALL:
_filter_flags &= ~FILTER_RIDES;
_filter_flags |= (1 << (widgetIndex - WIDX_FILTER_RIDE_TAB_TRANSPORT + _numSourceGameItems));
{
_selectedSubTab = widgetIndex - WIDX_FILTER_RIDE_TAB_ALL;
if (widgetIndex != WIDX_FILTER_RIDE_TAB_ALL)
{
_filter_flags &= ~FILTER_RIDES;
_filter_flags |= (1 << (_numSourceGameItems + _selectedSubTab - 1));
}
else
_filter_flags |= FILTER_RIDES;
Config::Get().interface.ObjectSelectionFilterFlags = _filter_flags;
Config::Save();
@@ -403,6 +398,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
frame_no = 0;
Invalidate();
break;
}
case WIDX_ADVANCED:
list_information_type ^= 1;
@@ -1024,7 +1020,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
int32_t spriteIndex = ride_tabs[i];
int32_t frame = 0;
if (i != 0 && IsWidgetPressed(WIDX_FILTER_RIDE_TAB_ALL + i))
if (i != 0 && _selectedSubTab == i)
{
frame = frame_no / window_editor_object_selection_animation_divisor[i - 1];
}
@@ -1145,6 +1141,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
return;
selected_tab = _page;
_selectedSubTab = 0;
selected_list_item = -1;
scrolls[0].v_top = 0;
frame_no = 0;