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

Incorrect framerate calculation for animations consisting of single frame #506

Open
FreeSlave opened this issue Jan 3, 2025 · 0 comments

Comments

@FreeSlave
Copy link
Member

FreeSlave commented Jan 3, 2025

The following code completely ignores the fps of the model sequence if the number of frames is 1, effectively treating the sequence like if it had fps = 1.

if( pseqdesc->numframes > 1 )
{
*pflFrameRate = 256.0f * pseqdesc->fps / ( pseqdesc->numframes - 1 );
*pflGroundSpeed = sqrt( pseqdesc->linearmovement[0] * pseqdesc->linearmovement[0] + pseqdesc->linearmovement[1] * pseqdesc->linearmovement[1] + pseqdesc->linearmovement[2] * pseqdesc->linearmovement[2] );
*pflGroundSpeed = *pflGroundSpeed * pseqdesc->fps / ( pseqdesc->numframes - 1 );
}
else
{
*pflFrameRate = 256.0f;
*pflGroundSpeed = 0.0f;
}

It means, for example, playing the animation of 1 frame and 30 fps is slower than playing animation of 2 frames and 2 fps.

Known affected entities: voltigore in Opposing Force appears to be "stuck" in flinch animation for the full second despite it having only 1 frame and 30 fps. Basically the sequence is intended to play the pain sound via animation event, but not "freezing" the voltigore.

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

No branches or pull requests

1 participant