make r_fps if else hell a bit more bearable to look at
lol lmao
This commit is contained in:
1 parent
cf04e8c23c
commit
eadffb6be3
1 file changed
+22
-45
+22
-45
@@ -287,6 +287,11 @@ angle_t R_InterpolateAngle(angle_t from, angle_t to)
|
||||
return (R_LerpAngle(from, to, rendertimefrac));
|
||||
}*/
|
||||
|
||||
#define IFCHANGED(a, b)\
|
||||
if (mobj->a == mobj->b)\
|
||||
(out->a = mobj->b);\
|
||||
else
|
||||
|
||||
void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
|
||||
{
|
||||
if (frac == FRACUNIT)
|
||||
@@ -308,44 +313,28 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
|
||||
return;
|
||||
}
|
||||
|
||||
if (mobj->x == mobj->old_x)
|
||||
out->x = mobj->x;
|
||||
else
|
||||
IFCHANGED(x, old_x)
|
||||
out->x = R_LerpFixed(mobj->old_x, mobj->x, frac);
|
||||
|
||||
if (mobj->y == mobj->old_y)
|
||||
out->y = mobj->y;
|
||||
else
|
||||
IFCHANGED(y, old_y)
|
||||
out->y = R_LerpFixed(mobj->old_y, mobj->y, frac);
|
||||
|
||||
if (mobj->z == mobj->old_z)
|
||||
out->z = mobj->z;
|
||||
else
|
||||
IFCHANGED(z, old_z)
|
||||
out->z = R_LerpFixed(mobj->old_z, mobj->z, frac);
|
||||
|
||||
if (mobj->spritexscale == mobj->old_spritexscale)
|
||||
out->spritexscale = mobj->spritexscale;
|
||||
else
|
||||
IFCHANGED(spritexscale, old_spritexscale)
|
||||
out->spritexscale = mobj->resetinterp ? mobj->spritexscale : R_LerpFixed(mobj->old_spritexscale, mobj->spritexscale, frac);
|
||||
|
||||
if (mobj->spriteyscale == mobj->old_spriteyscale)
|
||||
out->spriteyscale = mobj->spriteyscale;
|
||||
else
|
||||
IFCHANGED(spriteyscale, old_spriteyscale)
|
||||
out->spriteyscale = mobj->resetinterp ? mobj->spriteyscale : R_LerpFixed(mobj->old_spriteyscale, mobj->spriteyscale, frac);
|
||||
|
||||
if (mobj->spritexoffset == mobj->old_spritexoffset)
|
||||
out->spritexoffset = mobj->spritexoffset;
|
||||
else
|
||||
IFCHANGED(spritexoffset, old_spritexoffset)
|
||||
out->spritexoffset = mobj->resetinterp ? mobj->spritexoffset : R_LerpFixed(mobj->old_spritexoffset, mobj->spritexoffset, frac);
|
||||
|
||||
if (mobj->spriteyoffset == mobj->old_spriteyoffset)
|
||||
out->spriteyoffset = mobj->spriteyoffset;
|
||||
else
|
||||
IFCHANGED(spriteyoffset, old_spriteyoffset)
|
||||
out->spriteyoffset = mobj->resetinterp ? mobj->spriteyoffset : R_LerpFixed(mobj->old_spriteyoffset, mobj->spriteyoffset, frac);
|
||||
|
||||
if (mobj->scale == mobj->old_scale) // Tiny optimisation - scale is usually unchanging, so let's skip a lerp, two FixedMuls, and two FixedDivs
|
||||
out->scale = mobj->scale;
|
||||
else
|
||||
IFCHANGED(scale, old_scale)
|
||||
out->scale = mobj->resetinterp ? mobj->scale : R_LerpFixed(mobj->old_scale, mobj->scale, frac);
|
||||
|
||||
if (cv_mobjssector.value)
|
||||
@@ -355,39 +344,27 @@ void R_InterpolateMobjState(mobj_t *mobj, fixed_t frac, interpmobjstate_t *out)
|
||||
|
||||
if (mobj->player)
|
||||
{
|
||||
if (mobj->angle == mobj->player->old_frameangle)
|
||||
out->angle = mobj->player->frameangle;
|
||||
else
|
||||
IFCHANGED(angle, player->old_frameangle)
|
||||
out->angle = mobj->resetinterp ? mobj->player->frameangle : R_LerpAngle(mobj->player->old_frameangle, mobj->player->frameangle, frac);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mobj->angle == mobj->old_angle)
|
||||
out->angle = mobj->angle;
|
||||
else
|
||||
IFCHANGED(angle, old_angle)
|
||||
out->angle = mobj->resetinterp ? mobj->angle : R_LerpAngle(mobj->old_angle, mobj->angle, frac);
|
||||
}
|
||||
|
||||
// pitch roll stuff
|
||||
if (mobj->pitch == mobj->old_pitch)
|
||||
out->pitch = mobj->pitch;
|
||||
else
|
||||
IFCHANGED(pitch, old_pitch)
|
||||
out->pitch = mobj->resetinterp ? mobj->pitch : R_LerpAngle(mobj->old_pitch, mobj->pitch, frac);
|
||||
|
||||
if (mobj->roll == mobj->old_roll)
|
||||
out->roll = mobj->roll;
|
||||
else
|
||||
IFCHANGED(roll, old_roll)
|
||||
out->roll = mobj->resetinterp ? mobj->roll : R_LerpAngle(mobj->old_roll, mobj->roll, frac);
|
||||
|
||||
// and the slope stuff
|
||||
if (mobj->slopepitch == mobj->old_slopepitch)
|
||||
out->slopepitch = mobj->slopepitch;
|
||||
else
|
||||
IFCHANGED(slopepitch, old_slopepitch)
|
||||
out->slopepitch = mobj->resetinterp ? mobj->slopepitch : R_LerpAngle(mobj->old_slopepitch, mobj->slopepitch, frac);
|
||||
|
||||
if (mobj->sloperoll == mobj->old_sloperoll)
|
||||
out->sloperoll = mobj->sloperoll;
|
||||
else
|
||||
IFCHANGED(sloperoll, old_sloperoll)
|
||||
out->sloperoll = mobj->resetinterp ? mobj->sloperoll : R_LerpAngle(mobj->old_sloperoll, mobj->sloperoll, frac);
|
||||
}
|
||||
|
||||
@@ -422,12 +399,12 @@ void R_InterpolatePrecipMobjState(precipmobj_t *mobj, fixed_t frac, interpmobjst
|
||||
else
|
||||
out->subsector = mobj->subsector;
|
||||
|
||||
if (mobj->angle == mobj->old_angle)
|
||||
out->angle = mobj->angle;
|
||||
else
|
||||
IFCHANGED(angle, old_angle)
|
||||
out->angle = R_LerpAngle(mobj->old_angle, mobj->angle, frac);
|
||||
}
|
||||
|
||||
#undef IFCHANGED
|
||||
|
||||
static void AddInterpolator(levelinterpolator_t* interpolator)
|
||||
{
|
||||
if (levelinterpolators_len >= levelinterpolators_size)
|
||||
|
||||
Reference in new issue
Block a user