Fix animation jumping back one frame when cross ConditionState using MAINTAIN_FRAME_ACROSS_STATES#770
Conversation
…MAINTAIN_FRAME_ACROSS_STATES
| // 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; |
There was a problem hiding this comment.
This is done to gracefully support edge case where it should get to begin of animation if it crossed the end of it.
|
|
||
| // #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; |
There was a problem hiding this comment.
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.
This is a possible fix for
TheSuperHackers/GeneralsGameCode#157