mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
Port step smoothing code from r1q2.
While the bugfix in a6f4a3b
made the steping prediction working for
stairs, elevators are still stuttering. r1q2s code solves this problem
and is a little bit faster. Use it instead.
This commit is contained in:
parent
f16928f2cf
commit
93e9633382
1 changed files with 4 additions and 13 deletions
|
@ -227,13 +227,10 @@ CL_PredictMovement(void)
|
||||||
{
|
{
|
||||||
int ack, current;
|
int ack, current;
|
||||||
int frame;
|
int frame;
|
||||||
int oldframe;
|
|
||||||
usercmd_t *cmd;
|
usercmd_t *cmd;
|
||||||
pmove_t pm;
|
pmove_t pm;
|
||||||
int i;
|
int i;
|
||||||
int step;
|
int step;
|
||||||
int oldz;
|
|
||||||
static int last_step_frame = 0;
|
|
||||||
|
|
||||||
if (cls.state != ca_active)
|
if (cls.state != ca_active)
|
||||||
{
|
{
|
||||||
|
@ -298,19 +295,13 @@ CL_PredictMovement(void)
|
||||||
VectorCopy(pm.s.origin, cl.predicted_origins[frame]);
|
VectorCopy(pm.s.origin, cl.predicted_origins[frame]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We need to remove the current frame. Otherwise we're
|
step = pm.s.origin[2] - (int)(cl.predicted_origin[2] * 8);
|
||||||
predicting one frame too far, leading to misses. */
|
|
||||||
--ack;
|
|
||||||
|
|
||||||
oldframe = (ack - 2) & (CMD_BACKUP - 1);
|
if (((step > 62 && step < 66) || (step > 94 && step < 98) || (step > 126 && step < 130))
|
||||||
oldz = cl.predicted_origins[oldframe][2];
|
&& !VectorCompare((float *)pm.s.velocity, vec3_origin) && (pm.s.pm_flags & PMF_ON_GROUND))
|
||||||
step = pm.s.origin[2] - oldz;
|
|
||||||
|
|
||||||
if (last_step_frame != current && step > 63 && step < 160 && (pm.s.pm_flags & PMF_ON_GROUND))
|
|
||||||
{
|
{
|
||||||
cl.predicted_step = step * 0.125f;
|
cl.predicted_step = step * 0.125f;
|
||||||
cl.predicted_step_time = cls.realtime - cls.nframetime * 500;
|
cl.predicted_step_time = cls.realtime - (int)(cls.nframetime * 500);
|
||||||
last_step_frame = current;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy results out for rendering */
|
/* copy results out for rendering */
|
||||||
|
|
Loading…
Reference in a new issue