#include "quakedef.h"
-#define STEPSIZE 18
-
/*
=============
SV_CheckBottom
trace_t trace;
int x, y;
float mid, bottom;
-
+
VectorAdd (ent->v.origin, ent->v.mins, mins);
VectorAdd (ent->v.origin, ent->v.maxs, maxs);
{
start[0] = x ? maxs[0] : mins[0];
start[1] = y ? maxs[1] : mins[1];
- if (SV_PointContents (start) != CONTENTS_SOLID)
+ if (Mod_PointContents(start, sv.worldmodel) != CONTENTS_SOLID)
goto realcheck;
}
// check it for real...
//
start[2] = mins[2];
-
+
// the midpoint must be within 16 of the bottom
start[0] = stop[0] = (mins[0] + maxs[0])*0.5;
start[1] = stop[1] = (mins[1] + maxs[1])*0.5;
- stop[2] = start[2] - 2*STEPSIZE;
- trace = SV_Move (start, vec3_origin, vec3_origin, stop, true, ent);
+ stop[2] = start[2] - 2*sv_stepheight.value;
+ trace = SV_Move (start, vec3_origin, vec3_origin, stop, MOVE_NOMONSTERS, ent);
if (trace.fraction == 1.0)
return false;
mid = bottom = trace.endpos[2];
-
-// the corners must be within 16 of the midpoint
+
+// the corners must be within 16 of the midpoint
for (x=0 ; x<=1 ; x++)
for (y=0 ; y<=1 ; y++)
{
start[0] = stop[0] = x ? maxs[0] : mins[0];
start[1] = stop[1] = y ? maxs[1] : mins[1];
-
- trace = SV_Move (start, vec3_origin, vec3_origin, stop, true, ent);
-
+
+ trace = SV_Move (start, vec3_origin, vec3_origin, stop, MOVE_NOMONSTERS, ent);
+
if (trace.fraction != 1.0 && trace.endpos[2] > bottom)
bottom = trace.endpos[2];
- if (trace.fraction == 1.0 || mid - trace.endpos[2] > STEPSIZE)
+ if (trace.fraction == 1.0 || mid - trace.endpos[2] > sv_stepheight.value)
return false;
}
qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
{
float dz;
- vec3_t oldorg, neworg, end;
+ vec3_t oldorg, neworg, end, traceendpos;
trace_t trace;
int i;
edict_t *enemy;
-// try the move
+// try the move
VectorCopy (ent->v.origin, oldorg);
VectorAdd (ent->v.origin, move, neworg);
if (dz < 30)
neworg[2] += 8;
}
- trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, neworg, false, ent);
-
+ trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, neworg, MOVE_NORMAL, ent);
+
if (trace.fraction == 1)
{
- if ( ((int)ent->v.flags & FL_SWIM) && SV_PointContents(trace.endpos) == CONTENTS_EMPTY )
+ VectorCopy(trace.endpos, traceendpos);
+ if ( ((int)ent->v.flags & FL_SWIM) && Mod_PointContents(traceendpos, sv.worldmodel) == CONTENTS_EMPTY )
return false; // swim monster left water
-
- VectorCopy (trace.endpos, ent->v.origin);
+
+ VectorCopy (traceendpos, ent->v.origin);
if (relink)
SV_LinkEdict (ent, true);
return true;
}
-
+
if (enemy == sv.edicts)
break;
}
-
+
return false;
}
// push down from a step height above the wished position
- neworg[2] += STEPSIZE;
+ neworg[2] += sv_stepheight.value;
VectorCopy (neworg, end);
- end[2] -= STEPSIZE*2;
+ end[2] -= sv_stepheight.value*2;
- trace = SV_Move (neworg, ent->v.mins, ent->v.maxs, end, false, ent);
+ trace = SV_Move (neworg, ent->v.mins, ent->v.maxs, end, MOVE_NORMAL, ent);
if (trace.allsolid)
return false;
if (trace.startsolid)
{
- neworg[2] -= STEPSIZE;
- trace = SV_Move (neworg, ent->v.mins, ent->v.maxs, end, false, ent);
+ neworg[2] -= sv_stepheight.value;
+ trace = SV_Move (neworg, ent->v.mins, ent->v.maxs, end, MOVE_NORMAL, ent);
if (trace.allsolid || trace.startsolid)
return false;
}
if (relink)
SV_LinkEdict (ent, true);
ent->v.flags = (int)ent->v.flags & ~FL_ONGROUND;
-// Con_Printf ("fall down\n");
return true;
}
}
if ( (int)ent->v.flags & FL_PARTIALGROUND )
- {
-// Con_Printf ("back on ground\n");
ent->v.flags = (int)ent->v.flags & ~FL_PARTIALGROUND;
- }
+
ent->v.groundentity = EDICT_TO_PROG(trace.ent);
// the move is ok
*/
void SV_FixCheckBottom (edict_t *ent)
{
-// Con_Printf ("SV_FixCheckBottom\n");
-
ent->v.flags = (int)ent->v.flags | FL_PARTIALGROUND;
}
float d[3];
float tdir, olddir, turnaround;
- olddir = anglemod( (int)(actor->v.ideal_yaw/45)*45 );
- turnaround = anglemod(olddir - 180);
+ olddir = ANGLEMOD((int)(actor->v.ideal_yaw/45)*45);
+ turnaround = ANGLEMOD(olddir - 180);
deltax = enemy->v.origin[0] - actor->v.origin[0];
deltay = enemy->v.origin[1] - actor->v.origin[1];
d[2]=tdir;
}
- if (d[1]!=DI_NODIR && d[1]!=turnaround
+ if (d[1]!=DI_NODIR && d[1]!=turnaround
&& SV_StepDirection(actor, d[1], dist))
return;
qboolean SV_CloseEnough (edict_t *ent, edict_t *goal, float dist)
{
int i;
-
+
for (i=0 ; i<3 ; i++)
{
if (goal->v.absmin[i] > ent->v.absmax[i] + dist)