mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-25 22:01:33 +00:00
[client] Get the basic chase camera working
The more advanced modes are rather broken (continuous spinning), but they may have been for a while. The bulk of the various changes were due to renaming viewstate's origin and angles to make their meaning more explicit.
This commit is contained in:
parent
fb83d87a0e
commit
43a329dcb5
17 changed files with 105 additions and 100 deletions
|
@ -39,11 +39,12 @@
|
|||
#define INFO_CSHIFT_POWERUP (1 << 3)
|
||||
|
||||
typedef struct viewstate_s {
|
||||
vec4f_t player_origin;
|
||||
vec3_t player_angles;
|
||||
int chase;
|
||||
vec4f_t movecmd;
|
||||
vec4f_t velocity;
|
||||
vec4f_t origin;
|
||||
vec4f_t punchangle;
|
||||
vec3_t angles;
|
||||
float frametime;
|
||||
struct transform_s *camera_transform;
|
||||
double time;
|
||||
|
@ -77,7 +78,6 @@ typedef struct viewstate_s {
|
|||
struct entity_s *player_entity;
|
||||
|
||||
struct chasestate_s *chasestate;
|
||||
int chase;
|
||||
} viewstate_t;
|
||||
|
||||
#define VF_DEAD 1
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "QF/mathlib.h"
|
||||
|
||||
#include "QF/plugin/vid_render.h"
|
||||
#include "QF/simd/vec4f.h"
|
||||
#include "QF/scene/transform.h"
|
||||
|
||||
#include "world.h"
|
||||
|
||||
|
@ -83,21 +83,22 @@ Chase_Reset (void)
|
|||
// start position 12 units behind head
|
||||
}
|
||||
|
||||
static inline void
|
||||
TraceLine (chasestate_t *cs, vec3_t start, vec3_t end, vec3_t impact)
|
||||
static inline vec4f_t
|
||||
TraceLine (chasestate_t *cs, vec4f_t start, vec4f_t end)
|
||||
{
|
||||
trace_t trace;
|
||||
|
||||
memset (&trace, 0, sizeof (trace));
|
||||
trace.fraction = 1;
|
||||
MOD_TraceLine (cs->worldmodel->brush.hulls, 0, start, end, &trace);
|
||||
MOD_TraceLine (cs->worldmodel->brush.hulls, 0, &start[0], &end[0], &trace);
|
||||
|
||||
VectorCopy (trace.endpos, impact);
|
||||
return (vec4f_t) {trace.endpos[0], trace.endpos[1], trace.endpos[2], 1};
|
||||
}
|
||||
|
||||
void
|
||||
Chase_Update (chasestate_t *cs)
|
||||
{
|
||||
viewstate_t *vs = cs->viewstate;
|
||||
float pitch, yaw, fwd;
|
||||
vec4f_t move = {};
|
||||
vec4f_t forward = {}, up = {}, right = {}, stop = {}, dir = {};
|
||||
|
@ -107,28 +108,25 @@ Chase_Update (chasestate_t *cs)
|
|||
if (chase_active->int_val == 2 || chase_active->int_val == 3) {
|
||||
// control camera angles with key/mouse/joy-look
|
||||
vec3_t d;
|
||||
VectorSubtract (cs->viewstate->angles, player_angles, d);
|
||||
VectorSubtract (vs->player_angles, player_angles, d);
|
||||
VectorAdd (camera_angles, d, camera_angles);
|
||||
|
||||
if (chase_active->int_val == 2) {
|
||||
if (camera_angles[PITCH] < -60)
|
||||
camera_angles[PITCH] = -60;
|
||||
if (camera_angles[PITCH] > 60)
|
||||
camera_angles[PITCH] = 60;
|
||||
camera_angles[PITCH] = bound (-60, camera_angles[PITCH], 60);
|
||||
}
|
||||
|
||||
// move camera, it's not enough to just change the angles because
|
||||
// the angles are automatically changed to look toward the player
|
||||
|
||||
if (chase_active->int_val == 3) {
|
||||
player_origin = r_data->refdef->viewposition;
|
||||
player_origin = vs->player_origin;
|
||||
}
|
||||
|
||||
AngleVectors (camera_angles, &forward[0], &right[0], &up[0]);
|
||||
camera_origin = player_origin - chase_back->value * forward;
|
||||
|
||||
if (chase_active->int_val == 2) {
|
||||
player_origin = r_data->refdef->viewposition;
|
||||
player_origin = vs->player_origin;
|
||||
|
||||
// don't let camera get too low
|
||||
if (camera_origin[2] < player_origin[2] + chase_up->value) {
|
||||
|
@ -148,14 +146,12 @@ Chase_Update (chasestate_t *cs)
|
|||
// check for walls between player and camera
|
||||
|
||||
camera_origin += 8 * forward;
|
||||
//FIXME
|
||||
TraceLine (cs, &player_origin[0], &camera_origin[0], &stop[0]);
|
||||
stop[3] = 1;
|
||||
stop = TraceLine (cs, player_origin, camera_origin);
|
||||
if (magnitude3f (stop)[0] != 0) {
|
||||
camera_origin = stop - forward;
|
||||
}
|
||||
|
||||
dir = camera_origin - r_data->refdef->viewposition;
|
||||
dir = camera_origin - vs->player_origin;
|
||||
forward = normalf (dir);
|
||||
|
||||
if (chase_active->int_val == 2) {
|
||||
|
@ -184,12 +180,14 @@ Chase_Update (chasestate_t *cs)
|
|||
}
|
||||
}
|
||||
|
||||
AngleQuat (camera_angles, &r_data->refdef->viewrotation[0]);//FIXME rotate camera
|
||||
r_data->refdef->viewposition = camera_origin; // move camera
|
||||
vec4f_t rotation;
|
||||
AngleQuat (camera_angles, &rotation[0]);//FIXME
|
||||
Transform_SetWorldRotation (vs->camera_transform, rotation);
|
||||
Transform_SetWorldPosition (vs->camera_transform, camera_origin);
|
||||
|
||||
// get basic movement from keyboard
|
||||
|
||||
// VectorCopy (cs->viewstate->angles, cmd.angles);
|
||||
// VectorCopy (vs->player_angles, cmd.angles);
|
||||
|
||||
if (in_strafe.state & 1) {
|
||||
move[SIDE] += cl_sidespeed->value * IN_ButtonState (&in_right);
|
||||
|
@ -208,7 +206,7 @@ Chase_Update (chasestate_t *cs)
|
|||
}
|
||||
|
||||
// mouse and joystick controllers add to movement
|
||||
VectorSet (0, cs->viewstate->angles[1] - camera_angles[1], 0, dir);
|
||||
VectorSet (0, vs->player_angles[1] - camera_angles[1], 0, dir);
|
||||
AngleVectors (&dir[0], &forward[0], &right[0], &up[0]); //FIXME
|
||||
//forward *= viewdelta.position[2] * m_forward->value; FIXME
|
||||
//right *= viewdelta.position[0] * m_side->value; FIXME
|
||||
|
@ -224,16 +222,16 @@ Chase_Update (chasestate_t *cs)
|
|||
VectorAdd (forward, right, dir);
|
||||
|
||||
if (dir[1] || dir[0]) {
|
||||
cs->viewstate->angles[YAW] = (atan2 (dir[1], dir[0]) * 180 / M_PI);
|
||||
if (cs->viewstate->angles[YAW] < 0) {
|
||||
cs->viewstate->angles[YAW] += 360;
|
||||
vs->player_angles[YAW] = (atan2 (dir[1], dir[0]) * 180 / M_PI);
|
||||
if (vs->player_angles[YAW] < 0) {
|
||||
vs->player_angles[YAW] += 360;
|
||||
}
|
||||
}
|
||||
|
||||
cs->viewstate->angles[PITCH] = 0;
|
||||
vs->player_angles[PITCH] = 0;
|
||||
|
||||
// remember the new angle to calculate the difference next frame
|
||||
VectorCopy (cs->viewstate->angles, player_angles);
|
||||
VectorCopy (vs->player_angles, player_angles);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -241,21 +239,19 @@ Chase_Update (chasestate_t *cs)
|
|||
// regular camera, faces same direction as player
|
||||
|
||||
//FIXME
|
||||
AngleVectors (cs->viewstate->angles, &forward[0], &right[0], &up[0]);
|
||||
AngleVectors (vs->player_angles, &forward[0], &right[0], &up[0]);
|
||||
|
||||
// calc exact destination
|
||||
camera_origin = r_data->refdef->viewposition
|
||||
camera_origin = vs->player_origin
|
||||
- forward * chase_back->value - right * chase_right->value;
|
||||
// chase_up is world up
|
||||
camera_origin[2] += chase_up->value;
|
||||
|
||||
// check for walls between player and camera
|
||||
//FIXME
|
||||
TraceLine (cs, &r_data->refdef->viewposition[0], &camera_origin[0], &stop[0]);
|
||||
stop[3] = 1;
|
||||
stop = TraceLine (cs, vs->player_origin, camera_origin);
|
||||
if (magnitude3f (stop)[0] != 0) {
|
||||
camera_origin = stop + forward * 8;
|
||||
}
|
||||
|
||||
r_data->refdef->viewposition = camera_origin;
|
||||
Transform_SetWorldPosition (vs->camera_transform, camera_origin);
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ V_DriftPitch (viewstate_t *vs)
|
|||
return;
|
||||
}
|
||||
|
||||
delta = vs->idealpitch - vs->angles[PITCH];
|
||||
delta = vs->idealpitch - vs->player_angles[PITCH];
|
||||
|
||||
if (!delta) {
|
||||
vs->pitchvel = 0;
|
||||
|
@ -261,13 +261,13 @@ V_DriftPitch (viewstate_t *vs)
|
|||
vs->pitchvel = 0;
|
||||
move = delta;
|
||||
}
|
||||
vs->angles[PITCH] += move;
|
||||
vs->player_angles[PITCH] += move;
|
||||
} else if (delta < 0) {
|
||||
if (move > -delta) {
|
||||
vs->pitchvel = 0;
|
||||
move = -delta;
|
||||
}
|
||||
vs->angles[PITCH] -= move;
|
||||
vs->player_angles[PITCH] -= move;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -278,8 +278,8 @@ V_ParseDamage (qmsg_t *net_message, viewstate_t *vs)
|
|||
{
|
||||
float count, side;
|
||||
int armor, blood;
|
||||
vec4f_t origin = vs->origin;
|
||||
vec_t *angles = vs->angles;
|
||||
vec4f_t origin = vs->player_origin;
|
||||
vec_t *angles = vs->player_angles;
|
||||
vec3_t from, forward, right, up;
|
||||
|
||||
armor = MSG_ReadByte (net_message);
|
||||
|
@ -485,7 +485,7 @@ static void
|
|||
V_BoundOffsets (viewstate_t *vs)
|
||||
{
|
||||
vec4f_t offset = Transform_GetWorldPosition (vs->camera_transform);
|
||||
offset -= vs->origin;
|
||||
offset -= vs->player_origin;
|
||||
|
||||
// absolutely bound refresh reletive to entity clipping hull
|
||||
// so the view can never be inside a solid wall
|
||||
|
@ -493,7 +493,8 @@ V_BoundOffsets (viewstate_t *vs)
|
|||
offset[0] = bound (-14, offset[0], 14);
|
||||
offset[1] = bound (-14, offset[1], 14);
|
||||
offset[2] = bound (-22, offset[2], 30);
|
||||
Transform_SetWorldPosition (vs->camera_transform, vs->origin + offset);
|
||||
Transform_SetWorldPosition (vs->camera_transform,
|
||||
vs->player_origin + offset);
|
||||
}
|
||||
|
||||
static vec4f_t
|
||||
|
@ -544,7 +545,7 @@ V_AddIdle (viewstate_t *vs)
|
|||
static void
|
||||
V_CalcViewRoll (viewstate_t *vs)
|
||||
{
|
||||
vec_t *angles = vs->angles;
|
||||
vec_t *angles = vs->player_angles;
|
||||
vec4f_t velocity = vs->velocity;
|
||||
vec3_t ang = { };
|
||||
|
||||
|
@ -598,8 +599,8 @@ V_CalcRefdef (viewstate_t *vs)
|
|||
float bob;
|
||||
static float oldz = 0;
|
||||
vec4f_t forward = {}, right = {}, up = {};
|
||||
vec4f_t origin = vs->origin;
|
||||
vec_t *viewangles = vs->angles;
|
||||
vec4f_t origin = vs->player_origin;
|
||||
vec_t *viewangles = vs->player_angles;
|
||||
|
||||
V_DriftPitch (vs);
|
||||
|
||||
|
@ -615,7 +616,7 @@ V_CalcRefdef (viewstate_t *vs)
|
|||
origin += (vec4f_t) { 1.0/16, 1.0/16, 1.0/16, 0};
|
||||
|
||||
vec4f_t rotation;
|
||||
AngleQuat (vs->angles, &rotation[0]);//FIXME
|
||||
AngleQuat (vs->player_angles, &rotation[0]);//FIXME
|
||||
Transform_SetWorldRotation (vs->camera_transform, rotation);
|
||||
V_CalcViewRoll (vs);
|
||||
V_AddIdle (vs);
|
||||
|
@ -635,7 +636,7 @@ V_CalcRefdef (viewstate_t *vs)
|
|||
V_BoundOffsets (vs);
|
||||
|
||||
// set up gun position
|
||||
vec4f_t gun_origin = vs->origin;
|
||||
vec4f_t gun_origin = vs->player_origin;
|
||||
CalcGunAngle (vs);
|
||||
|
||||
gun_origin += (vec4f_t) { 0, 0, vs->height, 0 };
|
||||
|
|
|
@ -105,7 +105,7 @@ CL_WriteDemoMessage (sizebuf_t *msg)
|
|||
len = LittleLong (msg->cursize);
|
||||
Qwrite (cls.demofile, &len, 4);
|
||||
for (i = 0; i < 3; i++) {
|
||||
f = LittleFloat (cl.viewstate.angles[i]);
|
||||
f = LittleFloat (cl.viewstate.player_angles[i]);
|
||||
Qwrite (cls.demofile, &f, 4);
|
||||
}
|
||||
Qwrite (cls.demofile, msg->data, msg->cursize);
|
||||
|
|
|
@ -170,7 +170,8 @@ CL_RelinkEntities (void)
|
|||
d[j] += 360;
|
||||
}
|
||||
}
|
||||
VectorMultAdd (cl.frameViewAngles[1], frac, d, cl.viewstate.angles);
|
||||
VectorMultAdd (cl.frameViewAngles[1], frac, d,
|
||||
cl.viewstate.player_angles);
|
||||
}
|
||||
|
||||
bobjrotate = anglemod (100 * cl.time);
|
||||
|
@ -304,6 +305,6 @@ CL_RelinkEntities (void)
|
|||
|
||||
cl_forcelink[i] = false;
|
||||
}
|
||||
cl.viewstate.origin
|
||||
cl.viewstate.player_origin
|
||||
= Transform_GetWorldPosition (cl_entities[cl.viewentity].transform);
|
||||
}
|
||||
|
|
|
@ -74,14 +74,15 @@ CL_BaseMove (usercmd_t *cmd)
|
|||
if (cls.state != ca_active) {
|
||||
return;
|
||||
}
|
||||
VectorCopy (cl.viewstate.angles, cl.movestate.angles);//FIXME
|
||||
VectorCopy (cl.viewstate.player_angles, cl.movestate.angles);//FIXME
|
||||
CL_Input_BuildMove (host_frametime, &cl.movestate, &cl.viewstate);
|
||||
VectorCopy (cl.movestate.angles, cl.viewstate.angles);//FIXME
|
||||
VectorCopy (cl.movestate.angles, cl.viewstate.player_angles);//FIXME
|
||||
|
||||
memset (cmd, 0, sizeof (*cmd));
|
||||
cmd->forwardmove = cl.movestate.move[FORWARD];
|
||||
cmd->sidemove = cl.movestate.move[SIDE];
|
||||
cmd->upmove = cl.movestate.move[UP];
|
||||
cl.viewstate.movecmd = cl.movestate.move;
|
||||
}
|
||||
|
||||
|
||||
|
@ -103,7 +104,7 @@ CL_SendMove (usercmd_t *cmd)
|
|||
|
||||
MSG_WriteFloat (&buf, cl.mtime[0]); // so server can get ping times
|
||||
|
||||
write_angles (&buf, cl.viewstate.angles);
|
||||
write_angles (&buf, cl.viewstate.player_angles);
|
||||
|
||||
MSG_WriteShort (&buf, cmd->forwardmove);
|
||||
MSG_WriteShort (&buf, cmd->sidemove);
|
||||
|
|
|
@ -204,6 +204,7 @@ CL_ClearState (void)
|
|||
cl.viewstate.camera_transform = cam;
|
||||
cl.viewstate.chase = 1;
|
||||
cl.viewstate.chasestate = &cl.chasestate;
|
||||
cl.chasestate.viewstate = &cl.viewstate;
|
||||
cl.watervis = 1;
|
||||
r_data->force_fullscreen = 0;
|
||||
r_data->lightstyle = cl.lightstyle;
|
||||
|
@ -534,7 +535,7 @@ CL_SetState (cactive_t state)
|
|||
static void
|
||||
Force_CenterView_f (void)
|
||||
{
|
||||
cl.viewstate.angles[PITCH] = 0;
|
||||
cl.viewstate.player_angles[PITCH] = 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -440,6 +440,7 @@ CL_ParseServerInfo (void)
|
|||
|
||||
// local state
|
||||
cl_entities[0].renderer.model = cl.worldmodel = cl.model_precache[1];
|
||||
cl.chasestate.worldmodel = cl.worldmodel;
|
||||
if (!centerprint)
|
||||
centerprint = dstring_newstr ();
|
||||
else
|
||||
|
@ -959,7 +960,7 @@ CL_ParseServerMessage (void)
|
|||
|
||||
case svc_setangle:
|
||||
{
|
||||
vec_t *dest = cl.viewstate.angles;
|
||||
vec_t *dest = cl.viewstate.player_angles;
|
||||
|
||||
MSG_ReadAngleV (net_message, dest);
|
||||
break;
|
||||
|
|
|
@ -438,7 +438,7 @@ Cam_Track (usercmd_t *cmd)
|
|||
if (cl_chasecam->int_val) {
|
||||
cmd->forwardmove = cmd->sidemove = cmd->upmove = 0;
|
||||
|
||||
VectorCopy (player->viewangles, cl.viewstate.angles);
|
||||
VectorCopy (player->viewangles, cl.viewstate.player_angles);
|
||||
VectorCopy (player->pls.es.origin, desired_position);
|
||||
if (memcmp (&desired_position, &self->pls.es.origin,
|
||||
sizeof (desired_position)) != 0) {
|
||||
|
@ -467,8 +467,8 @@ Cam_Track (usercmd_t *cmd)
|
|||
VectorCopy (desired_position, self->pls.es.origin);
|
||||
|
||||
VectorSubtract (player->pls.es.origin, desired_position, vec);
|
||||
vectoangles (vec, cl.viewstate.angles);
|
||||
cl.viewstate.angles[0] = -cl.viewstate.angles[0];
|
||||
vectoangles (vec, cl.viewstate.player_angles);
|
||||
cl.viewstate.player_angles[0] = -cl.viewstate.player_angles[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -535,8 +535,8 @@ Cam_SetView (void)
|
|||
adjustang (cam_viewangles[YAW], vec2[YAW],
|
||||
cl_camera_maxyaw->value);
|
||||
}
|
||||
VectorCopy (cam_viewangles, cl.viewstate.angles);
|
||||
VectorCopy (cl.viewstate.angles, cl.simangles);
|
||||
VectorCopy (cam_viewangles, cl.viewstate.player_angles);
|
||||
VectorCopy (cl.viewstate.player_angles, cl.simangles);
|
||||
cl.simangles[ROLL] = 0; // FIXME @@@
|
||||
}
|
||||
#endif
|
||||
|
@ -575,7 +575,7 @@ Cam_FinishMove (usercmd_t *cmd)
|
|||
adjustang (cam_viewangles[YAW], vec2[YAW],
|
||||
cl_camera_maxyaw->value);
|
||||
}
|
||||
VectorCopy (cam_viewangles, cl.viewstate.angles);
|
||||
VectorCopy (cam_viewangles, cl.viewstate.player_angles);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -586,7 +586,7 @@ Cam_FinishMove (usercmd_t *cmd)
|
|||
|
||||
if (autocam > CAM_TRACK) {
|
||||
Cam_Unlock ();
|
||||
VectorCopy (cl.viewstate.angles, cmd->angles);
|
||||
VectorCopy (cl.viewstate.player_angles, cmd->angles);
|
||||
return;
|
||||
}
|
||||
} else
|
||||
|
|
|
@ -333,7 +333,7 @@ nextdemomessage:
|
|||
cls.netchan.outgoing_sequence++;
|
||||
for (i = 0; i < 3; i++) {
|
||||
Qread (cls.demofile, &f, 4);
|
||||
cl.viewstate.angles[i] = LittleFloat (f);
|
||||
cl.viewstate.player_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.viewstate.angles[i]);
|
||||
fl = LittleFloat (cl.viewstate.player_angles[i]);
|
||||
Qwrite (cls.demofile, &fl, 4);
|
||||
}
|
||||
|
||||
|
|
|
@ -394,7 +394,7 @@ CL_LinkPlayers (void)
|
|||
|
||||
// spawn light flashes, even ones coming from invisible objects
|
||||
if (j == cl.playernum) {
|
||||
org = cl.viewstate.origin;
|
||||
org = cl.viewstate.player_origin;
|
||||
r_data->player_entity = &cl_player_ents[j];
|
||||
clientplayer = true;
|
||||
} else {
|
||||
|
@ -444,8 +444,8 @@ CL_LinkPlayers (void)
|
|||
// angles
|
||||
if (j == cl.playernum)
|
||||
{
|
||||
ang[PITCH] = -cl.viewstate.angles[PITCH] / 3.0;
|
||||
ang[YAW] = cl.viewstate.angles[YAW];
|
||||
ang[PITCH] = -cl.viewstate.player_angles[PITCH] / 3.0;
|
||||
ang[YAW] = cl.viewstate.player_angles[YAW];
|
||||
} else {
|
||||
ang[PITCH] = -state->viewangles[PITCH] / 3.0;
|
||||
ang[YAW] = state->viewangles[YAW];
|
||||
|
@ -516,14 +516,14 @@ CL_EmitEntities (void)
|
|||
return;
|
||||
|
||||
TEntContext_t tentCtx = {
|
||||
cl.viewstate.origin, cl.worldmodel, cl.viewentity
|
||||
cl.viewstate.player_origin, cl.worldmodel, cl.viewentity
|
||||
};
|
||||
|
||||
CL_LinkPlayers ();
|
||||
CL_LinkPacketEntities ();
|
||||
CL_UpdateTEnts (cl.time, &tentCtx);
|
||||
if (cl_draw_locs->int_val) {
|
||||
locs_draw (cl.time, cl.viewstate.origin);
|
||||
locs_draw (cl.time, cl.viewstate.player_origin);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,9 +90,9 @@ CL_BaseMove (usercmd_t *cmd)
|
|||
if (cls.state != ca_active) {
|
||||
return;
|
||||
}
|
||||
VectorCopy (cl.viewstate.angles, cl.movestate.angles);//FIXME
|
||||
VectorCopy (cl.viewstate.player_angles, cl.movestate.angles);//FIXME
|
||||
CL_Input_BuildMove (host_frametime, &cl.movestate, &cl.viewstate);
|
||||
VectorCopy (cl.movestate.angles, cl.viewstate.angles);//FIXME
|
||||
VectorCopy (cl.movestate.angles, cl.viewstate.player_angles);//FIXME
|
||||
|
||||
memset (cmd, 0, sizeof (*cmd));
|
||||
cmd->forwardmove = cl.movestate.move[FORWARD];
|
||||
|
@ -139,7 +139,7 @@ CL_FinishMove (usercmd_t *cmd)
|
|||
}
|
||||
cmd->msec = ms;
|
||||
|
||||
VectorCopy (cl.viewstate.angles, cmd->angles);
|
||||
VectorCopy (cl.viewstate.player_angles, cmd->angles);
|
||||
|
||||
cmd->impulse = in_impulse;
|
||||
in_impulse = 0;
|
||||
|
|
|
@ -1102,7 +1102,7 @@ CL_Download_f (void)
|
|||
static void
|
||||
Force_CenterView_f (void)
|
||||
{
|
||||
cl.viewstate.angles[PITCH] = 0;
|
||||
cl.viewstate.player_angles[PITCH] = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1111,12 +1111,12 @@ CL_PRotate_f (void)
|
|||
if ((cl.fpd & FPD_LIMIT_PITCH) || Cmd_Argc() < 2)
|
||||
return;
|
||||
|
||||
cl.viewstate.angles[PITCH] += atoi (Cmd_Argv (1));
|
||||
cl.viewstate.player_angles[PITCH] += atoi (Cmd_Argv (1));
|
||||
|
||||
if (cl.viewstate.angles[PITCH] < -70)
|
||||
cl.viewstate.angles[PITCH] = -70;
|
||||
else if (cl.viewstate.angles[PITCH] > 80)
|
||||
cl.viewstate.angles[PITCH] = 80;
|
||||
if (cl.viewstate.player_angles[PITCH] < -70)
|
||||
cl.viewstate.player_angles[PITCH] = -70;
|
||||
else if (cl.viewstate.player_angles[PITCH] > 80)
|
||||
cl.viewstate.player_angles[PITCH] = 80;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1125,8 +1125,8 @@ CL_Rotate_f (void)
|
|||
if ((cl.fpd & FPD_LIMIT_YAW) || Cmd_Argc() < 2)
|
||||
return;
|
||||
|
||||
cl.viewstate.angles[YAW] += atoi (Cmd_Argv (1));
|
||||
cl.viewstate.angles[YAW] = anglemod (cl.viewstate.angles[YAW]);
|
||||
cl.viewstate.player_angles[YAW] += atoi (Cmd_Argv (1));
|
||||
cl.viewstate.player_angles[YAW] = anglemod(cl.viewstate.player_angles[YAW]);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1295,7 +1295,7 @@ CL_ParseMuzzleFlash (void)
|
|||
pl = &cl.frames[parsecountmod].playerstate[i - 1];
|
||||
|
||||
if (i - 1 == cl.playernum)
|
||||
AngleVectors (cl.viewstate.angles, f, r, u);
|
||||
AngleVectors (cl.viewstate.player_angles, f, r, u);
|
||||
else
|
||||
AngleVectors (pl->viewangles, f, r, u);
|
||||
|
||||
|
@ -1317,7 +1317,7 @@ CL_ParseServerMessage (void)
|
|||
const char *str;
|
||||
static dstring_t *stuffbuf;
|
||||
TEntContext_t tentCtx = {
|
||||
cl.viewstate.origin, cl.worldmodel, cl.viewentity
|
||||
cl.viewstate.player_origin, cl.worldmodel, cl.viewentity
|
||||
};
|
||||
|
||||
received_framecount = host_framecount;
|
||||
|
@ -1437,7 +1437,7 @@ CL_ParseServerMessage (void)
|
|||
|
||||
case svc_setangle:
|
||||
{
|
||||
vec_t *dest = cl.viewstate.angles;
|
||||
vec_t *dest = cl.viewstate.player_angles;
|
||||
vec3_t dummy;
|
||||
|
||||
if (cls.demoplayback2) {
|
||||
|
@ -1565,15 +1565,15 @@ CL_ParseServerMessage (void)
|
|||
cl.completed_time = realtime;
|
||||
r_data->vid->recalc_refdef = true; // go to full screen
|
||||
Sys_MaskPrintf (SYS_dev, "intermission simorg: ");
|
||||
MSG_ReadCoordV (net_message, &cl.viewstate.origin[0]);//FIXME
|
||||
cl.viewstate.origin[3] = 1;
|
||||
MSG_ReadCoordV (net_message, &cl.viewstate.player_origin[0]);//FIXME
|
||||
cl.viewstate.player_origin[3] = 1;
|
||||
Sys_MaskPrintf (SYS_dev, VEC4F_FMT,
|
||||
VEC4_EXP (cl.viewstate.origin));
|
||||
VEC4_EXP (cl.viewstate.player_origin));
|
||||
Sys_MaskPrintf (SYS_dev, "\nintermission simangles: ");
|
||||
MSG_ReadAngleV (net_message, cl.viewstate.angles);
|
||||
cl.viewstate.angles[ROLL] = 0; // FIXME @@@
|
||||
MSG_ReadAngleV (net_message, cl.viewstate.player_angles);
|
||||
cl.viewstate.player_angles[ROLL] = 0; // FIXME @@@
|
||||
Sys_MaskPrintf (SYS_dev, "%f %f %f",
|
||||
VectorExpand (cl.viewstate.angles));
|
||||
VectorExpand (cl.viewstate.player_angles));
|
||||
Sys_MaskPrintf (SYS_dev, "\n");
|
||||
cl.viewstate.velocity = (vec4f_t) { };
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ CL_PredictMove (void)
|
|||
return;
|
||||
|
||||
//VectorCopy (cl.viewstate.angles, cl.viewstate.angles);
|
||||
cl.viewstate.angles[ROLL] = 0; // FIXME @@@
|
||||
cl.viewstate.player_angles[ROLL] = 0; // FIXME @@@
|
||||
|
||||
// this is the last frame received from the server
|
||||
from = &cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK];
|
||||
|
@ -141,7 +141,7 @@ CL_PredictMove (void)
|
|||
|
||||
if (!cl_predict->int_val) {
|
||||
cl.viewstate.velocity = fromes->velocity;
|
||||
cl.viewstate.origin = fromes->origin;
|
||||
cl.viewstate.player_origin = fromes->origin;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -182,11 +182,12 @@ CL_PredictMove (void)
|
|||
if (fabs (fromes->origin[i] - toes->origin[i]) > 128) {
|
||||
// teleported, so don't lerp
|
||||
cl.viewstate.velocity = toes->velocity;
|
||||
cl.viewstate.origin = toes->origin;
|
||||
cl.viewstate.player_origin = toes->origin;
|
||||
return;
|
||||
}
|
||||
|
||||
cl.viewstate.origin = fromes->origin + f * (toes->origin - fromes->origin);
|
||||
cl.viewstate.player_origin = fromes->origin
|
||||
+ f * (toes->origin - fromes->origin);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -201,6 +201,9 @@ CL_UpdateScreen (double realtime)
|
|||
|
||||
cl.viewstate.intermission = cl.intermission != 0;
|
||||
V_PrepBlend (&cl.viewstate);
|
||||
int seq = (cls.netchan.outgoing_sequence - 1) & UPDATE_MASK;
|
||||
frame_t *frame = &cl.frames[seq];
|
||||
cl.viewstate.movecmd[FORWARD] = frame->cmd.forwardmove;
|
||||
V_RenderView (&cl.viewstate);
|
||||
SCR_UpdateScreen (cl.viewstate.camera_transform,
|
||||
realtime, scr_funcs[index]);
|
||||
|
|
|
@ -184,10 +184,10 @@ Team_ParseSay (dstring_t *buf, const char *s)
|
|||
case 'l':
|
||||
location:
|
||||
bracket = 0;
|
||||
location = locs_find (cl.viewstate.origin);
|
||||
location = locs_find (cl.viewstate.player_origin);
|
||||
if (location) {
|
||||
recorded_location = true;
|
||||
last_recorded_location = cl.viewstate.origin;
|
||||
last_recorded_location = cl.viewstate.player_origin;
|
||||
t1 = location->name;
|
||||
} else
|
||||
snprintf (t2, sizeof (t2), "Unknown!");
|
||||
|
@ -279,7 +279,7 @@ void
|
|||
Team_Dead (void)
|
||||
{
|
||||
died = true;
|
||||
death_location = cl.viewstate.origin;
|
||||
death_location = cl.viewstate.player_origin;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -370,7 +370,7 @@ locs_loc (void)
|
|||
|
||||
if (strcasecmp (Cmd_Argv (1), "add") == 0) {
|
||||
if (Cmd_Argc () >= 3)
|
||||
locs_mark (cl.viewstate.origin, desc);
|
||||
locs_mark (cl.viewstate.player_origin, desc);
|
||||
else
|
||||
Sys_Printf ("loc add <description> :marks the current location "
|
||||
"with the description and records the information "
|
||||
|
@ -379,7 +379,7 @@ locs_loc (void)
|
|||
|
||||
if (strcasecmp (Cmd_Argv (1), "rename") == 0) {
|
||||
if (Cmd_Argc () >= 3)
|
||||
locs_edit (cl.viewstate.origin, desc);
|
||||
locs_edit (cl.viewstate.player_origin, desc);
|
||||
else
|
||||
Sys_Printf ("loc rename <description> :changes the description of "
|
||||
"the nearest location marker\n");
|
||||
|
@ -387,14 +387,14 @@ locs_loc (void)
|
|||
|
||||
if (strcasecmp (Cmd_Argv (1),"delete") == 0) {
|
||||
if (Cmd_Argc () == 2)
|
||||
locs_del (cl.viewstate.origin);
|
||||
locs_del (cl.viewstate.player_origin);
|
||||
else
|
||||
Sys_Printf ("loc delete :removes nearest location marker\n");
|
||||
}
|
||||
|
||||
if (strcasecmp (Cmd_Argv (1),"move") == 0) {
|
||||
if (Cmd_Argc () == 2)
|
||||
locs_edit (cl.viewstate.origin, NULL);
|
||||
locs_edit (cl.viewstate.player_origin, NULL);
|
||||
else
|
||||
Sys_Printf ("loc move :moves the nearest location marker to your "
|
||||
"current location\n");
|
||||
|
@ -409,7 +409,7 @@ Locs_Loc_Get (void)
|
|||
if (GIB_Argc () != 1)
|
||||
GIB_USAGE ("");
|
||||
else {
|
||||
location = locs_find (cl.viewstate.origin);
|
||||
location = locs_find (cl.viewstate.player_origin);
|
||||
GIB_Return (location ? location->name : "unknown");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue