Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix animation jumping back one frame when cross ConditionState using MAINTAIN_FRAME_ACROSS_STATES #770

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

xezon
Copy link
Contributor

@xezon xezon commented Oct 17, 2022

This is a possible fix for
TheSuperHackers/GeneralsGamePatch#1389

@xezon xezon marked this pull request as draft October 17, 2022 17:53
// Loop frame to beginning of animation if supported.
frame += 2.0f;
if (Test_Animation_Flag(m_curState->m_flags, RESTART_ANIM_WHEN_COMPLETE) && frame > frames) {
frame -= frames;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done to gracefully support edge case where it should get to begin of animation if it crossed the end of it.

@@ -1501,6 +1501,13 @@ float W3DModelDraw::Get_Current_Anim_Fraction() const
return 0.0f;
}

// #BUGFIX Fix animation jumping back one frame when crossing ConditionState using MAINTAIN_FRAME_ACROSS_STATES.
// Loop frame to beginning of animation if supported.
frame += 2.0f;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I would have expected to add just one frame to advance the animation after we copy it from the previous animation state. But adding just one will duplicate the animation frame when crossing the ConditionState. It is unclear why it goes back one frame. Could be another bug somewhere else. However, if we are unable to observe other issues, then this fix is sufficient, otherwise just add one here if we find another place to avoid the deduction. Perhaps it is supposed to work like this and +2 frames is the correct approach.

As of right now this fix works for the observed issue. It would be good to test more scenarios to gain more confidence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant