mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 10:21:57 -05:00
Guest window: make pickup animation lengths dynamic
This commit is contained in:
parent
f3a0593591
commit
3c87ae6a92
1 changed files with 19 additions and 10 deletions
|
@ -875,21 +875,30 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void OnUpdateOverview()
|
||||
{
|
||||
_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);
|
||||
|
||||
const auto peep = GetGuest();
|
||||
if (peep == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto& objManager = GetContext()->GetObjectManager();
|
||||
auto* animObj = objManager.GetLoadedObject<PeepAnimationsObject>(peep->AnimationObjectIndex);
|
||||
|
||||
// Overview tab animation offset
|
||||
_guestAnimationFrame++;
|
||||
_guestAnimationFrame %= 24;
|
||||
|
||||
// Get pickup animation length
|
||||
const auto& pickAnim = animObj->GetPeepAnimation(peep->AnimationGroup, PeepAnimationType::Hanging);
|
||||
const auto pickAnimLength = pickAnim.frame_offsets.size();
|
||||
|
||||
// Update pickup animation, can only happen in this tab.
|
||||
picked_peep_frame++;
|
||||
picked_peep_frame %= pickAnimLength * 4;
|
||||
|
||||
WidgetInvalidate(*this, WIDX_TAB_1);
|
||||
WidgetInvalidate(*this, WIDX_TAB_2);
|
||||
|
||||
if (peep->WindowInvalidateFlags & PEEP_INVALIDATE_PEEP_ACTION)
|
||||
{
|
||||
peep->WindowInvalidateFlags &= ~PEEP_INVALIDATE_PEEP_ACTION;
|
||||
|
|
Loading…
Reference in a new issue