diff --git a/engine/client/cl_demo.c b/engine/client/cl_demo.c index 96de69a0..10b76b73 100644 --- a/engine/client/cl_demo.c +++ b/engine/client/cl_demo.c @@ -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 ); } /* diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 9d06ffb6..eb3f5856 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -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 ); diff --git a/engine/client/cl_pmove.c b/engine/client/cl_pmove.c index 5cc27021..0fd14ad7 100644 --- a/engine/client/cl_pmove.c +++ b/engine/client/cl_pmove.c @@ -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 ); diff --git a/engine/client/cl_view.c b/engine/client/cl_view.c index cc2bb26d..0a35b734 100644 --- a/engine/client/cl_view.c +++ b/engine/client/cl_view.c @@ -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]; diff --git a/engine/client/client.h b/engine/client/client.h index 221ad125..c1766e37 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -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;