2004-08-23 00:15:46 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2005-11-26 03:02:55 +00:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
#include "quakedef.h"
|
|
|
|
#include "winquake.h"
|
|
|
|
|
2006-02-11 02:09:43 +00:00
|
|
|
cvar_t cl_nopred = SCVAR("cl_nopred","0");
|
|
|
|
cvar_t cl_pushlatency = SCVAR("pushlatency","-999");
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
extern frame_t *view_frame;
|
|
|
|
|
|
|
|
#define MAX_PARSE_ENTITIES 1024
|
|
|
|
extern entity_state_t cl_parse_entities[MAX_PARSE_ENTITIES];
|
|
|
|
|
|
|
|
extern float pm_airaccelerate;
|
|
|
|
|
|
|
|
extern usercmd_t independantphysics[MAX_SPLITS];
|
|
|
|
|
|
|
|
#ifdef Q2CLIENT
|
|
|
|
char *Get_Q2ConfigString(int i);
|
|
|
|
|
|
|
|
#ifdef Q2BSPS
|
2005-03-18 06:14:07 +00:00
|
|
|
void VARGS Q2_Pmove (q2pmove_t *pmove);
|
2004-08-23 00:15:46 +00:00
|
|
|
#define Q2PMF_DUCKED 1
|
|
|
|
#define Q2PMF_JUMP_HELD 2
|
|
|
|
#define Q2PMF_ON_GROUND 4
|
|
|
|
#define Q2PMF_TIME_WATERJUMP 8 // pm_time is waterjump
|
|
|
|
#define Q2PMF_TIME_LAND 16 // pm_time is time before rejump
|
|
|
|
#define Q2PMF_TIME_TELEPORT 32 // pm_time is non-moving time
|
|
|
|
#define Q2PMF_NO_PREDICTION 64 // temporarily disables prediction (used for grappling hook)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
vec3_t cl_predicted_origins[UPDATE_BACKUP];
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
===================
|
|
|
|
CL_CheckPredictionError
|
|
|
|
===================
|
|
|
|
*/
|
|
|
|
#ifdef Q2BSPS
|
|
|
|
void CLQ2_CheckPredictionError (void)
|
|
|
|
{
|
|
|
|
int frame;
|
|
|
|
int delta[3];
|
|
|
|
int i;
|
|
|
|
int len;
|
|
|
|
|
|
|
|
if (cl_nopred.value || (cl.q2frame.playerstate.pmove.pm_flags & Q2PMF_NO_PREDICTION))
|
|
|
|
return;
|
|
|
|
|
|
|
|
// calculate the last usercmd_t we sent that the server has processed
|
|
|
|
frame = cls.netchan.incoming_acknowledged;
|
|
|
|
frame &= (UPDATE_MASK);
|
|
|
|
|
|
|
|
// compare what the server returned with what we had predicted it to be
|
|
|
|
VectorSubtract (cl.q2frame.playerstate.pmove.origin, cl_predicted_origins[frame], delta);
|
|
|
|
|
|
|
|
// save the prediction error for interpolation
|
|
|
|
len = abs(delta[0]) + abs(delta[1]) + abs(delta[2]);
|
|
|
|
if (len > 640) // 80 world units
|
|
|
|
{ // a teleport or something
|
|
|
|
VectorClear (cl.prediction_error);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-03-28 00:11:59 +00:00
|
|
|
// if (/*cl_showmiss->value && */(delta[0] || delta[1] || delta[2]) )
|
2005-11-26 03:02:55 +00:00
|
|
|
// Con_Printf ("prediction miss on %i: %i\n", cl.q2frame.serverframe,
|
2005-03-28 00:11:59 +00:00
|
|
|
// delta[0] + delta[1] + delta[2]);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
VectorCopy (cl.q2frame.playerstate.pmove.origin, cl_predicted_origins[frame]);
|
|
|
|
|
|
|
|
// save for error itnerpolation
|
|
|
|
for (i=0 ; i<3 ; i++)
|
|
|
|
cl.prediction_error[i] = delta[i]*0.125;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
====================
|
|
|
|
CL_ClipMoveToEntities
|
|
|
|
|
|
|
|
====================
|
|
|
|
*/
|
|
|
|
void CLQ2_ClipMoveToEntities ( vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, trace_t *tr )
|
|
|
|
{
|
|
|
|
int i, x, zd, zu;
|
|
|
|
trace_t trace;
|
|
|
|
float *angles;
|
|
|
|
entity_state_t *ent;
|
|
|
|
int num;
|
|
|
|
model_t *cmodel;
|
|
|
|
vec3_t bmins, bmaxs;
|
|
|
|
|
|
|
|
for (i=0 ; i<cl.q2frame.num_entities ; i++)
|
|
|
|
{
|
|
|
|
num = (cl.q2frame.parse_entities + i)&(MAX_PARSE_ENTITIES-1);
|
|
|
|
ent = &cl_parse_entities[num];
|
|
|
|
|
|
|
|
if (!ent->solid)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (ent->number == cl.playernum[0]+1)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (ent->solid == 31)
|
|
|
|
{ // special value for bmodel
|
|
|
|
cmodel = cl.model_precache[ent->modelindex];
|
|
|
|
if (!cmodel)
|
|
|
|
continue;
|
|
|
|
angles = ent->angles;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // encoded bbox
|
|
|
|
x = 8*(ent->solid & 31);
|
|
|
|
zd = 8*((ent->solid>>5) & 31);
|
|
|
|
zu = 8*((ent->solid>>10) & 63) - 32;
|
|
|
|
|
|
|
|
bmins[0] = bmins[1] = -x;
|
|
|
|
bmaxs[0] = bmaxs[1] = x;
|
|
|
|
bmins[2] = -zd;
|
|
|
|
bmaxs[2] = zu;
|
|
|
|
|
2005-08-26 22:56:51 +00:00
|
|
|
cmodel = CM_TempBoxModel (bmins, bmaxs);
|
2004-08-23 00:15:46 +00:00
|
|
|
angles = vec3_origin; // boxes don't rotate
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tr->allsolid)
|
|
|
|
return;
|
|
|
|
|
2005-08-26 22:56:51 +00:00
|
|
|
trace = CM_TransformedBoxTrace (cmodel, start, end,
|
|
|
|
mins, maxs, MASK_PLAYERSOLID,
|
2004-08-23 00:15:46 +00:00
|
|
|
ent->origin, angles);
|
|
|
|
|
2006-02-11 18:06:18 +00:00
|
|
|
if (trace.allsolid || trace.startsolid || trace.fraction < tr->fraction)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
trace.ent = (struct edict_s *)ent;
|
2006-02-11 18:06:18 +00:00
|
|
|
*tr = trace;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
CL_PMTrace
|
|
|
|
================
|
|
|
|
*/
|
2005-03-18 06:14:07 +00:00
|
|
|
q2trace_t VARGS CLQ2_PMTrace (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
q2trace_t q2t;
|
|
|
|
trace_t t;
|
|
|
|
|
|
|
|
// check against world
|
2005-08-26 22:56:51 +00:00
|
|
|
t = CM_BoxTrace (cl.worldmodel, start, end, mins, maxs, MASK_PLAYERSOLID);
|
2004-08-23 00:15:46 +00:00
|
|
|
if (t.fraction < 1.0)
|
|
|
|
t.ent = (struct edict_s *)1;
|
|
|
|
|
|
|
|
// check all other solid models
|
|
|
|
CLQ2_ClipMoveToEntities (start, mins, maxs, end, &t);
|
|
|
|
|
|
|
|
q2t.allsolid = t.allsolid;
|
|
|
|
q2t.contents = t.contents;
|
|
|
|
VectorCopy(t.endpos, q2t.endpos);
|
|
|
|
q2t.ent = t.ent;
|
|
|
|
q2t.fraction = t.fraction;
|
|
|
|
q2t.plane = t.plane;
|
|
|
|
q2t.startsolid = t.startsolid;
|
|
|
|
q2t.surface = t.surface;
|
|
|
|
|
|
|
|
return q2t;
|
|
|
|
}
|
|
|
|
|
2005-03-18 06:14:07 +00:00
|
|
|
int VARGS CLQ2_PMpointcontents (vec3_t point)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
entity_state_t *ent;
|
|
|
|
int num;
|
|
|
|
model_t *cmodel;
|
|
|
|
int contents;
|
|
|
|
|
2005-08-26 22:56:51 +00:00
|
|
|
contents = CM_PointContents (cl.worldmodel, point);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
for (i=0 ; i<cl.q2frame.num_entities ; i++)
|
|
|
|
{
|
|
|
|
num = (cl.q2frame.parse_entities + i)&(MAX_PARSE_ENTITIES-1);
|
|
|
|
ent = &cl_parse_entities[num];
|
|
|
|
|
|
|
|
if (ent->solid != 31) // special value for bmodel
|
|
|
|
continue;
|
|
|
|
|
|
|
|
cmodel = cl.model_precache[ent->modelindex];
|
|
|
|
if (!cmodel)
|
|
|
|
continue;
|
|
|
|
|
2005-08-26 22:56:51 +00:00
|
|
|
contents |= CM_TransformedPointContents (cl.worldmodel, point, cmodel->hulls[0].firstclipnode, ent->origin, ent->angles);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return contents;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
CL_PredictMovement
|
|
|
|
|
|
|
|
Sets cl.predicted_origin and cl.predicted_angles
|
|
|
|
=================
|
|
|
|
*/
|
|
|
|
void CLQ2_PredictMovement (void) //q2 doesn't support split clients.
|
|
|
|
{
|
|
|
|
#ifdef Q2BSPS
|
|
|
|
int ack, current;
|
|
|
|
int frame;
|
|
|
|
int oldframe;
|
2005-01-07 02:38:41 +00:00
|
|
|
q2usercmd_t *cmd;
|
2004-08-23 00:15:46 +00:00
|
|
|
q2pmove_t pm;
|
|
|
|
int step;
|
|
|
|
int oldz;
|
|
|
|
#endif
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (cls.state != ca_active)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// if (cl_paused->value)
|
|
|
|
// return;
|
|
|
|
|
|
|
|
#ifdef Q2BSPS
|
|
|
|
if (cl_nopred.value || (cl.q2frame.playerstate.pmove.pm_flags & Q2PMF_NO_PREDICTION))
|
|
|
|
#endif
|
|
|
|
{ // just set angles
|
|
|
|
for (i=0 ; i<3 ; i++)
|
|
|
|
{
|
|
|
|
cl.predicted_angles[i] = cl.viewangles[0][i] + SHORT2ANGLE(cl.q2frame.playerstate.pmove.delta_angles[i]);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#ifdef Q2BSPS
|
|
|
|
ack = cls.netchan.incoming_acknowledged;
|
|
|
|
current = cls.netchan.outgoing_sequence;
|
|
|
|
|
|
|
|
// if we are too far out of date, just freeze
|
|
|
|
if (current - ack >= UPDATE_MASK)
|
|
|
|
{
|
|
|
|
// if (cl_showmiss->value)
|
2005-03-28 00:11:59 +00:00
|
|
|
// Con_Printf ("exceeded CMD_BACKUP\n");
|
2005-11-26 03:02:55 +00:00
|
|
|
return;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// copy current state to pmove
|
|
|
|
memset (&pm, 0, sizeof(pm));
|
|
|
|
pm.trace = CLQ2_PMTrace;
|
|
|
|
pm.pointcontents = CLQ2_PMpointcontents;
|
|
|
|
|
|
|
|
pm_airaccelerate = atof(Get_Q2ConfigString(Q2CS_AIRACCEL));
|
|
|
|
|
|
|
|
pm.s = cl.q2frame.playerstate.pmove;
|
|
|
|
|
|
|
|
// SCR_DebugGraph (current - ack - 1, 0);
|
|
|
|
|
|
|
|
frame = 0;
|
|
|
|
|
|
|
|
// run frames
|
|
|
|
while (++ack < current)
|
|
|
|
{
|
|
|
|
frame = ack & (UPDATE_MASK);
|
2005-01-07 02:38:41 +00:00
|
|
|
cmd = (q2usercmd_t*)&cl.frames[frame].cmd[0];
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
pm.cmd = *cmd;
|
|
|
|
Q2_Pmove (&pm);
|
|
|
|
|
|
|
|
// save for debug checking
|
|
|
|
VectorCopy (pm.s.origin, cl_predicted_origins[frame]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (independantphysics[0].msec)
|
|
|
|
{
|
2005-01-07 02:38:41 +00:00
|
|
|
cmd = (q2usercmd_t*)&independantphysics[0];
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
pm.cmd = *cmd;
|
|
|
|
Q2_Pmove (&pm);
|
|
|
|
}
|
|
|
|
|
|
|
|
oldframe = (ack-2) & (UPDATE_MASK);
|
|
|
|
oldz = cl_predicted_origins[oldframe][2];
|
|
|
|
step = pm.s.origin[2] - oldz;
|
|
|
|
if (step > 63 && step < 160 && (pm.s.pm_flags & Q2PMF_ON_GROUND) )
|
|
|
|
{
|
|
|
|
cl.predicted_step = step * 0.125;
|
2005-03-18 06:14:07 +00:00
|
|
|
cl.predicted_step_time = realtime - host_frametime * 0.5;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cl.onground[0] = !!(pm.s.pm_flags & Q2PMF_ON_GROUND);
|
|
|
|
|
|
|
|
|
|
|
|
// copy results out for rendering
|
|
|
|
cl.predicted_origin[0] = pm.s.origin[0]*0.125;
|
|
|
|
cl.predicted_origin[1] = pm.s.origin[1]*0.125;
|
|
|
|
cl.predicted_origin[2] = pm.s.origin[2]*0.125;
|
|
|
|
|
|
|
|
VectorCopy (pm.viewangles, cl.predicted_angles);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
CL_NudgePosition
|
|
|
|
|
|
|
|
If pmove.origin is in a solid position,
|
|
|
|
try nudging slightly on all axis to
|
|
|
|
allow for the cut precision of the net coordinates
|
|
|
|
=================
|
|
|
|
*/
|
|
|
|
void CL_NudgePosition (void)
|
|
|
|
{
|
|
|
|
vec3_t base;
|
|
|
|
int x, y;
|
|
|
|
|
2005-08-26 22:56:51 +00:00
|
|
|
if (cl.worldmodel->funcs.PointContents (cl.worldmodel, pmove.origin) == FTECONTENTS_EMPTY)
|
2004-08-23 00:15:46 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
VectorCopy (pmove.origin, base);
|
|
|
|
for (x=-1 ; x<=1 ; x++)
|
|
|
|
{
|
|
|
|
for (y=-1 ; y<=1 ; y++)
|
|
|
|
{
|
|
|
|
pmove.origin[0] = base[0] + x * 1.0/8;
|
|
|
|
pmove.origin[1] = base[1] + y * 1.0/8;
|
2005-08-26 22:56:51 +00:00
|
|
|
if (cl.worldmodel->funcs.PointContents (cl.worldmodel, pmove.origin) == FTECONTENTS_EMPTY)
|
2004-08-23 00:15:46 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Con_DPrintf ("CL_NudgePosition: stuck\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
==============
|
|
|
|
CL_PredictUsercmd
|
|
|
|
==============
|
|
|
|
*/
|
|
|
|
void CL_PredictUsercmd (int pnum, player_state_t *from, player_state_t *to, usercmd_t *u)
|
|
|
|
{
|
|
|
|
extern vec3_t player_mins;
|
|
|
|
extern vec3_t player_maxs;
|
|
|
|
// split up very long moves
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
if (u->msec > 50)
|
|
|
|
{
|
2004-08-23 00:15:46 +00:00
|
|
|
player_state_t temp;
|
|
|
|
usercmd_t split;
|
|
|
|
|
|
|
|
split = *u;
|
|
|
|
split.msec /= 2;
|
|
|
|
|
|
|
|
CL_PredictUsercmd (pnum, from, &temp, &split);
|
|
|
|
CL_PredictUsercmd (pnum, &temp, to, &split);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
VectorCopy (from->origin, pmove.origin);
|
|
|
|
VectorCopy (u->angles, pmove.angles);
|
|
|
|
VectorCopy (from->velocity, pmove.velocity);
|
|
|
|
|
2008-01-09 00:52:31 +00:00
|
|
|
if (!(pmove.velocity[0] == 0) && !(pmove.velocity[0] != 0))
|
|
|
|
{
|
|
|
|
Con_Printf("nan velocity!\n");
|
|
|
|
pmove.velocity[0] = 0;
|
|
|
|
pmove.velocity[1] = 0;
|
|
|
|
pmove.velocity[2] = 0;
|
|
|
|
}
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
pmove.jump_msec = (cls.z_ext & Z_EXT_PM_TYPE) ? 0 : from->jump_msec;
|
|
|
|
pmove.jump_held = from->jump_held;
|
|
|
|
pmove.waterjumptime = from->waterjumptime;
|
|
|
|
pmove.pm_type = from->pm_type;
|
|
|
|
|
|
|
|
pmove.cmd = *u;
|
|
|
|
|
|
|
|
movevars.entgravity = cl.entgravity[pnum];
|
|
|
|
movevars.maxspeed = cl.maxspeed[pnum];
|
|
|
|
movevars.bunnyspeedcap = cl.bunnyspeedcap;
|
|
|
|
pmove.onladder = false;
|
|
|
|
pmove.hullnum = from->hullnum;
|
|
|
|
|
2008-11-09 22:29:28 +00:00
|
|
|
if (cl.worldmodel->fromgame != fg_quake)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
player_mins[0] = -16;
|
|
|
|
player_mins[1] = -16;
|
|
|
|
player_mins[2] = -24;
|
|
|
|
player_maxs[0] = 16;
|
|
|
|
player_maxs[1] = 16;
|
|
|
|
player_maxs[2] = 32;
|
|
|
|
|
|
|
|
VectorScale(player_mins, pmove.hullnum/56.0f, player_mins);
|
|
|
|
VectorScale(player_maxs, pmove.hullnum/56.0f, player_maxs);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
VectorCopy(cl.worldmodel->hulls[pmove.hullnum&(MAX_MAP_HULLSM-1)].clip_mins, player_mins);
|
|
|
|
VectorCopy(cl.worldmodel->hulls[pmove.hullnum&(MAX_MAP_HULLSM-1)].clip_maxs, player_maxs);
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
if (pmove.hullnum & 128)
|
2008-11-09 22:29:28 +00:00
|
|
|
{ //this hack is for hexen2.
|
2004-08-23 00:15:46 +00:00
|
|
|
player_maxs[2] -= player_mins[2];
|
|
|
|
player_mins[2] = 0;
|
|
|
|
}
|
|
|
|
|
2005-03-20 02:57:11 +00:00
|
|
|
PM_PlayerMove (cl.gamespeed);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
to->waterjumptime = pmove.waterjumptime;
|
|
|
|
to->jump_held = pmove.jump_held;
|
|
|
|
to->jump_msec = pmove.jump_msec;
|
|
|
|
pmove.jump_msec = 0;
|
|
|
|
|
|
|
|
VectorCopy (pmove.origin, to->origin);
|
|
|
|
VectorCopy (pmove.angles, to->viewangles);
|
|
|
|
VectorCopy (pmove.velocity, to->velocity);
|
|
|
|
to->onground = pmove.onground;
|
|
|
|
|
|
|
|
to->weaponframe = from->weaponframe;
|
|
|
|
to->pm_type = from->pm_type;
|
|
|
|
to->hullnum = from->hullnum;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Used when cl_nopred is 1 to determine whether we are on ground, otherwise stepup smoothing code produces ugly jump physics
|
|
|
|
void CL_CatagorizePosition (int pnum)
|
|
|
|
{
|
|
|
|
if (cl.spectator)
|
|
|
|
{
|
|
|
|
cl.onground[pnum] = false; // in air
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
VectorClear (pmove.velocity);
|
|
|
|
VectorCopy (cl.simorg[pnum], pmove.origin);
|
|
|
|
pmove.numtouch = 0;
|
|
|
|
PM_CategorizePosition ();
|
|
|
|
cl.onground[pnum] = pmove.onground;
|
|
|
|
}
|
|
|
|
//Smooth out stair step ups.
|
|
|
|
//Called before CL_EmitEntities so that the player's lightning model origin is updated properly
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
void CL_CalcCrouch (int pnum, float stepchange)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
qboolean teleported;
|
|
|
|
static vec3_t oldorigin[MAX_SPLITS];
|
|
|
|
static float oldz[MAX_SPLITS] = {0}, extracrouch[MAX_SPLITS] = {0}, crouchspeed[MAX_SPLITS] = {100,100};
|
|
|
|
vec3_t delta;
|
|
|
|
|
|
|
|
VectorSubtract(cl.simorg[pnum], oldorigin[pnum], delta);
|
|
|
|
|
|
|
|
teleported = Length(delta)>48;
|
|
|
|
VectorCopy (cl.simorg[pnum], oldorigin[pnum]);
|
|
|
|
|
|
|
|
if (teleported)
|
|
|
|
{
|
|
|
|
// possibly teleported or respawned
|
|
|
|
oldz[pnum] = cl.simorg[pnum][2];
|
|
|
|
extracrouch[pnum] = 0;
|
|
|
|
crouchspeed[pnum] = 100;
|
|
|
|
cl.crouch[pnum] = 0;
|
|
|
|
VectorCopy (cl.simorg[pnum], oldorigin[pnum]);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cl.onground[pnum] && cl.simorg[pnum][2] - oldz[pnum] > 0)
|
|
|
|
{
|
2007-06-20 00:02:54 +00:00
|
|
|
if (cl.simorg[pnum][2] - oldz[pnum] > movevars.stepheight+2)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
// if on steep stairs, increase speed
|
|
|
|
if (crouchspeed[pnum] < 160)
|
|
|
|
{
|
|
|
|
extracrouch[pnum] = cl.simorg[pnum][2] - oldz[pnum] - host_frametime * 200 - 15;
|
|
|
|
extracrouch[pnum] = min(extracrouch[pnum], 5);
|
|
|
|
}
|
|
|
|
crouchspeed[pnum] = 160;
|
|
|
|
}
|
|
|
|
|
|
|
|
oldz[pnum] += host_frametime * crouchspeed[pnum];
|
|
|
|
if (oldz[pnum] > cl.simorg[pnum][2])
|
|
|
|
oldz[pnum] = cl.simorg[pnum][2];
|
|
|
|
|
|
|
|
if (cl.simorg[pnum][2] - oldz[pnum] > 15 + extracrouch[pnum])
|
|
|
|
oldz[pnum] = cl.simorg[pnum][2] - 15 - extracrouch[pnum];
|
|
|
|
extracrouch[pnum] -= host_frametime * 200;
|
|
|
|
extracrouch[pnum] = max(extracrouch[pnum], 0);
|
|
|
|
|
|
|
|
cl.crouch[pnum] = oldz[pnum] - cl.simorg[pnum][2];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// in air or moving down
|
|
|
|
oldz[pnum] = cl.simorg[pnum][2];
|
|
|
|
cl.crouch[pnum] += host_frametime * 150;
|
|
|
|
if (cl.crouch[pnum] > 0)
|
|
|
|
cl.crouch[pnum] = 0;
|
|
|
|
crouchspeed[pnum] = 100;
|
|
|
|
extracrouch[pnum] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-10-01 03:09:17 +00:00
|
|
|
float LerpAngles360(float to, float from, float frac)
|
|
|
|
{
|
|
|
|
int delta;
|
|
|
|
delta = (from-to);
|
|
|
|
|
|
|
|
if (delta > 180)
|
|
|
|
delta -= 360;
|
|
|
|
if (delta < -180)
|
|
|
|
delta += 360;
|
|
|
|
|
|
|
|
return to + frac*delta;
|
|
|
|
}
|
|
|
|
|
|
|
|
//shamelessly ripped from zquake
|
|
|
|
extern cvar_t cl_nolerp;
|
|
|
|
static void CL_LerpMove (int pnum, float msgtime)
|
|
|
|
{
|
|
|
|
static int lastsequence = 0;
|
|
|
|
static vec3_t lerp_angles[3];
|
|
|
|
static vec3_t lerp_origin[3];
|
|
|
|
static float lerp_times[3];
|
|
|
|
static qboolean nolerp[2];
|
|
|
|
static float demo_latency = 0.01;
|
|
|
|
float frac;
|
|
|
|
float simtime;
|
|
|
|
int i;
|
|
|
|
int from, to;
|
|
|
|
|
2008-12-03 02:42:05 +00:00
|
|
|
if (!CL_MayLerp() || cls.demoplayback == DPB_MVD || cls.demoplayback == DPB_EZTV)
|
2005-10-01 03:09:17 +00:00
|
|
|
return;
|
|
|
|
|
2008-01-16 06:36:24 +00:00
|
|
|
#ifdef NQPROT
|
|
|
|
if (cls.demoplayback == DPB_NETQUAKE)
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
if (cls.netchan.outgoing_sequence < lastsequence)
|
|
|
|
{
|
2005-10-01 03:09:17 +00:00
|
|
|
// reset
|
|
|
|
lastsequence = -1;
|
|
|
|
lerp_times[0] = -1;
|
|
|
|
demo_latency = 0.01;
|
|
|
|
}
|
|
|
|
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
if (cls.netchan.outgoing_sequence > lastsequence)
|
|
|
|
{
|
2005-10-01 03:09:17 +00:00
|
|
|
lastsequence = cls.netchan.outgoing_sequence;
|
|
|
|
// move along
|
|
|
|
lerp_times[2] = lerp_times[1];
|
|
|
|
lerp_times[1] = lerp_times[0];
|
|
|
|
lerp_times[0] = msgtime;
|
|
|
|
|
|
|
|
VectorCopy (lerp_origin[1], lerp_origin[2]);
|
|
|
|
VectorCopy (lerp_origin[0], lerp_origin[1]);
|
|
|
|
VectorCopy (cl.simorg[pnum], lerp_origin[0]);
|
|
|
|
|
|
|
|
VectorCopy (lerp_angles[1], lerp_angles[2]);
|
|
|
|
VectorCopy (lerp_angles[0], lerp_angles[1]);
|
|
|
|
VectorCopy (cl.simangles[pnum], lerp_angles[0]);
|
|
|
|
|
|
|
|
nolerp[1] = nolerp[0];
|
|
|
|
nolerp[0] = false;
|
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
if (fabs(lerp_origin[0][i] - lerp_origin[1][i]) > 40)
|
|
|
|
break;
|
|
|
|
if (i < 3)
|
|
|
|
nolerp[0] = true; // a teleport or something
|
|
|
|
}
|
|
|
|
|
|
|
|
simtime = realtime - demo_latency;
|
|
|
|
|
|
|
|
// adjust latency
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
if (simtime > lerp_times[0])
|
|
|
|
{
|
2005-10-01 03:09:17 +00:00
|
|
|
// Com_DPrintf ("HIGH clamp\n");
|
|
|
|
demo_latency = realtime - lerp_times[0];
|
|
|
|
}
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
else if (simtime < lerp_times[2])
|
|
|
|
{
|
2005-10-01 03:09:17 +00:00
|
|
|
// Com_DPrintf (" low clamp\n");
|
|
|
|
demo_latency = realtime - lerp_times[2];
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-10-01 03:09:17 +00:00
|
|
|
// drift towards ideal latency
|
|
|
|
float ideal_latency = (lerp_times[0] - lerp_times[2]) * 0.6;
|
|
|
|
if (demo_latency > ideal_latency)
|
|
|
|
demo_latency = max(demo_latency - host_frametime * 0.1, ideal_latency);
|
|
|
|
}
|
|
|
|
|
|
|
|
// decide where to lerp from
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
if (simtime > lerp_times[1])
|
|
|
|
{
|
2005-10-01 03:09:17 +00:00
|
|
|
from = 1;
|
|
|
|
to = 0;
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-10-01 03:09:17 +00:00
|
|
|
from = 2;
|
|
|
|
to = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nolerp[to])
|
|
|
|
return;
|
|
|
|
|
|
|
|
frac = (simtime - lerp_times[from]) / (lerp_times[to] - lerp_times[from]);
|
|
|
|
frac = bound (0, frac, 1);
|
|
|
|
|
|
|
|
for (i=0 ; i<3 ; i++)
|
|
|
|
{
|
|
|
|
cl.simorg[pnum][i] = lerp_origin[from][i] +
|
|
|
|
frac * (lerp_origin[to][i] - lerp_origin[from][i]);
|
|
|
|
cl.simangles[pnum][i] = LerpAngles360(lerp_angles[from][i], lerp_angles[to][i], frac);
|
|
|
|
}
|
|
|
|
|
|
|
|
// LerpVector (lerp_origin[from], lerp_origin[to], frac, cl.simorg);
|
|
|
|
// LerpAngles (lerp_angles[from], lerp_angles[to], frac, cl.simangles);
|
|
|
|
}
|
|
|
|
|
|
|
|
short LerpAngles16(short to, short from, float frac)
|
|
|
|
{
|
|
|
|
int delta;
|
|
|
|
delta = (from-to);
|
|
|
|
|
|
|
|
if (delta > 32767)
|
|
|
|
delta -= 65535;
|
|
|
|
if (delta < -32767)
|
|
|
|
delta += 65535;
|
|
|
|
|
|
|
|
return to + frac*delta;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CL_CalcClientTime(void)
|
|
|
|
{
|
2005-11-26 03:02:55 +00:00
|
|
|
|
2005-10-01 03:09:17 +00:00
|
|
|
{
|
|
|
|
float want;
|
2009-11-04 21:16:50 +00:00
|
|
|
float oldst = realtime;
|
2008-05-31 10:31:47 +00:00
|
|
|
|
2010-03-14 14:35:56 +00:00
|
|
|
if (cls.protocol == CP_QUAKEWORLD && cls.demoplayback == DPB_MVD)
|
|
|
|
{
|
|
|
|
extern float nextdemotime, olddemotime, demtime;
|
|
|
|
float f;
|
|
|
|
f = (demtime - olddemotime) / (nextdemotime - olddemotime);
|
|
|
|
f = bound(0, f, 1);
|
|
|
|
cl.time = cl.servertime = cl.gametime*f + cl.oldgametime*(1-f);
|
|
|
|
}
|
|
|
|
else if (!(cls.fteprotocolextensions & PEXT_ACCURATETIMINGS) && cls.protocol == CP_QUAKEWORLD)
|
2009-11-04 21:16:50 +00:00
|
|
|
cl.servertime = cl.time;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
want = cl.oldgametime + (realtime - cl.gametimemark);
|
|
|
|
if (want>cl.servertime)
|
|
|
|
cl.servertime = want;
|
|
|
|
|
|
|
|
if (cl.servertime > cl.gametime)
|
|
|
|
cl.servertime = cl.gametime;
|
|
|
|
if (cl.servertime < cl.oldgametime)
|
|
|
|
cl.servertime = cl.oldgametime;
|
|
|
|
}
|
2008-05-31 10:31:47 +00:00
|
|
|
if (oldst == 0)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < MAX_CLIENTS; i++)
|
|
|
|
{
|
|
|
|
cl.players[i].entertime += cl.servertime;
|
|
|
|
}
|
|
|
|
}
|
2005-10-01 03:09:17 +00:00
|
|
|
}
|
|
|
|
|
2008-01-09 00:52:31 +00:00
|
|
|
if (cls.protocol == CP_NETQUAKE || (cls.demoplayback && cls.demoplayback != DPB_MVD && cls.demoplayback != DPB_EZTV))
|
2005-10-01 03:09:17 +00:00
|
|
|
{
|
|
|
|
float want;
|
|
|
|
// float off;
|
|
|
|
|
|
|
|
want = cl.oldgametime + realtime - cl.gametimemark;
|
|
|
|
// off = (want - cl.time);
|
|
|
|
if (want>cl.time) //don't decrease
|
|
|
|
cl.time = want;
|
|
|
|
|
|
|
|
// Con_Printf("Drifted to %f off by %f\n", cl.time, off);
|
2005-11-26 03:02:55 +00:00
|
|
|
|
2005-10-01 03:09:17 +00:00
|
|
|
// Con_Printf("\n");
|
|
|
|
if (cl.time > cl.gametime)
|
|
|
|
{
|
|
|
|
cl.time = cl.gametime;
|
|
|
|
// Con_Printf("max TimeClamp\n");
|
|
|
|
}
|
|
|
|
if (cl.time < cl.oldgametime)
|
|
|
|
{
|
|
|
|
cl.time = cl.oldgametime;
|
|
|
|
// Con_Printf("old TimeClamp\n");
|
|
|
|
}
|
2005-11-26 03:02:55 +00:00
|
|
|
|
2005-10-01 03:09:17 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cl.time = realtime - cls.latency - cl_pushlatency.value*0.001;
|
|
|
|
if (cl.time > realtime)
|
|
|
|
cl.time = realtime;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
/*
|
|
|
|
==============
|
|
|
|
CL_PredictMove
|
|
|
|
==============
|
|
|
|
*/
|
|
|
|
void CL_PredictMovePNum (int pnum)
|
|
|
|
{
|
|
|
|
frame_t ind;
|
|
|
|
int i;
|
|
|
|
float f;
|
|
|
|
frame_t *from, *to = NULL;
|
|
|
|
int oldphysent;
|
2004-11-27 08:16:25 +00:00
|
|
|
vec3_t lrp;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
//these are to make svc_viewentity work better
|
|
|
|
float *vel;
|
|
|
|
float *org;
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
float stepheight = 0;
|
2009-04-01 22:03:56 +00:00
|
|
|
|
|
|
|
cl.nolocalplayer[pnum] = false;
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
#ifdef Q2CLIENT
|
2005-05-26 12:55:34 +00:00
|
|
|
if (cls.protocol == CP_QUAKE2)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2006-09-17 00:59:22 +00:00
|
|
|
if (!cl.worldmodel || cl.worldmodel->needload)
|
|
|
|
return;
|
2004-08-23 00:15:46 +00:00
|
|
|
cl.crouch[pnum] = 0;
|
|
|
|
CLQ2_PredictMovement();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (cl_pushlatency.value > 0)
|
|
|
|
Cvar_Set (&cl_pushlatency, "0");
|
|
|
|
|
2008-01-09 00:52:31 +00:00
|
|
|
if (cl.paused && !(cls.demoplayback!=DPB_MVD && cls.demoplayback!=DPB_EZTV) && (!cl.spectator || !autocam[pnum]))
|
2004-08-23 00:15:46 +00:00
|
|
|
return;
|
2005-05-26 12:55:34 +00:00
|
|
|
|
2005-10-01 03:09:17 +00:00
|
|
|
CL_CalcClientTime();
|
2005-06-04 04:20:20 +00:00
|
|
|
|
2004-10-19 16:10:14 +00:00
|
|
|
if (cl.intermission && cl.intermission != 3)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
cl.crouch[pnum] = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-01-16 06:36:24 +00:00
|
|
|
#ifdef NQPROT
|
2008-01-30 22:04:38 +00:00
|
|
|
if (cls.protocol == CP_NETQUAKE)
|
2008-01-09 00:52:31 +00:00
|
|
|
{
|
|
|
|
cl.ackedinputsequence = cls.netchan.outgoing_sequence;
|
|
|
|
}
|
2008-01-16 06:36:24 +00:00
|
|
|
#endif
|
2008-01-09 00:52:31 +00:00
|
|
|
|
2007-06-20 00:02:54 +00:00
|
|
|
if (!cl.ackedinputsequence)
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-06-20 00:02:54 +00:00
|
|
|
if (cls.netchan.outgoing_sequence - cl.ackedinputsequence >= UPDATE_BACKUP-1)
|
2005-02-28 07:16:19 +00:00
|
|
|
{ //lagging like poo.
|
|
|
|
if (!cl.intermission) //keep the angles working though.
|
|
|
|
VectorCopy (cl.viewangles[pnum], cl.simangles[pnum]);
|
2004-08-23 00:15:46 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// this is the last frame received from the server
|
2007-06-20 00:02:54 +00:00
|
|
|
from = &cl.frames[cl.ackedinputsequence & UPDATE_MASK];
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2004-10-19 16:10:14 +00:00
|
|
|
if (!cl.intermission)
|
|
|
|
{
|
|
|
|
VectorCopy (cl.viewangles[pnum], cl.simangles[pnum]);
|
|
|
|
}
|
2004-08-27 00:48:49 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
vel = from->playerstate[cl.playernum[pnum]].velocity;
|
|
|
|
org = from->playerstate[cl.playernum[pnum]].origin;
|
|
|
|
|
|
|
|
#ifdef PEXT_SETVIEW
|
|
|
|
if (cl.viewentity[pnum])
|
|
|
|
{
|
2005-11-26 03:02:55 +00:00
|
|
|
if (cl.viewentity[pnum] < cl.maxlerpents)
|
|
|
|
{
|
2009-04-01 22:03:56 +00:00
|
|
|
cl.nolocalplayer[pnum] = true;
|
2005-11-26 03:02:55 +00:00
|
|
|
// Con_Printf("Using lerped pos\n");
|
|
|
|
org = cl.lerpents[cl.viewentity[pnum]].origin;
|
|
|
|
vel = vec3_origin;
|
|
|
|
goto fixedorg;
|
|
|
|
}
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
}
|
2004-08-23 00:15:46 +00:00
|
|
|
#endif
|
2009-03-03 01:52:30 +00:00
|
|
|
if (!from->playerstate[cl.playernum[pnum]].messagenum)
|
|
|
|
{
|
|
|
|
//no player states?? put the view on an ent
|
|
|
|
if (cl.playernum[pnum] < cl.maxlerpents)
|
|
|
|
{
|
2009-04-01 22:03:56 +00:00
|
|
|
cl.nolocalplayer[pnum] = true;
|
2009-03-03 01:52:30 +00:00
|
|
|
// Con_Printf("Using lerped pos\n");
|
|
|
|
org = cl.lerpents[cl.playernum[pnum]+1].origin;
|
|
|
|
vel = vec3_origin;
|
|
|
|
goto fixedorg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-01-09 00:52:31 +00:00
|
|
|
if (((cl_nopred.value && cls.demoplayback!=DPB_MVD && cls.demoplayback != DPB_EZTV)|| cl.fixangle))
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2004-11-27 08:16:25 +00:00
|
|
|
fixedorg:
|
2004-08-23 00:15:46 +00:00
|
|
|
VectorCopy (vel, cl.simvel[pnum]);
|
|
|
|
VectorCopy (org, cl.simorg[pnum]);
|
|
|
|
|
2007-06-20 00:02:54 +00:00
|
|
|
to = &cl.frames[cl.ackedinputsequence & UPDATE_MASK];
|
2004-08-23 00:15:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CL_CatagorizePosition(pnum);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
// predict forward until cl.time <= to->senttime
|
|
|
|
oldphysent = pmove.numphysent;
|
|
|
|
CL_SetSolidPlayers (cl.playernum[pnum]);
|
|
|
|
|
2007-06-20 00:02:54 +00:00
|
|
|
to = &cl.frames[cl.ackedinputsequence & UPDATE_MASK];
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2008-12-03 02:42:05 +00:00
|
|
|
if (Cam_TrackNum(pnum)>=0 && CL_MayLerp())
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2005-10-01 03:09:17 +00:00
|
|
|
float f;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2007-06-20 00:02:54 +00:00
|
|
|
to = &cl.frames[cl.ackedinputsequence & UPDATE_MASK];
|
2005-10-01 03:09:17 +00:00
|
|
|
from = &cl.frames[cl.oldvalidsequence & UPDATE_MASK];
|
|
|
|
|
|
|
|
//figure out the lerp factor
|
|
|
|
f = (cl.gametime-cl.servertime)/(cl.gametime-cl.oldgametime);//f = (cl.time-cl.lerpents[state->number].lerptime)/cl.lerpents[state->number].lerprate;
|
|
|
|
if (f<0)
|
|
|
|
f=0;
|
|
|
|
if (f>1)
|
|
|
|
f=1;
|
|
|
|
// f = 1-f;
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2005-10-01 03:09:17 +00:00
|
|
|
|
|
|
|
// calculate origin
|
|
|
|
for (i=0 ; i<3 ; i++)
|
|
|
|
{
|
|
|
|
lrp[i] = to->playerstate[cl.playernum[pnum]].origin[i] +
|
|
|
|
f * (from->playerstate[cl.playernum[pnum]].origin[i] - to->playerstate[cl.playernum[pnum]].origin[i]);
|
|
|
|
|
|
|
|
cl.simangles[pnum][i] = LerpAngles16(to->playerstate[spec_track[pnum]].command.angles[i], from->playerstate[spec_track[pnum]].command.angles[i], f)*360.0f/65535;
|
|
|
|
}
|
|
|
|
|
|
|
|
org = lrp;
|
|
|
|
|
|
|
|
goto fixedorg;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
2005-10-01 03:09:17 +00:00
|
|
|
else
|
2004-08-23 00:15:46 +00:00
|
|
|
{
|
2007-06-20 00:02:54 +00:00
|
|
|
for (i=1 ; i<UPDATE_BACKUP-1 && cl.ackedinputsequence+i <
|
2005-10-01 03:09:17 +00:00
|
|
|
cls.netchan.outgoing_sequence; i++)
|
|
|
|
{
|
2007-06-20 00:02:54 +00:00
|
|
|
to = &cl.frames[(cl.ackedinputsequence+i) & UPDATE_MASK];
|
2005-10-01 03:09:17 +00:00
|
|
|
if (cl.intermission)
|
|
|
|
to->playerstate->pm_type = PM_FLY;
|
2004-08-23 00:15:46 +00:00
|
|
|
CL_PredictUsercmd (pnum, &from->playerstate[cl.playernum[pnum]]
|
2005-10-01 03:09:17 +00:00
|
|
|
, &to->playerstate[cl.playernum[pnum]], &to->cmd[pnum]);
|
2004-08-23 00:15:46 +00:00
|
|
|
|
2005-10-01 03:09:17 +00:00
|
|
|
cl.onground[pnum] = pmove.onground;
|
|
|
|
|
|
|
|
if (to->senttime >= cl.time)
|
|
|
|
break;
|
|
|
|
from = to;
|
|
|
|
}
|
2005-11-26 03:02:55 +00:00
|
|
|
|
2005-10-01 03:09:17 +00:00
|
|
|
if (independantphysics[pnum].msec)
|
|
|
|
{
|
|
|
|
from = to;
|
|
|
|
to = &ind;
|
|
|
|
to->cmd[pnum] = independantphysics[pnum];
|
|
|
|
to->senttime = cl.time;
|
|
|
|
CL_PredictUsercmd (pnum, &from->playerstate[cl.playernum[pnum]]
|
|
|
|
, &to->playerstate[cl.playernum[pnum]], &to->cmd[pnum]);
|
|
|
|
|
|
|
|
cl.onground[pnum] = pmove.onground;
|
|
|
|
}
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
stepheight = to->playerstate[cl.playernum[pnum]].origin[2] - from->playerstate[cl.playernum[pnum]].origin[2];
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pmove.numphysent = oldphysent;
|
|
|
|
|
|
|
|
if (1)//!independantphysics.msec)
|
|
|
|
{
|
|
|
|
VectorCopy (to->playerstate[cl.playernum[pnum]].velocity, cl.simvel[pnum]);
|
|
|
|
VectorCopy (to->playerstate[cl.playernum[pnum]].origin, cl.simorg[pnum]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// now interpolate some fraction of the final frame
|
|
|
|
if (to->senttime == from->senttime)
|
|
|
|
f = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
f = (cl.time - from->senttime) / (to->senttime - from->senttime);
|
|
|
|
|
|
|
|
if (f < 0)
|
|
|
|
f = 0;
|
|
|
|
if (f > 1)
|
|
|
|
f = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i=0 ; i<3 ; i++)
|
|
|
|
if ( fabs(org[i] - to->playerstate[cl.playernum[pnum]].origin[i]) > 128)
|
|
|
|
{ // teleported, so don't lerp
|
|
|
|
VectorCopy (to->playerstate[cl.playernum[pnum]].velocity, cl.simvel[pnum]);
|
|
|
|
VectorCopy (to->playerstate[cl.playernum[pnum]].origin, cl.simorg[pnum]);
|
|
|
|
goto out;
|
|
|
|
}
|
2005-11-26 03:02:55 +00:00
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
for (i=0 ; i<3 ; i++)
|
|
|
|
{
|
2005-11-26 03:02:55 +00:00
|
|
|
cl.simorg[pnum][i] = org[i]
|
2004-08-23 00:15:46 +00:00
|
|
|
+ f*(to->playerstate[cl.playernum[pnum]].origin[i] - org[i]);
|
2005-11-26 03:02:55 +00:00
|
|
|
cl.simvel[pnum][i] = vel[i]
|
2004-08-23 00:15:46 +00:00
|
|
|
+ f*(to->playerstate[cl.playernum[pnum]].velocity[i] - vel[i]);
|
|
|
|
}
|
|
|
|
CL_CatagorizePosition(pnum);
|
|
|
|
|
|
|
|
}
|
2005-10-01 03:09:17 +00:00
|
|
|
|
|
|
|
if (cls.demoplayback)
|
|
|
|
CL_LerpMove (pnum, to->senttime);
|
|
|
|
|
2004-08-23 00:15:46 +00:00
|
|
|
out:
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
CL_CalcCrouch (pnum, stepheight);
|
2005-04-16 16:21:27 +00:00
|
|
|
cl.waterlevel[pnum] = pmove.waterlevel;
|
2004-08-23 00:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CL_PredictMove (void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < cl.splitclients; i++)
|
|
|
|
CL_PredictMovePNum(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
==============
|
|
|
|
CL_InitPrediction
|
|
|
|
==============
|
|
|
|
*/
|
|
|
|
void CL_InitPrediction (void)
|
|
|
|
{
|
|
|
|
extern char cl_predictiongroup[];
|
|
|
|
Cvar_Register (&cl_pushlatency, cl_predictiongroup);
|
|
|
|
Cvar_Register (&cl_nopred, cl_predictiongroup);
|
|
|
|
}
|