]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/bot/default/waypoints.qc
micro-optimization chore: in for-loops change all post-{in,de}crements to pre-{in...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / default / waypoints.qc
index a9069a0b158ac58cdf394339c28ac171781bf285..2a557c5f05f2ad6e1aa17a19625b0225244e6e29 100644 (file)
@@ -1,29 +1,29 @@
 #include "waypoints.qh"
 
-#include <common/weapons/_all.qh>
-#include <common/stats.qh>
-#include <server/items/items.qh>
-#include <server/miscfunctions.qh>
-#include <server/spawnpoints.qh>
-#include "cvars.qh"
-
-#include "bot.qh"
-#include "navigation.qh"
-
-#include <common/state.qh>
-
-#include "../../antilag.qh"
-
+#include <common/animdecide.qh>
 #include <common/constants.qh>
 #include <common/debug.qh>
 #include <common/gamemodes/_mod.qh>
 #include <common/mapobjects/trigger/jumppads.qh>
 #include <common/net_linked.qh>
 #include <common/physics/player.qh>
-
+#include <common/state.qh>
+#include <common/stats.qh>
+#include <common/weapons/_all.qh>
 #include <lib/warpzone/common.qh>
 #include <lib/warpzone/util_server.qh>
+#include <server/antilag.qh>
+#include <server/bot/default/bot.qh>
+#include <server/bot/default/cvars.qh>
+#include <server/bot/default/navigation.qh>
+#include <server/items/items.qh>
+#include <server/spawnpoints.qh>
+#include <server/weapons/tracing.qh>
 
+STATIC_INIT(waypoints)
+{
+       waypointeditor_enabled = autocvar_g_waypointeditor;
+}
 .entity spawnpointmodel;
 void waypoint_unreachable(entity pl)
 {
@@ -93,11 +93,11 @@ void waypoint_unreachable(entity pl)
                        LOG_INFO("spawn without waypoint: ", etos(it), " ", vtos(it.origin), "\n");
                        it.spawnpointmodel.effects |= EF_NODEPTHTEST;
                        _setmodel(it.spawnpointmodel, pl.model);
-                       it.spawnpointmodel.frame = pl.frame;
+                       it.spawnpointmodel.frame = ANIM_idle.m_id;
                        it.spawnpointmodel.skin = pl.skin;
-                       it.spawnpointmodel.colormap = pl.colormap;
-                       it.spawnpointmodel.colormod = pl.colormod;
-                       it.spawnpointmodel.glowmod = pl.glowmod;
+                       it.spawnpointmodel.colormap = 1024 + 68;
+                       it.spawnpointmodel.glowmod = '1 0 0';
+                       it.spawnpointmodel.angles = it.angles;
                        setsize(it.spawnpointmodel, PL_MIN_CONST, PL_MAX_CONST);
                        j++;
                }
@@ -170,7 +170,7 @@ void waypoint_getSymmetricalOrigin_cmd(entity caller, bool save, int arg_idx)
 {
        vector org = '0 0 0';
        int ctf_flags = 0;
-       for (int i = 0; i < 6; i++)
+       for (int i = 0; i < 6; ++i)
        {
                if (argv(arg_idx + i) != "")
                        ctf_flags++;
@@ -190,7 +190,7 @@ void waypoint_getSymmetricalOrigin_cmd(entity caller, bool save, int arg_idx)
        else
        {
                vector v1, v2, v3, v4, v5, v6;
-               for (int i = 1; i <= ctf_flags; i++)
+               for (int i = 1; i <= ctf_flags; ++i)
                {
                        if (i == 1) { v1 = stov(argv(arg_idx++)); org = v1 / ctf_flags; }
                        else if (i == 2) { v2 = stov(argv(arg_idx++)); org += v2 / ctf_flags; }
@@ -359,7 +359,7 @@ void waypoint_restore_hardwiredlinks(entity wp)
 
 void waypoint_setupmodel(entity wp)
 {
-       if (autocvar_g_waypointeditor)
+       if (waypointeditor_enabled)
        {
                // TODO: add some sort of visible box in edit mode for box waypoints
                vector m1 = wp.mins;
@@ -647,7 +647,7 @@ void waypoint_spawn_fromeditor(entity pl, bool at_crosshair, bool is_jump_wp, bo
                        e = it; break;
                });
                if (!e)
-                       e = waypoint_spawn(jp.absmin - PL_MAX_CONST + '1 1 1', jp.absmax - PL_MIN_CONST + '-1 -1 -1', WAYPOINTFLAG_TELEPORT);
+                       e = waypoint_spawn(jp.absmin - PL_MAX_CONST, jp.absmax - PL_MIN_CONST, WAYPOINTFLAG_TELEPORT);
                if (!pl.wp_locked)
                        pl.wp_locked = e;
        }
@@ -1563,9 +1563,9 @@ void waypoint_load_hardwiredlinks()
                {
                        waypoint_addlink(wp_from, wp_to);
                        waypoint_mark_hardwiredlink(wp_from, wp_to);
-               } else if (wp_from.wpflags & WPFLAGMASK_NORELINK
-                       && ((wp_from.wpflags & (WAYPOINTFLAG_JUMP | WAYPOINTFLAG_SUPPORT))
-                               || (wp_from.wpisbox && wp_from.wpflags & WAYPOINTFLAG_TELEPORT)))
+               }
+               else if ((wp_from.wpflags & WPFLAGMASK_NORELINK) && ((wp_from.wpflags & (WAYPOINTFLAG_JUMP | WAYPOINTFLAG_SUPPORT))
+               || (wp_from.wpisbox && (wp_from.wpflags & WAYPOINTFLAG_TELEPORT))))
                {
                        waypoint_addlink(wp_from, wp_to);
                }
@@ -1913,7 +1913,7 @@ float waypoint_loadall()
        waypoint_version_loaded = ver;
        LOG_TRACE("loaded ", ftos(cwp), " waypoints and ", ftos(cwb), " wayboxes from maps/", mapname, ".waypoints");
 
-       if (autocvar_g_waypointeditor && autocvar_g_waypointeditor_symmetrical_allowload)
+       if (waypointeditor_enabled && autocvar_g_waypointeditor_symmetrical_allowload)
        {
                string sym_str = "";
                cvar_set("g_waypointeditor_symmetrical", ftos(sym));
@@ -2062,7 +2062,7 @@ void waypoint_spawnforteleporter_wz(entity e, entity tracetest_ent)
 void waypoint_spawnforteleporter(entity e, vector destination, float timetaken, entity tracetest_ent)
 {
        destination = waypoint_fixorigin(destination, tracetest_ent);
-       waypoint_spawnforteleporter_boxes(e, WAYPOINTFLAG_TELEPORT, e.absmin - PL_MAX_CONST + '1 1 1', e.absmax - PL_MIN_CONST + '-1 -1 -1', destination, destination, timetaken);
+       waypoint_spawnforteleporter_boxes(e, WAYPOINTFLAG_TELEPORT, e.absmin - PL_MAX_CONST, e.absmax - PL_MIN_CONST, destination, destination, timetaken);
 }
 
 entity waypoint_spawnpersonal(entity this, vector position)