Header/whitespace rampage continues.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2001-08-28 03:47:10 +00:00
parent f4fd3178f4
commit b1c0bb7626
6 changed files with 306 additions and 461 deletions

View file

@ -32,11 +32,12 @@
#include <math.h> #include <math.h>
#include "QF/cvar.h"
#include "QF/qtypes.h"
#include "client.h" #include "client.h"
#include "compat.h" #include "compat.h"
#include "QF/cvar.h"
#include "pmove.h" #include "pmove.h"
#include "QF/qtypes.h"
cvar_t *no_pogo_stick; cvar_t *no_pogo_stick;
movevars_t movevars; movevars_t movevars;
@ -57,6 +58,7 @@ vec3_t player_maxs = { 16, 16, 32 };
void PM_InitBoxHull (void); void PM_InitBoxHull (void);
void PM_CategorizePosition (void); void PM_CategorizePosition (void);
void void
Pmove_Init (void) Pmove_Init (void)
{ {
@ -71,23 +73,18 @@ Pmove_Init_Cvars (void)
} }
#define STEPSIZE 18 #define STEPSIZE 18
#define BUTTON_JUMP 2 #define BUTTON_JUMP 2
/* /*
PM_ClipVelocity PM_ClipVelocity
Slide off of the impacting object Slide off of the impacting object
returns the blocked flags (1 = floor, 2 = step / wall) returns the blocked flags (1 = floor, 2 = step / wall)
*/ */
int int
PM_ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce) PM_ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce)
{ {
float backoff; float backoff, change;
float change;
int i, blocked; int i, blocked;
blocked = 0; blocked = 0;
@ -108,7 +105,6 @@ PM_ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce)
return blocked; return blocked;
} }
/* /*
PM_FlyMove PM_FlyMove
@ -119,17 +115,12 @@ PM_ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce)
int int
PM_FlyMove (void) PM_FlyMove (void)
{ {
int bumpcount, numbumps; int blocked, bumpcount, numbumps, numplanes, i, j;
vec3_t dir; vec3_t dir;
float d; float time_left, d;
int numplanes;
vec3_t planes[MAX_CLIP_PLANES];
vec3_t primal_velocity, original_velocity;
int i, j;
pmtrace_t trace; pmtrace_t trace;
vec3_t end; vec3_t planes[MAX_CLIP_PLANES];
float time_left; vec3_t end, primal_velocity, original_velocity;
int blocked;
numbumps = 4; numbumps = 4;
@ -182,9 +173,7 @@ PM_FlyMove (void)
VectorCopy (trace.plane.normal, planes[numplanes]); VectorCopy (trace.plane.normal, planes[numplanes]);
numplanes++; numplanes++;
// // modify original_velocity so it parallels all of the clip planes
// modify original_velocity so it parallels all of the clip planes
//
for (i = 0; i < numplanes; i++) { for (i = 0; i < numplanes; i++) {
PM_ClipVelocity (original_velocity, planes[i], pmove.velocity, 1); PM_ClipVelocity (original_velocity, planes[i], pmove.velocity, 1);
for (j = 0; j < numplanes; j++) for (j = 0; j < numplanes; j++)
@ -199,7 +188,7 @@ PM_FlyMove (void)
if (i != numplanes) { // go along this plane if (i != numplanes) { // go along this plane
} else { // go along the crease } else { // go along the crease
if (numplanes != 2) { if (numplanes != 2) {
// Con_Printf ("clip velocity, numplanes == %i\n",numplanes); // Con_Printf ("clip velocity, numplanes == %i\n",numplanes);
VectorCopy (vec3_origin, pmove.velocity); VectorCopy (vec3_origin, pmove.velocity);
break; break;
} }
@ -208,10 +197,8 @@ PM_FlyMove (void)
VectorScale (dir, d, pmove.velocity); VectorScale (dir, d, pmove.velocity);
} }
// // if original velocity is against the original velocity, stop dead
// if original velocity is against the original velocity, stop dead // to avoid tiny occilations in sloping corners
// to avoid tiny occilations in sloping corners
//
if (DotProduct (pmove.velocity, primal_velocity) <= 0) { if (DotProduct (pmove.velocity, primal_velocity) <= 0) {
VectorCopy (vec3_origin, pmove.velocity); VectorCopy (vec3_origin, pmove.velocity);
break; break;
@ -224,7 +211,6 @@ PM_FlyMove (void)
return blocked; return blocked;
} }
void PM_Accelerate (vec3_t, float, float); void PM_Accelerate (vec3_t, float, float);
/* /*
@ -236,17 +222,16 @@ void PM_Accelerate (vec3_t, float, float);
void void
PM_FlymodeMove (void) PM_FlymodeMove (void)
{ {
vec3_t start, dest, pmvel, pmtmp;
pmtrace_t trace;
float pmspeed; float pmspeed;
pmtrace_t trace;
vec3_t start, dest, pmvel, pmtmp;
pmvel[0] = pmvel[0] = forward[0] * pmove.cmd.forwardmove +
forward[0] * pmove.cmd.forwardmove + right[0] * pmove.cmd.sidemove; right[0] * pmove.cmd.sidemove;
pmvel[1] = pmvel[1] = forward[1] * pmove.cmd.forwardmove +
forward[1] * pmove.cmd.forwardmove + right[1] * pmove.cmd.sidemove; right[1] * pmove.cmd.sidemove;
pmvel[2] = pmvel[2] = forward[2] * pmove.cmd.forwardmove +
forward[2] * pmove.cmd.forwardmove + right[2] * pmove.cmd.sidemove + right[2] * pmove.cmd.sidemove + pmove.cmd.upmove;
pmove.cmd.upmove;
VectorCopy (pmvel, pmtmp); VectorCopy (pmvel, pmtmp);
pmspeed = VectorNormalize (pmtmp); // don't alter pmvel pmspeed = VectorNormalize (pmtmp); // don't alter pmvel
@ -270,7 +255,6 @@ PM_FlymodeMove (void)
PM_FlyMove (); // NOW we fly. PM_FlyMove (); // NOW we fly.
} }
/* /*
PM_GroundMove PM_GroundMove
@ -279,10 +263,10 @@ PM_FlymodeMove (void)
void void
PM_GroundMove (void) PM_GroundMove (void)
{ {
vec3_t start, dest;
pmtrace_t trace;
vec3_t original, originalvel, down, up, downvel;
float downdist, updist; float downdist, updist;
pmtrace_t trace;
vec3_t start, dest;
vec3_t original, originalvel, down, up, downvel;
pmove.velocity[2] = 0; pmove.velocity[2] = 0;
if (!pmove.velocity[0] && !pmove.velocity[1] && !pmove.velocity[2]) if (!pmove.velocity[0] && !pmove.velocity[1] && !pmove.velocity[2])
@ -314,17 +298,17 @@ PM_GroundMove (void)
VectorCopy (original, pmove.origin); VectorCopy (original, pmove.origin);
VectorCopy (originalvel, pmove.velocity); VectorCopy (originalvel, pmove.velocity);
// move up a stair height // move up a stair height
VectorCopy (pmove.origin, dest); VectorCopy (pmove.origin, dest);
dest[2] += STEPSIZE; dest[2] += STEPSIZE;
trace = PM_PlayerMove (pmove.origin, dest); trace = PM_PlayerMove (pmove.origin, dest);
if (!trace.startsolid && !trace.allsolid) { if (!trace.startsolid && !trace.allsolid) {
VectorCopy (trace.endpos, pmove.origin); VectorCopy (trace.endpos, pmove.origin);
} }
// slide move // slide move
PM_FlyMove (); PM_FlyMove ();
// press down the stepheight // press down the stepheight
VectorCopy (pmove.origin, dest); VectorCopy (pmove.origin, dest);
dest[2] -= STEPSIZE; dest[2] -= STEPSIZE;
trace = PM_PlayerMove (pmove.origin, dest); trace = PM_PlayerMove (pmove.origin, dest);
@ -348,12 +332,9 @@ PM_GroundMove (void)
} else // copy z value from slide move } else // copy z value from slide move
pmove.velocity[2] = downvel[2]; pmove.velocity[2] = downvel[2];
// if at a dead stop, retry the move with nudges to get around lips // if at a dead stop, retry the move with nudges to get around lips
} }
/* /*
PM_Friction PM_Friction
@ -363,11 +344,9 @@ void
PM_Friction (void) PM_Friction (void)
{ {
float *vel; float *vel;
float speed, newspeed; float drop, friction, speed, newspeed;
float friction;
float drop;
vec3_t start, stop;
pmtrace_t trace; pmtrace_t trace;
vec3_t start, stop;
if (pmove.waterjumptime) if (pmove.waterjumptime)
return; return;
@ -383,7 +362,7 @@ PM_Friction (void)
friction = movevars.friction; friction = movevars.friction;
// if the leading edge is over a dropoff, increase friction // if the leading edge is over a dropoff, increase friction
if (onground != -1) { if (onground != -1) {
start[0] = stop[0] = pmove.origin[0] + vel[0] / speed * 16; start[0] = stop[0] = pmove.origin[0] + vel[0] / speed * 16;
start[1] = stop[1] = pmove.origin[1] + vel[1] / speed * 16; start[1] = stop[1] = pmove.origin[1] + vel[1] / speed * 16;
@ -406,7 +385,7 @@ PM_Friction (void)
else if (onground != -1) // apply ground friction else if (onground != -1) // apply ground friction
drop += max (movevars.stopspeed, speed) * friction * frametime; drop += max (movevars.stopspeed, speed) * friction * frametime;
// scale the velocity // scale the velocity
newspeed = speed - drop; newspeed = speed - drop;
if (newspeed < 0) if (newspeed < 0)
newspeed = 0; newspeed = 0;
@ -417,15 +396,11 @@ PM_Friction (void)
vel[2] = vel[2] * newspeed; vel[2] = vel[2] * newspeed;
} }
/*
PM_Accelerate
*/
void void
PM_Accelerate (vec3_t wishdir, float wishspeed, float accel) PM_Accelerate (vec3_t wishdir, float wishspeed, float accel)
{ {
int i;
float addspeed, accelspeed, currentspeed; float addspeed, accelspeed, currentspeed;
int i;
if (pmove.dead) if (pmove.dead)
return; return;
@ -447,8 +422,8 @@ PM_Accelerate (vec3_t wishdir, float wishspeed, float accel)
void void
PM_AirAccelerate (vec3_t wishdir, float wishspeed, float accel) PM_AirAccelerate (vec3_t wishdir, float wishspeed, float accel)
{ {
int i;
float addspeed, accelspeed, currentspeed, wishspd = wishspeed; float addspeed, accelspeed, currentspeed, wishspd = wishspeed;
int i;
if (pmove.dead) if (pmove.dead)
return; return;
@ -469,24 +444,15 @@ PM_AirAccelerate (vec3_t wishdir, float wishspeed, float accel)
pmove.velocity[i] += accelspeed * wishdir[i]; pmove.velocity[i] += accelspeed * wishdir[i];
} }
/*
PM_WaterMove
*/
void void
PM_WaterMove (void) PM_WaterMove (void)
{ {
int i;
vec3_t wishvel;
float wishspeed; float wishspeed;
vec3_t wishdir; int i;
vec3_t start, dest;
pmtrace_t trace; pmtrace_t trace;
vec3_t start, dest, wishdir, wishvel;
// // user intentions
// user intentions
//
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
wishvel[i] = wishvel[i] =
forward[i] * pmove.cmd.forwardmove + right[i] * pmove.cmd.sidemove; forward[i] * pmove.cmd.forwardmove + right[i] * pmove.cmd.sidemove;
@ -505,14 +471,13 @@ PM_WaterMove (void)
} }
wishspeed *= 0.7; wishspeed *= 0.7;
// // water acceleration
// water acceleration // if (pmove.waterjumptime)
// // Con_Printf ("wm->%f, %f, %f\n", pmove.velocity[0], pmove.velocity[1],
// if (pmove.waterjumptime) // pmove.velocity[2]);
// Con_Printf ("wm->%f, %f, %f\n", pmove.velocity[0], pmove.velocity[1], pmove.velocity[2]);
PM_Accelerate (wishdir, wishspeed, movevars.wateraccelerate); PM_Accelerate (wishdir, wishspeed, movevars.wateraccelerate);
// assume it is a stair or a slope, so press down from stepheight above // assume it is a stair or a slope, so press down from stepheight above
VectorMA (pmove.origin, frametime, pmove.velocity, dest); VectorMA (pmove.origin, frametime, pmove.velocity, dest);
VectorCopy (dest, start); VectorCopy (dest, start);
start[2] += STEPSIZE + 1; start[2] += STEPSIZE + 1;
@ -526,19 +491,12 @@ PM_WaterMove (void)
PM_FlyMove (); PM_FlyMove ();
} }
/*
PM_AirMove
*/
void void
PM_AirMove (void) PM_AirMove (void)
{ {
int i; int i;
vec3_t wishvel; vec3_t original, wishdir, wishvel;
float fmove, smove; float fmove, smove, wishspeed;
vec3_t wishdir;
float wishspeed;
vec3_t original;
fmove = pmove.cmd.forwardmove; fmove = pmove.cmd.forwardmove;
smove = pmove.cmd.sidemove; smove = pmove.cmd.sidemove;
@ -555,9 +513,7 @@ PM_AirMove (void)
VectorCopy (wishvel, wishdir); VectorCopy (wishvel, wishdir);
wishspeed = VectorNormalize (wishdir); wishspeed = VectorNormalize (wishdir);
// // clamp to server defined max speed
// clamp to server defined max speed
//
if (wishspeed > movevars.maxspeed) { if (wishspeed > movevars.maxspeed) {
VectorScale (wishvel, movevars.maxspeed / wishspeed, wishvel); VectorScale (wishvel, movevars.maxspeed / wishspeed, wishvel);
wishspeed = movevars.maxspeed; wishspeed = movevars.maxspeed;
@ -566,7 +522,8 @@ PM_AirMove (void)
if (onground != -1) { if (onground != -1) {
pmove.velocity[2] = 0; pmove.velocity[2] = 0;
PM_Accelerate (wishdir, wishspeed, movevars.accelerate); PM_Accelerate (wishdir, wishspeed, movevars.accelerate);
pmove.velocity[2] -= movevars.entgravity * movevars.gravity * frametime; pmove.velocity[2] -= movevars.entgravity * movevars.gravity *
frametime;
PM_GroundMove (); PM_GroundMove ();
} else if (pmove.flying) { } else if (pmove.flying) {
PM_AirAccelerate (wishdir, wishspeed, movevars.accelerate); PM_AirAccelerate (wishdir, wishspeed, movevars.accelerate);
@ -576,7 +533,8 @@ PM_AirMove (void)
PM_AirAccelerate (wishdir, wishspeed, movevars.accelerate); PM_AirAccelerate (wishdir, wishspeed, movevars.accelerate);
// add gravity // add gravity
pmove.velocity[2] -= movevars.entgravity * movevars.gravity * frametime; pmove.velocity[2] -= movevars.entgravity * movevars.gravity *
frametime;
if (!PM_FlyMove ()) { if (!PM_FlyMove ()) {
// the move didn't get blocked // the move didn't get blocked
@ -597,22 +555,17 @@ PM_AirMove (void)
} }
} }
/*
PM_CategorizePosition
*/
void void
PM_CategorizePosition (void) PM_CategorizePosition (void)
{ {
vec3_t point;
int cont; int cont;
pmtrace_t tr; pmtrace_t tr;
vec3_t point;
// if the player hull point one unit down is solid, the player // if the player hull point one unit down is solid, the player
// is on ground // is on ground
// see if standing on something solid // see if standing on something solid
point[0] = pmove.origin[0]; point[0] = pmove.origin[0];
point[1] = pmove.origin[1]; point[1] = pmove.origin[1];
point[2] = pmove.origin[2] - 1; point[2] = pmove.origin[2] - 1;
@ -636,9 +589,7 @@ PM_CategorizePosition (void)
} }
} }
// // get waterlevel
// get waterlevel
//
waterlevel = 0; waterlevel = 0;
watertype = CONTENTS_EMPTY; watertype = CONTENTS_EMPTY;
@ -660,10 +611,6 @@ PM_CategorizePosition (void)
} }
} }
/*
JumpButton
*/
void void
JumpButton (void) JumpButton (void)
{ {
@ -708,15 +655,11 @@ JumpButton (void)
pmove.oldbuttons |= BUTTON_JUMP; // don't jump again until released pmove.oldbuttons |= BUTTON_JUMP; // don't jump again until released
} }
/*
CheckWaterJump
*/
void void
CheckWaterJump (void) CheckWaterJump (void)
{ {
vec3_t spot;
int cont; int cont;
vec3_t flatforward; vec3_t flatforward, spot;
if (pmove.waterjumptime || pmove.flying) if (pmove.waterjumptime || pmove.flying)
return; return;
@ -757,21 +700,20 @@ CheckWaterJump (void)
void void
NudgePosition (void) NudgePosition (void)
{ {
vec3_t base; int i, x, y, z;
int x, y, z;
int i;
static int sign[3] = { 0, -1, 1 }; static int sign[3] = { 0, -1, 1 };
vec3_t base;
VectorCopy (pmove.origin, base); VectorCopy (pmove.origin, base);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
pmove.origin[i] = ((int) (pmove.origin[i] * 8)) * 0.125; pmove.origin[i] = ((int) (pmove.origin[i] * 8)) * 0.125;
// pmove.origin[2] += 0.124; // pmove.origin[2] += 0.124;
// if (pmove.dead) // if (pmove.dead)
// return; // might be a squished point, so don'y bother // return; // might be a squished point, so don'y bother
// if (PM_TestPlayerPosition (pmove.origin) ) // if (PM_TestPlayerPosition (pmove.origin) )
// return; // return;
for (z = 0; z <= 2; z++) { for (z = 0; z <= 2; z++) {
for (x = 0; x <= 2; x++) { for (x = 0; x <= 2; x++) {
@ -785,25 +727,19 @@ NudgePosition (void)
} }
} }
VectorCopy (base, pmove.origin); VectorCopy (base, pmove.origin);
// Con_DPrintf ("NudgePosition: stuck\n"); // Con_DPrintf ("NudgePosition: stuck\n");
} }
/*
SpectatorMove
*/
void void
SpectatorMove (void) SpectatorMove (void)
{ {
float speed, drop, friction, control, newspeed; float control, drop, friction, fmove, smove, speed, newspeed;
float currentspeed, addspeed, accelspeed; float currentspeed, addspeed, accelspeed, wishspeed;
int i; int i;
vec3_t wishvel; vec3_t wishvel;
float fmove, smove;
vec3_t wishdir; vec3_t wishdir;
float wishspeed;
// friction // friction
speed = Length (pmove.velocity); speed = Length (pmove.velocity);
if (speed < 1) { if (speed < 1) {
VectorCopy (vec3_origin, pmove.velocity) VectorCopy (vec3_origin, pmove.velocity)
@ -837,9 +773,7 @@ SpectatorMove (void)
VectorCopy (wishvel, wishdir); VectorCopy (wishvel, wishdir);
wishspeed = VectorNormalize (wishdir); wishspeed = VectorNormalize (wishdir);
//
// clamp to server defined max speed // clamp to server defined max speed
//
if (wishspeed > movevars.spectatormaxspeed) { if (wishspeed > movevars.spectatormaxspeed) {
VectorScale (wishvel, movevars.spectatormaxspeed / wishspeed, wishvel); VectorScale (wishvel, movevars.spectatormaxspeed / wishspeed, wishvel);
wishspeed = movevars.spectatormaxspeed; wishspeed = movevars.spectatormaxspeed;
@ -856,7 +790,6 @@ SpectatorMove (void)
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
pmove.velocity[i] += accelspeed * wishdir[i]; pmove.velocity[i] += accelspeed * wishdir[i];
// move // move
VectorMA (pmove.origin, frametime, pmove.velocity, pmove.origin); VectorMA (pmove.origin, frametime, pmove.velocity, pmove.origin);
} }

View file

@ -36,13 +36,14 @@
# include <strings.h> # include <strings.h>
#endif #endif
#include "compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/model.h" #include "QF/model.h"
#include "pmove.h"
#include "QF/qtypes.h" #include "QF/qtypes.h"
#include "QF/sys.h" #include "QF/sys.h"
#include "compat.h"
#include "pmove.h"
static hull_t box_hull; static hull_t box_hull;
static dclipnode_t box_clipnodes[6]; static dclipnode_t box_clipnodes[6];
static mplane_t box_planes[6]; static mplane_t box_planes[6];
@ -50,6 +51,7 @@ static mplane_t box_planes[6];
extern vec3_t player_mins; extern vec3_t player_mins;
extern vec3_t player_maxs; extern vec3_t player_maxs;
/* /*
PM_InitBoxHull PM_InitBoxHull
@ -59,8 +61,7 @@ extern vec3_t player_maxs;
void void
PM_InitBoxHull (void) PM_InitBoxHull (void)
{ {
int i; int side, i;
int side;
box_hull.clipnodes = box_clipnodes; box_hull.clipnodes = box_clipnodes;
box_hull.planes = box_planes; box_hull.planes = box_planes;
@ -84,7 +85,6 @@ PM_InitBoxHull (void)
} }
/* /*
PM_HullForBox PM_HullForBox
@ -104,15 +104,11 @@ PM_HullForBox (vec3_t mins, vec3_t maxs)
return &box_hull; return &box_hull;
} }
/*
PM_HullPointContents
*/
int int
PM_HullPointContents (hull_t *hull, int num, vec3_t p) PM_HullPointContents (hull_t *hull, int num, vec3_t p)
{ {
float d;
dclipnode_t *node; dclipnode_t *node;
float d;
mplane_t *plane; mplane_t *plane;
while (num >= 0) { while (num >= 0) {
@ -132,17 +128,14 @@ PM_HullPointContents (hull_t *hull, int num, vec3_t p)
return num; return num;
} }
/*
PM_PointContents
*/
int int
PM_PointContents (vec3_t p) PM_PointContents (vec3_t p)
{ {
float d;
dclipnode_t *node; dclipnode_t *node;
mplane_t *plane; float d;
hull_t *hull; hull_t *hull;
int num; int num;
mplane_t *plane;
hull = &pmove.physents[0].model->hulls[0]; hull = &pmove.physents[0].model->hulls[0];
@ -165,28 +158,20 @@ PM_PointContents (vec3_t p)
return num; return num;
} }
/* /* LINE TESTING IN HULLS */
LINE TESTING IN HULLS
*/
// 1/32 epsilon to keep floating point happy // 1/32 epsilon to keep floating point happy
#define DIST_EPSILON (0.03125) #define DIST_EPSILON (0.03125)
/*
PM_RecursiveHullCheck
*/
qboolean qboolean
PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1,
vec3_t p2, pmtrace_t *trace) vec3_t p2, pmtrace_t *trace)
{ {
dclipnode_t *node; dclipnode_t *node;
float frac, midf, t1, t2;
int side, i;
mplane_t *plane; mplane_t *plane;
float t1, t2;
float frac;
int i;
vec3_t mid; vec3_t mid;
int side;
float midf;
loc0: loc0:
// check for empty // check for empty
@ -251,8 +236,8 @@ PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1,
if (PM_HullPointContents (hull, node->children[side ^ 1], if (PM_HullPointContents (hull, node->children[side ^ 1],
mid) != CONTENTS_SOLID) { mid) != CONTENTS_SOLID) {
// go past the node // go past the node
return PM_RecursiveHullCheck (hull, node->children[side ^ 1], midf, p2f, return PM_RecursiveHullCheck (hull, node->children[side ^ 1], midf,
mid, p2, trace); p2f, mid, p2, trace);
} }
if (trace->allsolid) if (trace->allsolid)
@ -293,7 +278,6 @@ PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1,
return false; return false;
} }
/* /*
PM_TestPlayerPosition PM_TestPlayerPosition
@ -302,10 +286,10 @@ PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1,
qboolean qboolean
PM_TestPlayerPosition (vec3_t pos) PM_TestPlayerPosition (vec3_t pos)
{ {
hull_t *hull;
int i; int i;
physent_t *pe; physent_t *pe;
vec3_t mins, maxs, test; vec3_t mins, maxs, test;
hull_t *hull;
for (i = 0; i < pmove.numphysent; i++) { for (i = 0; i < pmove.numphysent; i++) {
pe = &pmove.physents[i]; pe = &pmove.physents[i];
@ -327,21 +311,17 @@ PM_TestPlayerPosition (vec3_t pos)
return true; return true;
} }
/* /* PM_PlayerMove */
PM_PlayerMove
*/
pmtrace_t pmtrace_t
PM_PlayerMove (vec3_t start, vec3_t end) PM_PlayerMove (vec3_t start, vec3_t end)
{ {
pmtrace_t trace, total;
vec3_t offset;
vec3_t start_l, end_l;
hull_t *hull; hull_t *hull;
int i; int i;
physent_t *pe; physent_t *pe;
vec3_t mins, maxs; pmtrace_t trace, total;
vec3_t maxs, mins, offset, start_l, end_l;
// fill in a default trace // fill in a default trace
memset (&total, 0, sizeof (pmtrace_t)); memset (&total, 0, sizeof (pmtrace_t));
total.fraction = 1; total.fraction = 1;
@ -374,7 +354,7 @@ PM_PlayerMove (vec3_t start, vec3_t end)
trace.fraction = 1; trace.fraction = 1;
trace.allsolid = true; trace.allsolid = true;
// trace.startsolid = true; // trace.startsolid = true;
VectorCopy (end, trace.endpos); VectorCopy (end, trace.endpos);
// trace a line through the apropriate clipping hull // trace a line through the apropriate clipping hull

View file

@ -39,7 +39,6 @@
#include <stdlib.h> #include <stdlib.h>
#include "QF/cmd.h" #include "QF/cmd.h"
#include "compat.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "QF/draw.h" #include "QF/draw.h"
#include "QF/msg.h" #include "QF/msg.h"
@ -50,6 +49,7 @@
#include "bothdefs.h" #include "bothdefs.h"
#include "cl_cam.h" #include "cl_cam.h"
#include "client.h" #include "client.h"
#include "compat.h"
#include "sbar.h" #include "sbar.h"
int sb_updates; // if >= vid.numpages, no update needed int sb_updates; // if >= vid.numpages, no update needed
@ -88,6 +88,7 @@ static qboolean largegame = false;
cvar_t *cl_showscoresuid; cvar_t *cl_showscoresuid;
/* /*
Sbar_ShowTeamScores Sbar_ShowTeamScores
@ -103,7 +104,6 @@ Sbar_ShowTeamScores (void)
sb_updates = 0; sb_updates = 0;
} }
/* /*
Sbar_DontShowTeamScores Sbar_DontShowTeamScores
@ -116,7 +116,6 @@ Sbar_DontShowTeamScores (void)
sb_updates = 0; sb_updates = 0;
} }
/* /*
Sbar_ShowScores Sbar_ShowScores
@ -132,7 +131,6 @@ Sbar_ShowScores (void)
sb_updates = 0; sb_updates = 0;
} }
/* /*
Sbar_DontShowScores Sbar_DontShowScores
@ -145,14 +143,12 @@ Sbar_DontShowScores (void)
sb_updates = 0; sb_updates = 0;
} }
void void
Sbar_Changed (void) Sbar_Changed (void)
{ {
sb_updates = 0; // update next frame sb_updates = 0; // update next frame
} }
void void
Sbar_Init (void) Sbar_Init (void)
{ {
@ -249,7 +245,6 @@ Sbar_Init (void)
"show uid instead of ping on scores"); "show uid instead of ping on scores");
} }
// drawing routines are reletive to the status bar location // drawing routines are reletive to the status bar location
void void
Sbar_DrawPic (int x, int y, qpic_t *pic) Sbar_DrawPic (int x, int y, qpic_t *pic)
@ -257,7 +252,6 @@ Sbar_DrawPic (int x, int y, qpic_t *pic)
Draw_Pic (x, y + (vid.height - SBAR_HEIGHT), pic); Draw_Pic (x, y + (vid.height - SBAR_HEIGHT), pic);
} }
/* /*
Sbar_DrawSubPic Sbar_DrawSubPic
@ -271,7 +265,6 @@ Sbar_DrawSubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
height); height);
} }
void void
Sbar_DrawTransPic (int x, int y, qpic_t *pic) Sbar_DrawTransPic (int x, int y, qpic_t *pic)
{ {
@ -279,7 +272,6 @@ Sbar_DrawTransPic (int x, int y, qpic_t *pic)
pic); pic);
} }
/* /*
Sbar_DrawCharacter Sbar_DrawCharacter
@ -291,20 +283,17 @@ Sbar_DrawCharacter (int x, int y, int num)
Draw_Character (x + 4, y + vid.height - SBAR_HEIGHT, num); Draw_Character (x + 4, y + vid.height - SBAR_HEIGHT, num);
} }
void void
Sbar_DrawString (int x, int y, char *str) Sbar_DrawString (int x, int y, char *str)
{ {
Draw_String (x, y + vid.height - SBAR_HEIGHT, str); Draw_String (x, y + vid.height - SBAR_HEIGHT, str);
} }
int int
Sbar_itoa (int num, char *buf) Sbar_itoa (int num, char *buf)
{ {
char *str; char *str;
int pow10; int dig, pow10;
int dig;
str = buf; str = buf;
@ -327,7 +316,6 @@ Sbar_itoa (int num, char *buf)
return str - buf; return str - buf;
} }
void void
Sbar_DrawNum (int x, int y, int num, int digits, int color) Sbar_DrawNum (int x, int y, int num, int digits, int color)
{ {
@ -354,7 +342,6 @@ Sbar_DrawNum (int x, int y, int num, int digits, int color)
} }
} }
//ZOID: this should be MAX_CLIENTS, not MAX_SCOREBOARD!! //ZOID: this should be MAX_CLIENTS, not MAX_SCOREBOARD!!
//int fragsort[MAX_SCOREBOARD]; //int fragsort[MAX_SCOREBOARD];
int fragsort[MAX_CLIENTS]; int fragsort[MAX_CLIENTS];
@ -365,11 +352,11 @@ typedef struct {
int players; int players;
int plow, phigh, ptotal; int plow, phigh, ptotal;
} team_t; } team_t;
team_t teams[MAX_CLIENTS]; team_t teams[MAX_CLIENTS];
int teamsort[MAX_CLIENTS]; int teamsort[MAX_CLIENTS];
int scoreboardteams; int scoreboardteams;
void void
Sbar_SortFrags (qboolean includespec) Sbar_SortFrags (qboolean includespec)
{ {
@ -396,14 +383,12 @@ Sbar_SortFrags (qboolean includespec)
} }
} }
void void
Sbar_SortTeams (void) Sbar_SortTeams (void)
{ {
int i, j, k;
player_info_t *s;
int teamplay;
char t[16 + 1]; char t[16 + 1];
int teamplay, i, j, k;
player_info_t *s;
// request new ping times every two second // request new ping times every two second
scoreboardteams = 0; scoreboardteams = 0;
@ -463,14 +448,12 @@ Sbar_SortTeams (void)
} }
} }
int int
Sbar_ColorForMap (int m) Sbar_ColorForMap (int m)
{ {
return (bound (0, m, 13) * 16) + 8; return (bound (0, m, 13) * 16) + 8;
} }
void void
Sbar_SoloScoreboard (void) Sbar_SoloScoreboard (void)
{ {
@ -488,16 +471,13 @@ Sbar_SoloScoreboard (void)
Sbar_DrawString (184, 4, str); Sbar_DrawString (184, 4, str);
} }
void void
Sbar_DrawInventory (void) Sbar_DrawInventory (void)
{ {
int i;
char num[6]; char num[6];
float time; float time;
int flashon; int flashon, i;
qboolean headsup; qboolean headsup, hudswap;
qboolean hudswap;
headsup = !(cl_sbar->int_val || scr_viewsize->int_val < 100); headsup = !(cl_sbar->int_val || scr_viewsize->int_val < 100);
hudswap = cl_hudswap->int_val; hudswap = cl_hudswap->int_val;
@ -522,8 +502,8 @@ Sbar_DrawInventory (void)
if (headsup) { if (headsup) {
if (i || vid.height > 200) if (i || vid.height > 200)
Sbar_DrawSubPic ((hudswap) ? 0 : (vid.width - 24), Sbar_DrawSubPic ((hudswap) ? 0 : (vid.width - 24),
-68 - (7 - i) * 16, sb_weapons[flashon][i], -68 - (7 - i) * 16,
0, 0, 24, 16); sb_weapons[flashon][i], 0, 0, 24, 16);
} else } else
Sbar_DrawPic (i * 24, -16, sb_weapons[flashon][i]); Sbar_DrawPic (i * 24, -16, sb_weapons[flashon][i]);
@ -536,7 +516,8 @@ Sbar_DrawInventory (void)
// ammo counts // ammo counts
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
snprintf (num, sizeof (num), "%3i", min (cl.stats[STAT_SHELLS + i], 999)); snprintf (num, sizeof (num), "%3i", min (cl.stats[STAT_SHELLS + i],
999));
if (headsup) { if (headsup) {
#define HUD_X(dist) ((hudswap) ? dist : (vid.width - (42 - dist))) #define HUD_X(dist) ((hudswap) ? dist : (vid.width - (42 - dist)))
#define HUD_Y(n) (-24 - (4 - n) * 11) #define HUD_Y(n) (-24 - (4 - n) * 11)
@ -587,7 +568,6 @@ Sbar_DrawInventory (void)
} }
} }
void void
Sbar_DrawFrags (void) Sbar_DrawFrags (void)
{ {
@ -642,7 +622,6 @@ Sbar_DrawFrags (void)
} }
} }
void void
Sbar_DrawFace (void) Sbar_DrawFace (void)
{ {
@ -679,7 +658,6 @@ Sbar_DrawFace (void)
Sbar_DrawPic (112, 0, sb_faces[f][anim]); Sbar_DrawPic (112, 0, sb_faces[f][anim]);
} }
void void
Sbar_DrawNormal (void) Sbar_DrawNormal (void)
{ {
@ -720,12 +698,11 @@ Sbar_DrawNormal (void)
Sbar_DrawNum (248, 0, cl.stats[STAT_AMMO], 3, cl.stats[STAT_AMMO] <= 10); Sbar_DrawNum (248, 0, cl.stats[STAT_AMMO], 3, cl.stats[STAT_AMMO] <= 10);
} }
void void
Sbar_Draw (int swap) Sbar_Draw (int swap)
{ {
qboolean headsup;
char st[512]; char st[512];
qboolean headsup;
headsup = !(cl_sbar->int_val || scr_viewsize->int_val < 100); headsup = !(cl_sbar->int_val || scr_viewsize->int_val < 100);
if ((sb_updates >= vid.numpages) && !headsup) if ((sb_updates >= vid.numpages) && !headsup)
@ -791,7 +768,6 @@ Sbar_Draw (int swap)
Sbar_MiniDeathmatchOverlay (); Sbar_MiniDeathmatchOverlay ();
} }
void void
Sbar_IntermissionNumber (int x, int y, int num, int digits, int color) Sbar_IntermissionNumber (int x, int y, int num, int digits, int color)
{ {
@ -818,7 +794,6 @@ Sbar_IntermissionNumber (int x, int y, int num, int digits, int color)
} }
} }
/* /*
Sbar_TeamOverlay Sbar_TeamOverlay
@ -828,14 +803,10 @@ Sbar_IntermissionNumber (int x, int y, int num, int digits, int color)
void void
Sbar_TeamOverlay (void) Sbar_TeamOverlay (void)
{ {
char num[12], team[5];
int pavg, plow, phigh, teamplay, i, k, l, x, y;
qpic_t *pic; qpic_t *pic;
int i, k, l;
int x, y;
char num[12];
int teamplay;
char team[5];
team_t *tm; team_t *tm;
int plow, phigh, pavg;
// request new ping times every two second // request new ping times every two second
teamplay = atoi (Info_ValueForKey (cl.serverinfo, "teamplay")); teamplay = atoi (Info_ValueForKey (cl.serverinfo, "teamplay"));
@ -913,7 +884,6 @@ Sbar_TeamOverlay (void)
Sbar_DeathmatchOverlay (y); Sbar_DeathmatchOverlay (y);
} }
/* /*
Sbar_DeathmatchOverlay Sbar_DeathmatchOverlay
@ -922,18 +892,11 @@ Sbar_TeamOverlay (void)
void void
Sbar_DeathmatchOverlay (int start) Sbar_DeathmatchOverlay (int start)
{ {
qpic_t *pic; char num[12], team[5];
int i, k, l; int minutes, teamplay, total, top, bottom, f, i, k, l, p, x, y;
int top, bottom;
int x, y, f;
char num[12];
player_info_t *s;
int total;
int minutes;
int p;
int teamplay;
char team[5];
int skip = 10; int skip = 10;
player_info_t *s;
qpic_t *pic;
if (largegame) if (largegame)
skip = 8; skip = 8;
@ -972,7 +935,7 @@ Sbar_DeathmatchOverlay (int start)
else else
Draw_String (x, y, " uid pl time frags team name"); Draw_String (x, y, " uid pl time frags team name");
y += 8; y += 8;
// Draw_String ( x , y, "---- -- ---- ----- ---- ----------------"); // Draw_String ( x , y, "---- -- ---- ----- ---- ----------------");
Draw_String (x, y, "\x1d\x1e\x1e\x1f \x1d\x1f \x1d\x1e\x1e\x1f " Draw_String (x, y, "\x1d\x1e\x1e\x1f \x1d\x1f \x1d\x1e\x1e\x1f "
"\x1d\x1e\x1e\x1e\x1f \x1d\x1e\x1e\x1f \x1d\x1e\x1e" "\x1d\x1e\x1e\x1e\x1f \x1d\x1e\x1e\x1f \x1d\x1e\x1e"
"\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1f"); "\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1e\x1f");
@ -1080,7 +1043,6 @@ Sbar_DeathmatchOverlay (int start)
largegame = true; largegame = true;
} }
/* /*
Sbar_MiniDeathmatchOverlay Sbar_MiniDeathmatchOverlay
@ -1091,15 +1053,9 @@ Sbar_DeathmatchOverlay (int start)
void void
Sbar_MiniDeathmatchOverlay (void) Sbar_MiniDeathmatchOverlay (void)
{ {
int i, k; int numlines, teamplay, top, bottom, f, i, k, x, y;
int top, bottom; char name[16 + 1], num[12], team[5];
int x, y, f;
char num[12];
player_info_t *s; player_info_t *s;
int teamplay;
char team[5];
int numlines;
char name[16 + 1];
team_t *tm; team_t *tm;
if (vid.width < 512 || !sb_lines) if (vid.width < 512 || !sb_lines)
@ -1222,7 +1178,6 @@ Sbar_MiniDeathmatchOverlay (void)
} }
void void
Sbar_IntermissionOverlay (void) Sbar_IntermissionOverlay (void)
{ {
@ -1235,7 +1190,6 @@ Sbar_IntermissionOverlay (void)
Sbar_DeathmatchOverlay (0); Sbar_DeathmatchOverlay (0);
} }
void void
Sbar_FinaleOverlay (void) Sbar_FinaleOverlay (void)
{ {

View file

@ -36,7 +36,6 @@
# include <strings.h> # include <strings.h>
#endif #endif
#include "compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "QF/hash.h" #include "QF/hash.h"
@ -47,6 +46,7 @@
#include "QF/vfs.h" #include "QF/vfs.h"
#include "client.h" #include "client.h"
#include "compat.h"
#define MAX_TEMP_SKINS 64 //XXX dynamic? #define MAX_TEMP_SKINS 64 //XXX dynamic?

View file

@ -38,7 +38,6 @@
#include <errno.h> #include <errno.h>
#include "compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cmd.h" #include "QF/cmd.h"
#include "QF/cvar.h" #include "QF/cvar.h"
@ -49,19 +48,24 @@
#include "bothdefs.h" #include "bothdefs.h"
#include "client.h" #include "client.h"
#include "compat.h"
extern cvar_t *skin;
cvar_t *cl_deadbodyfilter;
cvar_t *cl_gibfilter;
cvar_t *cl_parsesay;
cvar_t *cl_nofake;
static qboolean died = false, recorded_location = false; static qboolean died = false, recorded_location = false;
static vec3_t death_location, last_recorded_location; static vec3_t death_location, last_recorded_location;
cvar_t *cl_deadbodyfilter;
cvar_t *cl_gibfilter;
cvar_t *cl_parsesay;
cvar_t *cl_nofake;
extern cvar_t *skin;
void void
Team_BestWeaponImpulse (void) Team_BestWeaponImpulse (void)
{ {
int best, i, imp, items; int best, i, imp, items;
extern int in_impulse; extern int in_impulse;
items = cl.stats[STAT_ITEMS]; items = cl.stats[STAT_ITEMS];
@ -73,38 +77,37 @@ Team_BestWeaponImpulse (void)
continue; continue;
switch (imp) { switch (imp) {
case 1: case 1:
if (items & IT_AXE) if (items & IT_AXE)
best = 1; best = 1;
break; break;
case 2: case 2:
if (items & IT_SHOTGUN && cl.stats[STAT_SHELLS] >= 1) if (items & IT_SHOTGUN && cl.stats[STAT_SHELLS] >= 1)
best = 2; best = 2;
break; break;
case 3: case 3:
if (items & IT_SUPER_SHOTGUN && cl.stats[STAT_SHELLS] >= 2) if (items & IT_SUPER_SHOTGUN && cl.stats[STAT_SHELLS] >= 2)
best = 3; best = 3;
break; break;
case 4: case 4:
if (items & IT_NAILGUN && cl.stats[STAT_NAILS] >= 1) if (items & IT_NAILGUN && cl.stats[STAT_NAILS] >= 1)
best = 4; best = 4;
break; break;
case 5: case 5:
if (items & IT_SUPER_NAILGUN && cl.stats[STAT_NAILS] >= 2) if (items & IT_SUPER_NAILGUN && cl.stats[STAT_NAILS] >= 2)
best = 5; best = 5;
break; break;
case 6: case 6:
if (items & IT_GRENADE_LAUNCHER && cl.stats[STAT_ROCKETS] >= 1) if (items & IT_GRENADE_LAUNCHER && cl.stats[STAT_ROCKETS] >= 1)
best = 6; best = 6;
break; break;
case 7: case 7:
if (items & IT_ROCKET_LAUNCHER && cl.stats[STAT_ROCKETS] >= 1) if (items & IT_ROCKET_LAUNCHER && cl.stats[STAT_ROCKETS] >= 1)
best = 7; best = 7;
break; break;
case 8: case 8:
if (items & IT_LIGHTNING && cl.stats[STAT_CELLS] >= 1) if (items & IT_LIGHTNING && cl.stats[STAT_CELLS] >= 1)
best = 8; best = 8;
} }
} }
@ -116,10 +119,10 @@ Team_BestWeaponImpulse (void)
const char * const char *
Team_ParseSay (const char *s) Team_ParseSay (const char *s)
{ {
static char buf[1024];
int i, bracket;
char c, chr, t2[128], t3[128]; char c, chr, t2[128], t3[128];
const char *t1; const char *t1;
static char buf[1024];
int i, bracket;
static location_t *location = NULL; static location_t *location = NULL;
if (!cl_parsesay->int_val) if (!cl_parsesay->int_val)
@ -131,27 +134,27 @@ Team_ParseSay (const char *s)
if ((*s == '$') && (s[1] != '\0')) { if ((*s == '$') && (s[1] != '\0')) {
c = 0; c = 0;
switch (s[1]) { switch (s[1]) {
case '\\': case '\\':
c = 13; c = 13;
break; // fake message break; // fake message
case '[': case '[':
c = 0x90; c = 0x90;
break; // colored brackets break; // colored brackets
case ']': case ']':
c = 0x91; c = 0x91;
break; break;
case 'G': case 'G':
c = 0x86; c = 0x86;
break; // ocrana leds break; // ocrana leds
case 'R': case 'R':
c = 0x87; c = 0x87;
break; break;
case 'Y': case 'Y':
c = 0x88; c = 0x88;
break; break;
case 'B': case 'B':
c = 0x89; c = 0x89;
break; break;
} }
if (c) { if (c) {
@ -174,80 +177,59 @@ Team_ParseSay (const char *s)
s += 2; s += 2;
} }
switch (chr) { switch (chr) {
case '%': case '%':
t2[0] = '%'; t2[0] = '%';
t2[1] = 0; t2[1] = 0;
t1 = t2; t1 = t2;
break; break;
case 's': case 's':
bracket = 0; bracket = 0;
t1 = skin->string; t1 = skin->string;
break; break;
case 'd': case 'd':
bracket = 0; bracket = 0;
if (died) { if (died) {
location = locs_find (death_location); location = locs_find (death_location);
if (location) {
recorded_location = true;
VectorCopy (death_location, last_recorded_location);
t1 = location->name;
break;
}
}
goto location;
case 'r':
bracket = 0;
if (recorded_location) {
location = locs_find (last_recorded_location);
if (location) {
t1 = location->name;
break;
}
}
goto location;
case 'l':
location:
bracket = 0;
location = locs_find (cl.simorg);
if (location) { if (location) {
recorded_location = true; recorded_location = true;
VectorCopy (cl.simorg, last_recorded_location); VectorCopy (death_location, last_recorded_location);
t1 = location->name; t1 = location->name;
} else break;
snprintf (t2, sizeof (t2), "Unknown!\n"); }
break; }
case 'a': goto location;
if (bracket) { case 'r':
if (cl.stats[STAT_ARMOR] > 50) bracket = 0;
bracket = 0; if (recorded_location) {
location = locs_find (last_recorded_location);
if (location) {
t1 = location->name;
break;
}
}
goto location;
case 'l':
location:
bracket = 0;
location = locs_find (cl.simorg);
if (location) {
recorded_location = true;
VectorCopy (cl.simorg, last_recorded_location);
t1 = location->name;
} else
snprintf (t2, sizeof (t2), "Unknown!\n");
break;
case 'a':
if (bracket) {
if (cl.stats[STAT_ARMOR] > 50)
bracket = 0;
if (cl.stats[STAT_ITEMS] & IT_ARMOR3)
t3[0] = 'R' | 0x80;
else if (cl.stats[STAT_ITEMS] & IT_ARMOR2)
t3[0] = 'Y' | 0x80;
else if (cl.stats[STAT_ITEMS] & IT_ARMOR1)
t3[0] = 'G' | 0x80;
else {
t2[0] = 'N' | 0x80;
t2[1] = 'O' | 0x80;
t2[2] = 'N' | 0x80;
t2[3] = 'E' | 0x80;
t2[4] = '!' | 0x80;
}
snprintf (t2, sizeof (t2), "%sa:%i", t3,
cl.stats[STAT_ARMOR]);
} else
snprintf (t2, sizeof (t2), "%i", cl.stats[STAT_ARMOR]);
break;
case 'A':
bracket = 0;
if (cl.stats[STAT_ITEMS] & IT_ARMOR3) if (cl.stats[STAT_ITEMS] & IT_ARMOR3)
t2[0] = 'R' | 0x80; t3[0] = 'R' | 0x80;
else if (cl.stats[STAT_ITEMS] & IT_ARMOR2) else if (cl.stats[STAT_ITEMS] & IT_ARMOR2)
t2[0] = 'Y' | 0x80; t3[0] = 'Y' | 0x80;
else if (cl.stats[STAT_ITEMS] & IT_ARMOR1) else if (cl.stats[STAT_ITEMS] & IT_ARMOR1)
t2[0] = 'G' | 0x80; t3[0] = 'G' | 0x80;
else { else {
t2[0] = 'N' | 0x80; t2[0] = 'N' | 0x80;
t2[1] = 'O' | 0x80; t2[1] = 'O' | 0x80;
@ -255,18 +237,39 @@ Team_ParseSay (const char *s)
t2[3] = 'E' | 0x80; t2[3] = 'E' | 0x80;
t2[4] = '!' | 0x80; t2[4] = '!' | 0x80;
} }
break;
case 'h': snprintf (t2, sizeof (t2), "%sa:%i", t3,
if (bracket) { cl.stats[STAT_ARMOR]);
if (cl.stats[STAT_HEALTH] > 50) } else
bracket = 0; snprintf (t2, sizeof (t2), "%i", cl.stats[STAT_ARMOR]);
snprintf (t2, sizeof (t2), "h:%i", break;
cl.stats[STAT_HEALTH]); case 'A':
} else bracket = 0;
snprintf (t2, sizeof (t2), "%i", cl.stats[STAT_HEALTH]); if (cl.stats[STAT_ITEMS] & IT_ARMOR3)
break; t2[0] = 'R' | 0x80;
default: else if (cl.stats[STAT_ITEMS] & IT_ARMOR2)
bracket = 0; t2[0] = 'Y' | 0x80;
else if (cl.stats[STAT_ITEMS] & IT_ARMOR1)
t2[0] = 'G' | 0x80;
else {
t2[0] = 'N' | 0x80;
t2[1] = 'O' | 0x80;
t2[2] = 'N' | 0x80;
t2[3] = 'E' | 0x80;
t2[4] = '!' | 0x80;
}
break;
case 'h':
if (bracket) {
if (cl.stats[STAT_HEALTH] > 50)
bracket = 0;
snprintf (t2, sizeof (t2), "h:%i",
cl.stats[STAT_HEALTH]);
} else
snprintf (t2, sizeof (t2), "%i", cl.stats[STAT_HEALTH]);
break;
default:
bracket = 0;
} }
if (!t1) { if (!t1) {
@ -317,11 +320,11 @@ Team_NewMap (void)
died = false; died = false;
recorded_location = false; recorded_location = false;
mapname = strdup(cl.worldmodel->name); mapname = strdup (cl.worldmodel->name);
t2 = malloc(sizeof(cl.worldmodel->name)); t2 = malloc (sizeof(cl.worldmodel->name));
if (!mapname || !t2) if (!mapname || !t2)
Sys_Error ("Can't duplicate mapname!"); Sys_Error ("Can't duplicate mapname!");
map_to_loc(mapname,t2); map_to_loc (mapname,t2);
t1 = strrchr (t2, '/'); t1 = strrchr (t2, '/');
if (!t1) if (!t1)
Sys_Error ("Can't find /!"); Sys_Error ("Can't find /!");
@ -335,38 +338,42 @@ Team_NewMap (void)
void void
Team_Init_Cvars (void) Team_Init_Cvars (void)
{ {
cl_deadbodyfilter = cl_deadbodyfilter = Cvar_Get ("cl_deadbodyfilter", "0", CVAR_NONE, NULL,
Cvar_Get ("cl_deadbodyfilter", "0", CVAR_NONE, NULL, "Hide dead player models");
"Hide dead player models"); cl_gibfilter = Cvar_Get ("cl_gibfilter", "0", CVAR_NONE, NULL,
cl_gibfilter = Cvar_Get ("cl_gibfilter", "0", CVAR_NONE, NULL, "Hide gibs"); "Hide gibs");
cl_parsesay = Cvar_Get ("cl_parsesay", "0", CVAR_NONE, NULL, cl_parsesay = Cvar_Get ("cl_parsesay", "0", CVAR_NONE, NULL,
"Use .loc files to find your present location when you put %l in messages"); "Use .loc files to find your present location "
"when you put %l in messages");
cl_nofake = Cvar_Get ("cl_nofake", "0", CVAR_NONE, NULL, cl_nofake = Cvar_Get ("cl_nofake", "0", CVAR_NONE, NULL,
"Unhide fake messages"); "Unhide fake messages");
} }
/* /*
locs_loc locs_loc
Location marker manipulation
Location marker manipulation
*/ */
void void
locs_loc (void) locs_loc (void)
{ {
char locfile[MAX_OSPATH];
char *mapname; char *mapname;
const char *desc = NULL; const char *desc = NULL;
char locfile[MAX_OSPATH];
//FIXME checking needed to make sure you are actually in the game and a live. // FIXME: need to check to ensure you are actually in the game and alive.
if (Cmd_Argc () == 1) { if (Cmd_Argc () == 1) {
Con_Printf ("loc <add|delete|rename|move|save|zsave> [<description>] :Modifies location data, add|rename take <description> parameter\n"); Con_Printf ("loc <add|delete|rename|move|save|zsave> [<description>] "
":Modifies location data, add|rename take <description> "
"parameter\n");
return; return;
} }
if (Cmd_Argc () >= 3) if (Cmd_Argc () >= 3)
desc = Cmd_Args (2); desc = Cmd_Args (2);
mapname = malloc(sizeof(cl.worldmodel->name)); mapname = malloc (sizeof(cl.worldmodel->name));
if (!mapname) if (!mapname)
Sys_Error ("Can't duplicate mapname!"); Sys_Error ("Can't duplicate mapname!");
map_to_loc(cl.worldmodel->name,mapname); map_to_loc (cl.worldmodel->name,mapname);
snprintf (locfile, sizeof (locfile), "%s/%s", com_gamedir, mapname); snprintf (locfile, sizeof (locfile), "%s/%s", com_gamedir, mapname);
free(mapname); free(mapname);
@ -374,48 +381,52 @@ locs_loc (void)
if (Cmd_Argc () == 2) { if (Cmd_Argc () == 2) {
locs_save(locfile, false); locs_save(locfile, false);
} else } else
Con_Printf("loc save :saves locs from memory into a .loc file\n"); Con_Printf ("loc save :saves locs from memory into a .loc file\n");
} }
if (strcasecmp(Cmd_Argv(1),"zsave") == 0) { if (strcasecmp(Cmd_Argv(1),"zsave") == 0) {
if (Cmd_Argc () == 2) { if (Cmd_Argc () == 2) {
locs_save(locfile, true); locs_save(locfile, true);
} else } else
Con_Printf("loc save :saves locs from memory into a .loc file\n"); Con_Printf ("loc save :saves locs from memory into a .loc file\n");
} }
if (strcasecmp(Cmd_Argv(1),"add") == 0) { if (strcasecmp(Cmd_Argv(1),"add") == 0) {
if (Cmd_Argc () >= 3) if (Cmd_Argc () >= 3)
locs_mark(cl.simorg,desc); locs_mark(cl.simorg,desc);
else else
Con_Printf("loc add <description> :marks the current location with the description and records the information into a loc file.\n"); Con_Printf ("loc add <description> :marks the current location "
"with the description and records the information "
"into a loc file.\n");
} }
if (strcasecmp(Cmd_Argv(1),"rename") == 0) { if (strcasecmp(Cmd_Argv(1),"rename") == 0) {
if (Cmd_Argc () >= 3) if (Cmd_Argc () >= 3)
locs_edit(cl.simorg,desc); locs_edit(cl.simorg,desc);
else else
Con_Printf("loc rename <description> :changes the description of the nearest location marker\n"); Con_Printf ("loc rename <description> :changes the description of "
"the nearest location marker\n");
} }
if (strcasecmp(Cmd_Argv(1),"delete") == 0) { if (strcasecmp(Cmd_Argv(1),"delete") == 0) {
if (Cmd_Argc () == 2) if (Cmd_Argc () == 2)
locs_del(cl.simorg); locs_del(cl.simorg);
else else
Con_Printf("loc delete :removes nearest location marker\n"); Con_Printf ("loc delete :removes nearest location marker\n");
} }
if (strcasecmp(Cmd_Argv(1),"move") == 0) { if (strcasecmp(Cmd_Argv(1),"move") == 0) {
if (Cmd_Argc () == 2) if (Cmd_Argc () == 2)
locs_edit(cl.simorg,NULL); locs_edit(cl.simorg,NULL);
else else
Con_Printf("loc move :moves the nearest location marker to your current location\n"); Con_Printf ("loc move :moves the nearest location marker to your "
"current location\n");
} }
} }
void void
Locs_Init (void) Locs_Init (void)
{ {
Cmd_AddCommand ("loc", locs_loc, "Location marker editing commands: 'loc help' for more"); Cmd_AddCommand ("loc", locs_loc, "Location marker editing commands: 'loc "
"help' for more");
} }

View file

@ -65,9 +65,7 @@ typedef struct {
int SV_HullPointContents (hull_t *hull, int num, vec3_t p); int SV_HullPointContents (hull_t *hull, int num, vec3_t p);
/* /* HULL BOXES */
HULL BOXES
*/
static hull_t box_hull; static hull_t box_hull;
static dclipnode_t box_clipnodes[6]; static dclipnode_t box_clipnodes[6];
@ -83,8 +81,7 @@ static mplane_t box_planes[6];
void void
SV_InitHull (hull_t *hull, dclipnode_t *clipnodes, mplane_t *planes) SV_InitHull (hull_t *hull, dclipnode_t *clipnodes, mplane_t *planes)
{ {
int i; int side, i;
int side;
hull->clipnodes = clipnodes; hull->clipnodes = clipnodes;
hull->planes = planes; hull->planes = planes;
@ -113,7 +110,6 @@ SV_InitBoxHull (void)
SV_InitHull (&box_hull, box_clipnodes, box_planes); SV_InitHull (&box_hull, box_clipnodes, box_planes);
} }
/* /*
SV_HullForBox SV_HullForBox
@ -133,7 +129,6 @@ SV_HullForBox (vec3_t mins, vec3_t maxs)
return &box_hull; return &box_hull;
} }
/* /*
SV_HullForEntity SV_HullForEntity
@ -145,11 +140,10 @@ SV_HullForBox (vec3_t mins, vec3_t maxs)
hull_t * hull_t *
SV_HullForEntity (edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset) SV_HullForEntity (edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset)
{ {
model_t *model;
vec3_t size;
vec3_t hullmins, hullmaxs;
hull_t *hull = 0; hull_t *hull = 0;
int hull_index = 0; int hull_index = 0;
model_t *model;
vec3_t hullmins, hullmaxs, size;
if ((sv_fields.rotated_bbox != -1 if ((sv_fields.rotated_bbox != -1
&& SVinteger (ent, rotated_bbox)) && SVinteger (ent, rotated_bbox))
@ -196,21 +190,16 @@ SV_HullForEntity (edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset)
return hull; return hull;
} }
/* ENTITY AREA CHECKING */
/*
ENTITY AREA CHECKING
*/
areanode_t sv_areanodes[AREA_NODES]; areanode_t sv_areanodes[AREA_NODES];
int sv_numareanodes; int sv_numareanodes;
areanode_t * areanode_t *
SV_CreateAreaNode (int depth, vec3_t mins, vec3_t maxs) SV_CreateAreaNode (int depth, vec3_t mins, vec3_t maxs)
{ {
areanode_t *anode; areanode_t *anode;
vec3_t size; vec3_t mins1, maxs1, mins2, maxs2, size;
vec3_t mins1, maxs1, mins2, maxs2;
anode = &sv_areanodes[sv_numareanodes]; anode = &sv_areanodes[sv_numareanodes];
sv_numareanodes++; sv_numareanodes++;
@ -244,7 +233,6 @@ SV_CreateAreaNode (int depth, vec3_t mins, vec3_t maxs)
return anode; return anode;
} }
void void
SV_ClearWorld (void) SV_ClearWorld (void)
{ {
@ -269,9 +257,9 @@ SV_UnlinkEdict (edict_t *ent)
void void
SV_TouchLinks (edict_t *ent, areanode_t *node) SV_TouchLinks (edict_t *ent, areanode_t *node)
{ {
link_t *l, *next;
edict_t *touch; edict_t *touch;
int old_self, old_other; int old_self, old_other;
link_t *l, *next;
// touch linked edicts // touch linked edicts
for (l = node->trigger_edicts.next; l != &node->trigger_edicts; l = next) { for (l = node->trigger_edicts.next; l != &node->trigger_edicts; l = next) {
@ -316,10 +304,9 @@ SV_TouchLinks (edict_t *ent, areanode_t *node)
void void
SV_FindTouchedLeafs (edict_t *ent, mnode_t *node) SV_FindTouchedLeafs (edict_t *ent, mnode_t *node)
{ {
mplane_t *splitplane; int leafnum, sides;
mleaf_t *leaf; mleaf_t *leaf;
int sides; mplane_t *splitplane;
int leafnum;
if (node->contents == CONTENTS_SOLID) if (node->contents == CONTENTS_SOLID)
return; return;
@ -350,7 +337,6 @@ SV_FindTouchedLeafs (edict_t *ent, mnode_t *node)
SV_FindTouchedLeafs (ent, node->children[1]); SV_FindTouchedLeafs (ent, node->children[1]);
} }
void void
SV_LinkEdict (edict_t *ent, qboolean touch_triggers) SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
{ {
@ -420,19 +406,15 @@ SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
SV_TouchLinks (ent, sv_areanodes); SV_TouchLinks (ent, sv_areanodes);
} }
/* POINT TESTING IN HULLS */
/*
POINT TESTING IN HULLS
*/
#ifndef USE_INTEL_ASM #ifndef USE_INTEL_ASM
int int
SV_HullPointContents (hull_t *hull, int num, vec3_t p) SV_HullPointContents (hull_t *hull, int num, vec3_t p)
{ {
float d;
dclipnode_t *node; dclipnode_t *node;
mplane_t *plane; float d;
mplane_t *plane;
while (num >= 0) { while (num >= 0) {
if (num < hull->firstclipnode || num > hull->lastclipnode) if (num < hull->firstclipnode || num > hull->lastclipnode)
@ -455,7 +437,6 @@ SV_HullPointContents (hull_t *hull, int num, vec3_t p)
} }
#endif // !USE_INTEL_ASM #endif // !USE_INTEL_ASM
int int
SV_PointContents (vec3_t p) SV_PointContents (vec3_t p)
{ {
@ -467,14 +448,12 @@ SV_PointContents (vec3_t p)
return cont; return cont;
} }
int int
SV_TruePointContents (vec3_t p) SV_TruePointContents (vec3_t p)
{ {
return SV_HullPointContents (&sv.worldmodel->hulls[0], 0, p); return SV_HullPointContents (&sv.worldmodel->hulls[0], 0, p);
} }
/* /*
SV_TestEntityPosition SV_TestEntityPosition
@ -498,27 +477,20 @@ SV_TestEntityPosition (edict_t *ent)
return NULL; return NULL;
} }
/* LINE TESTING IN HULLS */
/*
LINE TESTING IN HULLS
*/
// 1/32 epsilon to keep floating point happy // 1/32 epsilon to keep floating point happy
#define DIST_EPSILON (0.03125) #define DIST_EPSILON (0.03125)
qboolean qboolean
SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1,
vec3_t p2, trace_t *trace) vec3_t p2, trace_t *trace)
{ {
dclipnode_t *node; dclipnode_t *node;
float frac, midf, t1, t2;
int side, i;
mplane_t *plane; mplane_t *plane;
float t1, t2;
float frac;
int i;
vec3_t mid; vec3_t mid;
int side;
float midf;
// check for empty // check for empty
if (num < 0) { if (num < 0) {
@ -631,7 +603,6 @@ SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1,
return false; return false;
} }
/* /*
SV_ClipMoveToEntity SV_ClipMoveToEntity
@ -642,10 +613,9 @@ trace_t
SV_ClipMoveToEntity (edict_t *touched, edict_t *mover, vec3_t start, SV_ClipMoveToEntity (edict_t *touched, edict_t *mover, vec3_t start,
vec3_t mins, vec3_t maxs, vec3_t end) vec3_t mins, vec3_t maxs, vec3_t end)
{ {
trace_t trace;
vec3_t offset;
vec3_t start_l, end_l;
hull_t *hull; hull_t *hull;
trace_t trace;
vec3_t offset, start_l, end_l;
// fill in a default trace // fill in a default trace
memset (&trace, 0, sizeof (trace_t)); memset (&trace, 0, sizeof (trace_t));
@ -675,7 +645,6 @@ SV_ClipMoveToEntity (edict_t *touched, edict_t *mover, vec3_t start,
return trace; return trace;
} }
/* /*
SV_ClipToLinks SV_ClipToLinks
@ -684,8 +653,8 @@ SV_ClipMoveToEntity (edict_t *touched, edict_t *mover, vec3_t start,
void void
SV_ClipToLinks (areanode_t *node, moveclip_t * clip) SV_ClipToLinks (areanode_t *node, moveclip_t * clip)
{ {
link_t *l, *next;
edict_t *touch; edict_t *touch;
link_t *l, *next;
trace_t trace; trace_t trace;
// touch linked edicts // touch linked edicts
@ -755,7 +724,6 @@ SV_ClipToLinks (areanode_t *node, moveclip_t * clip)
SV_ClipToLinks (node->children[1], clip); SV_ClipToLinks (node->children[1], clip);
} }
void void
SV_MoveBounds (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, SV_MoveBounds (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end,
vec3_t boxmins, vec3_t boxmaxs) vec3_t boxmins, vec3_t boxmaxs)
@ -779,13 +747,12 @@ SV_MoveBounds (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end,
#endif #endif
} }
trace_t trace_t
SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type,
edict_t *passedict) edict_t *passedict)
{ {
moveclip_t clip;
int i; int i;
moveclip_t clip;
memset (&clip, 0, sizeof (moveclip_t)); memset (&clip, 0, sizeof (moveclip_t));
@ -823,11 +790,10 @@ SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type,
edict_t * edict_t *
SV_TestPlayerPosition (edict_t *ent, vec3_t origin) SV_TestPlayerPosition (edict_t *ent, vec3_t origin)
{ {
hull_t *hull;
edict_t *check; edict_t *check;
vec3_t boxmins, boxmaxs; hull_t *hull;
vec3_t offset;
int e; int e;
vec3_t boxmins, boxmaxs, offset;
// check world first // check world first
hull = &sv.worldmodel->hulls[1]; hull = &sv.worldmodel->hulls[1];
@ -839,7 +805,8 @@ SV_TestPlayerPosition (edict_t *ent, vec3_t origin)
VectorAdd (origin, SVvector (ent, maxs), boxmaxs); VectorAdd (origin, SVvector (ent, maxs), boxmaxs);
check = NEXT_EDICT (&sv_pr_state, sv.edicts); check = NEXT_EDICT (&sv_pr_state, sv.edicts);
for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state, check)) { for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state,
check)) {
if (check->free) if (check->free)
continue; continue;
if (check == ent) if (check == ent)