allow server to control player angles as in Hack and Slash mod\nclient's player model stands up straight\nmouse and joystick work properly in chase_active 2 and 3 modes

This commit is contained in:
Seth Galbraith 2001-12-11 20:49:10 +00:00
parent e9690c8ee9
commit 8a47406dcd
5 changed files with 32 additions and 26 deletions

View file

@ -210,7 +210,13 @@ Chase_Update (void)
} }
// mouse and joystick controllers add to movement // mouse and joystick controllers add to movement
// IN_Move (&cmd); // problem - mouse strafe movement is weird dir[1] = cl.viewangles[1] - camera_angles[1]; dir[0] = 0; dir[2] = 0;
AngleVectors (dir, forward, right, up);
VectorScale (forward, viewdelta.position[2] * m_forward->value, forward);
VectorScale (right, viewdelta.position[0] * m_side->value, right);
VectorAdd (forward, right, dir);
cmd.forwardmove += dir[0];
cmd.sidemove -= dir[1];
dir[1] = camera_angles[1]; dir[0] = 0; dir[2] = 0; dir[1] = camera_angles[1]; dir[0] = 0; dir[2] = 0;
AngleVectors (dir, forward, right, up); AngleVectors (dir, forward, right, up);

View file

@ -510,16 +510,17 @@ CL_BaseMove (usercmd_t *cmd)
// adjust for chase camera angles // adjust for chase camera angles
if (chase_active->int_val == 2 || chase_active->int_val == 3) if (chase_active->int_val == 2 || chase_active->int_val == 3)
{ {
vec3_t dir = {0,0,0}, forward, right, up; vec3_t dir = {0,0,0}, forward, right, up, f, r;
dir[1] = r_refdef.viewangles[1] - cl.viewangles[1]; dir[1] = r_refdef.viewangles[1] - cl.viewangles[1];
AngleVectors (dir, forward, right, up); AngleVectors (dir, forward, right, up);
VectorScale (forward, cmd->forwardmove, f);
VectorScale (forward, cmd->forwardmove, forward); VectorScale (right, cmd->sidemove, r);
VectorScale (right, cmd->sidemove, right); cmd->forwardmove = f[0] + r[0];
VectorAdd (forward, right, dir); cmd->sidemove = f[1] + r[1];
VectorScale (forward, viewdelta.position[2], f);
cmd->forwardmove = dir[0]; VectorScale (right, viewdelta.position[0], r);
cmd->sidemove = dir[1]; viewdelta.position[2] = f[0] + r[0];
viewdelta.position[0] = (f[1] + r[1]) * -1;
} }
cmd->forwardmove += viewdelta.position[2] * m_forward->value; cmd->forwardmove += viewdelta.position[2] * m_forward->value;

View file

@ -609,14 +609,6 @@ V_CalcRefdef (void)
// view is the weapon model (only visible from inside body) // view is the weapon model (only visible from inside body)
view = &cl.viewent; view = &cl.viewent;
// transform the view offset by the model's matrix to get the offset from
// model origin for the view
ent->angles[YAW] = cl.viewangles[YAW]; // the model should face
// the view dir
ent->angles[PITCH] = -cl.viewangles[PITCH]; // the model should face
// the view dir
bob = V_CalcBob (); bob = V_CalcBob ();
// refresh position // refresh position

View file

@ -780,7 +780,13 @@ Chase_Update (void)
} }
// mouse and joystick controllers add to movement // mouse and joystick controllers add to movement
// IN_Move (&cmd); // problem - mouse strafe movement is weird dir[1] = cl.viewangles[1] - camera_angles[1]; dir[0] = 0; dir[2] = 0;
AngleVectors (dir, forward, right, up);
VectorScale (forward, viewdelta.position[2] * m_forward->value, forward);
VectorScale (right, viewdelta.position[0] * m_side->value, right);
VectorAdd (forward, right, dir);
cmd.forwardmove += dir[0];
cmd.sidemove -= dir[1];
dir[1] = camera_angles[1]; dir[0] = 0; dir[2] = 0; dir[1] = camera_angles[1]; dir[0] = 0; dir[2] = 0;
AngleVectors (dir, forward, right, up); AngleVectors (dir, forward, right, up);

View file

@ -525,16 +525,17 @@ CL_BaseMove (usercmd_t *cmd)
if (cl.chase if (cl.chase
&& (chase_active->int_val == 2 || chase_active->int_val == 3)) && (chase_active->int_val == 2 || chase_active->int_val == 3))
{ {
vec3_t dir = {0,0,0}, forward, right, up; vec3_t dir = {0,0,0}, forward, right, up, f, r;
dir[1] = r_refdef.viewangles[1] - cl.viewangles[1]; dir[1] = r_refdef.viewangles[1] - cl.viewangles[1];
AngleVectors (dir, forward, right, up); AngleVectors (dir, forward, right, up);
VectorScale (forward, cmd->forwardmove, f);
VectorScale (forward, cmd->forwardmove, forward); VectorScale (right, cmd->sidemove, r);
VectorScale (right, cmd->sidemove, right); cmd->forwardmove = f[0] + r[0];
VectorAdd (forward, right, dir); cmd->sidemove = f[1] + r[1];
VectorScale (forward, viewdelta.position[2], f);
cmd->forwardmove = dir[0]; VectorScale (right, viewdelta.position[0], r);
cmd->sidemove = dir[1]; viewdelta.position[2] = f[0] + r[0];
viewdelta.position[0] = (f[1] + r[1]) * -1;
} }
cmd->forwardmove += viewdelta.position[2] * m_forward->value; cmd->forwardmove += viewdelta.position[2] * m_forward->value;