#include "bot.qh"
#include "navigation.qh"
+#include <common/state.qh>
+
#include "../antilag.qh"
-#include "../../common/constants.qh"
+#include <common/constants.qh>
-#include "../../lib/warpzone/common.qh"
-#include "../../lib/warpzone/util_server.qh"
+#include <lib/warpzone/common.qh>
+#include <lib/warpzone/util_server.qh>
// create a new spawnfunc_waypoint and automatically link it to other waypoints, and link
// them back to it as well
}
w = new(waypoint);
- make_pure(w);
w.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
w.wpflags = f;
setorigin(w, (m1 + m2) * 0.5);
if(!w.wpisbox)
{
- setsize(w, PL_MIN - '1 1 0', PL_MAX + '1 1 0');
+ setsize(w, STAT(PL_MIN, NULL) - '1 1 0', STAT(PL_MAX, NULL) + '1 1 0');
if(!move_out_of_solid(w))
{
if(!(f & WAYPOINTFLAG_GENERATED))
ev.z = bound(em1_z, ev.z, em2_z);
dv = ev - sv;
dv.z = 0;
- if (vlen(dv) >= 1050) // max search distance in XY
+ if(vdist(dv, >=, 1050)) // max search distance in XY
{
++relink_lengthculled;
continue;
navigation_testtracewalk = 0;
if (!self.wpisbox)
{
- tracebox(sv - PL_MIN.z * '0 0 1', PL_MIN, PL_MAX, sv, false, self);
+ tracebox(sv - STAT(PL_MIN, NULL).z * '0 0 1', STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), sv, false, self);
if (!trace_startsolid)
{
//dprint("sv deviation", vtos(trace_endpos - sv), "\n");
}
if (!e.wpisbox)
{
- tracebox(ev - PL_MIN.z * '0 0 1', PL_MIN, PL_MAX, ev, false, e);
+ tracebox(ev - STAT(PL_MIN, NULL).z * '0 0 1', STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), ev, false, e);
if (!trace_startsolid)
{
//dprint("ev deviation", vtos(trace_endpos - ev), "\n");
}
//traceline(self.origin, e.origin, false, world);
//if (trace_fraction == 1)
- if (!self.wpisbox && tracewalk(self, sv, PL_MIN, PL_MAX, ev, MOVE_NOMONSTERS))
+ if (!self.wpisbox && tracewalk(self, sv, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), ev, MOVE_NOMONSTERS))
waypoint_addlink(self, e);
else
relink_walkculled += 0.5;
- if (!e.wpisbox && tracewalk(e, ev, PL_MIN, PL_MAX, sv, MOVE_NOMONSTERS))
+ if (!e.wpisbox && tracewalk(e, ev, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), sv, MOVE_NOMONSTERS))
waypoint_addlink(e, self);
else
relink_walkculled += 0.5;
// spawnfunc_waypoint map entity
spawnfunc(waypoint)
{
- setorigin(self, self.origin);
+ setorigin(this, this.origin);
// schedule a relink after other waypoints have had a chance to spawn
- waypoint_clearlinks(self);
- //waypoint_schedulerelink(self);
+ waypoint_clearlinks(this);
+ //waypoint_schedulerelink(this);
}
// remove a spawnfunc_waypoint, and schedule all neighbors to relink
vector waypoint_fixorigin(vector position)
{
- tracebox(position + '0 0 1' * (1 - PL_MIN.z), PL_MIN, PL_MAX, position + '0 0 -512', MOVE_NOMONSTERS, world);
+ tracebox(position + '0 0 1' * (1 - STAT(PL_MIN, NULL).z), STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), position + '0 0 -512', MOVE_NOMONSTERS, world);
if(trace_fraction < 1)
position = trace_endpos;
//traceline(position, position + '0 0 -512', MOVE_NOMONSTERS, world);
waypoint_spawnforteleporter_boxes(e, e.absmin, e.absmax, destination, destination, timetaken);
}
-entity waypoint_spawnpersonal(vector position)
-{SELFPARAM();
+entity waypoint_spawnpersonal(entity this, vector position)
+{
entity w;
// drop the waypoint to a proper location:
w = waypoint_spawn(position, position, WAYPOINTFLAG_GENERATED | WAYPOINTFLAG_PERSONAL);
w.nearestwaypoint = world;
w.nearestwaypointtimeout = 0;
- w.owner = self;
+ w.owner = this;
waypoint_schedulerelink(w);
void botframe_showwaypointlinks()
{
- entity player, head, w;
+ entity head, w;
if (time < botframe_waypointeditorlightningtime)
return;
botframe_waypointeditorlightningtime = time + 0.5;
- player = find(world, classname, "player");
- while (player)
- {
- if (!player.isbot)
- if (IS_ONGROUND(player) || player.waterlevel > WATERLEVEL_NONE)
+ FOREACH_CLIENT(IS_PLAYER(it) && !it.isbot, LAMBDA(
+ if(IS_ONGROUND(it) || it.waterlevel > WATERLEVEL_NONE)
{
//navigation_testtracewalk = true;
- head = navigation_findnearestwaypoint(player, false);
+ head = navigation_findnearestwaypoint(it, false);
// print("currently selected WP is ", etos(head), "\n");
//navigation_testtracewalk = false;
if (head)
{
- w = head ;if (w) te_lightning2(world, w.origin, player.origin);
+ w = head ;if (w) te_lightning2(world, w.origin, it.origin);
w = head.wp00;if (w) te_lightning2(world, w.origin, head.origin);
w = head.wp01;if (w) te_lightning2(world, w.origin, head.origin);
w = head.wp02;if (w) te_lightning2(world, w.origin, head.origin);
w = head.wp31;if (w) te_lightning2(world, w.origin, head.origin);
}
}
- player = find(player, classname, "player");
- }
+ ));
}
float botframe_autowaypoints_fixdown(vector v)
{
- tracebox(v, PL_MIN, PL_MAX, v + '0 0 -64', MOVE_NOMONSTERS, world);
+ tracebox(v, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), v + '0 0 -64', MOVE_NOMONSTERS, world);
if(trace_fraction >= 1)
return 0;
return 1;
}
t = (tmin + tmax) * 0.5;
- o = antilag_takebackorigin(p, time - t);
+ o = antilag_takebackorigin(p, CS(p), time - t);
if(!botframe_autowaypoints_fixdown(o))
return -2;
o = trace_endpos;
goto next;
}
}
-:next
+LABEL(next)
}
}
// d) The waypoint is a dead end. Dead end waypoints must be kept as
void botframe_autowaypoints()
{
- FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && it.deadflag == DEAD_NO, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it) && !IS_DEAD(it), LAMBDA(
// going back is broken, so only fix waypoints to walk TO the player
//botframe_autowaypoints_fix(p, false, botframe_autowaypoints_lastwp0);
botframe_autowaypoints_fix(it, true, botframe_autowaypoints_lastwp1);