From 4545a28bb92345da80d958796b2bebb0e7e5dbc4 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 18 Apr 2016 12:10:05 +1000 Subject: [PATCH] Purge self from the bot code --- qcsrc/server/bot/aim.qc | 4 ++-- qcsrc/server/bot/aim.qh | 4 ++-- qcsrc/server/bot/havocbot/havocbot.qc | 19 +++++++++-------- qcsrc/server/bot/waypoints.qc | 30 +++++++++++++-------------- 4 files changed, 29 insertions(+), 28 deletions(-) diff --git a/qcsrc/server/bot/aim.qc b/qcsrc/server/bot/aim.qc index 2d6a642ba..0f138d2d5 100644 --- a/qcsrc/server/bot/aim.qc +++ b/qcsrc/server/bot/aim.qc @@ -156,8 +156,8 @@ void bot_lagfunc(entity this, float t, float f1, float f2, entity e1, vector v1, } this.bot_aimtarg = e1; this.bot_aimlatency = this.ping; // FIXME? Shouldn't this be in the lag item? - this.bot_aimselforigin = v1; - this.bot_aimselfvelocity = v2; + //this.bot_aimselforigin = v1; + //this.bot_aimselfvelocity = v2; this.bot_aimtargorigin = v3; this.bot_aimtargvelocity = v4; if(skill <= 0) diff --git a/qcsrc/server/bot/aim.qh b/qcsrc/server/bot/aim.qh index 5a1cb16c4..a26e64bc7 100644 --- a/qcsrc/server/bot/aim.qh +++ b/qcsrc/server/bot/aim.qh @@ -74,8 +74,8 @@ vector shotdir; .vector bot_5th_order_aimfilter; .vector bot_olddesiredang; -.vector bot_aimselforigin; -.vector bot_aimselfvelocity; +//.vector bot_aimselforigin; +//.vector bot_aimselfvelocity; .vector bot_aimtargorigin; .vector bot_aimtargvelocity; diff --git a/qcsrc/server/bot/havocbot/havocbot.qc b/qcsrc/server/bot/havocbot/havocbot.qc index 5403b35ca..cff3fe214 100644 --- a/qcsrc/server/bot/havocbot/havocbot.qc +++ b/qcsrc/server/bot/havocbot/havocbot.qc @@ -1106,24 +1106,24 @@ void havocbot_chooseweapon(entity this) void havocbot_aim(entity this) { - vector selfvel, enemyvel; + vector myvel, enemyvel; // if(this.flags & FL_INWATER) // return; if (time < this.nextaim) return; this.nextaim = time + 0.1; - selfvel = this.velocity; + myvel = this.velocity; if (!this.waterlevel) - selfvel.z = 0; + myvel.z = 0; if (this.enemy) { enemyvel = this.enemy.velocity; if (!this.enemy.waterlevel) enemyvel.z = 0; - lag_additem(this, time + this.ping, 0, 0, this.enemy, this.origin, selfvel, (this.enemy.absmin + this.enemy.absmax) * 0.5, enemyvel); + lag_additem(this, time + this.ping, 0, 0, this.enemy, this.origin, myvel, (this.enemy.absmin + this.enemy.absmax) * 0.5, enemyvel); } else - lag_additem(this, time + this.ping, 0, 0, world, this.origin, selfvel, ( this.goalcurrent.absmin + this.goalcurrent.absmax ) * 0.5, '0 0 0'); + lag_additem(this, time + this.ping, 0, 0, world, this.origin, myvel, ( this.goalcurrent.absmin + this.goalcurrent.absmax ) * 0.5, '0 0 0'); } bool havocbot_moveto_refresh_route(entity this) @@ -1273,6 +1273,7 @@ vector havocbot_dodge() // LordHavoc: disabled because this is too expensive return '0 0 0'; #if 0 +SELFPARAM(); entity head; vector dodge, v, n; float danger, bestdanger, vl, d; @@ -1282,13 +1283,13 @@ vector havocbot_dodge() head = findchainfloat(bot_dodge, true); while(head) { - if (head.owner != self) + if (head.owner != this) { vl = vlen(head.velocity); if (vl > autocvar_sv_maxspeed * 0.3) { n = normalize(head.velocity); - v = self.origin - head.origin; + v = this.origin - head.origin; d = v * n; if (d > (0 - head.bot_dodgerating)) if (d < (vl * 0.2 + head.bot_dodgerating)) @@ -1306,11 +1307,11 @@ vector havocbot_dodge() } else { - danger = head.bot_dodgerating - vlen(head.origin - self.origin); + danger = head.bot_dodgerating - vlen(head.origin - this.origin); if (bestdanger < danger) { bestdanger = danger; - dodge = normalize(self.origin - head.origin); + dodge = normalize(this.origin - head.origin); } } } diff --git a/qcsrc/server/bot/waypoints.qc b/qcsrc/server/bot/waypoints.qc index 225ae8597..bba6a1b9e 100644 --- a/qcsrc/server/bot/waypoints.qc +++ b/qcsrc/server/bot/waypoints.qc @@ -172,20 +172,20 @@ void waypoint_think() bot_navigation_movemode = ((autocvar_bot_navigation_ignoreplayers) ? MOVE_NOMONSTERS : MOVE_NORMAL); - //dprint("waypoint_think wpisbox = ", ftos(self.wpisbox), "\n"); - sm1 = self.origin + self.mins; - sm2 = self.origin + self.maxs; + //dprint("waypoint_think wpisbox = ", ftos(this.wpisbox), "\n"); + sm1 = this.origin + this.mins; + sm2 = this.origin + this.maxs; for(e = world; (e = find(e, classname, "waypoint")); ) { - if (boxesoverlap(self.absmin, self.absmax, e.absmin, e.absmax)) + if (boxesoverlap(this.absmin, this.absmax, e.absmin, e.absmax)) { - waypoint_addlink(self, e); - waypoint_addlink(e, self); + waypoint_addlink(this, e); + waypoint_addlink(e, this); } else { ++relink_total; - if(!checkpvs(self.origin, e)) + if(!checkpvs(this.origin, e)) { ++relink_pvsculled; continue; @@ -194,7 +194,7 @@ void waypoint_think() sv.x = bound(sm1_x, sv.x, sm2_x); sv.y = bound(sm1_y, sv.y, sm2_y); sv.z = bound(sm1_z, sv.z, sm2_z); - ev = self.origin; + ev = this.origin; em1 = e.origin + e.mins; em2 = e.origin + e.maxs; ev.x = bound(em1_x, ev.x, em2_x); @@ -208,9 +208,9 @@ void waypoint_think() continue; } navigation_testtracewalk = 0; - if (!self.wpisbox) + if (!this.wpisbox) { - tracebox(sv - STAT(PL_MIN, NULL).z * '0 0 1', STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), sv, false, self); + tracebox(sv - STAT(PL_MIN, NULL).z * '0 0 1', STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), sv, false, this); if (!trace_startsolid) { //dprint("sv deviation", vtos(trace_endpos - sv), "\n"); @@ -226,20 +226,20 @@ void waypoint_think() ev = trace_endpos + '0 0 1'; } } - //traceline(self.origin, e.origin, false, world); + //traceline(this.origin, e.origin, false, world); //if (trace_fraction == 1) - if (!self.wpisbox && tracewalk(self, sv, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), ev, MOVE_NOMONSTERS)) - waypoint_addlink(self, e); + if (!this.wpisbox && tracewalk(this, sv, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), ev, MOVE_NOMONSTERS)) + waypoint_addlink(this, e); else relink_walkculled += 0.5; if (!e.wpisbox && tracewalk(e, ev, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), sv, MOVE_NOMONSTERS)) - waypoint_addlink(e, self); + waypoint_addlink(e, this); else relink_walkculled += 0.5; } } navigation_testtracewalk = 0; - self.wplinked = true; + this.wplinked = true; } void waypoint_clearlinks(entity wp) -- 2.39.2