Skip to content

Incorrect framerate calculation for animations consisting of single frame  #506

@FreeSlave

Description

@FreeSlave

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions