]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Mario/wepent_experimental
authorMario <mario@smbclan.net>
Tue, 20 Dec 2016 00:49:24 +0000 (10:49 +1000)
committerMario <mario@smbclan.net>
Tue, 20 Dec 2016 00:49:24 +0000 (10:49 +1000)
qcsrc/client/hud/panel/radar.qc
qcsrc/client/miscfunctions.qh
qcsrc/client/teamradar.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/lib/vector.qh
qcsrc/server/bot/api.qh
qcsrc/server/bot/default/waypoints.qc
qcsrc/server/command/getreplies.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qc

index 269d870718e42663a431a3445c984876ff74b4c5..3bc537c8f8b5e42760e5ca614ac4e02dadc4ce08 100644 (file)
@@ -312,10 +312,10 @@ void HUD_Radar()
        else
        {
                vector c0, c1, c2, c3, span;
-               c0 = rotate(mi_min, teamradar_angle * DEG2RAD);
-               c1 = rotate(mi_max, teamradar_angle * DEG2RAD);
-               c2 = rotate('1 0 0' * mi_min.x + '0 1 0' * mi_max.y, teamradar_angle * DEG2RAD);
-               c3 = rotate('1 0 0' * mi_max.x + '0 1 0' * mi_min.y, teamradar_angle * DEG2RAD);
+               c0 = Rotate(mi_min, teamradar_angle * DEG2RAD);
+               c1 = Rotate(mi_max, teamradar_angle * DEG2RAD);
+               c2 = Rotate('1 0 0' * mi_min.x + '0 1 0' * mi_max.y, teamradar_angle * DEG2RAD);
+               c3 = Rotate('1 0 0' * mi_max.x + '0 1 0' * mi_min.y, teamradar_angle * DEG2RAD);
                span = '0 0 0';
                span.x = max(c0_x, c1_x, c2_x, c3_x) - min(c0_x, c1_x, c2_x, c3_x);
                span.y = max(c0_y, c1_y, c2_y, c3_y) - min(c0_y, c1_y, c2_y, c3_y);
index 9d792f60cd62ad3335e5531e8c48c483a16dc199..62de4565e53bff2549a9b361f063ab0791c7004b 100644 (file)
@@ -31,7 +31,7 @@ vector HUD_GetFontsize(string cvarname);
 
 float PreviewExists(string name);
 
-vector rotate(vector v, float a);
+vector Rotate(vector v, float a);
 
 
 #define IS_DEAD(s) (((s).classname == "csqcmodel") ? (s).csqcmodel_isdead : ((s).health <= 0))
index abd700e613e38895b44ceeba7acbe86498895b42..782776eb7866757ebc7ff8ad24076b4923e57859 100644 (file)
@@ -20,7 +20,7 @@ vector teamradar_texcoord_to_2dcoord(vector in)
        vector out;
        in -= teamradar_origin3d_in_texcoord;
 
-       out = rotate(in, teamradar_angle * DEG2RAD);
+       out = Rotate(in, teamradar_angle * DEG2RAD);
        out.y = - out.y; // screen space is reversed
 
        out = out * teamradar_size;
@@ -42,7 +42,7 @@ vector teamradar_2dcoord_to_texcoord(vector in)
        out = out / teamradar_size;
 
        out_y = - out_y; // screen space is reversed
-       out = rotate(out, -teamradar_angle * DEG2RAD);
+       out = Rotate(out, -teamradar_angle * DEG2RAD);
 
        out += teamradar_origin3d_in_texcoord;
 
index a26441ee6e425118186595bf4fdcc3479a2dfa7a..bcb317b4abe305562183dfd2456c51e994d93acf 100644 (file)
@@ -282,10 +282,10 @@ void drawrotpic(vector org, float rot, string pic, vector sz, vector hotspot, ve
 
     // rotate them, and make them absolute
     rot = -rot; // rotate by the opposite angle, as our coordinate system is reversed
-    v1 = rotate(v1, rot) + org;
-    v2 = rotate(v2, rot) + org;
-    v3 = rotate(v3, rot) + org;
-    v4 = rotate(v4, rot) + org;
+    v1 = Rotate(v1, rot) + org;
+    v2 = Rotate(v2, rot) + org;
+    v3 = Rotate(v3, rot) + org;
+    v4 = Rotate(v4, rot) + org;
 
     // draw them
     R_BeginPolygon(pic, f);
@@ -319,9 +319,9 @@ void drawhealthbar(vector org, float rot, float h, vector sz, vector hotspot, fl
     up = '0 1 0';
 
     rot = -rot; // rotate by the opposite angle, as our coordinate system is reversed
-    o = rotate(o, rot) + org;
-    ri = rotate(ri, rot);
-    up = rotate(up, rot);
+    o = Rotate(o, rot) + org;
+    ri = Rotate(ri, rot);
+    up = Rotate(up, rot);
 
     owidth = width + 2 * border;
     o = o - up * (margin + border + theheight) + ri * (sz.x - owidth) * 0.5;
@@ -348,19 +348,19 @@ vector drawspritearrow(vector o, float ang, vector rgb, float a, float t)
 
     R_BeginPolygon("", DRAWFLAG_NORMAL);
     R_PolygonVertex(o,                                  '0 0 0', '0 0 0', a);
-    R_PolygonVertex(o + rotate(arrowY  - borderX, ang), '0 0 0', '0 0 0', a);
-    R_PolygonVertex(o + rotate(borderY - borderX, ang), '0 0 0', '0 0 0', a);
-    R_PolygonVertex(o + rotate(borderY + borderX, ang), '0 0 0', '0 0 0', a);
-    R_PolygonVertex(o + rotate(arrowY  + borderX, ang), '0 0 0', '0 0 0', a);
+    R_PolygonVertex(o + Rotate(arrowY  - borderX, ang), '0 0 0', '0 0 0', a);
+    R_PolygonVertex(o + Rotate(borderY - borderX, ang), '0 0 0', '0 0 0', a);
+    R_PolygonVertex(o + Rotate(borderY + borderX, ang), '0 0 0', '0 0 0', a);
+    R_PolygonVertex(o + Rotate(arrowY  + borderX, ang), '0 0 0', '0 0 0', a);
     R_EndPolygon();
 
     R_BeginPolygon("", DRAWFLAG_ADDITIVE);
-    R_PolygonVertex(o + rotate(eY * borderDiag, ang), '0 0 0', rgb, a);
-    R_PolygonVertex(o + rotate(arrowY - arrowX, ang), '0 0 0', rgb, a);
-    R_PolygonVertex(o + rotate(arrowY + arrowX, ang), '0 0 0', rgb, a);
+    R_PolygonVertex(o + Rotate(eY * borderDiag, ang), '0 0 0', rgb, a);
+    R_PolygonVertex(o + Rotate(arrowY - arrowX, ang), '0 0 0', rgb, a);
+    R_PolygonVertex(o + Rotate(arrowY + arrowX, ang), '0 0 0', rgb, a);
     R_EndPolygon();
 
-    return o + rotate(eY * (borderDiag+size+margin), ang);
+    return o + Rotate(eY * (borderDiag+size+margin), ang);
 }
 
 // returns location of sprite healthbar
index bb363c12ef26ba5b5dd765200ed08f28dc99519f..0a887cfebb03c4544df88a8d0316bd6f8aa4ab8d 100644 (file)
@@ -101,7 +101,7 @@ noref vector _vec2;
 noref vector _vec3;
 #define vec3(_x, _y, _z) (_vec3.x = (_x), _vec3.y = (_y), _vec3.z = (_z), _vec3)
 
-vector rotate(vector v, float a)
+vector Rotate(vector v, float a)
 {
        float a_sin = sin(a), a_cos = cos(a);
        vector r = '0 0 0';
index 79ba6426efd374e442277347e86b0d2e0028c4f9..97104ef3765908f46d29ad59368f325e3781d759 100644 (file)
@@ -85,3 +85,6 @@ void waypoint_spawnforitem_force(entity e, vector org);
 void waypoint_spawnforteleporter(entity e, vector destination, float timetaken);
 void waypoint_spawnforteleporter_v(entity e, vector org, vector destination, float timetaken);
 entity waypoint_spawn(vector m1, vector m2, float f);
+
+.entity goalcurrent;
+void navigation_clearroute(entity this);
index c83d0f63c58dc2c4e3ebae76e9c50593ce85bd8c..0f8999a8d17f7cbb5c58017a28096c31b4178b9a 100644 (file)
 #include <lib/warpzone/common.qh>
 #include <lib/warpzone/util_server.qh>
 
+void waypoint_setupmodel(entity wp)
+{
+       if (autocvar_g_waypointeditor)
+       {
+               // TODO: add some sort of visible box in edit mode for box waypoints
+               vector m1 = wp.mins;
+               vector m2 = wp.maxs;
+               setmodel(wp, MDL_WAYPOINT);
+               setsize(wp, m1, m2);
+               wp.effects = EF_LOWPRECISION;
+               if (wp.wpflags & WAYPOINTFLAG_ITEM)
+                       wp.colormod = '1 0 0';
+               else if (wp.wpflags & WAYPOINTFLAG_GENERATED)
+                       wp.colormod = '1 1 0';
+               else
+                       wp.colormod = '1 1 1';
+       }
+       else
+               wp.model = "";
+}
+
 // create a new spawnfunc_waypoint and automatically link it to other waypoints, and link
 // them back to it as well
 // (suitable for spawnfunc_waypoint editor)
@@ -64,21 +85,7 @@ entity waypoint_spawn(vector m1, vector m2, float f)
        waypoint_clearlinks(w);
        //waypoint_schedulerelink(w);
 
-       if (autocvar_g_waypointeditor)
-       {
-               m1 = w.mins;
-               m2 = w.maxs;
-               setmodel(w, MDL_WAYPOINT); w.effects = EF_LOWPRECISION;
-               setsize(w, m1, m2);
-               if (w.wpflags & WAYPOINTFLAG_ITEM)
-                       w.colormod = '1 0 0';
-               else if (w.wpflags & WAYPOINTFLAG_GENERATED)
-                       w.colormod = '1 1 0';
-               else
-                       w.colormod = '1 1 1';
-       }
-       else
-               w.model = "";
+       waypoint_setupmodel(w);
 
        return w;
 }
@@ -264,23 +271,8 @@ void waypoint_schedulerelink(entity wp)
 {
        if (wp == NULL)
                return;
-       // TODO: add some sort of visible box in edit mode for box waypoints
-       if (autocvar_g_waypointeditor)
-       {
-               vector m1, m2;
-               m1 = wp.mins;
-               m2 = wp.maxs;
-               setmodel(wp, MDL_WAYPOINT); wp.effects = EF_LOWPRECISION;
-               setsize(wp, m1, m2);
-               if (wp.wpflags & WAYPOINTFLAG_ITEM)
-                       wp.colormod = '1 0 0';
-               else if (wp.wpflags & WAYPOINTFLAG_GENERATED)
-                       wp.colormod = '1 1 0';
-               else
-                       wp.colormod = '1 1 1';
-       }
-       else
-               wp.model = "";
+
+       waypoint_setupmodel(wp);
        wp.wpisbox = vdist(wp.size, >, 0);
        wp.enemy = NULL;
        if (!(wp.wpflags & WAYPOINTFLAG_PERSONAL))
index 5017e81aba03014d4d325c3ddbb56fe0b9e36e2e..d01448aad81ca4d022f415c42d12759eebff606a 100644 (file)
@@ -242,16 +242,22 @@ string getmaplist()
        return sprintf("^7Maps in list: %s\n", maplist);
 }
 
-
+const int LSMAPS_MAX = 250;
 string getlsmaps()
 {
        string lsmaps = "", col;
-       float i, newmaps = 0;
+       bool newmaps = false;
+       int added = 0;
 
-       for (i = 0; i < MapInfo_count; ++i)
+       for (int i = 0; i < MapInfo_count; ++i)
        {
                if ((MapInfo_Get_ByID(i)) && !(MapInfo_Map_flags & MapInfo_ForbiddenFlags()))
                {
+                       ++added;
+
+                       if(added > LSMAPS_MAX)
+                               continue; // we still get the added count, but skip the actual processing
+
                        // todo: Check by play count of maps for other game types?
                        if (
                            (g_race && !stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, RACE_RECORD, "time"))))
@@ -271,19 +277,22 @@ string getlsmaps()
                }
        }
 
+       if(added > LSMAPS_MAX)
+               lsmaps = sprintf("%s^7(%d not listed)", lsmaps, added - LSMAPS_MAX);
+
        MapInfo_ClearTemps();
-       return sprintf("^7Maps available (%d)%s: %s\n", tokenize_console(lsmaps), (newmaps ? " (New maps have asterisks marked in blue)" : ""), lsmaps);
+       return sprintf("^7Maps available (%d)%s: %s\n", added, (newmaps ? " (New maps have asterisks marked in blue)" : ""), lsmaps);
 }
 
 string getmonsterlist()
 {
-       string monsterlist = "", col;
+       string monsterlist = "";
 
-       for (int i = MON_FIRST; i <= MON_LAST; ++i)
+       FOREACH(Monsters, it != MON_Null,
        {
-               if (i % 2) col = "^2"; else col = "^3";
-               monsterlist = sprintf("%s%s%s ", monsterlist, col, (get_monsterinfo(i)).netname);
-       }
+               string col = ((i % 2) ? "^2" : "^3");
+               monsterlist = sprintf("%s%s%s ", monsterlist, col, it.netname);
+       });
 
        return sprintf("^7Monsters available: %s\n", monsterlist);
 }
index 1e5fedbcb65b79d209fff4de1fd2e7b11045a861..76e913500db7b53fafe4df3ee69c8f6d35e4c06b 100644 (file)
@@ -383,10 +383,16 @@ void GameCommand_bot_cmd(float request, float argc, string command)
                                                }
                                                else
                                                {
-                                                       // let's start at token 2 so we can skip sv_cmd bot_cmd
-                                                       bot = find_bot_by_number(stof(argv(2)));
-                                                       if (bot == NULL) bot = find_bot_by_name(argv(2));
-                                                       if (bot) bot_queuecommand(bot, substring(s, argv_start_index(3), -1));
+                                                       if(argv(2) == "*" || argv(2) == "all")
+                                                               FOREACH_CLIENT(IS_BOT_CLIENT(it), {
+                                                                       bot_queuecommand(it, substring(s, argv_start_index(3), -1));
+                                                               });
+                                                       else
+                                                       {
+                                                               bot = find_bot_by_number(stof(argv(2)));
+                                                               if (bot == NULL) bot = find_bot_by_name(argv(2));
+                                                               if (bot) bot_queuecommand(bot, substring(s, argv_start_index(3), -1));
+                                                       }
                                                }
                                        }
                                        else
@@ -408,17 +414,31 @@ void GameCommand_bot_cmd(float request, float argc, string command)
                        }
                        else if (argc >= 3)  // this comes last
                        {
-                               bot = find_bot_by_number(stof(argv(1)));
-                               if (bot == NULL) bot = find_bot_by_name(argv(1));
-                               if (bot)
+                               if(argv(1) == "*" || argv(1) == "all")
                                {
-                                       LOG_INFO(strcat("Command '", substring(command, argv_start_index(2), -1), "' sent to bot ", bot.netname, "\n"));
-                                       bot_queuecommand(bot, substring(command, argv_start_index(2), -1));
+                                       int bot_num = 0;
+                                       FOREACH_CLIENT(IS_BOT_CLIENT(it), {
+                                               bot_queuecommand(it, substring(command, argv_start_index(2), -1));
+                                               bot_num++;
+                                       });
+                                       if(bot_num)
+                                               LOG_INFO(strcat("Command '", substring(command, argv_start_index(2), -1), "' sent to all bots (", ftos(bot_num), ")\n"));
                                        return;
                                }
                                else
                                {
-                                       LOG_INFO(strcat("Error: Can't find bot with the name or id '", argv(1), "' - Did you mistype the command?\n"));  // don't return so that usage is shown
+                                       bot = find_bot_by_number(stof(argv(1)));
+                                       if (bot == NULL) bot = find_bot_by_name(argv(1));
+                                       if (bot)
+                                       {
+                                               LOG_INFO(strcat("Command '", substring(command, argv_start_index(2), -1), "' sent to bot ", bot.netname, "\n"));
+                                               bot_queuecommand(bot, substring(command, argv_start_index(2), -1));
+                                               return;
+                                       }
+                                       else
+                                       {
+                                               LOG_INFO(strcat("Error: Can't find bot with the name or id '", argv(1), "' - Did you mistype the command?\n"));  // don't return so that usage is shown
+                                       }
                                }
                        }
                }
@@ -428,10 +448,12 @@ void GameCommand_bot_cmd(float request, float argc, string command)
                case CMD_REQUEST_USAGE:
                {
                        LOG_INFO("\nUsage:^3 sv_cmd bot_cmd client command [argument]\n");
-                       LOG_INFO("  'client' can be either the name or entity id of the bot\n");
+                       LOG_INFO("  'client' can be either the name of the bot or a progressive number (not the entity number!)\n");
+                       LOG_INFO("           can also be '*' or 'all' to allow sending the command to all the bots\n");
                        LOG_INFO("  For full list of commands, see bot_cmd help [command].\n");
-                       LOG_INFO("Examples: sv_cmd bot_cmd client cc \"say something\"\n");
-                       LOG_INFO("          sv_cmd bot_cmd client presskey jump\n");
+                       LOG_INFO("Examples: sv_cmd bot_cmd 1 cc \"say something\"\n");
+                       LOG_INFO("          sv_cmd bot_cmd 1 presskey jump\n");
+                       LOG_INFO("          sv_cmd bot_cmd * pause\n");
                        return;
                }
        }
index 4db911362ecfe0b6b31cbb73dee668b339c492d5..27fd46b88524ebc6eecd712634b4ea8af0296f37 100644 (file)
@@ -1825,6 +1825,11 @@ void havocbot_role_ctf_retriever(entity this)
        mf = havocbot_ctf_find_flag(this);
        if(mf.ctf_status==FLAG_BASE)
        {
+               if(this.goalcurrent == mf)
+               {
+                       navigation_clearroute(this);
+                       this.bot_strategytime = 0;
+               }
                havocbot_ctf_reset_role(this);
                return;
        }