]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Purge self from the bot code
authorMario <mario@smbclan.net>
Mon, 18 Apr 2016 02:10:05 +0000 (12:10 +1000)
committerMario <mario@smbclan.net>
Mon, 18 Apr 2016 02:10:05 +0000 (12:10 +1000)
qcsrc/server/bot/aim.qc
qcsrc/server/bot/aim.qh
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/bot/waypoints.qc

index 2d6a642bab38d064d563b46880d17f2044648a1c..0f138d2d5610a57c75c5b013ba83c0766433993b 100644 (file)
@@ -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)
index 5a1cb16c4d05a8a56d9f8cc1b2747cf8770db70e..a26e64bc792aa14a8ae96f2510c79d88f7d66048 100644 (file)
@@ -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;
 
index 5403b35ca6110e3dde18e1840d019300de04ac1e..cff3fe21452ad42a9f1a931927dcbcc82e18670f 100644 (file)
@@ -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);
                                }
                        }
                }
index 225ae859754952e1ca5b6e411bb6ca61d2f84084..bba6a1b9e2a7084b1fb9a1ad06a2a975c57b7596 100644 (file)
@@ -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)