Remove player specific window vars from common

This commit is contained in:
Duncan 2023-06-22 23:44:17 +01:00 committed by GitHub
parent 42ff471617
commit a6d3dbc6d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 15 deletions

View File

@ -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();

View File

@ -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];

View File

@ -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();

View File

@ -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);
}

View File

@ -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{};