mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-04-05 09:21:15 +00:00
Add functions to handle interpolation
Much less code duplication
This commit is contained in:
parent
ca8698d13e
commit
8fb939df79
2 changed files with 24 additions and 0 deletions
20
src/r_fps.c
20
src/r_fps.c
|
@ -177,6 +177,26 @@ void R_SetViewContext(enum viewcontext_e _viewcontext)
|
|||
}
|
||||
}
|
||||
|
||||
fixed_t R_InterpolateFixed(fixed_t from, fixed_t to)
|
||||
{
|
||||
if (cv_frameinterpolation.value == 0)
|
||||
{
|
||||
return to;
|
||||
}
|
||||
|
||||
return (R_LerpFixed(from, to, rendertimefrac));
|
||||
}
|
||||
|
||||
angle_t R_InterpolateAngle(angle_t from, angle_t to)
|
||||
{
|
||||
if (cv_frameinterpolation.value == 0)
|
||||
{
|
||||
return to;
|
||||
}
|
||||
|
||||
return (R_LerpAngle(from, to, rendertimefrac));
|
||||
}
|
||||
|
||||
void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
|
||||
{
|
||||
out->x = R_LerpFixed(mobj->old_x, mobj->x, frac);
|
||||
|
|
|
@ -99,6 +99,10 @@ void R_UpdateViewInterpolation(void);
|
|||
void R_ResetViewInterpolation(void);
|
||||
// Set the current view context (the viewvars pointed to by newview)
|
||||
void R_SetViewContext(enum viewcontext_e _viewcontext);
|
||||
|
||||
fixed_t R_InterpolateFixed(fixed_t from, fixed_t to);
|
||||
angle_t R_InterpolateAngle(angle_t from, angle_t to);
|
||||
|
||||
// Evaluate the interpolated mobj state for the given mobj
|
||||
void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out);
|
||||
// Evaluate the interpolated mobj state for the given precipmobj
|
||||
|
|
Loading…
Reference in a new issue