From 65fa73a4fb18595a130df7e45c93a4555f1f5361 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Thu, 8 Jun 2023 01:45:45 +0300 Subject: [PATCH] Fix peep pickup being frame rate dependent --- src/openrct2-ui/windows/Guest.cpp | 15 ++++++--------- src/openrct2-ui/windows/Staff.cpp | 8 +++++--- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index 1bf8d56dd2..79f27df4ee 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -850,10 +850,12 @@ private: void OnUpdateOverview() { - int32_t newAnimationFrame = _guestAnimationFrame; - newAnimationFrame++; - newAnimationFrame %= 24; - _guestAnimationFrame = newAnimationFrame; + _guestAnimationFrame++; + _guestAnimationFrame %= 24; + + // Update pickup animation, can only happen in this tab. + picked_peep_frame++; + picked_peep_frame %= 48; WidgetInvalidate(*this, WIDX_TAB_1); WidgetInvalidate(*this, WIDX_TAB_2); @@ -930,11 +932,6 @@ private: gPickupPeepX = screenCoords.x - 1; gPickupPeepY = screenCoords.y + 16; - picked_peep_frame++; - if (picked_peep_frame >= 48) - { - picked_peep_frame = 0; - } const auto peep = GetGuest(); if (peep == nullptr) diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index 700b5bce77..ac5219c31a 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -633,6 +633,11 @@ private: { _tabAnimationOffset++; _tabAnimationOffset %= 24; + + // Update pickup animation, can only happen in this tab. + picked_peep_frame++; + picked_peep_frame %= 48; + InvalidateWidget(WIDX_TAB_1); } @@ -664,9 +669,6 @@ private: gPickupPeepX = screenCoords.x - 1; gPickupPeepY = screenCoords.y + 16; - picked_peep_frame++; - picked_peep_frame %= 48; - auto staff = GetStaff(); if (staff == nullptr) {