[qw] Remove viewangles from client state

Other than the one line in cl_pred.c, it's redundant, but it looks to be
just a redundant copy from ancient times.
This commit is contained in:
Bill Currie 2021-03-20 01:48:26 +09:00
parent 5cf1da7c25
commit dc7cb97481
9 changed files with 53 additions and 49 deletions

View file

@ -477,8 +477,9 @@ CL_AdjustAngles (void)
void
CL_BaseMove (usercmd_t *cmd)
{
if (cls.state != ca_active)
if (cls.state != ca_active) {
return;
}
CL_AdjustAngles ();

View file

@ -216,13 +216,11 @@ typedef struct {
cshift_t cshifts[NUM_CSHIFTS]; // Color shifts for damage, powerups
cshift_t prev_cshifts[NUM_CSHIFTS]; // and content types
// the client maintains its own idea of view angles, which are sent to the
// server each frame. And reset only at level change and teleport times
vec3_t viewangles;
// the client simulates or interpolates movement to get these values
double time; // this is the time value that the client
// is rendering at. always <= realtime
// the client maintains its own idea of view angles, which are sent to the
// server each frame. And reset only at level change and teleport times
viewstate_t viewstate;
// pitch drifting vars
float idealpitch;

View file

@ -439,7 +439,7 @@ Cam_Track (usercmd_t *cmd)
if (cl_chasecam->int_val) {
cmd->forwardmove = cmd->sidemove = cmd->upmove = 0;
VectorCopy (player->viewangles, cl.viewangles);
VectorCopy (player->viewangles, cl.viewstate.angles);
VectorCopy (player->pls.es.origin, desired_position);
if (memcmp (&desired_position, &self->pls.es.origin,
sizeof (desired_position)) != 0) {
@ -468,8 +468,8 @@ Cam_Track (usercmd_t *cmd)
VectorCopy (desired_position, self->pls.es.origin);
VectorSubtract (player->pls.es.origin, desired_position, vec);
vectoangles (vec, cl.viewangles);
cl.viewangles[0] = -cl.viewangles[0];
vectoangles (vec, cl.viewstate.angles);
cl.viewstate.angles[0] = -cl.viewstate.angles[0];
}
}
@ -536,8 +536,8 @@ Cam_SetView (void)
adjustang (cam_viewangles[YAW], vec2[YAW],
cl_camera_maxyaw->value);
}
VectorCopy (cam_viewangles, cl.viewangles);
VectorCopy (cl.viewangles, cl.simangles);
VectorCopy (cam_viewangles, cl.viewstate.angles);
VectorCopy (cl.viewstate.angles, cl.simangles);
cl.simangles[ROLL] = 0; // FIXME @@@
}
#endif
@ -576,7 +576,7 @@ Cam_FinishMove (usercmd_t *cmd)
adjustang (cam_viewangles[YAW], vec2[YAW],
cl_camera_maxyaw->value);
}
VectorCopy (cam_viewangles, cl.viewangles);
VectorCopy (cam_viewangles, cl.viewstate.angles);
}
#endif
@ -587,7 +587,7 @@ Cam_FinishMove (usercmd_t *cmd)
if (autocam > CAM_TRACK) {
Cam_Unlock ();
VectorCopy (cl.viewangles, cmd->angles);
VectorCopy (cl.viewstate.angles, cmd->angles);
return;
}
} else

View file

@ -333,7 +333,7 @@ nextdemomessage:
cls.netchan.outgoing_sequence++;
for (i = 0; i < 3; i++) {
Qread (cls.demofile, &f, 4);
cl.viewangles[i] = LittleFloat (f);
cl.viewstate.angles[i] = LittleFloat (f);
}
break;
@ -462,7 +462,7 @@ CL_WriteDemoCmd (usercmd_t *pcmd)
Qwrite (cls.demofile, &cmd, sizeof (cmd));
for (i = 0; i < 3; i++) {
fl = LittleFloat (cl.viewangles[i]);
fl = LittleFloat (cl.viewstate.angles[i]);
Qwrite (cls.demofile, &fl, 4);
}

View file

@ -425,8 +425,8 @@ CL_LinkPlayers (void)
// angles
if (j == cl.playernum)
{
ang[PITCH] = -cl.viewangles[PITCH] / 3.0;
ang[YAW] = cl.viewangles[YAW];
ang[PITCH] = -cl.viewstate.angles[PITCH] / 3.0;
ang[YAW] = cl.viewstate.angles[YAW];
} else {
ang[PITCH] = -state->viewangles[PITCH] / 3.0;
ang[YAW] = state->viewangles[YAW];

View file

@ -454,35 +454,35 @@ CL_AdjustAngles (void)
yawspeed *= host_frametime;
if (!(in_strafe.state & 1)) {
cl.viewangles[YAW] -= yawspeed * CL_KeyState (&in_right);
cl.viewangles[YAW] += yawspeed * CL_KeyState (&in_left);
cl.viewangles[YAW] = anglemod (cl.viewangles[YAW]);
cl.viewstate.angles[YAW] -= yawspeed * CL_KeyState (&in_right);
cl.viewstate.angles[YAW] += yawspeed * CL_KeyState (&in_left);
cl.viewstate.angles[YAW] = anglemod (cl.viewstate.angles[YAW]);
}
if (in_klook.state & 1) {
V_StopPitchDrift ();
cl.viewangles[PITCH] -= pitchspeed * CL_KeyState (&in_forward);
cl.viewangles[PITCH] += pitchspeed * CL_KeyState (&in_back);
cl.viewstate.angles[PITCH] -= pitchspeed * CL_KeyState (&in_forward);
cl.viewstate.angles[PITCH] += pitchspeed * CL_KeyState (&in_back);
}
up = CL_KeyState (&in_lookup);
down = CL_KeyState (&in_lookdown);
cl.viewangles[PITCH] -= pitchspeed * up;
cl.viewangles[PITCH] += pitchspeed * down;
cl.viewstate.angles[PITCH] -= pitchspeed * up;
cl.viewstate.angles[PITCH] += pitchspeed * down;
if (up || down)
V_StopPitchDrift ();
// FIXME: Need to clean up view angle limits
if (cl.viewangles[PITCH] > 80)
cl.viewangles[PITCH] = 80;
if (cl.viewangles[PITCH] < -70)
cl.viewangles[PITCH] = -70;
if (cl.viewstate.angles[PITCH] > 80)
cl.viewstate.angles[PITCH] = 80;
if (cl.viewstate.angles[PITCH] < -70)
cl.viewstate.angles[PITCH] = -70;
if (cl.viewangles[ROLL] > 50)
cl.viewangles[ROLL] = 50;
if (cl.viewangles[ROLL] < -50)
cl.viewangles[ROLL] = -50;
if (cl.viewstate.angles[ROLL] > 50)
cl.viewstate.angles[ROLL] = 50;
if (cl.viewstate.angles[ROLL] < -50)
cl.viewstate.angles[ROLL] = -50;
}
/*
@ -493,11 +493,15 @@ CL_AdjustAngles (void)
void
CL_BaseMove (usercmd_t *cmd)
{
if (cls.state != ca_active) {
return;
}
CL_AdjustAngles ();
memset (cmd, 0, sizeof (*cmd));
VectorCopy (cl.viewangles, cmd->angles);
VectorCopy (cl.viewstate.angles, cmd->angles);
if (in_strafe.state & 1) {
cmd->sidemove += cl_sidespeed->value * CL_KeyState (&in_right);
cmd->sidemove -= cl_sidespeed->value * CL_KeyState (&in_left);
@ -536,7 +540,7 @@ CL_BaseMove (usercmd_t *cmd)
vec3_t forward, right, up, f, r;
vec3_t dir = {0, 0, 0};
dir[1] = r_data->refdef->viewangles[1] - cl.viewangles[1];
dir[1] = r_data->refdef->viewangles[1] - cl.viewstate.angles[1];
AngleVectors (dir, forward, right, up);
VectorScale (forward, cmd->forwardmove, f);
VectorScale (right, cmd->sidemove, r);
@ -552,12 +556,13 @@ CL_BaseMove (usercmd_t *cmd)
cmd->forwardmove += viewdelta.position[2] * m_forward->value;
cmd->sidemove += viewdelta.position[0] * m_side->value;
cmd->upmove += viewdelta.position[1];
cl.viewangles[PITCH] += viewdelta.angles[PITCH] * m_pitch->value;
cl.viewangles[YAW] += viewdelta.angles[YAW] * m_yaw->value;
cl.viewangles[ROLL] += viewdelta.angles[ROLL];
cl.viewstate.angles[PITCH] += viewdelta.angles[PITCH] * m_pitch->value;
cl.viewstate.angles[YAW] += viewdelta.angles[YAW] * m_yaw->value;
cl.viewstate.angles[ROLL] += viewdelta.angles[ROLL];
if (freelook && !(in_strafe.state & 1)) {
cl.viewangles[PITCH] = bound (-70, cl.viewangles[PITCH], 80);
cl.viewstate.angles[PITCH]
= bound (-70, cl.viewstate.angles[PITCH], 80);
}
}
@ -609,7 +614,7 @@ CL_FinishMove (usercmd_t *cmd)
}
cmd->msec = ms;
VectorCopy (cl.viewangles, cmd->angles);
VectorCopy (cl.viewstate.angles, cmd->angles);
cmd->impulse = in_impulse;
in_impulse = 0;

View file

@ -1100,7 +1100,7 @@ CL_Download_f (void)
static void
Force_CenterView_f (void)
{
cl.viewangles[PITCH] = 0;
cl.viewstate.angles[PITCH] = 0;
}
static void
@ -1109,12 +1109,12 @@ CL_PRotate_f (void)
if ((cl.fpd & FPD_LIMIT_PITCH) || Cmd_Argc() < 2)
return;
cl.viewangles[PITCH] += atoi (Cmd_Argv (1));
cl.viewstate.angles[PITCH] += atoi (Cmd_Argv (1));
if (cl.viewangles[PITCH] < -70)
cl.viewangles[PITCH] = -70;
else if (cl.viewangles[PITCH] > 80)
cl.viewangles[PITCH] = 80;
if (cl.viewstate.angles[PITCH] < -70)
cl.viewstate.angles[PITCH] = -70;
else if (cl.viewstate.angles[PITCH] > 80)
cl.viewstate.angles[PITCH] = 80;
}
static void
@ -1123,8 +1123,8 @@ CL_Rotate_f (void)
if ((cl.fpd & FPD_LIMIT_YAW) || Cmd_Argc() < 2)
return;
cl.viewangles[YAW] += atoi (Cmd_Argv (1));
cl.viewangles[YAW] = anglemod (cl.viewangles[YAW]);
cl.viewstate.angles[YAW] += atoi (Cmd_Argv (1));
cl.viewstate.angles[YAW] = anglemod (cl.viewstate.angles[YAW]);
}
void

View file

@ -1273,7 +1273,7 @@ CL_ParseMuzzleFlash (void)
pl = &cl.frames[parsecountmod].playerstate[i - 1];
if (i - 1 == cl.playernum)
AngleVectors (cl.viewangles, f, r, u);
AngleVectors (cl.viewstate.angles, f, r, u);
else
AngleVectors (pl->viewangles, f, r, u);
@ -1415,7 +1415,7 @@ CL_ParseServerMessage (void)
case svc_setangle:
{
vec_t *dest = cl.viewangles;
vec_t *dest = cl.viewstate.angles;
vec3_t dummy;
if (cls.demoplayback2) {

View file

@ -132,7 +132,7 @@ CL_PredictMove (void)
UPDATE_BACKUP - 1)
return;
VectorCopy (cl.viewangles, cl.viewstate.angles);
//VectorCopy (cl.viewstate.angles, cl.viewstate.angles);
cl.viewstate.angles[ROLL] = 0; // FIXME @@@
// this is the last frame received from the server