mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2024-11-11 07:01:46 +00:00
I thought this was already checked in. If it fixes something with view
stuff cool. If it breaks stuff.... Um, well...
This commit is contained in:
parent
a7d766abc9
commit
bf764072a0
3 changed files with 111 additions and 248 deletions
|
@ -1161,7 +1161,7 @@ void CL_RelinkEntities (void)
|
||||||
// interpolate player info
|
// interpolate player info
|
||||||
//
|
//
|
||||||
for (i=0 ; i<3 ; i++)
|
for (i=0 ; i<3 ; i++)
|
||||||
cl.velocity[i] = cl.mvelocity[1][i] +
|
cl.simvel[i] = cl.mvelocity[1][i] +
|
||||||
frac * (cl.mvelocity[0][i] - cl.mvelocity[1][i]);
|
frac * (cl.mvelocity[0][i] - cl.mvelocity[1][i]);
|
||||||
|
|
||||||
if (cls.demoplayback)
|
if (cls.demoplayback)
|
||||||
|
|
|
@ -337,7 +337,7 @@ typedef struct
|
||||||
// between these
|
// between these
|
||||||
vec3_t mvelocity[2]; // update by server, used for lean+bob
|
vec3_t mvelocity[2]; // update by server, used for lean+bob
|
||||||
// (0 is newest)
|
// (0 is newest)
|
||||||
vec3_t velocity; // lerped between mvelocity[0] and [1]
|
// vec3_t velocity; // lerped between mvelocity[0] and [1]
|
||||||
} client_state_t;
|
} client_state_t;
|
||||||
|
|
||||||
extern client_state_t cl;
|
extern client_state_t cl;
|
||||||
|
|
349
common/view.c
349
common/view.c
|
@ -35,15 +35,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
extern int onground;
|
extern int onground;
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
The view is allowed to move slightly from it's true position for bobbing,
|
|
||||||
but if it exceeds 8 pixels linear distance (spherical, not box), the list of
|
|
||||||
entities sent from the server may not include everything in the pvs, especially
|
|
||||||
when crossing a water boudnary.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
cvar_t *lcd_x; // FIXME: make this work sometime...
|
cvar_t *lcd_x; // FIXME: make this work sometime...
|
||||||
cvar_t *lcd_yaw;
|
cvar_t *lcd_yaw;
|
||||||
|
|
||||||
|
@ -91,7 +82,10 @@ player_state_t *view_message;
|
||||||
/*
|
/*
|
||||||
V_CalcRoll
|
V_CalcRoll
|
||||||
|
|
||||||
(desc)
|
The view is allowed to move slightly from it's true position for
|
||||||
|
bobbing, but if it exceeds 8 pixels linear distance (spherical, not
|
||||||
|
box), the list of entities sent from the server may not include
|
||||||
|
everything in the pvs, especially when crossing a water boudnary.
|
||||||
*/
|
*/
|
||||||
float
|
float
|
||||||
V_CalcRoll (vec3_t angles, vec3_t velocity)
|
V_CalcRoll (vec3_t angles, vec3_t velocity)
|
||||||
|
@ -123,14 +117,11 @@ V_CalcRoll (vec3_t angles, vec3_t velocity)
|
||||||
|
|
||||||
(desc)
|
(desc)
|
||||||
*/
|
*/
|
||||||
float V_CalcBob (void)
|
float
|
||||||
|
V_CalcBob ( void )
|
||||||
{
|
{
|
||||||
#ifdef QUAKEWORLD
|
static double bobtime;
|
||||||
static double bobtime;
|
|
||||||
static float bob;
|
static float bob;
|
||||||
#else
|
|
||||||
float bob;
|
|
||||||
#endif
|
|
||||||
float cycle;
|
float cycle;
|
||||||
|
|
||||||
#ifdef QUAKEWORLD
|
#ifdef QUAKEWORLD
|
||||||
|
@ -139,31 +130,22 @@ float V_CalcBob (void)
|
||||||
|
|
||||||
if (onground == -1)
|
if (onground == -1)
|
||||||
return bob; // just use old value
|
return bob; // just use old value
|
||||||
|
#endif
|
||||||
|
|
||||||
bobtime += host_frametime;
|
bobtime += host_frametime;
|
||||||
cycle = bobtime - (int)(bobtime/cl_bobcycle->value)*cl_bobcycle->value;
|
cycle = bobtime - (int)(bobtime/cl_bobcycle->value)*cl_bobcycle->value;
|
||||||
#else
|
|
||||||
cycle = cl.time - (int)(cl.time/cl_bobcycle->value)*cl_bobcycle->value;
|
|
||||||
#endif
|
|
||||||
cycle /= cl_bobcycle->value;
|
cycle /= cl_bobcycle->value;
|
||||||
if (cycle < cl_bobup->value)
|
if (cycle < cl_bobup->value)
|
||||||
cycle = M_PI * cycle / cl_bobup->value;
|
cycle = M_PI * cycle / cl_bobup->value;
|
||||||
else
|
else
|
||||||
cycle = M_PI + M_PI*(cycle-cl_bobup->value)/(1.0 - cl_bobup->value);
|
cycle = M_PI + M_PI*(cycle-cl_bobup->value)/(1.0 - cl_bobup->value);
|
||||||
|
|
||||||
// bob is proportional to [simulated] velocity in the xy plane
|
// bob is proportional to simulated velocity in the xy plane
|
||||||
// (don't count Z, or jumping messes it up)
|
// (don't count Z, or jumping messes it up)
|
||||||
|
|
||||||
#ifdef QUAKEWORLD
|
|
||||||
bob = sqrt(cl.simvel[0]*cl.simvel[0] + cl.simvel[1]*cl.simvel[1]) * cl_bob->value;
|
bob = sqrt(cl.simvel[0]*cl.simvel[0] + cl.simvel[1]*cl.simvel[1]) * cl_bob->value;
|
||||||
#else
|
|
||||||
bob = sqrt(cl.velocity[0]*cl.velocity[0] + cl.velocity[1]*cl.velocity[1]) * cl_bob->value;
|
|
||||||
#endif
|
|
||||||
bob = bob*0.3 + bob*0.7*sin(cycle);
|
bob = bob*0.3 + bob*0.7*sin(cycle);
|
||||||
if (bob > 4)
|
bob = bound( -7, bob, 4);
|
||||||
bob = 4;
|
|
||||||
else if (bob < -7)
|
|
||||||
bob = -7;
|
|
||||||
return bob;
|
return bob;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -202,7 +184,7 @@ V_StopPitchDrift (void)
|
||||||
|
|
||||||
Move client pitch angle towards cl.idealpitch sent by the server.
|
Move client pitch angle towards cl.idealpitch sent by the server.
|
||||||
|
|
||||||
If the user is adjusting pitch manually, either with lookup/lookdown,
|
If user is adjusting pitch manually, either with lookup/lookdown,
|
||||||
mlook and mouse, or klook and keyboard, pitch drifting is constantly
|
mlook and mouse, or klook and keyboard, pitch drifting is constantly
|
||||||
stopped.
|
stopped.
|
||||||
|
|
||||||
|
@ -212,11 +194,11 @@ V_StopPitchDrift (void)
|
||||||
void
|
void
|
||||||
V_DriftPitch ( void )
|
V_DriftPitch ( void )
|
||||||
{
|
{
|
||||||
float delta, move;
|
float delta, move;
|
||||||
|
|
||||||
#ifdef QUAKEWORLD
|
#ifdef QUAKEWORLD
|
||||||
if (view_message->onground == -1 || cls.demoplayback ) {
|
if (view_message->onground == -1 || cls.demoplayback ) {
|
||||||
#else
|
#elif UQUAKE
|
||||||
if (noclip_anglehack || !cl.onground || cls.demoplayback ) {
|
if (noclip_anglehack || !cl.onground || cls.demoplayback ) {
|
||||||
#endif
|
#endif
|
||||||
cl.driftmove = 0;
|
cl.driftmove = 0;
|
||||||
|
@ -228,7 +210,7 @@ V_DriftPitch ( void )
|
||||||
if ( cl.nodrift ) {
|
if ( cl.nodrift ) {
|
||||||
#ifdef QUAKEWORLD
|
#ifdef QUAKEWORLD
|
||||||
if ( fabs(cl.frames[(cls.netchan.outgoing_sequence-1)&UPDATE_MASK].cmd.forwardmove) < 200)
|
if ( fabs(cl.frames[(cls.netchan.outgoing_sequence-1)&UPDATE_MASK].cmd.forwardmove) < 200)
|
||||||
#else
|
#elif UQUAKE
|
||||||
if ( fabs(cl.cmd.forwardmove) < cl_forwardspeed->value)
|
if ( fabs(cl.cmd.forwardmove) < cl_forwardspeed->value)
|
||||||
#endif
|
#endif
|
||||||
cl.driftmove = 0;
|
cl.driftmove = 0;
|
||||||
|
@ -342,9 +324,6 @@ V_ParseDamage ( void )
|
||||||
vec3_t from;
|
vec3_t from;
|
||||||
int i;
|
int i;
|
||||||
vec3_t forward, right, up;
|
vec3_t forward, right, up;
|
||||||
#ifdef UQUAKE
|
|
||||||
entity_t *ent;
|
|
||||||
#endif
|
|
||||||
float side;
|
float side;
|
||||||
float count;
|
float count;
|
||||||
|
|
||||||
|
@ -376,20 +355,10 @@ V_ParseDamage ( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate view angle kicks
|
// calculate view angle kicks
|
||||||
#ifdef QUAKEWORLD
|
|
||||||
VectorSubtract (from, cl.simorg, from);
|
VectorSubtract (from, cl.simorg, from);
|
||||||
#else
|
|
||||||
ent = &cl_entities[cl.playernum + 1];
|
|
||||||
|
|
||||||
VectorSubtract (from, ent->origin, from);
|
|
||||||
#endif
|
|
||||||
VectorNormalize (from);
|
VectorNormalize (from);
|
||||||
|
|
||||||
#ifdef QUAKEWORLD
|
|
||||||
AngleVectors (cl.simangles, forward, right, up);
|
AngleVectors (cl.simangles, forward, right, up);
|
||||||
#else
|
|
||||||
AngleVectors (ent->angles, forward, right, up);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
side = DotProduct (from, right);
|
side = DotProduct (from, right);
|
||||||
v_dmg_roll = count*side*v_kickroll->value;
|
v_dmg_roll = count*side*v_kickroll->value;
|
||||||
|
@ -409,9 +378,10 @@ V_ParseDamage ( void )
|
||||||
void
|
void
|
||||||
V_cshift_f ( void )
|
V_cshift_f ( void )
|
||||||
{
|
{
|
||||||
cshift_empty.destcolor[0] = atoi(Cmd_Argv(1));
|
int i;
|
||||||
cshift_empty.destcolor[1] = atoi(Cmd_Argv(2));
|
|
||||||
cshift_empty.destcolor[2] = atoi(Cmd_Argv(3));
|
for ( i=0 ; i<3 ; i++ )
|
||||||
|
cshift_empty.destcolor[i] = atoi(Cmd_Argv(i+1));
|
||||||
cshift_empty.percent = atoi(Cmd_Argv(4));
|
cshift_empty.percent = atoi(Cmd_Argv(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,31 +408,27 @@ V_BonusFlash_f ( void )
|
||||||
void
|
void
|
||||||
V_SetContentsColor (int contents)
|
V_SetContentsColor (int contents)
|
||||||
{
|
{
|
||||||
#ifdef QUAKEWORLD
|
|
||||||
if (!v_contentblend->value) {
|
if (!v_contentblend->value) {
|
||||||
cl.cshifts[CSHIFT_CONTENTS] = cshift_empty;
|
cl.cshifts[CSHIFT_CONTENTS] = cshift_empty;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (contents) {
|
||||||
|
case CONTENTS_EMPTY:
|
||||||
|
cl.cshifts[CSHIFT_CONTENTS] = cshift_empty;
|
||||||
|
break;
|
||||||
|
case CONTENTS_LAVA:
|
||||||
|
cl.cshifts[CSHIFT_CONTENTS] = cshift_lava;
|
||||||
|
break;
|
||||||
|
case CONTENTS_SOLID:
|
||||||
|
#ifdef UQUAKE
|
||||||
|
cl.cshifts[CSHIFT_CONTENTS] = cshift_empty;
|
||||||
#endif
|
#endif
|
||||||
switch (contents)
|
case CONTENTS_SLIME:
|
||||||
{
|
cl.cshifts[CSHIFT_CONTENTS] = cshift_slime;
|
||||||
case CONTENTS_SOLID:
|
break;
|
||||||
#ifdef QUAKEWORLD
|
default:
|
||||||
cl.cshifts[CSHIFT_CONTENTS] = cshift_slime;
|
cl.cshifts[CSHIFT_CONTENTS] = cshift_water;
|
||||||
#else
|
|
||||||
cl.cshifts[CSHIFT_CONTENTS] = cshift_empty;
|
|
||||||
#endif
|
|
||||||
case CONTENTS_EMPTY:
|
|
||||||
cl.cshifts[CSHIFT_CONTENTS] = cshift_empty;
|
|
||||||
break;
|
|
||||||
case CONTENTS_LAVA:
|
|
||||||
cl.cshifts[CSHIFT_CONTENTS] = cshift_lava;
|
|
||||||
break;
|
|
||||||
case CONTENTS_SLIME:
|
|
||||||
cl.cshifts[CSHIFT_CONTENTS] = cshift_slime;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
cl.cshifts[CSHIFT_CONTENTS] = cshift_water;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,16 +479,12 @@ V_CalcBlend ( void )
|
||||||
b = 0;
|
b = 0;
|
||||||
a = 0;
|
a = 0;
|
||||||
|
|
||||||
for (j=0 ; j<NUM_CSHIFTS ; j++)
|
for (j=0 ; j<NUM_CSHIFTS ; j++) {
|
||||||
{
|
|
||||||
if (!gl_cshiftpercent->value)
|
if (!gl_cshiftpercent->value)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
a2 = ((cl.cshifts[j].percent * gl_cshiftpercent->value) / 100.0) / 255.0;
|
a2 = ((cl.cshifts[j].percent * gl_cshiftpercent->value) / 100.0) / 255.0;
|
||||||
|
|
||||||
// a2 = (cl.cshifts[j].percent/2)/255.0; // from qw
|
|
||||||
// a2 = cl.cshifts[j].percent/255.0; // from uq
|
|
||||||
|
|
||||||
if (!a2)
|
if (!a2)
|
||||||
continue;
|
continue;
|
||||||
a = a + a2*(1-a);
|
a = a + a2*(1-a);
|
||||||
|
@ -572,15 +534,11 @@ CalcGunAngle ( void )
|
||||||
pitch = -r_refdef.viewangles[PITCH];
|
pitch = -r_refdef.viewangles[PITCH];
|
||||||
|
|
||||||
yaw = angledelta(yaw - r_refdef.viewangles[YAW]) * 0.4;
|
yaw = angledelta(yaw - r_refdef.viewangles[YAW]) * 0.4;
|
||||||
if (yaw > 10)
|
yaw = bound(-10, yaw, 10);
|
||||||
yaw = 10;
|
|
||||||
if (yaw < -10)
|
|
||||||
yaw = -10;
|
|
||||||
pitch = angledelta(-pitch - r_refdef.viewangles[PITCH]) * 0.4;
|
pitch = angledelta(-pitch - r_refdef.viewangles[PITCH]) * 0.4;
|
||||||
if (pitch > 10)
|
pitch = bound(-10, pitch, 10);
|
||||||
pitch = 10;
|
|
||||||
if (pitch < -10)
|
|
||||||
pitch = -10;
|
|
||||||
move = host_frametime*20;
|
move = host_frametime*20;
|
||||||
if ( yaw > oldyaw ) {
|
if ( yaw > oldyaw ) {
|
||||||
if (oldyaw + move < yaw)
|
if (oldyaw + move < yaw)
|
||||||
|
@ -603,13 +561,9 @@ CalcGunAngle ( void )
|
||||||
|
|
||||||
cl.viewent.angles[YAW] = r_refdef.viewangles[YAW] + yaw;
|
cl.viewent.angles[YAW] = r_refdef.viewangles[YAW] + yaw;
|
||||||
cl.viewent.angles[PITCH] = - (r_refdef.viewangles[PITCH] + pitch);
|
cl.viewent.angles[PITCH] = - (r_refdef.viewangles[PITCH] + pitch);
|
||||||
#ifdef UQUAKE
|
|
||||||
cl.viewent.angles[ROLL] -= v_idlescale->value * sin(cl.time*v_iroll_cycle->value) * v_iroll_level->value;
|
|
||||||
cl.viewent.angles[PITCH] -= v_idlescale->value * sin(cl.time*v_ipitch_cycle->value) * v_ipitch_level->value;
|
|
||||||
cl.viewent.angles[YAW] -= v_idlescale->value * sin(cl.time*v_iyaw_cycle->value) * v_iyaw_level->value;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
V_BoundOffsets
|
V_BoundOffsets
|
||||||
|
|
||||||
|
@ -619,15 +573,6 @@ CalcGunAngle ( void )
|
||||||
void
|
void
|
||||||
V_BoundOffsets ( void )
|
V_BoundOffsets ( void )
|
||||||
{
|
{
|
||||||
#ifdef UQUAKE
|
|
||||||
entity_t *ent;
|
|
||||||
|
|
||||||
ent = &cl_entities[cl.playernum + 1];
|
|
||||||
#endif
|
|
||||||
// absolutely bound refresh reletive to entity clipping hull
|
|
||||||
// so the view can never be inside a solid wall
|
|
||||||
|
|
||||||
#ifdef QUAKEWORLD
|
|
||||||
if (r_refdef.vieworg[0] < cl.simorg[0] - 14)
|
if (r_refdef.vieworg[0] < cl.simorg[0] - 14)
|
||||||
r_refdef.vieworg[0] = cl.simorg[0] - 14;
|
r_refdef.vieworg[0] = cl.simorg[0] - 14;
|
||||||
else if (r_refdef.vieworg[0] > cl.simorg[0] + 14)
|
else if (r_refdef.vieworg[0] > cl.simorg[0] + 14)
|
||||||
|
@ -640,22 +585,9 @@ V_BoundOffsets ( void )
|
||||||
r_refdef.vieworg[2] = cl.simorg[2] - 22;
|
r_refdef.vieworg[2] = cl.simorg[2] - 22;
|
||||||
else if (r_refdef.vieworg[2] > cl.simorg[2] + 30)
|
else if (r_refdef.vieworg[2] > cl.simorg[2] + 30)
|
||||||
r_refdef.vieworg[2] = cl.simorg[2] + 30;
|
r_refdef.vieworg[2] = cl.simorg[2] + 30;
|
||||||
#else
|
|
||||||
if (r_refdef.vieworg[0] < ent->origin[0] - 14)
|
|
||||||
r_refdef.vieworg[0] = ent->origin[0] - 14;
|
|
||||||
else if (r_refdef.vieworg[0] > ent->origin[0] + 14)
|
|
||||||
r_refdef.vieworg[0] = ent->origin[0] + 14;
|
|
||||||
if (r_refdef.vieworg[1] < ent->origin[1] - 14)
|
|
||||||
r_refdef.vieworg[1] = ent->origin[1] - 14;
|
|
||||||
else if (r_refdef.vieworg[1] > ent->origin[1] + 14)
|
|
||||||
r_refdef.vieworg[1] = ent->origin[1] + 14;
|
|
||||||
if (r_refdef.vieworg[2] < ent->origin[2] - 22)
|
|
||||||
r_refdef.vieworg[2] = ent->origin[2] - 22;
|
|
||||||
else if (r_refdef.vieworg[2] > ent->origin[2] + 30)
|
|
||||||
r_refdef.vieworg[2] = ent->origin[2] + 30;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
V_AddIdle
|
V_AddIdle
|
||||||
|
|
||||||
|
@ -667,11 +599,10 @@ V_AddIdle ( void )
|
||||||
r_refdef.viewangles[ROLL] += v_idlescale->value * sin(cl.time*v_iroll_cycle->value) * v_iroll_level->value;
|
r_refdef.viewangles[ROLL] += v_idlescale->value * sin(cl.time*v_iroll_cycle->value) * v_iroll_level->value;
|
||||||
r_refdef.viewangles[PITCH] += v_idlescale->value * sin(cl.time*v_ipitch_cycle->value) * v_ipitch_level->value;
|
r_refdef.viewangles[PITCH] += v_idlescale->value * sin(cl.time*v_ipitch_cycle->value) * v_ipitch_level->value;
|
||||||
r_refdef.viewangles[YAW] += v_idlescale->value * sin(cl.time*v_iyaw_cycle->value) * v_iyaw_level->value;
|
r_refdef.viewangles[YAW] += v_idlescale->value * sin(cl.time*v_iyaw_cycle->value) * v_iyaw_level->value;
|
||||||
#ifdef QUAKEWORLD
|
|
||||||
cl.viewent.angles[ROLL] -= v_idlescale->value * sin(cl.time*v_iroll_cycle->value) * v_iroll_level->value;
|
cl.viewent.angles[ROLL] -= v_idlescale->value * sin(cl.time*v_iroll_cycle->value) * v_iroll_level->value;
|
||||||
cl.viewent.angles[PITCH] -= v_idlescale->value * sin(cl.time*v_ipitch_cycle->value) * v_ipitch_level->value;
|
cl.viewent.angles[PITCH] -= v_idlescale->value * sin(cl.time*v_ipitch_cycle->value) * v_ipitch_level->value;
|
||||||
cl.viewent.angles[YAW] -= v_idlescale->value * sin(cl.time*v_iyaw_cycle->value) * v_iyaw_level->value;
|
cl.viewent.angles[YAW] -= v_idlescale->value * sin(cl.time*v_iyaw_cycle->value) * v_iyaw_level->value;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -685,11 +616,7 @@ V_CalcViewRoll (void)
|
||||||
{
|
{
|
||||||
float side;
|
float side;
|
||||||
|
|
||||||
#ifdef QUAKEWORLD
|
|
||||||
side = V_CalcRoll (cl.simangles, cl.simvel);
|
side = V_CalcRoll (cl.simangles, cl.simvel);
|
||||||
#else
|
|
||||||
side = V_CalcRoll (cl_entities[cl.playernum + 1].angles, cl.velocity);
|
|
||||||
#endif
|
|
||||||
r_refdef.viewangles[ROLL] += side;
|
r_refdef.viewangles[ROLL] += side;
|
||||||
|
|
||||||
if (v_dmg_time > 0) {
|
if (v_dmg_time > 0) {
|
||||||
|
@ -717,35 +644,23 @@ void
|
||||||
V_CalcIntermissionRefdef ( void )
|
V_CalcIntermissionRefdef ( void )
|
||||||
{
|
{
|
||||||
entity_t *view;
|
entity_t *view;
|
||||||
#ifdef UQUAKE
|
|
||||||
entity_t *ent;
|
|
||||||
#endif
|
|
||||||
float old;
|
float old;
|
||||||
|
|
||||||
// view is the weapon model
|
// view is the weapon model
|
||||||
#ifdef UQUAKE
|
|
||||||
// ent is the player model (visible when out of body)
|
|
||||||
ent = &cl_entities[cl.playernum + 1];
|
|
||||||
// view is the weapon model (only visible from inside body)
|
|
||||||
#endif
|
|
||||||
view = &cl.viewent;
|
view = &cl.viewent;
|
||||||
|
|
||||||
#ifdef QUAKEWORLD
|
|
||||||
VectorCopy (cl.simorg, r_refdef.vieworg);
|
VectorCopy (cl.simorg, r_refdef.vieworg);
|
||||||
VectorCopy (cl.simangles, r_refdef.viewangles);
|
VectorCopy (cl.simangles, r_refdef.viewangles);
|
||||||
#else
|
|
||||||
VectorCopy (ent->origin, r_refdef.vieworg);
|
|
||||||
VectorCopy (ent->angles, r_refdef.viewangles);
|
|
||||||
#endif
|
|
||||||
view->model = NULL;
|
view->model = NULL;
|
||||||
|
|
||||||
// allways idle in intermission
|
// allways idle in intermission
|
||||||
old = v_idlescale->value;
|
old = v_idlescale->value;
|
||||||
v_idlescale->value = 1;
|
v_idlescale->value = 1;
|
||||||
V_AddIdle ();
|
V_AddIdle ();
|
||||||
v_idlescale->value = old;
|
v_idlescale->value = old;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
V_CalcRefdef
|
V_CalcRefdef
|
||||||
|
|
||||||
|
@ -754,72 +669,54 @@ V_CalcIntermissionRefdef ( void )
|
||||||
void
|
void
|
||||||
V_CalcRefdef ( void )
|
V_CalcRefdef ( void )
|
||||||
{
|
{
|
||||||
entity_t *view;
|
entity_t *view;
|
||||||
#ifdef QUAKEWORLD
|
int i;
|
||||||
int h;
|
vec3_t forward, right, up;
|
||||||
#else
|
#ifdef UQUAKE
|
||||||
entity_t *ent;
|
vec3_t angles;
|
||||||
vec3_t angles;
|
|
||||||
#endif
|
#endif
|
||||||
int i;
|
float bob;
|
||||||
vec3_t forward, right, up;
|
static float oldz = 0;
|
||||||
float bob;
|
int vh;
|
||||||
static float oldz = 0;
|
|
||||||
|
|
||||||
|
// Set up view height
|
||||||
#ifdef QUAKEWORLD
|
#ifdef QUAKEWORLD
|
||||||
h = cl.qfserver ? cl.stats[STAT_VIEWHEIGHT] : 22;
|
vh = cl.qfserver ? cl.stats[STAT_VIEWHEIGHT] : 22;
|
||||||
|
#elif UQUAKE
|
||||||
|
vh = cl.viewheight;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
V_DriftPitch ();
|
V_DriftPitch ();
|
||||||
|
|
||||||
#ifdef UQUAKE
|
// view is the weapon model (only visible from inside body)
|
||||||
// ent is the player model (visible when out of body)
|
|
||||||
ent = &cl_entities[cl.playernum + 1];
|
|
||||||
#endif
|
|
||||||
// view is the weapon model (only visible from inside body)
|
|
||||||
view = &cl.viewent;
|
view = &cl.viewent;
|
||||||
|
|
||||||
#ifdef UQUAKE
|
|
||||||
// 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
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
bob = V_CalcBob ();
|
bob = V_CalcBob ();
|
||||||
|
|
||||||
#ifdef QUAKEWORLD
|
// refresh position from simulated origin
|
||||||
// refresh position from simulated origin
|
|
||||||
VectorCopy (cl.simorg, r_refdef.vieworg);
|
VectorCopy (cl.simorg, r_refdef.vieworg);
|
||||||
|
#ifdef QUAKEWORLD
|
||||||
r_refdef.vieworg[2] += bob;
|
r_refdef.vieworg[2] += bob;
|
||||||
#else
|
#elif UQUAKE
|
||||||
// refresh position
|
r_refdef.vieworg[2] += vh + bob;
|
||||||
VectorCopy (ent->origin, r_refdef.vieworg);
|
|
||||||
r_refdef.vieworg[2] += cl.viewheight + bob;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// never let it sit exactly on a node line, because a water plane can
|
/*
|
||||||
// dissapear when viewed with the eye exactly on it.
|
never let it sit exactly on a node line, because a water plane can
|
||||||
|
dissapear when viewed with the eye exactly on it. the server protocol
|
||||||
|
only specifies to 1/N pixel, so add VIEWORG_PIXADJUST in each axis
|
||||||
|
*/
|
||||||
#ifdef QUAKEWORLD
|
#ifdef QUAKEWORLD
|
||||||
// the server protocol only specifies to 1/8 pixel, so add 1/16 in each axis
|
#define VIEWORG_PIXADJUST 16
|
||||||
r_refdef.vieworg[0] += 1.0/16;
|
#elif UQUAKE
|
||||||
r_refdef.vieworg[1] += 1.0/16;
|
#define VIEWORG_PIXADJUST 32
|
||||||
r_refdef.vieworg[2] += 1.0/16;
|
|
||||||
#else
|
|
||||||
// the server protocol only specifies to 1/16 pixel, so add 1/32 in each axis
|
|
||||||
r_refdef.vieworg[0] += 1.0/32;
|
|
||||||
r_refdef.vieworg[1] += 1.0/32;
|
|
||||||
r_refdef.vieworg[2] += 1.0/32;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef QUAKEWORLD
|
for ( i = 0 ; i < 3 ; i++ ) {
|
||||||
|
r_refdef.vieworg[i] += 1.0/VIEWORG_PIXADJUST;
|
||||||
|
}
|
||||||
|
|
||||||
VectorCopy (cl.simangles, r_refdef.viewangles);
|
VectorCopy (cl.simangles, r_refdef.viewangles);
|
||||||
#else
|
|
||||||
VectorCopy (cl.viewangles, r_refdef.viewangles);
|
|
||||||
#endif
|
|
||||||
V_CalcViewRoll ();
|
V_CalcViewRoll ();
|
||||||
V_AddIdle ();
|
V_AddIdle ();
|
||||||
|
|
||||||
|
@ -830,55 +727,38 @@ V_CalcRefdef ( void )
|
||||||
else if (view_message->flags & PF_DEAD)
|
else if (view_message->flags & PF_DEAD)
|
||||||
r_refdef.vieworg[2] -= 16; // corpse view height
|
r_refdef.vieworg[2] -= 16; // corpse view height
|
||||||
else
|
else
|
||||||
r_refdef.vieworg[2] += h; // view height
|
r_refdef.vieworg[2] += vh; // view height
|
||||||
|
|
||||||
if (view_message->flags & PF_DEAD) // PF_GIB will also set PF_DEAD
|
if (view_message->flags & PF_DEAD) // PF_GIB will also set PF_DEAD
|
||||||
r_refdef.viewangles[ROLL] = 80; // dead view angle
|
r_refdef.viewangles[ROLL] = 80; // dead view angle
|
||||||
#else
|
|
||||||
// offsets
|
|
||||||
angles[PITCH] = -ent->angles[PITCH]; // because entity pitches are
|
|
||||||
// actually backward
|
|
||||||
angles[YAW] = ent->angles[YAW];
|
|
||||||
angles[ROLL] = ent->angles[ROLL];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef UQUAKE
|
AngleVectors ( cl.simangles, forward, right, up );
|
||||||
|
#elif UQUAKE
|
||||||
|
angles[PITCH] = -cl.simangles[PITCH]; // because entity pitches are
|
||||||
|
// actually backward FIXME?
|
||||||
|
angles[YAW] = cl.simangles[YAW];
|
||||||
|
angles[ROLL] = cl.simangles[ROLL];
|
||||||
|
|
||||||
AngleVectors (angles, forward, right, up);
|
AngleVectors (angles, forward, right, up);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef QUAKEWORLD
|
for (i=0 ; i<3 ; i++) {
|
||||||
// offsets
|
|
||||||
AngleVectors (cl.simangles, forward, right, up);
|
|
||||||
#else
|
|
||||||
for (i=0 ; i<3 ; i++)
|
|
||||||
r_refdef.vieworg[i] += scr_ofsx->value*forward[i]
|
r_refdef.vieworg[i] += scr_ofsx->value*forward[i]
|
||||||
+ scr_ofsy->value*right[i]
|
+ scr_ofsy->value*right[i]
|
||||||
+ scr_ofsz->value*up[i];
|
+ scr_ofsz->value*up[i];
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef UQUAKE
|
|
||||||
V_BoundOffsets ();
|
V_BoundOffsets ();
|
||||||
#endif
|
#endif
|
||||||
// set up gun position
|
|
||||||
#ifdef QUAKEWORLD
|
// set up gun position
|
||||||
VectorCopy (cl.simangles, view->angles);
|
VectorCopy (cl.simangles, view->angles);
|
||||||
#else
|
|
||||||
VectorCopy (cl.viewangles, view->angles);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CalcGunAngle ();
|
CalcGunAngle ();
|
||||||
|
|
||||||
#ifdef QUAKEWORLD
|
|
||||||
VectorCopy (cl.simorg, view->origin);
|
VectorCopy (cl.simorg, view->origin);
|
||||||
view->origin[2] += h;
|
view->origin[2] += vh;
|
||||||
#else
|
|
||||||
VectorCopy (ent->origin, view->origin);
|
|
||||||
view->origin[2] += cl.viewheight;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (i=0 ; i<3 ; i++)
|
for ( i=0 ; i<3 ; i++ ) {
|
||||||
{
|
|
||||||
view->origin[i] += forward[i]*bob*0.4;
|
view->origin[i] += forward[i]*bob*0.4;
|
||||||
// view->origin[i] += right[i]*bob*0.4;
|
// view->origin[i] += right[i]*bob*0.4;
|
||||||
// view->origin[i] += up[i]*bob*0.8;
|
// view->origin[i] += up[i]*bob*0.8;
|
||||||
|
@ -902,7 +782,7 @@ V_CalcRefdef ( void )
|
||||||
else
|
else
|
||||||
view->model = cl.model_precache[cl.stats[STAT_WEAPON]];
|
view->model = cl.model_precache[cl.stats[STAT_WEAPON]];
|
||||||
view->frame = view_message->weaponframe;
|
view->frame = view_message->weaponframe;
|
||||||
#else
|
#elif UQUAKE
|
||||||
view->model = cl.model_precache[cl.stats[STAT_WEAPON]];
|
view->model = cl.model_precache[cl.stats[STAT_WEAPON]];
|
||||||
view->frame = cl.stats[STAT_WEAPONFRAME];
|
view->frame = cl.stats[STAT_WEAPONFRAME];
|
||||||
#endif
|
#endif
|
||||||
|
@ -914,13 +794,15 @@ V_CalcRefdef ( void )
|
||||||
// smooth out stair step ups
|
// smooth out stair step ups
|
||||||
#ifdef QUAKEWORLD
|
#ifdef QUAKEWORLD
|
||||||
if ( (view_message->onground != -1) && (cl.simorg[2] - oldz > 0) ) {
|
if ( (view_message->onground != -1) && (cl.simorg[2] - oldz > 0) ) {
|
||||||
|
#elif UQUAKE
|
||||||
|
if ( cl.onground && (cl.simorg[2] - oldz > 0) ) {
|
||||||
|
#endif
|
||||||
float steptime;
|
float steptime;
|
||||||
|
|
||||||
steptime = host_frametime;
|
steptime = host_frametime;
|
||||||
|
|
||||||
oldz += steptime * 80;
|
oldz += steptime * 80;
|
||||||
if (oldz > cl.simorg[2])
|
oldz = min(oldz, cl.simorg[2]);
|
||||||
oldz = cl.simorg[2];
|
|
||||||
if (cl.simorg[2] - oldz > 12)
|
if (cl.simorg[2] - oldz > 12)
|
||||||
oldz = cl.simorg[2] - 12;
|
oldz = cl.simorg[2] - 12;
|
||||||
r_refdef.vieworg[2] += oldz - cl.simorg[2];
|
r_refdef.vieworg[2] += oldz - cl.simorg[2];
|
||||||
|
@ -928,26 +810,8 @@ V_CalcRefdef ( void )
|
||||||
} else {
|
} else {
|
||||||
oldz = cl.simorg[2];
|
oldz = cl.simorg[2];
|
||||||
}
|
}
|
||||||
#else
|
#ifdef UQUAKE
|
||||||
if (cl.onground && ent->origin[2] - oldz > 0) {
|
if ( cl_chasecam->value )
|
||||||
float steptime;
|
|
||||||
|
|
||||||
steptime = cl.time - cl.oldtime;
|
|
||||||
if (steptime < 0)
|
|
||||||
//FIXME I_Error ("steptime < 0");
|
|
||||||
steptime = 0;
|
|
||||||
|
|
||||||
oldz += steptime * 80;
|
|
||||||
if (oldz > ent->origin[2])
|
|
||||||
oldz = ent->origin[2];
|
|
||||||
if (ent->origin[2] - oldz > 12)
|
|
||||||
oldz = ent->origin[2] - 12;
|
|
||||||
r_refdef.vieworg[2] += oldz - ent->origin[2];
|
|
||||||
view->origin[2] += oldz - ent->origin[2];
|
|
||||||
}
|
|
||||||
|
|
||||||
oldz = ent->origin[2];
|
|
||||||
if (cl_chasecam->value)
|
|
||||||
Chase_Update ();
|
Chase_Update ();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -959,7 +823,7 @@ V_CalcRefdef ( void )
|
||||||
*/
|
*/
|
||||||
#ifdef QUAKEWORLD
|
#ifdef QUAKEWORLD
|
||||||
void
|
void
|
||||||
DropPunchAngle (void)
|
DropPunchAngle ( void )
|
||||||
{
|
{
|
||||||
cl.punchangle -= 10*host_frametime;
|
cl.punchangle -= 10*host_frametime;
|
||||||
cl.punchangle = max(cl.punchangle, 0);
|
cl.punchangle = max(cl.punchangle, 0);
|
||||||
|
@ -974,23 +838,24 @@ DropPunchAngle (void)
|
||||||
*/
|
*/
|
||||||
extern vrect_t scr_vrect;
|
extern vrect_t scr_vrect;
|
||||||
|
|
||||||
void V_RenderView (void)
|
void
|
||||||
|
V_RenderView ( void )
|
||||||
{
|
{
|
||||||
#ifdef QUAKEWORLD
|
#ifdef QUAKEWORLD
|
||||||
// if (cl.simangles[ROLL])
|
if (cl.simangles[ROLL])
|
||||||
// Sys_Error ("cl.simangles[ROLL]"); // DEBUG
|
Sys_Printf ("cl.simangles[ROLL] != 0"); // DEBUG
|
||||||
cl.simangles[ROLL] = 0; // FIXME
|
cl.simangles[ROLL] = 0; // FIXME
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (cls.state != ca_active)
|
if (cls.state != ca_active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef QUAKEWORLD
|
#ifdef QUAKEWORLD
|
||||||
view_frame = &cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK];
|
view_frame = &cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK];
|
||||||
view_message = &view_frame->playerstate[cl.playernum];
|
view_message = &view_frame->playerstate[cl.playernum];
|
||||||
#else
|
#elif UQUAKE
|
||||||
// don't allow cheats in multiplayer
|
// don't allow cheats in multiplayer
|
||||||
if (cl.maxclients > 1)
|
if (cl.maxclients > 1) {
|
||||||
{
|
|
||||||
Cvar_Set ("scr_ofsx", "0");
|
Cvar_Set ("scr_ofsx", "0");
|
||||||
Cvar_Set ("scr_ofsy", "0");
|
Cvar_Set ("scr_ofsy", "0");
|
||||||
Cvar_Set ("scr_ofsz", "0");
|
Cvar_Set ("scr_ofsz", "0");
|
||||||
|
@ -1102,5 +967,3 @@ V_Init ( void )
|
||||||
|
|
||||||
BuildGammaTable (v_gamma->value); // no gamma yet
|
BuildGammaTable (v_gamma->value); // no gamma yet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue