]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into terencehill/bot_waypoints
authorterencehill <piuntn@gmail.com>
Thu, 22 Aug 2019 00:07:59 +0000 (02:07 +0200)
committerterencehill <piuntn@gmail.com>
Thu, 22 Aug 2019 00:07:59 +0000 (02:07 +0200)
# Conflicts:
# qcsrc/server/bot/default/havocbot/havocbot.qc

1  2 
qcsrc/menu/xonotic/keybinder.qc
qcsrc/server/bot/api.qh
qcsrc/server/bot/default/havocbot/havocbot.qc
qcsrc/server/bot/default/waypoints.qc
xonotic-client.cfg

Simple merge
index 630f3205297b238c41f01e372ec7ee3ce6f20b38,35b52e3d9121de10f322853ea0d92d9c14a51e81..eddc712347a6f115c26fb7eb3fa466d5cb24e58a
@@@ -14,19 -14,7 +14,16 @@@ const int WAYPOINTFLAG_USEFUL = BIT(17)
  const int WAYPOINTFLAG_DEAD_END = BIT(16);  // Useless WP detection temporary flag.
  const int WAYPOINTFLAG_LADDER = BIT(15);
  const int WAYPOINTFLAG_JUMP = BIT(14);
 +const int WAYPOINTFLAG_CUSTOM_JP = BIT(13);  // jumppad with different destination waypoint (changed in the editor)
 +const int WAYPOINTFLAG_CROUCH = BIT(12);
 +const int WAYPOINTFLAG_SUPPORT = BIT(11);
 +
 +// removed WAYPOINTFLAG_NORELINK since it breaks backward compatibility
 +// e.g. support waypoints would have no outgoing links in old Xonotic versions
 +// In general, old Xonotic versions should spawn a normal waypoint for each unknown waypoint type
 +const int WAYPOINTFLAG_NORELINK__DEPRECATED = BIT(20);
 +const int WPFLAGMASK_NORELINK = (WAYPOINTFLAG_TELEPORT | WAYPOINTFLAG_LADDER | WAYPOINTFLAG_JUMP | WAYPOINTFLAG_CUSTOM_JP | WAYPOINTFLAG_SUPPORT);
  
- entity kh_worldkeylist;
- .entity kh_worldkeynext;
  float bot_custom_weapon;
  float bot_weapons_close[Weapons_MAX];
  float bot_weapons_far[Weapons_MAX];
index 9f6da64eb26abe234e4142e221f24ecd8d47a98c,2b2dfbf3cf5e86a4d9d3b19af56fd676be07c06b..6af0032368c0d4293ef8f9ac9099513f3a2efb07
@@@ -304,75 -296,72 +296,73 @@@ void havocbot_bunnyhop(entity this, vec
  
        // Run only to visible goals
        if(IS_ONGROUND(this))
-       if(vdist(vec2(this.velocity), >=, autocvar_sv_maxspeed)) // if -really- running
+       if(vdist(vec2(this.velocity), >=, autocvar_sv_maxspeed))
        if(checkpvs(this.origin + this.view_ofs, this.goalcurrent))
        {
-                       this.bot_lastseengoal = this.goalcurrent;
+               this.bot_lastseengoal = this.goalcurrent;
  
-                       // seen it before
-                       if(this.bot_timelastseengoal)
+               // seen it before
+               if(this.bot_timelastseengoal)
+               {
+                       // for a period of time
+                       if(time - this.bot_timelastseengoal > autocvar_bot_ai_bunnyhop_firstjumpdelay)
                        {
-                               // for a period of time
-                               if(time - this.bot_timelastseengoal > autocvar_bot_ai_bunnyhop_firstjumpdelay)
-                               {
-                                       float checkdistance;
-                                       checkdistance = true;
+                               bool checkdistance = true;
  
-                                       // don't run if it is too close
-                                       if(this.bot_canruntogoal==0)
-                                       {
-                                               if(bunnyhopdistance > autocvar_bot_ai_bunnyhop_startdistance)
-                                                       this.bot_canruntogoal = 1;
-                                               else
-                                                       this.bot_canruntogoal = -1;
-                                       }
+                               // don't run if it is too close
+                               if(this.bot_canruntogoal==0)
+                               {
+                                       if(vdist(this.origin - gco, >, autocvar_bot_ai_bunnyhop_startdistance))
+                                               this.bot_canruntogoal = 1;
+                                       else
+                                               this.bot_canruntogoal = -1;
+                               }
  
-                                       if(this.bot_canruntogoal != 1)
-                                               return;
+                               if(this.bot_canruntogoal != 1)
+                                       return;
  
-                                       if(this.aistatus & AI_STATUS_ROAMING)
-                                       if(this.goalcurrent.classname=="waypoint")
-                                       if (!(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL))
-                                       if(fabs(gco.z - this.origin.z) < this.maxs.z - this.mins.z)
-                                       if(this.goalstack01 && !wasfreed(this.goalstack01))
-                                       if (!(this.goalstack01.wpflags & WAYPOINTFLAG_JUMP))
+                               if(this.aistatus & AI_STATUS_ROAMING)
+                               if(this.goalcurrent.classname == "waypoint")
 -                              if(!(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL))
++                              if (!(this.goalcurrent.wpflags & WAYPOINTFLAG_PERSONAL))
+                               if(fabs(gco.z - this.origin.z) < this.maxs.z - this.mins.z)
 -                              if(this.goalstack01 && !wasfreed(this.goalstack01))
++                              if (this.goalstack01 && !wasfreed(this.goalstack01))
++                              if (!(this.goalstack01.wpflags & WAYPOINTFLAG_JUMP))
+                               {
+                                       vector gno = (this.goalstack01.absmin + this.goalstack01.absmax) * 0.5;
+                                       vector deviation = vectoangles(gno - this.origin) - vectoangles(gco - this.origin);
+                                       while (deviation.y < -180) deviation.y = deviation.y + 360;
+                                       while (deviation.y > 180) deviation.y = deviation.y - 360;
+                                       if(fabs(deviation.y) < 20)
+                                       if(vlen2(this.origin - gco) < vlen2(this.origin - gno))
+                                       if(fabs(gno.z - gco.z) < this.maxs.z - this.mins.z)
                                        {
-                                               vector gno = (this.goalstack01.absmin + this.goalstack01.absmax) * 0.5;
-                                               deviation = vectoangles(gno - this.origin) - vectoangles(gco - this.origin);
-                                               while (deviation.y < -180) deviation.y = deviation.y + 360;
-                                               while (deviation.y > 180) deviation.y = deviation.y - 360;
-                                               if(fabs(deviation.y) < 20)
-                                               if(bunnyhopdistance < vlen(this.origin - gno))
-                                               if(fabs(gno.z - gco.z) < this.maxs.z - this.mins.z)
+                                               if(vdist(gco - gno, >, autocvar_bot_ai_bunnyhop_startdistance))
+                                               if(checkpvs(this.origin + this.view_ofs, this.goalstack01))
                                                {
-                                                       if(vdist(gco - gno, >, autocvar_bot_ai_bunnyhop_startdistance))
-                                                       if(checkpvs(this.origin + this.view_ofs, this.goalstack01))
-                                                       {
-                                                               checkdistance = false;
-                                                       }
+                                                       checkdistance = false;
                                                }
                                        }
+                               }
  
-                                       if(checkdistance)
-                                       {
-                                               this.aistatus &= ~AI_STATUS_RUNNING;
-                                               // increase stop distance in case the goal is on a slope or a lower platform
-                                               if(bunnyhopdistance > autocvar_bot_ai_bunnyhop_stopdistance + (this.origin.z - gco.z))
-                                                       PHYS_INPUT_BUTTON_JUMP(this) = true;
-                                       }
-                                       else
-                                       {
-                                               this.aistatus |= AI_STATUS_RUNNING;
+                               if(checkdistance)
+                               {
+                                       this.aistatus &= ~AI_STATUS_RUNNING;
+                                       // increase stop distance in case the goal is on a slope or a lower platform
+                                       if(vdist(this.origin - gco, >, autocvar_bot_ai_bunnyhop_stopdistance + (this.origin.z - gco.z)))
                                                PHYS_INPUT_BUTTON_JUMP(this) = true;
-                                       }
+                               }
+                               else
+                               {
+                                       this.aistatus |= AI_STATUS_RUNNING;
+                                       PHYS_INPUT_BUTTON_JUMP(this) = true;
                                }
                        }
-                       else
-                       {
-                               this.bot_timelastseengoal = time;
-                       }
+               }
+               else
+               {
+                       this.bot_timelastseengoal = time;
+               }
        }
        else
        {
Simple merge
Simple merge