2000-05-10 20:33:16 +00:00
|
|
|
/*
|
2000-05-11 16:03:29 +00:00
|
|
|
sv_move.c
|
2000-05-10 20:33:16 +00:00
|
|
|
|
2000-05-22 07:46:47 +00:00
|
|
|
monster movement
|
2000-05-10 20:33:16 +00:00
|
|
|
|
2000-05-11 16:03:29 +00:00
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
2000-05-10 20:33:16 +00:00
|
|
|
|
2000-05-11 16:03:29 +00:00
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
2000-05-10 20:33:16 +00:00
|
|
|
|
2000-05-11 16:03:29 +00:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
2000-05-10 20:33:16 +00:00
|
|
|
|
2000-05-11 16:03:29 +00:00
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
$Id$
|
2000-05-10 20:33:16 +00:00
|
|
|
*/
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-05-17 10:03:19 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2000-12-08 06:51:37 +00:00
|
|
|
# include "config.h"
|
2000-05-17 10:03:19 +00:00
|
|
|
#endif
|
2000-05-21 08:24:45 +00:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <math.h>
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-30 02:16:36 +00:00
|
|
|
#include "pmove.h"
|
|
|
|
#include "server.h"
|
2001-01-04 05:44:53 +00:00
|
|
|
#include "sv_pr_cmds.h"
|
2000-12-30 02:16:36 +00:00
|
|
|
#include "world.h"
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
#define STEPSIZE 18
|
|
|
|
|
|
|
|
/*
|
|
|
|
=============
|
|
|
|
SV_CheckBottom
|
|
|
|
|
|
|
|
Returns false if any part of the bottom of the entity is off an edge that
|
|
|
|
is not a staircase.
|
|
|
|
|
|
|
|
=============
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
int c_yes, c_no;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
qboolean
|
|
|
|
SV_CheckBottom (edict_t *ent)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
vec3_t mins, maxs, start, stop;
|
|
|
|
trace_t trace;
|
|
|
|
int x, y;
|
|
|
|
float mid, bottom;
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
VectorAdd (ent->v.origin, ent->v.mins, mins);
|
|
|
|
VectorAdd (ent->v.origin, ent->v.maxs, maxs);
|
|
|
|
|
|
|
|
// if all of the points under the corners are solid world, don't bother
|
|
|
|
// with the tougher checks
|
|
|
|
// the corners must be within 16 of the midpoint
|
|
|
|
start[2] = mins[2] - 1;
|
2000-12-08 06:51:37 +00:00
|
|
|
for (x = 0; x <= 1; x++)
|
|
|
|
for (y = 0; y <= 1; y++) {
|
2000-05-10 11:29:38 +00:00
|
|
|
start[0] = x ? maxs[0] : mins[0];
|
|
|
|
start[1] = y ? maxs[1] : mins[1];
|
|
|
|
if (SV_PointContents (start) != CONTENTS_SOLID)
|
|
|
|
goto realcheck;
|
|
|
|
}
|
|
|
|
|
|
|
|
c_yes++;
|
2000-12-08 06:51:37 +00:00
|
|
|
return true; // we got out easy
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
realcheck:
|
2000-05-10 11:29:38 +00:00
|
|
|
c_no++;
|
|
|
|
//
|
|
|
|
// check it for real...
|
|
|
|
//
|
|
|
|
start[2] = mins[2];
|
2000-12-08 06:51:37 +00:00
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
// the midpoint must be within 16 of the bottom
|
2000-12-08 06:51:37 +00:00
|
|
|
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;
|
2000-05-10 11:29:38 +00:00
|
|
|
trace = SV_Move (start, vec3_origin, vec3_origin, stop, true, ent);
|
|
|
|
|
|
|
|
if (trace.fraction == 1.0)
|
|
|
|
return false;
|
|
|
|
mid = bottom = trace.endpos[2];
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
|
|
// the corners must be within 16 of the midpoint
|
|
|
|
for (x = 0; x <= 1; x++)
|
|
|
|
for (y = 0; y <= 1; y++) {
|
2000-05-10 11:29:38 +00:00
|
|
|
start[0] = stop[0] = x ? maxs[0] : mins[0];
|
|
|
|
start[1] = stop[1] = y ? maxs[1] : mins[1];
|
2000-12-08 06:51:37 +00:00
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
trace = SV_Move (start, vec3_origin, vec3_origin, stop, true, ent);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
if (trace.fraction != 1.0 && trace.endpos[2] > bottom)
|
|
|
|
bottom = trace.endpos[2];
|
|
|
|
if (trace.fraction == 1.0 || mid - trace.endpos[2] > STEPSIZE)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
c_yes++;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
=============
|
|
|
|
SV_movestep
|
|
|
|
|
|
|
|
Called by monster program code.
|
|
|
|
The move will be adjusted for slopes and stairs, but if the move isn't
|
|
|
|
possible, no move is done, false is returned, and
|
|
|
|
pr_global_struct->trace_normal is set to the normal of the blocking wall
|
|
|
|
=============
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
qboolean
|
|
|
|
SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
float dz;
|
|
|
|
vec3_t oldorg, neworg, end;
|
|
|
|
trace_t trace;
|
|
|
|
int i;
|
|
|
|
edict_t *enemy;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
// try the move
|
2000-05-10 11:29:38 +00:00
|
|
|
VectorCopy (ent->v.origin, oldorg);
|
|
|
|
VectorAdd (ent->v.origin, move, neworg);
|
|
|
|
|
|
|
|
// flying monsters don't step up
|
2000-12-08 06:51:37 +00:00
|
|
|
if ((int) ent->v.flags & (FL_SWIM | FL_FLY)) {
|
|
|
|
// try one move with vertical motion, then one without
|
|
|
|
for (i = 0; i < 2; i++) {
|
2000-05-10 11:29:38 +00:00
|
|
|
VectorAdd (ent->v.origin, move, neworg);
|
2001-01-02 03:22:46 +00:00
|
|
|
enemy = PROG_TO_EDICT (&sv_progs, ent->v.enemy);
|
2000-12-08 06:51:37 +00:00
|
|
|
if (i == 0 && enemy != sv.edicts) {
|
|
|
|
dz =
|
|
|
|
ent->v.origin[2] -
|
2001-01-02 03:22:46 +00:00
|
|
|
PROG_TO_EDICT (&sv_progs, ent->v.enemy)->v.origin[2];
|
2000-05-10 11:29:38 +00:00
|
|
|
if (dz > 40)
|
|
|
|
neworg[2] -= 8;
|
|
|
|
if (dz < 30)
|
|
|
|
neworg[2] += 8;
|
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
trace =
|
|
|
|
SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, neworg, false,
|
|
|
|
ent);
|
|
|
|
|
|
|
|
if (trace.fraction == 1) {
|
|
|
|
if (((int) ent->v.flags & FL_SWIM)
|
|
|
|
&& SV_PointContents (trace.endpos) == CONTENTS_EMPTY)
|
|
|
|
return false; // swim monster left water
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
VectorCopy (trace.endpos, ent->v.origin);
|
|
|
|
if (relink)
|
|
|
|
SV_LinkEdict (ent, true);
|
|
|
|
return true;
|
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
if (enemy == sv.edicts)
|
|
|
|
break;
|
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
// push down from a step height above the wished position
|
|
|
|
neworg[2] += STEPSIZE;
|
|
|
|
VectorCopy (neworg, end);
|
2000-12-08 06:51:37 +00:00
|
|
|
end[2] -= STEPSIZE * 2;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
trace = SV_Move (neworg, ent->v.mins, ent->v.maxs, end, false, ent);
|
|
|
|
|
|
|
|
if (trace.allsolid)
|
|
|
|
return false;
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
if (trace.startsolid) {
|
2000-05-10 11:29:38 +00:00
|
|
|
neworg[2] -= STEPSIZE;
|
|
|
|
trace = SV_Move (neworg, ent->v.mins, ent->v.maxs, end, false, ent);
|
|
|
|
if (trace.allsolid || trace.startsolid)
|
|
|
|
return false;
|
|
|
|
}
|
2000-12-08 06:51:37 +00:00
|
|
|
if (trace.fraction == 1) {
|
|
|
|
// if monster had the ground pulled out, go ahead and fall
|
|
|
|
if ((int) ent->v.flags & FL_PARTIALGROUND) {
|
2000-05-10 11:29:38 +00:00
|
|
|
VectorAdd (ent->v.origin, move, ent->v.origin);
|
|
|
|
if (relink)
|
|
|
|
SV_LinkEdict (ent, true);
|
2000-12-08 06:51:37 +00:00
|
|
|
ent->v.flags = (int) ent->v.flags & ~FL_ONGROUND;
|
|
|
|
// Con_Printf ("fall down\n");
|
2000-05-10 11:29:38 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
return false; // walked off an edge
|
|
|
|
}
|
2000-05-10 11:29:38 +00:00
|
|
|
// check point traces down for dangling corners
|
|
|
|
VectorCopy (trace.endpos, ent->v.origin);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
|
|
if (!SV_CheckBottom (ent)) {
|
|
|
|
if ((int) ent->v.flags & FL_PARTIALGROUND) { // entity had floor
|
|
|
|
// mostly pulled out
|
|
|
|
// from underneath it
|
2000-05-10 11:29:38 +00:00
|
|
|
// and is trying to correct
|
|
|
|
if (relink)
|
|
|
|
SV_LinkEdict (ent, true);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
VectorCopy (oldorg, ent->v.origin);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
if ((int) ent->v.flags & FL_PARTIALGROUND) {
|
|
|
|
// Con_Printf ("back on ground\n");
|
|
|
|
ent->v.flags = (int) ent->v.flags & ~FL_PARTIALGROUND;
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
2001-01-02 03:22:46 +00:00
|
|
|
ent->v.groundentity = EDICT_TO_PROG (&sv_progs, trace.ent);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
// the move is ok
|
|
|
|
if (relink)
|
|
|
|
SV_LinkEdict (ent, true);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
/*
|
|
|
|
======================
|
|
|
|
SV_StepDirection
|
|
|
|
|
|
|
|
Turns to the movement direction, and walks the current distance if
|
|
|
|
facing it.
|
|
|
|
|
|
|
|
======================
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
qboolean
|
|
|
|
SV_StepDirection (edict_t *ent, float yaw, float dist)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
vec3_t move, oldorigin;
|
|
|
|
float delta;
|
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
ent->v.ideal_yaw = yaw;
|
2001-01-04 05:44:53 +00:00
|
|
|
PF_changeyaw (&sv_progs);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
|
|
yaw = yaw * M_PI * 2 / 360;
|
|
|
|
move[0] = cos (yaw) * dist;
|
|
|
|
move[1] = sin (yaw) * dist;
|
2000-05-10 11:29:38 +00:00
|
|
|
move[2] = 0;
|
|
|
|
|
|
|
|
VectorCopy (ent->v.origin, oldorigin);
|
2000-12-08 06:51:37 +00:00
|
|
|
if (SV_movestep (ent, move, false)) {
|
2000-05-10 11:29:38 +00:00
|
|
|
delta = ent->v.angles[YAW] - ent->v.ideal_yaw;
|
2000-12-08 06:51:37 +00:00
|
|
|
if (delta > 45 && delta < 315) { // not turned far enough, so
|
|
|
|
// don't take the step
|
2000-05-10 11:29:38 +00:00
|
|
|
VectorCopy (oldorigin, ent->v.origin);
|
|
|
|
}
|
|
|
|
SV_LinkEdict (ent, true);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
SV_LinkEdict (ent, true);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
2000-05-10 11:29:38 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
======================
|
|
|
|
SV_FixCheckBottom
|
|
|
|
|
|
|
|
======================
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
SV_FixCheckBottom (edict_t *ent)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
// Con_Printf ("SV_FixCheckBottom\n");
|
|
|
|
|
|
|
|
ent->v.flags = (int) ent->v.flags | FL_PARTIALGROUND;
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
================
|
|
|
|
SV_NewChaseDir
|
|
|
|
|
|
|
|
================
|
|
|
|
*/
|
|
|
|
#define DI_NODIR -1
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
float deltax, deltay;
|
|
|
|
float d[3];
|
|
|
|
float tdir, olddir, turnaround;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
olddir = anglemod ((int) (actor->v.ideal_yaw / 45) * 45);
|
|
|
|
turnaround = anglemod (olddir - 180);
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
deltax = enemy->v.origin[0] - actor->v.origin[0];
|
|
|
|
deltay = enemy->v.origin[1] - actor->v.origin[1];
|
2000-12-08 06:51:37 +00:00
|
|
|
if (deltax > 10)
|
|
|
|
d[1] = 0;
|
|
|
|
else if (deltax < -10)
|
|
|
|
d[1] = 180;
|
2000-05-10 11:29:38 +00:00
|
|
|
else
|
2000-12-08 06:51:37 +00:00
|
|
|
d[1] = DI_NODIR;
|
|
|
|
if (deltay < -10)
|
|
|
|
d[2] = 270;
|
|
|
|
else if (deltay > 10)
|
|
|
|
d[2] = 90;
|
2000-05-10 11:29:38 +00:00
|
|
|
else
|
2000-12-08 06:51:37 +00:00
|
|
|
d[2] = DI_NODIR;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
// try direct route
|
2000-12-08 06:51:37 +00:00
|
|
|
if (d[1] != DI_NODIR && d[2] != DI_NODIR) {
|
2000-05-10 11:29:38 +00:00
|
|
|
if (d[1] == 0)
|
|
|
|
tdir = d[2] == 90 ? 45 : 315;
|
|
|
|
else
|
|
|
|
tdir = d[2] == 90 ? 135 : 215;
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
|
|
if (tdir != turnaround && SV_StepDirection (actor, tdir, dist))
|
2000-05-10 11:29:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// try other directions
|
2000-12-08 06:51:37 +00:00
|
|
|
if (((rand () & 3) & 1) || abs (deltay) > abs (deltax)) {
|
|
|
|
tdir = d[1];
|
|
|
|
d[1] = d[2];
|
|
|
|
d[2] = tdir;
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
if (d[1] != DI_NODIR && d[1] != turnaround
|
|
|
|
&& SV_StepDirection (actor, d[1], dist)) return;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
if (d[2] != DI_NODIR && d[2] != turnaround
|
|
|
|
&& SV_StepDirection (actor, d[2], dist)) return;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
/* there is no direct path to the player, so pick another direction */
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
if (olddir != DI_NODIR && SV_StepDirection (actor, olddir, dist))
|
|
|
|
return;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
if (rand () & 1) { /* randomly determine direction of
|
|
|
|
search */
|
|
|
|
for (tdir = 0; tdir <= 315; tdir += 45)
|
|
|
|
if (tdir != turnaround && SV_StepDirection (actor, tdir, dist))
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
for (tdir = 315; tdir >= 0; tdir -= 45)
|
|
|
|
if (tdir != turnaround && SV_StepDirection (actor, tdir, dist))
|
|
|
|
return;
|
2000-05-10 11:29:38 +00:00
|
|
|
}
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
if (turnaround != DI_NODIR && SV_StepDirection (actor, turnaround, dist))
|
|
|
|
return;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
actor->v.ideal_yaw = olddir; // can't move
|
|
|
|
|
|
|
|
// if a bridge was pulled out from underneath a monster, it may not have
|
|
|
|
// a valid standing position at all
|
|
|
|
|
|
|
|
if (!SV_CheckBottom (actor))
|
|
|
|
SV_FixCheckBottom (actor);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
======================
|
|
|
|
SV_CloseEnough
|
|
|
|
|
|
|
|
======================
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
qboolean
|
|
|
|
SV_CloseEnough (edict_t *ent, edict_t *goal, float dist)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++) {
|
2000-05-10 11:29:38 +00:00
|
|
|
if (goal->v.absmin[i] > ent->v.absmax[i] + dist)
|
|
|
|
return false;
|
|
|
|
if (goal->v.absmax[i] < ent->v.absmin[i] - dist)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
======================
|
|
|
|
SV_MoveToGoal
|
|
|
|
|
|
|
|
======================
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
2000-12-31 07:43:09 +00:00
|
|
|
SV_MoveToGoal (progs_t *pr)
|
2000-05-10 11:29:38 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
edict_t *ent, *goal;
|
|
|
|
float dist;
|
|
|
|
|
2001-01-02 03:22:46 +00:00
|
|
|
ent = PROG_TO_EDICT (&sv_progs, sv_progs.pr_global_struct->self);
|
|
|
|
goal = PROG_TO_EDICT (&sv_progs, ent->v.goalentity);
|
2000-12-31 07:43:09 +00:00
|
|
|
dist = G_FLOAT (&sv_progs, OFS_PARM0);
|
2000-12-08 06:51:37 +00:00
|
|
|
|
|
|
|
if (!((int) ent->v.flags & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
|
2000-12-31 07:43:09 +00:00
|
|
|
G_FLOAT (&sv_progs, OFS_RETURN) = 0;
|
2000-05-10 11:29:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// if the next step hits the enemy, return immediately
|
2001-01-02 03:22:46 +00:00
|
|
|
if (PROG_TO_EDICT (&sv_progs, ent->v.enemy) != sv.edicts
|
2000-12-08 06:51:37 +00:00
|
|
|
&& SV_CloseEnough (ent, goal, dist)) return;
|
2000-05-10 11:29:38 +00:00
|
|
|
|
|
|
|
// bump around...
|
2000-12-08 06:51:37 +00:00
|
|
|
if ((rand () & 3) == 1 || !SV_StepDirection (ent, ent->v.ideal_yaw, dist)) {
|
2000-05-10 11:29:38 +00:00
|
|
|
SV_NewChaseDir (ent, goal, dist);
|
|
|
|
}
|
|
|
|
}
|