mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
engine: client: always pass a valid pointer to usercmd_t in ref_params_t to prevent crassh when client.dll reads them during demo playback
This commit is contained in:
@@ -642,9 +642,7 @@ static void CL_ReadDemoUserCmd( qboolean discard )
|
||||
pcmd->sendsize = 1;
|
||||
|
||||
// always delta'ing from null
|
||||
cl.cmd = &pcmd->cmd;
|
||||
|
||||
MSG_ReadDeltaUsercmd( &buf, &nullcmd, cl.cmd );
|
||||
MSG_ReadDeltaUsercmd( &buf, &nullcmd, &pcmd->cmd );
|
||||
|
||||
// make sure what interp info contain angles from different frames
|
||||
// or lerping will stop working
|
||||
@@ -656,13 +654,16 @@ static void CL_ReadDemoUserCmd( qboolean discard )
|
||||
|
||||
// record update
|
||||
a->starttime = demo.timestamp;
|
||||
VectorCopy( cl.cmd->viewangles, a->viewangles );
|
||||
VectorCopy( pcmd->cmd.viewangles, a->viewangles );
|
||||
demo.lasttime = demo.timestamp;
|
||||
}
|
||||
|
||||
// NOTE: we need to have the current outgoing sequence correct
|
||||
// so we can do prediction correctly during playback
|
||||
cls.netchan.outgoing_sequence = outgoing_sequence;
|
||||
|
||||
// save last usercmd
|
||||
cl.cmd = pcmd->cmd;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1145,8 +1146,7 @@ void CL_DemoInterpolateAngles( void )
|
||||
QuaternionSlerp( q2, q1, frac, q );
|
||||
QuaternionAngle( q, cl.viewangles );
|
||||
}
|
||||
else if( cl.cmd != NULL )
|
||||
VectorCopy( cl.cmd->viewangles, cl.viewangles );
|
||||
else VectorCopy( cl.cmd.viewangles, cl.viewangles );
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -673,7 +673,7 @@ static void CL_CreateCmd( void )
|
||||
}
|
||||
|
||||
// demo always have commands so don't overwrite them
|
||||
if( !cls.demoplayback ) cl.cmd = &pcmd->cmd;
|
||||
if( !cls.demoplayback ) cl.cmd = pcmd->cmd;
|
||||
|
||||
// predict all unacknowledged movements
|
||||
CL_PredictMovement( false );
|
||||
|
||||
@@ -973,7 +973,7 @@ void CL_MoveSpectatorCamera( void )
|
||||
|
||||
CL_SetUpPlayerPrediction( false, true );
|
||||
CL_SetSolidPlayers( cl.playernum );
|
||||
CL_RunUsercmd( &cls.spectator_state, &cls.spectator_state, cl.cmd, true, &time, (uint)( time * 100.0 ));
|
||||
CL_RunUsercmd( &cls.spectator_state, &cls.spectator_state, &cl.cmd, true, &time, (uint)( time * 100.0 ));
|
||||
|
||||
VectorCopy( cls.spectator_state.client.velocity, cl.simvel );
|
||||
VectorCopy( cls.spectator_state.client.origin, cl.simorg );
|
||||
|
||||
@@ -165,7 +165,7 @@ static void V_SetRefParams( ref_params_t *fd )
|
||||
|
||||
// get pointers to movement vars and user cmd
|
||||
fd->movevars = &clgame.movevars;
|
||||
fd->cmd = cl.cmd;
|
||||
fd->cmd = &cl.cmd;
|
||||
|
||||
// setup viewport
|
||||
fd->viewport[0] = clgame.viewport[0];
|
||||
|
||||
@@ -234,7 +234,7 @@ typedef struct
|
||||
cl_local_data_t local;
|
||||
|
||||
// player final info
|
||||
usercmd_t *cmd; // cl.commands[outgoing_sequence].cmd
|
||||
usercmd_t cmd; // cl.commands[outgoing_sequence].cmd
|
||||
vec3_t viewangles;
|
||||
vec3_t viewheight;
|
||||
vec3_t punchangle;
|
||||
|
||||
Reference in New Issue
Block a user