From a6d3dbc6d94535e2874fed953d8ec8a9e35b32f6 Mon Sep 17 00:00:00 2001 From: Duncan Date: Thu, 22 Jun 2023 23:44:17 +0100 Subject: [PATCH] Remove player specific window vars from common --- src/openrct2-ui/interface/Window.cpp | 1 - .../windows/EditorObjectiveOptions.cpp | 1 - src/openrct2-ui/windows/EditorScenarioOptions.cpp | 1 - src/openrct2-ui/windows/Player.cpp | 15 +++++++++------ src/openrct2/interface/Window_internal.h | 7 +------ 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/openrct2-ui/interface/Window.cpp b/src/openrct2-ui/interface/Window.cpp index d80699c7a6..b3b767193e 100644 --- a/src/openrct2-ui/interface/Window.cpp +++ b/src/openrct2-ui/interface/Window.cpp @@ -279,7 +279,6 @@ WindowBase* WindowCreate( w->focus = std::nullopt; w->page = 0; w->var_48C = 0; - w->var_492 = 0; ColourSchemeUpdate(w); w->Invalidate(); diff --git a/src/openrct2-ui/windows/EditorObjectiveOptions.cpp b/src/openrct2-ui/windows/EditorObjectiveOptions.cpp index 42e993dc44..af74525af4 100644 --- a/src/openrct2-ui/windows/EditorObjectiveOptions.cpp +++ b/src/openrct2-ui/windows/EditorObjectiveOptions.cpp @@ -288,7 +288,6 @@ private: page = newPage; frame_no = 0; - var_492 = 0; no_list_items = 0; selected_list_item = -1; hold_down_widgets = window_editor_objective_options_page_hold_down_widgets[newPage]; diff --git a/src/openrct2-ui/windows/EditorScenarioOptions.cpp b/src/openrct2-ui/windows/EditorScenarioOptions.cpp index fce940a6a4..84cf535587 100644 --- a/src/openrct2-ui/windows/EditorScenarioOptions.cpp +++ b/src/openrct2-ui/windows/EditorScenarioOptions.cpp @@ -356,7 +356,6 @@ private: page = newPage; frame_no = 0; - var_492 = 0; hold_down_widgets = window_editor_scenario_options_page_hold_down_widgets[page]; widgets = window_editor_scenario_options_widgets[page]; Invalidate(); diff --git a/src/openrct2-ui/windows/Player.cpp b/src/openrct2-ui/windows/Player.cpp index 1910a28720..389972b3d3 100644 --- a/src/openrct2-ui/windows/Player.cpp +++ b/src/openrct2-ui/windows/Player.cpp @@ -78,6 +78,9 @@ static Widget *window_player_page_widgets[] = { class PlayerWindow final : public Window { + int16_t _previousRotation = -1; + bool _drawViewport = true; + public: void Init(const uint8_t id) { @@ -305,7 +308,7 @@ private: return; } // Don't scroll if the view was originally undefined - if (var_492 == -1) + if (!_drawViewport) { scroll = false; } @@ -322,12 +325,12 @@ private: } // Draw the viewport - var_492 = 0; + _drawViewport = true; } else { // Don't draw the viewport - var_492 = -1; + _drawViewport = false; } } } @@ -368,9 +371,9 @@ private: bool scroll = true; // Use this spare window field for rotation check - if (var_4AE != GetCurrentRotation()) + if (_previousRotation != GetCurrentRotation()) { - var_4AE = GetCurrentRotation(); + _previousRotation = GetCurrentRotation(); scroll = false; } UpdateViewport(scroll); @@ -483,7 +486,7 @@ private: } DrawTextEllipsised(dpi, screenCoords, updatedWidth, STR_LAST_ACTION_RAN, ft, { TextAlignment::CENTRE }); - if (viewport != nullptr && var_492 != -1) + if (viewport != nullptr && _drawViewport) { WindowDrawViewport(dpi, *this); } diff --git a/src/openrct2/interface/Window_internal.h b/src/openrct2/interface/Window_internal.h index 1947840acf..57b54e3cc1 100644 --- a/src/openrct2/interface/Window_internal.h +++ b/src/openrct2/interface/Window_internal.h @@ -76,18 +76,13 @@ struct WindowBase }; uint16_t frame_no{}; // updated every tic for motion in windows sprites uint16_t list_information_type{}; // 0 for none - union - { - int16_t picked_peep_frame; // Animation frame of picked peep in staff window and guest window - int16_t var_492; - }; + int16_t picked_peep_frame; // Animation frame of picked peep in staff window and guest window union { uint16_t ride_colour; const ScenarioIndexEntry* highlighted_scenario; }; int16_t selected_tab{}; - int16_t var_4AE{}; EntityId viewport_target_sprite{ EntityId::GetNull() }; ScreenCoordsXY savedViewPos{}; WindowClass classification{};