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"
2013-09-06 22:57:44 +00:00
cvar_t cl_predict_extrapolate = CVARD ( " cl_predict_extrapolate " , " " , " If 1, enables prediction based upon partial input frames which can change over time resulting in a swimmy feel but does not need to interpolate. If 0, prediction will stay in the past and thus use only completed frames. Interpolation will then be used to smooth movement. \n This cvar only applies when video and input frames are independant (ie: cl_netfps is set). " ) ;
2019-09-17 19:49:39 +00:00
static cvar_t cl_predict_timenudge = CVARD ( " cl_predict_timenudge " , " 0 " , " A debug feature. You should normally leave this as 0. Nudges local player prediction into the future if positive (resulting in extrapolation), or into the past if negative (resulting in laggy interpolation). Value is in seconds, so small decimals are required. This cvar applies even if input frames are tied to video frames. " ) ;
cvar_t cl_lerp_smooth = CVARD ( " cl_lerp_smooth " , " 2 " , " If 2, will act as 1 when playing demos/singleplayer and otherwise act as if set to 0 (ie: deathmatch). \n If 1, interpolation will run in the past, resulting in really smooth movement at the cost of latency (even on bunchy german ISDNs). \n If 0, interpolation will be based upon packet arrival times and may judder due to packet loss. " ) ;
static cvar_t cl_lerp_driftbias = CVARD ( " cl_lerp_driftbias " , " 0 " , " Additional bias, can be set to a negative value to hold interpolation in the past. " ) ;
static cvar_t cl_lerp_driftfrac = CVARD ( " cl_lerp_driftfrac " , " 0 " , " Proportion of the latest time vs the older time to favour drifting towards. " ) ;
2017-08-29 02:29:06 +00:00
cvar_t cl_nopred = CVARD ( " cl_nopred " , " 0 " , " Disables clientside movement prediction. " ) ;
2019-09-17 19:49:39 +00:00
static cvar_t cl_pushlatency = CVAR ( " pushlatency " , " -999 " ) ;
2004-08-23 00:15:46 +00:00
extern float pm_airaccelerate ;
2017-08-29 02:29:06 +00:00
extern usercmd_t cl_pendingcmd [ MAX_SPLITS ] ;
2004-08-23 00:15:46 +00:00
# ifdef Q2CLIENT
2012-02-12 05:18:31 +00:00
# define MAX_PARSE_ENTITIES 1024
2013-10-08 14:28:11 +00:00
extern entity_state_t clq2_parse_entities [ MAX_PARSE_ENTITIES ] ;
2012-02-12 05:18:31 +00:00
2004-08-23 00:15:46 +00:00
char * Get_Q2ConfigString ( int i ) ;
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)
2023-09-11 09:31:09 +00:00
static struct
{
vec3_t origin ;
int seq ;
} cl_predictions [ MAX_SPLITS ] [ UPDATE_BACKUP ] ;
2004-08-23 00:15:46 +00:00
/*
= = = = = = = = = = = = = = = = = = =
CL_CheckPredictionError
= = = = = = = = = = = = = = = = = = =
*/
void CLQ2_CheckPredictionError ( void )
{
int frame ;
int delta [ 3 ] ;
int i ;
int len ;
2016-01-18 05:22:07 +00:00
int seat ;
q2player_state_t * ps ;
playerview_t * pv ;
2004-08-23 00:15:46 +00:00
2016-01-18 05:22:07 +00:00
for ( seat = 0 ; seat < cl . splitclients ; seat + + )
{
2023-09-11 09:31:09 +00:00
ps = & cl . q2frame . seat [ seat ] . playerstate ;
2016-01-18 05:22:07 +00:00
pv = & cl . playerview [ seat ] ;
2004-08-23 00:15:46 +00:00
2016-01-18 05:22:07 +00:00
if ( cl_nopred . value | | ( ps - > pmove . pm_flags & Q2PMF_NO_PREDICTION ) )
continue ;
2004-08-23 00:15:46 +00:00
2016-01-18 05:22:07 +00:00
// calculate the last usercmd_t we sent that the server has processed
2023-09-11 09:31:09 +00:00
frame = cl . ackedmovesequence ;
2016-01-18 05:22:07 +00:00
frame & = ( UPDATE_MASK ) ;
2004-08-23 00:15:46 +00:00
2023-09-11 09:31:09 +00:00
if ( cl_predictions [ seat ] [ frame ] . seq ! = cl . ackedmovesequence )
continue ;
2016-01-18 05:22:07 +00:00
// compare what the server returned with what we had predicted it to be
2023-09-11 09:31:09 +00:00
VectorSubtract ( ps - > pmove . origin , cl_predictions [ seat ] [ frame ] . origin , delta ) ;
2016-01-18 05:22:07 +00:00
// 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 ( pv - > prediction_error ) ;
}
else
{
// if (/*cl_showmiss->value && */(delta[0] || delta[1] || delta[2]) )
// Con_Printf ("prediction miss on %i: %i\n", cl.q2frame.serverframe,
// delta[0] + delta[1] + delta[2]);
2004-08-23 00:15:46 +00:00
2023-09-11 09:31:09 +00:00
VectorCopy ( ps - > pmove . origin , cl_predictions [ seat ] [ frame ] . origin ) ;
2004-08-23 00:15:46 +00:00
2016-01-18 05:22:07 +00:00
// save for error itnerpolation
for ( i = 0 ; i < 3 ; i + + )
pv - > prediction_error [ i ] = delta [ i ] * 0.125 ;
}
2004-08-23 00:15:46 +00:00
}
}
/*
= = = = = = = = = = = = = = = = = = = =
CL_ClipMoveToEntities
= = = = = = = = = = = = = = = = = = = =
*/
2016-01-18 05:22:07 +00:00
int predignoreentitynum ;
2004-08-23 00:15:46 +00:00
void CLQ2_ClipMoveToEntities ( vec3_t start , vec3_t mins , vec3_t maxs , vec3_t end , trace_t * tr )
{
2016-07-12 00:40:13 +00:00
int i ;
2004-08-23 00:15:46 +00:00
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 ) ;
2013-10-08 14:28:11 +00:00
ent = & clq2_parse_entities [ num ] ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
if ( ent - > solidsize = = ES_SOLID_NOT )
2004-08-23 00:15:46 +00:00
continue ;
2016-01-18 05:22:07 +00:00
if ( ent - > number = = predignoreentitynum )
2004-08-23 00:15:46 +00:00
continue ;
2016-07-12 00:40:13 +00:00
if ( ent - > solidsize = = ES_SOLID_BSP )
2004-08-23 00:15:46 +00:00
{ // special value for bmodel
cmodel = cl . model_precache [ ent - > modelindex ] ;
if ( ! cmodel )
continue ;
angles = ent - > angles ;
}
else
{ // encoded bbox
2016-07-12 00:40:13 +00:00
COM_DecodeSize ( ent - > solidsize , bmins , bmaxs ) ;
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 ;
2015-02-09 03:37:41 +00:00
World_TransformedTrace ( cmodel , 0 , 0 , start , end , mins , maxs , false , & trace , ent - > origin , angles , MASK_PLAYERSOLID ) ;
2004-08-23 00:15:46 +00:00
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
2017-01-29 13:10:53 +00:00
cl . worldmodel - > funcs . NativeTrace ( cl . worldmodel , 0 , NULLFRAMESTATE , NULL , start , end , mins , maxs , false , MASK_PLAYERSOLID , & t ) ;
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 ;
2021-11-03 20:30:40 +00:00
vec3_t axis [ 3 ] , relpos ;
2004-08-23 00:15:46 +00:00
2021-11-03 20:30:40 +00:00
contents = cl . worldmodel - > funcs . PointContents ( cl . worldmodel , NULL , 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 ) ;
2013-10-08 14:28:11 +00:00
ent = & clq2_parse_entities [ num ] ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
if ( ent - > solidsize ! = ES_SOLID_BSP ) // special value for bmodel
2004-08-23 00:15:46 +00:00
continue ;
cmodel = cl . model_precache [ ent - > modelindex ] ;
if ( ! cmodel )
continue ;
2021-11-03 20:30:40 +00:00
AngleVectors ( ent - > angles , axis [ 0 ] , axis [ 1 ] , axis [ 2 ] ) ;
VectorNegate ( axis [ 1 ] , axis [ 1 ] ) ;
VectorSubtract ( point , ent - > origin , relpos ) ;
contents | = cmodel - > funcs . PointContents ( cmodel , axis , relpos ) ;
2004-08-23 00:15:46 +00:00
}
return contents ;
}
/*
= = = = = = = = = = = = = = = = =
CL_PredictMovement
Sets cl . predicted_origin and cl . predicted_angles
= = = = = = = = = = = = = = = = =
*/
2022-02-19 20:49:42 +00:00
static void CLQ2_UserCmdToQ2 ( q2usercmd_t * out , const usercmd_t * cmd )
{
out - > msec = cmd - > msec ;
out - > buttons = cmd - > buttons ;
VectorCopy ( cmd - > angles , out - > angles ) ;
out - > forwardmove = cmd - > forwardmove ;
out - > sidemove = cmd - > sidemove ;
out - > upmove = cmd - > upmove ;
out - > impulse = cmd - > impulse ;
out - > lightlevel = cmd - > lightlevel ;
}
2016-01-18 05:22:07 +00:00
static void CLQ2_PredictMovement ( int seat ) //q2 doesn't support split clients.
2004-08-23 00:15:46 +00:00
{
int ack , current ;
int frame ;
int oldframe ;
2022-02-19 20:49:42 +00:00
q2pmove_t pm ;
2004-08-23 00:15:46 +00:00
int step ;
int oldz ;
int i ;
2023-09-11 09:31:09 +00:00
q2player_state_t * ps = & cl . q2frame . seat [ seat ] . playerstate ;
2016-01-18 05:22:07 +00:00
playerview_t * pv = & cl . playerview [ seat ] ;
2004-08-23 00:15:46 +00:00
if ( cls . state ! = ca_active )
return ;
// if (cl_paused->value)
// return;
2015-12-12 19:25:15 +00:00
2016-01-18 05:22:07 +00:00
if ( cl_nopred . value | | cls . demoplayback | | ( ps - > pmove . pm_flags & Q2PMF_NO_PREDICTION ) )
2004-08-23 00:15:46 +00:00
{ // just set angles
for ( i = 0 ; i < 3 ; i + + )
{
2016-01-18 05:22:07 +00:00
pv - > predicted_angles [ i ] = pv - > viewangles [ i ] + SHORT2ANGLE ( ps - > pmove . delta_angles [ i ] ) ;
2004-08-23 00:15:46 +00:00
}
return ;
}
2023-09-11 09:31:09 +00:00
ack = cl . ackedmovesequence ; //index was received
current = cl . movesequence ; //count generated, [current] is thus invalid.
2004-08-23 00:15:46 +00:00
// 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 ) ) ;
2016-01-18 05:22:07 +00:00
pm . s = ps - > pmove ;
2004-08-23 00:15:46 +00:00
// SCR_DebugGraph (current - ack - 1, 0);
frame = 0 ;
2023-09-11 09:31:09 +00:00
predignoreentitynum = cl . q2frame . seat [ seat ] . clientnum + 1 ; //cl.playerview[seat].playernum+1;
2016-01-18 05:22:07 +00:00
2004-08-23 00:15:46 +00:00
// run frames
while ( + + ack < current )
{
frame = ack & ( UPDATE_MASK ) ;
2022-02-19 20:49:42 +00:00
CLQ2_UserCmdToQ2 ( & pm . cmd , & cl . outframes [ frame ] . cmd [ seat ] ) ;
2004-08-23 00:15:46 +00:00
Q2_Pmove ( & pm ) ;
// save for debug checking
2023-09-11 09:31:09 +00:00
VectorCopy ( pm . s . origin , cl_predictions [ seat ] [ frame ] . origin ) ;
cl_predictions [ seat ] [ frame ] . seq = ack ;
2004-08-23 00:15:46 +00:00
}
2017-08-29 02:29:06 +00:00
if ( cl_pendingcmd [ seat ] . msec )
2004-08-23 00:15:46 +00:00
{
2022-02-19 20:49:42 +00:00
CLQ2_UserCmdToQ2 ( & pm . cmd , & cl_pendingcmd [ seat ] ) ;
2004-08-23 00:15:46 +00:00
Q2_Pmove ( & pm ) ;
}
2015-12-12 19:25:15 +00:00
oldframe = ( ack - 1 ) & ( UPDATE_MASK ) ;
2023-09-11 09:31:09 +00:00
oldz = cl_predictions [ seat ] [ oldframe ] . origin [ 2 ] ;
2004-08-23 00:15:46 +00:00
step = pm . s . origin [ 2 ] - oldz ;
if ( step > 63 & & step < 160 & & ( pm . s . pm_flags & Q2PMF_ON_GROUND ) )
{
2016-01-18 05:22:07 +00:00
pv - > predicted_step = step * 0.125 ;
pv - > predicted_step_time = realtime ; // - host_frametime;// * 0.5;
2004-08-23 00:15:46 +00:00
}
2016-01-18 05:22:07 +00:00
pv - > onground = ! ! ( pm . s . pm_flags & Q2PMF_ON_GROUND ) ;
2004-08-23 00:15:46 +00:00
// copy results out for rendering
2016-01-18 05:22:07 +00:00
pv - > predicted_origin [ 0 ] = pm . s . origin [ 0 ] * 0.125 ;
pv - > predicted_origin [ 1 ] = pm . s . origin [ 1 ] * 0.125 ;
pv - > predicted_origin [ 2 ] = pm . s . origin [ 2 ] * 0.125 ;
2004-08-23 00:15:46 +00:00
2016-07-12 00:40:13 +00:00
VectorScale ( pm . s . velocity , 0.125 , pv - > simvel ) ;
2016-01-18 05:22:07 +00:00
VectorCopy ( pm . viewangles , pv - > predicted_angles ) ;
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = = = = =
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 ;
2010-08-28 17:14:38 +00:00
if ( cl . worldmodel - > funcs . PointContents ( cl . worldmodel , NULL , 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 ;
2010-08-28 17:14:38 +00:00
if ( cl . worldmodel - > funcs . PointContents ( cl . worldmodel , NULL , pmove . origin ) = = FTECONTENTS_EMPTY )
2004-08-23 00:15:46 +00:00
return ;
}
}
Con_DPrintf ( " CL_NudgePosition: stuck \n " ) ;
}
# endif
/*
= = = = = = = = = = = = = =
CL_PredictUsercmd
= = = = = = = = = = = = = =
*/
2012-04-24 07:59:11 +00:00
void CL_PredictUsercmd ( int pnum , int entnum , player_state_t * from , player_state_t * to , usercmd_t * u )
2004-08-23 00:15:46 +00:00
{
// 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 ;
2013-09-06 22:57:44 +00:00
split . msec = u - > msec / 2 ; //special care to avoid forgetting an msec here and there
2015-10-27 15:20:15 +00:00
if ( split . msec > 500 )
{
split . msec = 500 ;
CL_PredictUsercmd ( pnum , entnum , from , to , & split ) ;
}
else
{
CL_PredictUsercmd ( pnum , entnum , from , & temp , & split ) ;
split . msec = u - > msec - split . msec ;
CL_PredictUsercmd ( pnum , entnum , & temp , to , & split ) ;
}
2004-08-23 00:15:46 +00:00
return ;
}
2014-10-05 20:04:11 +00:00
if ( ! cl . worldmodel | | cl . worldmodel - > loadstate ! = MLS_LOADED )
2013-06-29 16:01:07 +00:00
return ;
2004-08-23 00:15:46 +00:00
VectorCopy ( from - > origin , pmove . origin ) ;
VectorCopy ( u - > angles , pmove . angles ) ;
VectorCopy ( from - > velocity , pmove . velocity ) ;
2012-07-05 19:42:36 +00:00
VectorCopy ( from - > gravitydir , pmove . gravitydir ) ;
2004-08-23 00:15:46 +00:00
2015-07-09 18:02:49 +00:00
if ( IS_NAN ( pmove . velocity [ 0 ] ) )
2008-01-09 00:52:31 +00:00
{
2015-07-09 18:02:49 +00:00
Con_DPrintf ( " nan velocity! \n " ) ;
2008-01-09 00:52:31 +00:00
pmove . velocity [ 0 ] = 0 ;
pmove . velocity [ 1 ] = 0 ;
pmove . velocity [ 2 ] = 0 ;
}
2019-03-01 22:39:30 +00:00
pmove . onground = from - > onground ;
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 ;
2012-04-24 07:59:11 +00:00
pmove . skipent = entnum ;
2004-08-23 00:15:46 +00:00
2013-06-23 02:17:02 +00:00
movevars . entgravity = cl . playerview [ pnum ] . entgravity ;
movevars . maxspeed = cl . playerview [ pnum ] . maxspeed ;
2004-08-23 00:15:46 +00:00
movevars . bunnyspeedcap = cl . bunnyspeedcap ;
pmove . onladder = false ;
2014-07-12 06:56:17 +00:00
pmove . safeorigin_known = false ;
2014-09-17 03:04:08 +00:00
pmove . capsule = false ; //FIXME
2004-08-23 00:15:46 +00:00
2014-01-13 02:42:25 +00:00
VectorCopy ( from - > szmins , pmove . player_mins ) ;
VectorCopy ( from - > szmaxs , pmove . player_maxs ) ;
2004-08-23 00:15:46 +00:00
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 ) ;
2012-07-05 19:42:36 +00:00
VectorCopy ( pmove . gravitydir , to - > gravitydir ) ;
2004-08-23 00:15:46 +00:00
to - > onground = pmove . onground ;
to - > weaponframe = from - > weaponframe ;
to - > pm_type = from - > pm_type ;
2012-02-12 05:18:31 +00:00
2014-01-13 02:42:25 +00:00
VectorCopy ( pmove . player_mins , to - > szmins ) ;
VectorCopy ( pmove . player_maxs , to - > szmaxs ) ;
2004-08-23 00:15:46 +00:00
}
//Used when cl_nopred is 1 to determine whether we are on ground, otherwise stepup smoothing code produces ugly jump physics
2014-04-13 04:23:13 +00:00
void CL_CatagorizePosition ( playerview_t * pv , float * org )
2004-08-23 00:15:46 +00:00
{
2014-08-15 02:20:41 +00:00
//fixme: in nq, we are told by the server and should skip this, which avoids needing to know the player's size.
2019-09-25 20:23:24 +00:00
if ( pv - > spectator & & ! CAM_ISLOCKED ( pv ) )
2004-08-23 00:15:46 +00:00
{
2013-06-23 02:17:02 +00:00
pv - > onground = false ; // in air
2004-08-23 00:15:46 +00:00
return ;
}
VectorClear ( pmove . velocity ) ;
2014-04-13 04:23:13 +00:00
VectorCopy ( org , pmove . origin ) ;
2004-08-23 00:15:46 +00:00
pmove . numtouch = 0 ;
PM_CategorizePosition ( ) ;
2013-06-23 02:17:02 +00:00
pv - > onground = pmove . onground ;
2004-08-23 00:15:46 +00:00
}
//Smooth out stair step ups.
//Called before CL_EmitEntities so that the player's lightning model origin is updated properly
2013-09-06 22:57:44 +00:00
void CL_CalcCrouch ( playerview_t * pv )
2004-08-23 00:15:46 +00:00
{
qboolean teleported ;
vec3_t delta ;
2013-09-06 22:57:44 +00:00
float orgz = - DotProduct ( pv - > simorg , pv - > gravitydir ) ; //compensate for running on walls.
2004-08-23 00:15:46 +00:00
2013-06-23 02:17:02 +00:00
VectorSubtract ( pv - > simorg , pv - > oldorigin , delta ) ;
2004-08-23 00:15:46 +00:00
teleported = Length ( delta ) > 48 ;
if ( teleported )
{
// possibly teleported or respawned
2013-06-23 02:17:02 +00:00
pv - > oldz = orgz ;
pv - > extracrouch = 0 ;
pv - > crouchspeed = 100 ;
pv - > crouch = 0 ;
VectorCopy ( pv - > simorg , pv - > oldorigin ) ;
2004-08-23 00:15:46 +00:00
return ;
}
2015-02-02 08:01:53 +00:00
VectorCopy ( pv - > simorg , pv - > oldorigin ) ;
2019-08-19 16:01:24 +00:00
if ( pv - > onground & & orgz - pv - > oldz )
2004-08-23 00:15:46 +00:00
{
2018-01-22 19:18:04 +00:00
if ( pv - > oldz > orgz )
{ //stepping down should be a little faster than stepping up.
//so steps will still feel a little juddery. my knees hate walking down steep hills, so I guess this is similar.
if ( pv - > crouchspeed > 0 )
pv - > crouchspeed = - pv - > crouchspeed * 2 ;
if ( orgz - pv - > oldz < - movevars . stepheight - 2 )
2004-08-23 00:15:46 +00:00
{
2018-01-22 19:18:04 +00:00
// if on steep stairs, increase speed
if ( pv - > crouchspeed > - 160 * 2 )
{
pv - > extracrouch = orgz - pv - > oldz + host_frametime * 400 + 15 ;
2019-08-19 16:01:24 +00:00
pv - > extracrouch = max ( pv - > extracrouch , - 5 ) ;
2018-01-22 19:18:04 +00:00
}
pv - > crouchspeed = - 160 * 2 ;
2004-08-23 00:15:46 +00:00
}
2018-01-22 19:18:04 +00:00
pv - > oldz + = host_frametime * pv - > crouchspeed ;
if ( pv - > oldz < orgz )
pv - > oldz = orgz ;
if ( pv - > oldz > orgz + 15 - pv - > extracrouch )
2019-08-19 16:01:24 +00:00
pv - > oldz = orgz + 15 + pv - > extracrouch ;
if ( pv - > extracrouch < - host_frametime * 400 )
pv - > extracrouch + = host_frametime * 400 ;
else if ( pv - > extracrouch < 0 )
pv - > extracrouch = 0 ;
2004-08-23 00:15:46 +00:00
}
2018-01-22 19:18:04 +00:00
else
{
if ( pv - > crouchspeed < 0 )
pv - > crouchspeed = - pv - > crouchspeed / 2 ;
2004-08-23 00:15:46 +00:00
2018-01-22 19:18:04 +00:00
if ( orgz - pv - > oldz > movevars . stepheight + 2 )
{
// if on steep stairs, increase speed
if ( pv - > crouchspeed < 160 )
{
pv - > extracrouch = orgz - pv - > oldz - host_frametime * 200 - 15 ;
pv - > extracrouch = min ( pv - > extracrouch , 5 ) ;
}
pv - > crouchspeed = 160 ;
}
pv - > oldz + = host_frametime * pv - > crouchspeed ;
if ( pv - > oldz > orgz )
pv - > oldz = orgz ;
2004-08-23 00:15:46 +00:00
2018-01-22 19:18:04 +00:00
// if (orgz - pv->oldz > 15 + pv->extracrouch)
2019-08-19 16:01:24 +00:00
if ( pv - > oldz < orgz - 15 + pv - > extracrouch )
2018-01-22 19:18:04 +00:00
pv - > oldz = orgz - 15 - pv - > extracrouch ;
2019-08-19 16:01:24 +00:00
if ( pv - > extracrouch > = host_frametime * 200 )
pv - > extracrouch - = host_frametime * 200 ;
else if ( pv - > extracrouch > 0 )
pv - > extracrouch = 0 ;
2018-01-22 19:18:04 +00:00
}
2004-08-23 00:15:46 +00:00
2013-06-23 02:17:02 +00:00
pv - > crouch = pv - > oldz - orgz ;
2004-08-23 00:15:46 +00:00
}
else
{
// in air or moving down
2013-06-23 02:17:02 +00:00
pv - > oldz = orgz ;
if ( pv - > crouch > 0 )
2018-01-22 19:18:04 +00:00
{
//step-down
pv - > crouch - = host_frametime * 150 ;
if ( orgz - pv - > oldz > 0 )
pv - > crouch + = orgz - pv - > oldz ; //if the view moved down, remove that amount from our crouching to avoid unneeded bobbing
if ( pv - > crouch > 0 )
pv - > crouch = 0 ;
pv - > crouchspeed = - 100 ;
}
else
{ //step-up
pv - > crouch + = host_frametime * 150 ;
if ( orgz - pv - > oldz < 0 )
pv - > crouch - = orgz - pv - > oldz ; //if the view moved down, remove that amount from our crouching to avoid unneeded bobbing
if ( pv - > crouch > 0 )
pv - > crouch = 0 ;
pv - > crouchspeed = 100 ;
}
2013-06-23 02:17:02 +00:00
pv - > extracrouch = 0 ;
2004-08-23 00:15:46 +00:00
}
}
2005-10-01 03:09:17 +00:00
float LerpAngles360 ( float to , float from , float frac )
{
2013-07-26 17:19:06 +00:00
float delta ;
2005-10-01 03:09:17 +00:00
delta = ( from - to ) ;
if ( delta > 180 )
delta - = 360 ;
if ( delta < - 180 )
delta + = 360 ;
return to + frac * delta ;
}
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 )
{
2024-07-21 00:18:21 +00:00
extern cvar_t cl_demospeed ;
2014-05-10 13:42:13 +00:00
if ( ! cls . state )
2014-10-06 21:03:08 +00:00
{
2023-01-20 02:04:26 +00:00
if ( ! cl . implicitpause )
cl . servertime + = host_frametime ;
2014-10-06 21:03:08 +00:00
cl . time = cl . servertime ;
return ;
}
2014-06-12 23:08:42 +00:00
else // if (cls.protocol != CP_QUAKE3)
2005-10-01 03:09:17 +00:00
{
2015-06-24 17:59:57 +00:00
// float oldst = realtime;
2008-05-31 10:31:47 +00:00
2014-10-22 19:41:20 +00:00
if ( cls . demoplayback & & cls . timedemo )
{ //more deterministic. one frame is drawn per demo packet parsed. so sync to it as closely as possible.
/*NOTE: this also has the effect of speeding up particles etc*/
extern float olddemotime ;
cl . servertime = olddemotime ;
}
2020-04-29 10:43:22 +00:00
//q2 has no drifting (our code can't cope with picking anything beyond old/new snapshots, and frankly its 10fps which is horrendous enough as it is).
//q3 always drifts (gamecode does snapshot selection).
//qw code can drift (but oh noes! my latency!)
//FIXME: nq code should be able to drift, but is apparently buggy somewhere and ends up uncomfortably stuttery right now.
2016-11-20 20:52:41 +00:00
//default is to drift in demos+SP but not live (oh noes! added latency!)
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
if ( cls . protocol = = CP_QUAKE2 | | cls . protocol = = CP_NETQUAKE /*FIXME*/ | | ( cls . protocol ! = CP_QUAKE3 & & ( ! cl_lerp_smooth . ival | | ( cl_lerp_smooth . ival = = 2 & & ! ( cls . demoplayback | | cl . allocated_client_slots = = 1 | | cl . playerview [ 0 ] . spectator ) ) ) & & cls . demoplayback ! = DPB_MVD ) )
2015-12-12 19:25:15 +00:00
{ //no drift logic
2023-09-11 09:31:09 +00:00
double f ;
extern cvar_t cl_demospeed ;
2012-04-24 07:59:11 +00:00
f = cl . gametime - cl . oldgametime ;
if ( f > 0.1 )
f = 0.1 ;
f = ( realtime - cl . gametimemark ) / ( f ) ;
2023-09-11 09:31:09 +00:00
if ( cls . demoplayback & & cl_demospeed . value > 0 & & cls . state = = ca_active )
f * = cl_demospeed . value ;
2012-04-24 07:59:11 +00:00
f = bound ( 0 , f , 1 ) ;
2023-09-11 09:31:09 +00:00
cl . servertime = cl . oldgametime + f * ( cl . gametime - cl . oldgametime ) ;
2010-03-14 14:35:56 +00:00
}
2009-11-04 21:16:50 +00:00
else
2015-12-12 19:25:15 +00:00
{ //funky magic drift logic. we be behind the most recent frame in order to attempt to cover network congestions (which is apparently common in germany).
2011-12-05 15:23:40 +00:00
float min , max ;
2024-07-21 00:18:21 +00:00
float r ;
2011-12-05 15:23:40 +00:00
2015-06-24 17:59:57 +00:00
// oldst = cl.servertime;
2011-10-27 15:46:36 +00:00
2012-07-21 04:43:31 +00:00
max = cl . gametime ;
min = cl . oldgametime ;
2019-09-17 19:49:39 +00:00
FloatInterpolate ( min , cl_lerp_driftfrac . value , max , min ) ;
min + = cl_lerp_driftbias . value ;
2013-06-23 02:17:02 +00:00
if ( max < min )
max = min ;
2011-12-05 15:23:40 +00:00
2024-07-21 00:18:21 +00:00
if ( cls . demoplayback & & cl_demospeed . value > 0 & & cls . state = = ca_active )
r = cl_demospeed . value ;
else
r = 1 ;
2012-08-04 01:35:52 +00:00
if ( max )
2024-07-21 00:18:21 +00:00
cl . servertime + = host_frametime * r ;
2012-08-04 01:35:52 +00:00
else
cl . servertime = 0 ;
2009-11-04 21:16:50 +00:00
2019-12-10 14:50:47 +00:00
if ( ! cl . oldgametime )
cl . servertime = max ; //map start (or reload/connect or something). snap to current.
else if ( cl . servertime > min )
2011-10-27 15:46:36 +00:00
{
2013-06-23 02:17:02 +00:00
if ( cl . servertime > max )
2011-12-05 15:23:40 +00:00
{
2013-06-23 02:17:02 +00:00
cl . servertime = max ;
2011-12-05 15:23:40 +00:00
// Con_Printf("clamped to new time\n");
}
else
{
2024-07-21 00:18:21 +00:00
cl . servertime - = 0.02 * ( max - cl . servertime ) * r ;
2020-04-29 10:43:22 +00:00
if ( cl . servertime < cl . time )
cl . servertime = cl . time ;
2011-12-05 15:23:40 +00:00
}
2011-10-27 15:46:36 +00:00
}
2011-12-05 15:23:40 +00:00
if ( cl . servertime < min )
2011-10-27 15:46:36 +00:00
{
2011-12-05 15:23:40 +00:00
if ( cl . servertime < min - 0.5 )
2011-10-27 15:46:36 +00:00
{
2011-12-05 15:23:40 +00:00
cl . servertime = min - 0.5 ;
2011-10-27 15:46:36 +00:00
// Con_Printf("clamped to old time\n");
}
2011-12-05 15:23:40 +00:00
else if ( cl . servertime < min - 0.3 )
2011-10-27 15:46:36 +00:00
{
2024-07-21 00:18:21 +00:00
cl . servertime + = 0.02 * ( min - cl . servertime ) * r ;
2011-10-27 15:46:36 +00:00
// Con_Printf("running really slow\n");
}
else
{
2024-07-21 00:18:21 +00:00
cl . servertime + = 0.01 * ( min - cl . servertime ) * r ;
2011-10-27 15:46:36 +00:00
// Con_Printf("running slow\n");
}
}
2009-11-04 21:16:50 +00:00
}
2011-10-27 15:46:36 +00:00
cl . time = cl . servertime ;
2015-06-24 17:59:57 +00:00
/* if (oldst == 0)
2008-05-31 10:31:47 +00:00
{
int i ;
2013-10-29 17:38:22 +00:00
for ( i = 0 ; i < cl . allocated_client_slots ; i + + )
2008-05-31 10:31:47 +00:00
{
cl . players [ i ] . entertime + = cl . servertime ;
}
}
2015-06-24 17:59:57 +00:00
*/
2011-10-27 15:46:36 +00:00
return ;
2005-10-01 03:09:17 +00:00
}
2015-06-24 17:59:57 +00:00
#if 0
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
{
2013-09-06 22:57:44 +00:00
if ( cl_pushlatency . value > 0 )
Cvar_Set ( & cl_pushlatency , " 0 " ) ;
2005-10-01 03:09:17 +00:00
cl . time = realtime - cls . latency - cl_pushlatency . value * 0.001 ;
if ( cl . time > realtime )
cl . time = realtime ;
}
2015-06-24 17:59:57 +00:00
# endif
2005-10-01 03:09:17 +00:00
}
2016-07-12 00:40:13 +00:00
static void CL_DecodeStateSize ( unsigned int solid , int modelindex , vec3_t mins , vec3_t maxs )
2012-02-12 05:18:31 +00:00
{
if ( solid = = ES_SOLID_BSP )
{
2014-10-05 20:04:11 +00:00
if ( modelindex < MAX_PRECACHE_MODELS & & cl . model_precache [ modelindex ] & & cl . model_precache [ modelindex ] - > loadstate = = MLS_LOADED )
2012-02-12 05:18:31 +00:00
{
VectorCopy ( cl . model_precache [ modelindex ] - > mins , mins ) ;
VectorCopy ( cl . model_precache [ modelindex ] - > maxs , maxs ) ;
}
else
{
VectorClear ( mins ) ;
VectorClear ( maxs ) ;
}
}
else if ( solid )
2016-07-12 00:40:13 +00:00
COM_DecodeSize ( solid , mins , maxs ) ;
2012-02-12 05:18:31 +00:00
else
{
VectorClear ( mins ) ;
VectorClear ( maxs ) ;
}
}
/*called on packet reception*/
2012-02-12 05:33:16 +00:00
# include "pr_common.h"
2013-09-06 22:57:44 +00:00
static void CL_EntStateToPlayerState ( player_state_t * plstate , entity_state_t * state )
2012-02-12 05:18:31 +00:00
{
2012-07-05 19:42:36 +00:00
vec3_t a ;
2013-09-06 22:57:44 +00:00
int pmtype ;
2020-09-29 07:09:01 +00:00
unsigned int flags = plstate - > flags ;
2014-08-19 06:08:23 +00:00
qboolean onground = plstate - > onground ;
2017-03-30 18:37:16 +00:00
qboolean jumpheld = plstate - > jump_held ;
2014-08-19 06:08:23 +00:00
vec3_t vel ;
VectorCopy ( plstate - > velocity , vel ) ;
2013-09-06 22:57:44 +00:00
memset ( plstate , 0 , sizeof ( * plstate ) ) ;
2017-03-30 18:37:16 +00:00
plstate - > jump_held = jumpheld ;
2016-07-12 00:40:13 +00:00
2019-09-25 20:23:24 +00:00
switch ( state - > u . q1 . pmovetype & 0x3f )
2012-02-12 05:18:31 +00:00
{
2012-02-15 13:53:30 +00:00
case MOVETYPE_NOCLIP :
2012-02-12 05:18:31 +00:00
if ( cls . z_ext & Z_EXT_PM_TYPE_NEW )
pmtype = PM_SPECTATOR ;
else
pmtype = PM_OLD_SPECTATOR ;
2012-02-15 13:53:30 +00:00
break ;
case MOVETYPE_FLY :
2012-02-12 05:18:31 +00:00
pmtype = PM_FLY ;
2012-02-15 13:53:30 +00:00
break ;
case MOVETYPE_NONE :
2012-02-12 05:18:31 +00:00
pmtype = PM_NONE ;
2012-02-15 13:53:30 +00:00
break ;
case MOVETYPE_BOUNCE :
case MOVETYPE_TOSS :
2012-02-12 05:18:31 +00:00
pmtype = PM_DEAD ;
2012-02-15 13:53:30 +00:00
break ;
case MOVETYPE_WALLWALK :
pmtype = PM_WALLWALK ;
break ;
2014-06-21 17:58:17 +00:00
case MOVETYPE_6DOF :
pmtype = PM_6DOF ;
break ;
2012-02-15 13:53:30 +00:00
default :
2012-02-12 05:18:31 +00:00
pmtype = PM_NORMAL ;
2012-02-15 13:53:30 +00:00
break ;
}
2012-02-12 05:18:31 +00:00
VectorCopy ( state - > origin , plstate - > origin ) ;
2014-08-19 06:08:23 +00:00
if ( cls . protocol = = CP_NETQUAKE & & ! ( cls . fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS ) )
{ //nq is annoying, this stuff wasn't part of the entity state, so don't break it
VectorCopy ( vel , plstate - > velocity ) ;
2016-07-12 00:40:13 +00:00
pmtype = PM_NORMAL ;
2014-08-19 06:08:23 +00:00
plstate - > onground = onground ;
}
else
2019-03-01 22:39:30 +00:00
{
2014-08-19 06:08:23 +00:00
VectorScale ( state - > u . q1 . velocity , 1 / 8.0 , plstate - > velocity ) ;
2019-03-01 22:39:30 +00:00
plstate - > onground = ! ! ( state - > u . q1 . pmovetype & 128 ) ;
2019-09-25 20:23:24 +00:00
plstate - > jump_held = ! ! ( state - > u . q1 . pmovetype & 64 ) ;
2019-03-01 22:39:30 +00:00
}
2016-07-12 00:40:13 +00:00
plstate - > pm_type = pmtype ;
2020-09-29 07:09:01 +00:00
plstate - > flags = flags & PF_INWATER ;
2012-02-12 05:18:31 +00:00
2015-02-02 08:01:53 +00:00
plstate - > viewangles [ 0 ] = SHORT2ANGLE ( state - > u . q1 . vangle [ 0 ] ) ;
plstate - > viewangles [ 1 ] = SHORT2ANGLE ( state - > u . q1 . vangle [ 1 ] ) ;
plstate - > viewangles [ 2 ] = SHORT2ANGLE ( state - > u . q1 . vangle [ 2 ] ) ;
2016-07-12 00:40:13 +00:00
if ( ! state - > u . q1 . gravitydir [ 0 ] & & ! state - > u . q1 . gravitydir [ 1 ] )
VectorSet ( plstate - > gravitydir , 0 , 0 , - 1 ) ;
else
{
added r_meshpitch cvar that allows for fixing the unfixable mesh pitch bug from vanilla... needs a better name... do note that this will break pretty much any mod, so this is really only for TCs designed to use it. Its likely that I missed places.
nqsv: added support for spectators with nq clients. the angles are a bit rough, but hey. need to do something about frags so nq clients know who's a spectator. use 'cmd observe' to get an nq client to spectate on an fte server (then attack/jump behave the same as in qw clients).
nqsv: rewrote EF_MUZZLEFLASH handling, so svc_muzzleflash is now translated properly to EF_MUZZLEFLASH, and vice versa. No more missing muzzleflashes!
added screenshot_cubemap, so you can actually pre-generate cubemaps with fte (which can be used for reflections or whatever).
misc fixes (server crash, a couple of other less important ones).
external files based on a model's name will now obey r_replacemodels properly, instead of needing to use foo.mdl_0.skin for foo.md3.
identify <playernum> should now use the correct masked ip, instead of abrubtly failing (reported by kt)
vid_toggle console command should now obey vid_width and vid_height when switching to fullscreen, but only if vid_fullscreen is actually set, which should make it seem better behaved (reported by kt).
qcc: cleaned up sym->symboldata[sym->ofs] to be more consistent at all stages.
qcc: typedef float vec4[4]; now works to define a float array with 4 elements (however, it will be passed by-value rather than by-reference).
qcc: cleaned up optional vs __out ordering issues.
qccgui: shift+f3 searches backwards
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5064 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-02-27 09:34:35 +00:00
a [ 0 ] = ( ( 192 + state - > u . q1 . gravitydir [ 0 ] ) / 256.0f ) * 360 ;
2016-07-12 00:40:13 +00:00
a [ 1 ] = ( state - > u . q1 . gravitydir [ 1 ] / 256.0f ) * 360 ;
a [ 2 ] = 0 ;
AngleVectors ( a , plstate - > gravitydir , NULL , NULL ) ;
}
2012-07-05 19:42:36 +00:00
2016-07-12 00:40:13 +00:00
if ( ! state - > solidsize | | ! ( cls . fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS ) )
2015-01-21 18:18:37 +00:00
{
VectorSet ( plstate - > szmins , - 16 , - 16 , - 24 ) ;
VectorSet ( plstate - > szmaxs , 16 , 16 , 32 ) ;
}
else
2016-07-12 00:40:13 +00:00
CL_DecodeStateSize ( state - > solidsize , state - > modelindex , plstate - > szmins , plstate - > szmaxs ) ;
2012-02-12 05:18:31 +00:00
}
2013-09-06 22:57:44 +00:00
static void CL_EntStateToPlayerCommand ( usercmd_t * cmd , entity_state_t * state , float age )
{
int msec ;
float extra ;
memset ( cmd , 0 , sizeof ( * cmd ) ) ;
extra = /*-cls.latency + */ 0.02 ; //network latency
extra + = age ; //if the state is not exactly current
// extra += realtime - cl.inframes[cl.validsequence&UPDATE_MASK].receivedtime;
// extra += (cl.inframes[cl.validsequence&UPDATE_MASK].receivedtime - cl.inframes[cl.oldvalidsequence&UPDATE_MASK].receivedtime)*4;
msec = 1000 * extra ;
2013-11-21 23:02:28 +00:00
// Con_DPrintf("%i: age = %i, stale=%i\n", state->number, msec, state->u.q1.msec);
2013-09-06 22:57:44 +00:00
msec + = state - > u . q1 . msec ; //this is the age on the server
cmd - > msec = bound ( 0 , msec , 250 ) ;
cmd - > forwardmove = state - > u . q1 . movement [ 0 ] ;
cmd - > sidemove = state - > u . q1 . movement [ 1 ] ;
cmd - > upmove = state - > u . q1 . movement [ 2 ] ;
2015-02-02 08:01:53 +00:00
cmd - > angles [ 0 ] = state - > u . q1 . vangle [ 0 ] ; // * -3 *65536/360.0;
cmd - > angles [ 1 ] = state - > u . q1 . vangle [ 1 ] ; // * 65536/360.0;
cmd - > angles [ 2 ] = state - > u . q1 . vangle [ 2 ] ; // * 65536/360.0;
2013-09-06 22:57:44 +00:00
}
2012-02-12 05:18:31 +00:00
2013-09-06 22:57:44 +00:00
void CL_PredictEntityMovement ( entity_state_t * estate , float age )
2012-02-12 05:18:31 +00:00
{
2013-09-06 22:57:44 +00:00
player_state_t startstate , resultstate ;
2012-02-12 05:18:31 +00:00
usercmd_t cmd ;
2013-09-06 22:57:44 +00:00
int oldphysent ;
2015-01-21 18:18:37 +00:00
extern cvar_t cl_predict_players ;
2013-09-06 22:57:44 +00:00
//build the entitystate state into a player state for prediction to use
2012-02-12 05:18:31 +00:00
2015-01-21 18:18:37 +00:00
if ( ! estate - > u . q1 . pmovetype | | ! cl_predict_players . ival | | age < = 0 )
2013-09-06 22:57:44 +00:00
VectorCopy ( estate - > origin , estate - > u . q1 . predorg ) ;
else
2012-02-12 05:18:31 +00:00
{
2014-08-25 07:35:41 +00:00
VectorClear ( startstate . velocity ) ;
startstate . onground = false ;
2017-07-28 01:49:25 +00:00
startstate . jump_held = false ;
2020-10-26 06:30:35 +00:00
startstate . flags = 0 ;
2013-09-06 22:57:44 +00:00
CL_EntStateToPlayerState ( & startstate , estate ) ;
CL_EntStateToPlayerCommand ( & cmd , estate , age ) ;
2012-02-12 05:18:31 +00:00
2013-09-06 22:57:44 +00:00
// cmd.forwardmove = 5000;
// cmd.msec = sin(realtime*6) * 128 + 128;
oldphysent = pmove . numphysent ;
2019-03-01 22:39:30 +00:00
pmove . onground = startstate . onground ;
2013-09-06 22:57:44 +00:00
CL_PredictUsercmd ( 0 , estate - > number , & startstate , & resultstate , & cmd ) ; //uses player 0's maxspeed/grav...
pmove . numphysent = oldphysent ;
2012-02-12 05:18:31 +00:00
2013-09-06 22:57:44 +00:00
VectorCopy ( resultstate . origin , estate - > u . q1 . predorg ) ;
}
2012-02-12 05:18:31 +00:00
}
2021-06-21 13:46:52 +00:00
float CL_GetPredictionRealtime ( playerview_t * pv )
2004-08-23 00:15:46 +00:00
{
2021-06-21 13:46:52 +00:00
float simtime ;
//these are to make svc_viewentity work better
2013-03-12 22:53:23 +00:00
float netfps = cl_netfps . value ;
2013-07-26 17:19:06 +00:00
2013-03-12 22:53:23 +00:00
if ( ! netfps )
{
//every video frame has its own input frame.
simtime = realtime ;
}
else
{
2013-09-06 22:57:44 +00:00
qboolean extrap = cl_predict_extrapolate . ival ;
// float fps = 1/host_frametime;
// fps = bound(6.7, fps, cls.maxfps);
2013-03-12 22:53:23 +00:00
netfps = bound ( 6.7 , netfps , cls . maxfps ) ;
2013-09-06 22:57:44 +00:00
// if (netfps > fps)
// netfps = fps;
if ( ! * cl_predict_extrapolate . string )
extrap = netfps < 30 ;
2017-08-29 02:29:06 +00:00
if ( cls . protocol = = CP_NETQUAKE & & CPNQ_IS_DP )
extrap = true ; //DP servers do a nasty thing where they send packets without any entities. This messes with our timings. Its much smoother to just always use extrapolation in this case (otherwise we'd have to backdate too much for prediction to do much).
2013-09-06 22:57:44 +00:00
if ( ! extrap )
2013-03-12 22:53:23 +00:00
{
//interpolate. The input rate is completely smoothed out, at the cost of some latency.
//You can still get juddering if the video rate doesn't match the monitor refresh rate (and isn't so high that it doesn't matter).
//note that the code below will back-date input frames if the server acks too fast.
2017-08-29 02:29:06 +00:00
simtime = realtime - ( 1.0 / netfps ) ;
2013-03-12 22:53:23 +00:00
}
2013-09-06 22:57:44 +00:00
else
{
//extrapolate if we've a low net rate. This should reduce apparent lag, but will be jerky if the net rate is not an (inverse) multiple of the monitor rate.
//this is in addition to any monitor desync.
simtime = realtime ;
}
2013-03-12 22:53:23 +00:00
}
2009-04-01 22:03:56 +00:00
2015-06-28 03:43:10 +00:00
if ( cls . demoplayback = = DPB_QUAKEWORLD | | pv - > cam_state = = CAM_EYECAM )
2017-08-29 02:29:06 +00:00
simtime - = cls . latency ; //push back when playing demos.
2013-09-06 22:57:44 +00:00
simtime + = bound ( - 0.5 , cl_predict_timenudge . value , 0.5 ) ;
2021-06-21 13:46:52 +00:00
return simtime ;
}
2023-04-14 01:50:19 +00:00
qboolean CSQC_GetSSQCEntityOrigin ( unsigned int ssqcent , float * out ) ;
2021-06-21 13:46:52 +00:00
/*
= = = = = = = = = = = = = =
CL_PredictMove
= = = = = = = = = = = = = =
*/
void CL_PredictMovePNum ( int seat )
{
//when this is called, the entity states have been interpolated.
//interpolation state should be updated to match prediction state, so entities move correctly in mirrors/portals.
//this entire function is pure convolouted bollocks.
struct {
int frame ;
double time ;
player_state_t * state ;
usercmd_t * cmd ;
} from , to ;
playerview_t * pv = & cl . playerview [ seat ] ;
int i ;
float f ;
outframe_t * backdate ;
player_state_t framebuf [ 2 ] ; //need two framebufs so we can interpolate between two states.
static player_state_t nullstate ;
int oldphysent ;
double simtime ; //this is server time if nopred is set (lerp-only), and local time if we're predicting
extern cvar_t cl_netfps ;
lerpents_t * le ;
qboolean nopred ;
qboolean lerpangles = false ;
int trackent ;
qboolean cam_nowlocked = false ;
usercmd_t indcmd ;
simtime = CL_GetPredictionRealtime ( pv ) ;
2013-06-23 02:17:02 +00:00
pv - > nolocalplayer = ! ! ( cls . fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS ) | | ( cls . protocol ! = CP_QUAKEWORLD ) ;
2009-04-01 22:03:56 +00:00
2017-05-28 15:42:32 +00:00
if ( ! pv - > spectator & & ( pv - > cam_state ! = CAM_FREECAM | | pv - > cam_spec_track ! = - 1 ) ) //just in case
2015-06-24 17:59:57 +00:00
{
2015-07-03 02:07:41 +00:00
if ( pv - > cam_state ! = CAM_FREECAM )
pv - > viewentity = ( cls . demoplayback ) ? 0 : ( pv - > playernum + 1 ) ;
2015-06-22 11:49:15 +00:00
pv - > cam_state = CAM_FREECAM ;
2015-06-24 17:59:57 +00:00
pv - > cam_spec_track = - 1 ;
}
2015-06-22 11:49:15 +00:00
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
{
2014-10-05 20:04:11 +00:00
if ( ! cl . worldmodel | | cl . worldmodel - > loadstate ! = MLS_LOADED )
2006-09-17 00:59:22 +00:00
return ;
2013-06-23 02:17:02 +00:00
pv - > crouch = 0 ;
2016-01-18 05:22:07 +00:00
CLQ2_PredictMovement ( seat ) ;
2004-08-23 00:15:46 +00:00
return ;
}
# endif
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
if ( cl . paused & & ! ( cls . demoplayback ! = DPB_MVD ) & & pv - > cam_state = = CAM_FREECAM )
2004-08-23 00:15:46 +00:00
return ;
2005-05-26 12:55:34 +00:00
2013-07-26 17:19:06 +00:00
if ( ! cl . validsequence )
2004-08-23 00:15:46 +00:00
{
return ;
}
2015-09-01 04:45:15 +00:00
if ( cl . intermissionmode = = IM_QWSCORES )
2004-08-23 00:15:46 +00:00
{
2013-09-06 22:57:44 +00:00
//quakeworld locks view position once you hit intermission.
2013-07-26 17:19:06 +00:00
VectorCopy ( pv - > intermissionangles , pv - > simangles ) ;
2004-08-23 00:15:46 +00:00
return ;
}
2015-09-01 04:45:15 +00:00
else if ( cl . intermissionmode ! = IM_NONE )
2015-08-20 03:17:47 +00:00
lerpangles = false ; //will do angles later.
2013-07-26 17:19:06 +00:00
else
{
if ( cl . currentpackentities & & cl . currentpackentities - > fixangles [ seat ] )
{
if ( cl . previouspackentities & & cl . previouspackentities - > fixangles [ seat ] = = cl . currentpackentities - > fixangles [ seat ] )
{
for ( i = 0 ; i < 3 ; i + + )
pv - > simangles [ i ] = LerpAngles360 ( cl . currentpackentities - > fixedangles [ seat ] [ i ] , cl . previouspackentities - > fixedangles [ seat ] [ i ] , 1 - ( cl . previouspackentities - > fixangles [ seat ] ? cl . packfrac : 1 ) ) ;
}
else
VectorCopy ( cl . currentpackentities - > fixedangles [ seat ] , pv - > simangles ) ;
2015-06-05 09:04:05 +00:00
2017-09-21 12:22:16 +00:00
if ( cls . demoplayback )
VectorCopy ( pv - > simangles , pv - > viewangles ) ;
2015-06-05 09:04:05 +00:00
if ( cl . currentpackentities - > fixangles [ seat ] = = 2 )
lerpangles = ( cls . demoplayback = = DPB_QUAKEWORLD ) ;
2013-07-26 17:19:06 +00:00
}
else
2015-06-05 09:04:05 +00:00
{
lerpangles = ( cls . demoplayback = = DPB_QUAKEWORLD ) ;
2021-05-09 13:02:49 +00:00
VectorCopy ( pv - > aimangles , pv - > simangles ) ;
2015-06-05 09:04:05 +00:00
}
2004-08-23 00:15:46 +00:00
}
2015-06-22 11:49:15 +00:00
//if we now know where our target player is, we can finally lock on to them.
if ( pv - > cam_state = = CAM_PENDING & & pv - > cam_spec_track > = 0 & & pv - > cam_spec_track < cl . allocated_client_slots & & pv - > viewentity ! = pv - > cam_spec_track + 1 )
2014-04-24 01:53:01 +00:00
{
2015-06-22 11:49:15 +00:00
if ( ( cl . inframes [ cl . validsequence & UPDATE_MASK ] . playerstate [ pv - > cam_spec_track ] . messagenum = = cl . validsequence ) | |
2023-04-14 01:50:19 +00:00
( pv - > cam_spec_track + 1 < cl . maxlerpents & & cl . lerpents [ pv - > cam_spec_track + 1 ] . sequence = = cl . lerpentssequence ) | |
CSQC_GetSSQCEntityOrigin ( pv - > cam_spec_track + 1 , NULL ) )
2014-04-24 01:53:01 +00:00
{
2015-06-22 11:49:15 +00:00
pv - > cam_state = CAM_EYECAM ;
2014-04-24 01:53:01 +00:00
pv - > viewentity = pv - > cam_spec_track + 1 ;
2015-06-22 11:49:15 +00:00
cam_nowlocked = true ;
2014-04-24 01:53:01 +00:00
}
}
2015-06-22 11:49:15 +00:00
if ( pv - > cam_state = = CAM_WALLCAM )
trackent = pv - > cam_spec_track + 1 ;
else
trackent = pv - > viewentity ;
2013-09-06 22:57:44 +00:00
nopred = cl_nopred . ival ;
2013-07-26 17:19:06 +00:00
//don't wrap
2013-09-06 22:57:44 +00:00
if ( ! cl . ackedmovesequence )
nopred = true ;
else if ( cl . movesequence - cl . ackedmovesequence > = UPDATE_BACKUP - 1 )
2015-10-27 15:20:15 +00:00
nopred = true ;
2004-08-23 00:15:46 +00:00
2013-09-06 22:57:44 +00:00
//these things also force-disable prediction
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
if ( cls . demoplayback = = DPB_MVD | |
2015-09-01 04:45:15 +00:00
cl . intermissionmode ! = IM_NONE | | cl . paused | | pv - > pmovetype = = PM_NONE | | pv - > pmovetype = = PM_FREEZE | | CAM_ISLOCKED ( pv ) )
2013-09-06 22:57:44 +00:00
{
nopred = true ;
}
// figure out the first frame to lerp from.
// we generate one new input frame every 1/72th of a second, with a refresh rate of 60hz that's blatently obvious
// if we live in the present, we'll only have half a frame. in order to avoid extrapolation (which can give a swimmy feel), we live in the past by one frame time period
// if we're running somewhere with a low latency, we can get a reply from the server before our next input frame is even generated, so we need to go backwards beyond the current state
2004-08-23 00:15:46 +00:00
2013-09-06 22:57:44 +00:00
if ( nopred )
2004-08-23 00:15:46 +00:00
{
2019-10-06 01:59:13 +00:00
lerpangles = false ;
2013-09-06 22:57:44 +00:00
//match interpolation info
2019-09-25 20:23:24 +00:00
from . frame = ( ( char * ) cl . previouspackentities - ( char * ) & cl . inframes [ 0 ] . packet_entities ) / sizeof ( inframe_t ) ;
from . time = cl . inframes [ from . frame & UPDATE_MASK ] . packet_entities . servertime ;
to . frame = ( ( char * ) cl . currentpackentities - ( char * ) & cl . inframes [ 0 ] . packet_entities ) / sizeof ( inframe_t ) ;
to . time = cl . inframes [ to . frame & UPDATE_MASK ] . packet_entities . servertime ;
2013-09-06 22:57:44 +00:00
simtime = cl . currentpacktime ;
2019-09-25 20:23:24 +00:00
to . cmd = from . cmd = NULL ;
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
}
2013-09-06 22:57:44 +00:00
else
2009-03-03 01:52:30 +00:00
{
2019-09-25 20:23:24 +00:00
to . frame = from . frame = 0 ;
to . time = from . time = 0 ;
to . cmd = from . cmd = NULL ;
2013-09-06 22:57:44 +00:00
//try to find the inbound frame that sandwiches the realtime that we're trying to simulate.
//if we're predicting, this will be some time in the future, and thus we'll be forced to pick the most recent frame.
//if we're interpolating, we'll need to grab the frame before that.
//we're only interested in inbound frames, not outbound, but its outbound frames that contain the prediction timing, so we need to look that up
//(note that in qw, inframe[i].ack==i holds true, but this code tries to be generic for unsyncronised protocols)
//(note that in nq, using outbound times means we'll skip over dupe states without noticing, and input packets with dupes should also be handled gracefully)
2015-03-03 00:14:43 +00:00
// Con_DPrintf("in:%i:%i out:%i:%i ack:%i\n", cls.netchan.incoming_sequence, cl.validsequence, cls.netchan.outgoing_sequence,cl.movesequence, cl.ackedmovesequence);
2013-09-06 22:57:44 +00:00
for ( i = cl . validsequence ; i > = cls . netchan . incoming_sequence - UPDATE_MASK ; i - - )
2009-03-03 01:52:30 +00:00
{
2013-09-06 22:57:44 +00:00
int out ;
//skip frames which were not received, or are otherwise invalid. yay packetloss
if ( cl . inframes [ i & UPDATE_MASK ] . frameid ! = i | | cl . inframes [ i & UPDATE_MASK ] . invalid )
{
2015-03-03 00:14:43 +00:00
// Con_DPrintf("stale incoming command %i\n", i);
2013-09-06 22:57:44 +00:00
continue ;
}
//each inbound frame tracks the outgoing frame that was last applied to it, and its outgoing frames that contain our timing info
out = cl . inframes [ i & UPDATE_MASK ] . ackframe ;
backdate = & cl . outframes [ out & UPDATE_MASK ] ;
if ( backdate - > cmd_sequence ! = out )
{
2015-03-03 00:14:43 +00:00
// Con_DPrintf("stale outgoing command %i (%i:%i:%i)\n", i, out, backdate->cmd_sequence, backdate->server_message_num);
2013-09-06 22:57:44 +00:00
continue ;
}
//okay, looks valid
//if this is the first one we found, make sure both from+to are set properly
2019-09-25 20:23:24 +00:00
if ( ! from . frame )
2013-09-06 22:57:44 +00:00
{
2019-09-25 20:23:24 +00:00
from . frame = i ;
from . time = backdate - > senttime ;
2013-09-06 22:57:44 +00:00
}
2019-09-25 20:23:24 +00:00
to = from ;
to . state = NULL ;
from . frame = i ;
from . time = backdate - > senttime ;
from . cmd = & backdate - > cmd [ seat ] ;
2020-05-14 15:50:26 +00:00
if ( cl . inframes [ to . frame & UPDATE_MASK ] . ackframe > pv - > prop . sequence )
2019-09-25 20:23:24 +00:00
continue ; //if we didn't predict to this frame yet, then the waterjump etc state will be invalid, so try to go for an older frame so that it actually propagates properly.
if ( from . time < simtime & & from . frame ! = to . frame )
2013-09-06 22:57:44 +00:00
break ; //okay, we found the first frame that is older, no need to continue looking
2009-03-03 01:52:30 +00:00
}
}
2015-03-03 00:14:43 +00:00
// Con_DPrintf("sim%f, %i(%i-%i): old%f, cur%f\n", simtime, cl.ackedmovesequence, fromframe, toframe, fromtime, totime);
2009-03-03 01:52:30 +00:00
2015-06-22 11:49:15 +00:00
if ( ( pv - > cam_state = = CAM_WALLCAM | | pv - > cam_state = = CAM_EYECAM ) & & trackent & & trackent < = cl . allocated_client_slots )
2013-10-21 05:20:13 +00:00
{
2019-09-25 20:23:24 +00:00
from . state = & cl . inframes [ from . frame & UPDATE_MASK ] . playerstate [ trackent - 1 ] ;
to . state = & cl . inframes [ to . frame & UPDATE_MASK ] . playerstate [ trackent - 1 ] ;
2013-10-21 05:20:13 +00:00
}
else
{
Added sys_openfile console command(and menu option) to web and flatpak(via cmake+dbus) builds, to 'install' packages on sandboxed systems a bit more easily.
Cmake: Add FTE_WERROR option, defaults to true in debug builds and off in release builds (in case future compilers have issues).
Cmake: Pull in libXscreensaver so we don't get interrupted by screensavers when playing demos.
Make: Added `make webcl-rel` for a web build without server bloat (eg for sites focused on demo playback. Yes, this means you XantoM).
fteqcc: Include the decompiler in fteqcc (non-gui) builds ('-d' arg).
fteqcc: Decompiler can now mostly handle hexen2 mods without any unknown opcodes.
Allow ezHud and OpenSSL to be compiled as in-engine plugins, potentially for web and windows ports respectively.
Web: Fix support for ogg vorbis. Add support for voip.
Web: Added basic support for WebXR.
QTV: Don't try seeking on unseekable qtv streams. Don't spam when developer 1 is set.
QTV: add support for some eztv extensions.
MVD: added hack to use ktx's vweps in mvd where mvdsv doesn't bother to record the info.
qwfwd: hack around a hack in qwfwd, allowing it to work again.
recording: favour qwd in single player, instead of mvd.
Protocol: reduce client memory used for precache names. Bump maximum precache counts - some people are just abusive, yes you Orl.
hexen2: add enough clientside protocol compat to play the demo included with h2mp. lacks effects.
in_xflip: restored this setting.
fs_hidesyspaths: new cvar, defaults to enabled so you won't find your username or whatever turning up in screenshots or the like. change it to 0 before debuging stuff eg via 'path'.
gl_overbright_models: Added cvar to match QS.
netchan: Added MTU determination, we'll no longer fail to connect when routers stupidly drop icmp packets.
Win: try a few other versions of xinput too.
CSQC: Added a CSQC_GenerateMaterial function, to give the csqc a chance to generate custom materials.
MenuQC: Added support for the skeletal objects API.
2024-04-09 17:13:59 +00:00
if ( cls . demoplayback = = DPB_MVD )
2013-10-21 05:20:13 +00:00
{
2018-11-04 08:38:27 +00:00
pv - > nolocalplayer = false ;
2019-09-25 20:23:24 +00:00
from . state = & cl . inframes [ cl . ackedmovesequence & UPDATE_MASK ] . playerstate [ pv - > playernum ] ;
to . state = & cl . inframes [ cl . movesequence & UPDATE_MASK ] . playerstate [ pv - > playernum ] ;
2013-10-21 05:20:13 +00:00
}
else
{
2019-09-25 20:23:24 +00:00
from . state = & cl . inframes [ from . frame & UPDATE_MASK ] . playerstate [ pv - > playernum ] ;
to . state = & cl . inframes [ to . frame & UPDATE_MASK ] . playerstate [ pv - > playernum ] ;
2013-10-21 05:20:13 +00:00
}
}
2019-09-25 20:23:24 +00:00
pv - > pmovetype = to . state - > pm_type ;
2013-09-06 22:57:44 +00:00
le = & cl . lerpplayers [ pv - > playernum ] ;
2019-09-25 20:23:24 +00:00
if ( ! from . cmd )
from . cmd = & cl . outframes [ from . frame & UPDATE_MASK ] . cmd [ pv - > playernum ] ;
if ( ! to . cmd )
to . cmd = & cl . outframes [ to . frame & UPDATE_MASK ] . cmd [ pv - > playernum ] ;
2015-06-05 09:04:05 +00:00
2013-09-06 22:57:44 +00:00
//if our network protocol doesn't have a concept of separate players, make sure our player states are updated from those entities
//fixme: use entity states instead of player states to avoid the extra work here
2019-06-05 20:48:06 +00:00
if ( pv - > nolocalplayer )
2004-08-23 00:15:46 +00:00
{
2013-09-06 22:57:44 +00:00
packet_entities_t * pe ;
2019-09-25 20:23:24 +00:00
pe = & cl . inframes [ from . frame & UPDATE_MASK ] . packet_entities ;
2020-10-26 06:30:35 +00:00
if ( ! pe - > num_entities & & ! from . frame )
pe = & cl . inframes [ to . frame & UPDATE_MASK ] . packet_entities ;
2013-09-06 22:57:44 +00:00
for ( i = 0 ; i < pe - > num_entities ; i + + )
2011-12-23 03:12:29 +00:00
{
2015-06-22 11:49:15 +00:00
if ( pe - > entities [ i ] . number = = trackent )
2013-07-26 17:19:06 +00:00
{
2019-09-25 20:23:24 +00:00
CL_EntStateToPlayerState ( from . state , & pe - > entities [ i ] ) ;
2014-04-13 04:23:13 +00:00
if ( nopred )
2019-09-25 20:23:24 +00:00
from . time - = ( pe - > entities [ i ] . u . q1 . msec / 1000.0f ) ; //correct the time to match stale players
2013-09-06 22:57:44 +00:00
break ;
2013-07-26 17:19:06 +00:00
}
2013-09-06 22:57:44 +00:00
}
2017-11-23 07:46:39 +00:00
if ( i = = pe - > num_entities & & pv - > nolocalplayer )
{
2020-05-14 15:50:26 +00:00
if ( cls . state > = ca_active )
return ; //no player, nothing makes sense any more.
2019-09-25 20:23:24 +00:00
from . state = & nullstate ;
2017-11-23 07:46:39 +00:00
nopred = true ;
}
2019-09-25 20:23:24 +00:00
pe = & cl . inframes [ to . frame & UPDATE_MASK ] . packet_entities ;
2013-09-06 22:57:44 +00:00
for ( i = 0 ; i < pe - > num_entities ; i + + )
{
2015-06-22 11:49:15 +00:00
if ( pe - > entities [ i ] . number = = trackent )
2013-07-26 17:19:06 +00:00
{
2019-09-25 20:23:24 +00:00
CL_EntStateToPlayerState ( to . state , & pe - > entities [ i ] ) ;
2014-04-13 04:23:13 +00:00
if ( nopred )
2019-09-25 20:23:24 +00:00
to . time - = ( pe - > entities [ i ] . u . q1 . msec / 1000.0f ) ; //correct the time to match stale players. FIXME: this can push the simtime into the 'future' resulting in stuttering
2013-09-06 22:57:44 +00:00
if ( cls . fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS )
{
2015-09-01 04:45:15 +00:00
# ifdef QUAKESTATS
2016-10-22 07:06:51 +00:00
//putting weapon frames in there was a stupid idea. qwisms I guess.
2015-01-21 18:18:37 +00:00
if ( ! ( cls . fteprotocolextensions2 & PEXT2_PREDINFO ) )
{
pv - > stats [ STAT_WEAPONFRAME ] = cl . players [ pv - > playernum ] . stats [ STAT_WEAPONFRAME ] = pe - > entities [ i ] . u . q1 . weaponframe ;
pv - > statsf [ STAT_WEAPONFRAME ] = cl . players [ pv - > playernum ] . statsf [ STAT_WEAPONFRAME ] = pe - > entities [ i ] . u . q1 . weaponframe ;
}
2015-09-01 04:45:15 +00:00
# endif
2019-09-25 20:23:24 +00:00
pv - > pmovetype = to . state - > pm_type ;
2013-09-06 22:57:44 +00:00
}
break ;
2013-07-26 17:19:06 +00:00
}
2011-12-23 03:12:29 +00:00
}
2017-11-23 07:46:39 +00:00
if ( i = = pe - > num_entities & & pv - > nolocalplayer )
{
2019-09-25 20:23:24 +00:00
to . state = & nullstate ;
2017-11-23 07:46:39 +00:00
nopred = true ;
}
2015-06-22 11:49:15 +00:00
if ( pv - > nolocalplayer & & trackent < cl . maxlerpents )
2017-11-23 07:46:39 +00:00
{
2015-06-22 11:49:15 +00:00
le = & cl . lerpents [ trackent ] ;
2017-11-23 07:46:39 +00:00
if ( le - > sequence ! = cl . lerpentssequence )
nopred = true ; //err, guys, this guy ain't valid... we don't know who we are! no point predicting.
}
2004-08-23 00:15:46 +00:00
}
// predict forward until cl.time <= to->senttime
oldphysent = pmove . numphysent ;
2012-02-12 05:18:31 +00:00
CL_SetSolidPlayers ( ) ;
2015-06-22 11:49:15 +00:00
pmove . skipent = trackent ;
2004-08-23 00:15:46 +00:00
2013-10-21 05:20:13 +00:00
//just in case we don't run any prediction
2019-09-25 20:23:24 +00:00
VectorCopy ( to . state - > gravitydir , pmove . gravitydir ) ;
2013-10-21 05:20:13 +00:00
2019-07-29 05:28:20 +00:00
//if all else fails...
2019-09-25 20:23:24 +00:00
pmove . pm_type = to . state - > pm_type ;
pmove . onground = to . state - > onground ;
VectorCopy ( to . state - > szmins , pmove . player_mins ) ;
VectorCopy ( to . state - > szmaxs , pmove . player_maxs ) ;
2019-07-29 05:28:20 +00:00
if ( ! nopred )
2019-09-25 20:23:24 +00:00
{
int stopframe ;
//Con_Printf("Pred %i to %i\n", to.frame+1, min(from.frame+UPDATE_BACKUP, cl.movesequence));
2020-05-14 15:50:26 +00:00
//fix up sequence numbers for nq
int validsequence = cl . inframes [ cl . validsequence & UPDATE_MASK ] . ackframe ;
from . frame = cl . inframes [ from . frame & UPDATE_MASK ] . ackframe ;
to . frame = cl . inframes [ to . frame & UPDATE_MASK ] . ackframe ;
2019-09-25 20:23:24 +00:00
for ( i = to . frame + 1 , stopframe = min ( from . frame + UPDATE_BACKUP , cl . movesequence ) ; i < stopframe ; i + + )
2012-07-21 04:43:31 +00:00
{
2019-09-25 20:23:24 +00:00
outframe_t * of = & cl . outframes [ i & UPDATE_MASK ] ;
if ( to . time > = simtime )
2013-09-06 22:57:44 +00:00
break ;
2019-09-25 20:23:24 +00:00
if ( of - > cmd_sequence ! = i )
2013-09-06 22:57:44 +00:00
{
2013-10-21 05:20:13 +00:00
// Con_DPrintf("trying to predict a frame which is no longer valid\n");
2013-09-06 22:57:44 +00:00
break ;
}
2019-09-25 20:23:24 +00:00
//okay, move it forward a frame.
from = to ;
2005-10-01 03:09:17 +00:00
2019-09-25 20:23:24 +00:00
to . cmd = & of - > cmd [ seat ] ;
to . time = of - > senttime ;
to . frame = i ; //qw debug
to . state = & framebuf [ to . frame & 1 ] ;
2012-01-24 04:24:14 +00:00
2019-09-25 20:23:24 +00:00
if ( from . frame = = pv - > prop . sequence & & pv - > prop . sequence )
{
if ( ! ( cls . z_ext & Z_EXT_PF_ONGROUND ) )
from . state - > onground = pv - > prop . onground ;
if ( ! ( cls . z_ext & Z_EXT_PM_TYPE ) )
from . state - > jump_held = pv - > prop . jump_held ;
from . state - > jump_msec = pv - > prop . jump_msec ;
from . state - > waterjumptime = pv - > prop . waterjumptime ;
if ( ! ( cls . fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS ) )
VectorCopy ( pv - > prop . gravitydir , from . state - > gravitydir ) ;
}
CL_PredictUsercmd ( seat , trackent , from . state , to . state , to . cmd ) ;
2020-05-14 15:50:26 +00:00
if ( i < = validsequence & & simtime > = to . time )
2019-09-25 20:23:24 +00:00
{ //this frame is final keep track of our propagated values.
pv - > prop . onground = pmove . onground ;
pv - > prop . jump_held = pmove . jump_held ;
pv - > prop . jump_msec = pmove . jump_msec ;
pv - > prop . waterjumptime = pmove . waterjumptime ;
VectorCopy ( pmove . gravitydir , pv - > prop . gravitydir ) ;
pv - > prop . sequence = i ;
}
2005-10-01 03:09:17 +00:00
}
2019-09-25 20:23:24 +00:00
if ( simtime > to . time )
2005-10-01 03:09:17 +00:00
{
2013-09-06 22:57:44 +00:00
//extrapolate X extra seconds
float msec ;
2005-10-01 03:09:17 +00:00
2019-09-25 20:23:24 +00:00
msec = ( ( simtime - to . time ) * 1000 ) ;
2013-09-06 22:57:44 +00:00
if ( msec > = 1 )
2012-01-24 04:24:14 +00:00
{
2019-09-25 20:23:24 +00:00
from = to ;
2005-11-26 03:02:55 +00:00
2017-08-29 02:29:06 +00:00
if ( cl_pendingcmd [ seat ] . msec & & ! cls . demoplayback )
indcmd = cl_pendingcmd [ seat ] ;
2013-09-06 22:57:44 +00:00
else
2019-09-25 20:23:24 +00:00
indcmd = * to . cmd ;
to . cmd = & indcmd ;
to . time = simtime ;
to . frame + = 1 ;
to . state = & framebuf [ to . frame & 1 ] ;
2012-02-12 05:18:31 +00:00
2015-06-05 09:04:05 +00:00
if ( cls . demoplayback )
{
extern cvar_t cl_demospeed ;
msec * = cl_demospeed . value ;
}
2019-09-25 20:23:24 +00:00
to . cmd - > msec = bound ( 0 , msec , 250 ) ;
if ( from . frame = = pv - > prop . sequence & & pv - > prop . sequence )
{ //overwrite non-networked state, to propagate it as required.
if ( ! ( cls . z_ext & Z_EXT_PF_ONGROUND ) )
from . state - > onground = pv - > prop . onground ;
if ( ! ( cls . z_ext & Z_EXT_PM_TYPE ) )
from . state - > jump_held = pv - > prop . jump_held ;
from . state - > jump_msec = pv - > prop . jump_msec ;
from . state - > waterjumptime = pv - > prop . waterjumptime ;
if ( ! ( cls . fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS ) )
VectorCopy ( pv - > prop . gravitydir , from . state - > gravitydir ) ;
}
2014-08-15 02:20:41 +00:00
// Con_DPrintf(" extrap %i: %f-%f (%g)\n", toframe, fromtime, simtime, simtime-fromtime);
2019-09-25 20:23:24 +00:00
CL_PredictUsercmd ( seat , trackent , from . state , to . state , to . cmd ) ;
2013-09-06 22:57:44 +00:00
}
2012-02-12 05:18:31 +00:00
}
2013-06-23 02:17:02 +00:00
pv - > onground = pmove . onground ;
2019-09-25 20:23:24 +00:00
pv - > pmovetype = to . state - > pm_type ;
2004-08-23 00:15:46 +00:00
}
pmove . numphysent = oldphysent ;
2019-09-25 20:23:24 +00:00
if ( to . time = = from . time )
2004-08-23 00:15:46 +00:00
{
2019-09-25 20:23:24 +00:00
VectorCopy ( to . state - > velocity , pv - > simvel ) ;
VectorCopy ( to . state - > origin , pv - > simorg ) ;
2013-10-21 05:20:13 +00:00
2015-06-22 11:49:15 +00:00
if ( trackent & & trackent ! = pv - > playernum + 1 & & pv - > cam_state = = CAM_EYECAM )
2019-09-25 20:23:24 +00:00
VectorCopy ( to . state - > viewangles , pv - > simangles ) ;
2013-10-21 05:20:13 +00:00
//Con_DPrintf("%f %f %f\n", fromtime, simtime, totime);
2004-08-23 00:15:46 +00:00
}
else
{
2013-09-06 22:57:44 +00:00
vec3_t move ;
2004-08-23 00:15:46 +00:00
// now interpolate some fraction of the final frame
2019-09-25 20:23:24 +00:00
f = ( simtime - from . time ) / ( to . time - from . time ) ;
2004-08-23 00:15:46 +00:00
2013-03-12 22:53:23 +00:00
if ( f < 0 )
f = 0 ;
if ( f > 1 )
f = 1 ;
2013-10-21 05:20:13 +00:00
//Con_DPrintf("%i:%f %f %i:%f (%f)\n", fromframe, fromtime, simtime, toframe, totime, f);
2019-09-25 20:23:24 +00:00
VectorSubtract ( to . state - > origin , from . state - > origin , move ) ;
2013-09-06 22:57:44 +00:00
if ( DotProduct ( move , move ) > 128 * 128 )
2004-08-23 00:15:46 +00:00
{
2013-09-06 22:57:44 +00:00
// teleported, so don't lerp
2019-09-25 20:23:24 +00:00
VectorCopy ( to . state - > velocity , pv - > simvel ) ;
VectorCopy ( to . state - > origin , pv - > simorg ) ;
2013-09-06 22:57:44 +00:00
}
else
{
for ( i = 0 ; i < 3 ; i + + )
{
2019-09-25 20:23:24 +00:00
pv - > simorg [ i ] = ( 1 - f ) * from . state - > origin [ i ] + f * to . state - > origin [ i ] ;
pv - > simvel [ i ] = ( 1 - f ) * from . state - > velocity [ i ] + f * to . state - > velocity [ i ] ;
2013-09-06 22:57:44 +00:00
2015-06-22 11:49:15 +00:00
if ( trackent & & trackent ! = pv - > playernum + 1 & & pv - > cam_state = = CAM_EYECAM )
2013-10-08 14:28:11 +00:00
{
2019-09-25 20:23:24 +00:00
pv - > simangles [ i ] = LerpAngles360 ( from . state - > viewangles [ i ] , to . state - > viewangles [ i ] , f ) ; // * (360.0/65535);
2013-10-08 14:28:11 +00:00
// pv->viewangles[i] = LerpAngles16(fromstate->command.angles[i], tostate->command.angles[i], f) * (360.0/65535);
}
2015-06-05 09:04:05 +00:00
else if ( lerpangles )
2019-09-25 20:23:24 +00:00
pv - > simangles [ i ] = LerpAngles16 ( from . cmd - > angles [ i ] , to . cmd - > angles [ i ] , f ) * ( 360.0 / 65535 ) ;
2013-10-08 14:28:11 +00:00
}
2013-09-06 22:57:44 +00:00
}
2004-08-23 00:15:46 +00:00
}
2014-08-19 06:08:23 +00:00
if ( cls . protocol = = CP_NETQUAKE & & nopred )
2020-09-29 07:09:01 +00:00
{
2019-09-25 20:23:24 +00:00
pv - > onground = to . state - > onground ;
2020-09-29 07:09:01 +00:00
if ( to . state - > flags & PF_INWATER )
{
pmove . watertype = FTECONTENTS_WATER ; //don't really know.
pmove . waterlevel = 3 ; //pick one at random.
}
else
{
pmove . watertype = FTECONTENTS_EMPTY ;
pmove . waterlevel = 0 ;
}
}
2014-08-19 06:08:23 +00:00
else
2019-09-25 20:23:24 +00:00
CL_CatagorizePosition ( pv , to . state - > origin ) ;
2005-10-01 03:09:17 +00:00
2015-01-21 18:18:37 +00:00
CL_CalcCrouch ( pv ) ;
pv - > waterlevel = pmove . waterlevel ;
2015-06-22 11:49:15 +00:00
if ( ! DotProduct ( pmove . gravitydir , pmove . gravitydir ) )
VectorSet ( pmove . gravitydir , 0 , 0 , - 1 ) ;
else
VectorCopy ( pmove . gravitydir , pv - > gravitydir ) ;
2015-01-21 18:18:37 +00:00
2015-09-01 04:45:15 +00:00
if ( cl . intermissionmode ! = IM_NONE & & le )
2015-08-20 03:17:47 +00:00
{
VectorCopy ( le - > angles , pv - > simangles ) ;
VectorCopy ( pv - > simangles , pv - > viewangles ) ;
}
else if ( le & & pv - > cam_state = = CAM_FREECAM )
2013-03-12 22:53:23 +00:00
{
//keep the entity tracking the prediction position, so mirrors don't go all weird
2015-01-21 18:18:37 +00:00
VectorMA ( pv - > simorg , - pv - > crouch , pv - > gravitydir , le - > origin ) ;
2015-09-01 04:45:15 +00:00
# ifdef QUAKESTATS
2013-10-08 14:28:11 +00:00
if ( pv - > stats [ STAT_HEALTH ] > 0 )
2015-09-01 04:45:15 +00:00
# endif
2013-10-08 14:28:11 +00:00
{
VectorScale ( pv - > simangles , 1 , le - > angles ) ;
added r_meshpitch cvar that allows for fixing the unfixable mesh pitch bug from vanilla... needs a better name... do note that this will break pretty much any mod, so this is really only for TCs designed to use it. Its likely that I missed places.
nqsv: added support for spectators with nq clients. the angles are a bit rough, but hey. need to do something about frags so nq clients know who's a spectator. use 'cmd observe' to get an nq client to spectate on an fte server (then attack/jump behave the same as in qw clients).
nqsv: rewrote EF_MUZZLEFLASH handling, so svc_muzzleflash is now translated properly to EF_MUZZLEFLASH, and vice versa. No more missing muzzleflashes!
added screenshot_cubemap, so you can actually pre-generate cubemaps with fte (which can be used for reflections or whatever).
misc fixes (server crash, a couple of other less important ones).
external files based on a model's name will now obey r_replacemodels properly, instead of needing to use foo.mdl_0.skin for foo.md3.
identify <playernum> should now use the correct masked ip, instead of abrubtly failing (reported by kt)
vid_toggle console command should now obey vid_width and vid_height when switching to fullscreen, but only if vid_fullscreen is actually set, which should make it seem better behaved (reported by kt).
qcc: cleaned up sym->symboldata[sym->ofs] to be more consistent at all stages.
qcc: typedef float vec4[4]; now works to define a float array with 4 elements (however, it will be passed by-value rather than by-reference).
qcc: cleaned up optional vs __out ordering issues.
qccgui: shift+f3 searches backwards
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5064 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-02-27 09:34:35 +00:00
if ( pv - > pmovetype ! = PM_6DOF )
le - > angles [ 0 ] * = 0.333 ;
le - > angles [ 0 ] * = r_meshpitch . value ;
2020-10-06 03:17:28 +00:00
le - > angles [ 2 ] * = r_meshroll . value ;
2013-10-08 14:28:11 +00:00
}
2013-03-12 22:53:23 +00:00
}
2015-06-22 11:49:15 +00:00
if ( cam_nowlocked )
Cam_NowLocked ( pv ) ;
if ( pv - > cam_state = = CAM_WALLCAM )
{
vec3_t dir ;
VectorSubtract ( pv - > simorg , pv - > cam_desired_position , dir ) ;
added r_meshpitch cvar that allows for fixing the unfixable mesh pitch bug from vanilla... needs a better name... do note that this will break pretty much any mod, so this is really only for TCs designed to use it. Its likely that I missed places.
nqsv: added support for spectators with nq clients. the angles are a bit rough, but hey. need to do something about frags so nq clients know who's a spectator. use 'cmd observe' to get an nq client to spectate on an fte server (then attack/jump behave the same as in qw clients).
nqsv: rewrote EF_MUZZLEFLASH handling, so svc_muzzleflash is now translated properly to EF_MUZZLEFLASH, and vice versa. No more missing muzzleflashes!
added screenshot_cubemap, so you can actually pre-generate cubemaps with fte (which can be used for reflections or whatever).
misc fixes (server crash, a couple of other less important ones).
external files based on a model's name will now obey r_replacemodels properly, instead of needing to use foo.mdl_0.skin for foo.md3.
identify <playernum> should now use the correct masked ip, instead of abrubtly failing (reported by kt)
vid_toggle console command should now obey vid_width and vid_height when switching to fullscreen, but only if vid_fullscreen is actually set, which should make it seem better behaved (reported by kt).
qcc: cleaned up sym->symboldata[sym->ofs] to be more consistent at all stages.
qcc: typedef float vec4[4]; now works to define a float array with 4 elements (however, it will be passed by-value rather than by-reference).
qcc: cleaned up optional vs __out ordering issues.
qccgui: shift+f3 searches backwards
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5064 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-02-27 09:34:35 +00:00
VectorAngles ( dir , NULL , pv - > simangles , false ) ;
2015-06-22 11:49:15 +00:00
VectorCopy ( pv - > simangles , pv - > viewangles ) ;
pv - > viewangles [ 0 ] = anglemod ( pv - > viewangles [ 0 ] ) ;
if ( pv - > viewangles [ 0 ] > 180 )
pv - > viewangles [ 0 ] - = 360 ;
VectorCopy ( pv - > cam_desired_position , pv - > simorg ) ;
VectorClear ( pv - > simvel ) ;
}
if ( cam_nowlocked )
{
//invalidate the roll, so we don't spin when switching povs
pv - > rollangle = V_CalcRoll ( pv - > simangles , pv - > simvel ) ;
pv - > vm . oldmodel = NULL ; //invalidate the viewmodel, so the lerps get reset
}
2004-08-23 00:15:46 +00:00
}
void CL_PredictMove ( void )
{
int i ;
2012-01-17 07:57:46 +00:00
// Set up prediction for other players
CL_SetUpPlayerPrediction ( false ) ;
// do client side motion prediction
2004-08-23 00:15:46 +00:00
for ( i = 0 ; i < cl . splitclients ; i + + )
CL_PredictMovePNum ( i ) ;
2012-01-17 07:57:46 +00:00
// Set up prediction for other players
CL_SetUpPlayerPrediction ( true ) ;
2019-07-29 05:28:20 +00:00
VALGRIND_MAKE_MEM_UNDEFINED ( & pmove . onground , sizeof ( pmove . onground ) ) ;
2004-08-23 00:15:46 +00:00
}
/*
= = = = = = = = = = = = = =
CL_InitPrediction
= = = = = = = = = = = = = =
*/
void CL_InitPrediction ( void )
{
extern char cl_predictiongroup [ ] ;
Cvar_Register ( & cl_pushlatency , cl_predictiongroup ) ;
Cvar_Register ( & cl_nopred , cl_predictiongroup ) ;
2013-09-06 22:57:44 +00:00
Cvar_Register ( & cl_predict_extrapolate , cl_predictiongroup ) ;
Cvar_Register ( & cl_predict_timenudge , cl_predictiongroup ) ;
2019-09-17 19:49:39 +00:00
Cvar_Register ( & cl_lerp_smooth , cl_predictiongroup ) ;
Cvar_Register ( & cl_lerp_driftbias , cl_predictiongroup ) ;
Cvar_Register ( & cl_lerp_driftfrac , cl_predictiongroup ) ;
2004-08-23 00:15:46 +00:00
}