]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Snap to the ground waypoints of source and destination warpzones depending on their...
authorterencehill <piuntn@gmail.com>
Wed, 17 Oct 2018 20:18:11 +0000 (22:18 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 17 Oct 2018 21:58:26 +0000 (23:58 +0200)
qcsrc/server/bot/api.qh
qcsrc/server/bot/default/waypoints.qc
qcsrc/server/bot/default/waypoints.qh
qcsrc/server/bot/null/bot_null.qc
qcsrc/server/sv_main.qc

index 0cddd3b27a01df165978105a753016033b7b5c1c..b5ff8e53c13855689f24f0011db679ff0ff7eac7 100644 (file)
@@ -118,7 +118,7 @@ void waypoint_schedulerelink(entity wp);
 void waypoint_spawnforitem(entity e);
 void waypoint_spawnforitem_force(entity e, vector org);
 void waypoint_spawnforteleporter(entity e, vector destination, float timetaken, entity tracetest_ent);
-void waypoint_spawnforteleporter_wz(entity e, vector org, vector destination, float timetaken, vector down_dir, entity tracetest_ent);
+void waypoint_spawnforteleporter_wz(entity e, vector org, vector destination, float timetaken, vector down_dir_src, vector down_dir_dest, entity tracetest_ent);
 void waypoint_spawn_fromeditor(entity pl);
 entity waypoint_spawn(vector m1, vector m2, float f);
 void waypoint_unreachable(entity pl);
index 74d7c6c170fca56021e776919c68889822c5be06..ef75d7aa2f8e344f3ea10572506de246f1cc8724 100644 (file)
@@ -1297,19 +1297,22 @@ void waypoint_spawnforteleporter_boxes(entity e, int teleport_flag, vector org1,
        e.nearestwaypointtimeout = -1;
 }
 
-void waypoint_spawnforteleporter_wz(entity e, vector org, vector destination, float timetaken, vector down_dir, entity tracetest_ent)
+void waypoint_spawnforteleporter_wz(entity e, vector src, vector destination, float timetaken, vector down_dir_src, vector down_dir_dest, entity tracetest_ent)
 {
        // warpzones with oblique warp plane rely on down_dir to snap waypoints
        // to the ground without leaving the warp plane
        // warpzones with horizontal warp plane (down_dir.x == -1) generate
        // destination waypoint snapped to the ground (leaving warpzone), source
        // waypoint in the center of the warp plane
-       if(down_dir.x != -1)
-               org = waypoint_fixorigin_down_dir(org, tracetest_ent, down_dir);
-       if(down_dir.x == -1)
-               down_dir = '0 0 -1';
-       destination = waypoint_fixorigin_down_dir(destination, tracetest_ent, down_dir);
-       waypoint_spawnforteleporter_boxes(e, WAYPOINTFLAG_TELEPORT, org, org, destination, destination, timetaken);
+
+       // snap to the ground only if source warpzone isn't horizontal
+       if(down_dir_src.x != -1)
+               src = waypoint_fixorigin_down_dir(src, tracetest_ent, down_dir_src);
+       if(down_dir_dest.x == -1) // horizontal
+               down_dir_dest = '0 0 -1'; // change to vertical
+       destination = waypoint_fixorigin_down_dir(destination, tracetest_ent, down_dir_dest);
+
+       waypoint_spawnforteleporter_boxes(e, WAYPOINTFLAG_TELEPORT, src, src, destination, destination, timetaken);
 }
 
 void waypoint_spawnforteleporter(entity e, vector destination, float timetaken, entity tracetest_ent)
index 2f9b1163879f25621e7a9c21ac21415e934092f7..aa11778b14c2efd1836b1785bdafbdfd2c89ab9c 100644 (file)
@@ -59,7 +59,7 @@ void waypoint_saveall();
 void waypoint_spawnforitem_force(entity e, vector org);
 void waypoint_spawnforitem(entity e);
 void waypoint_spawnforteleporter(entity e, vector destination, float timetaken, entity tracetest_ent);
-void waypoint_spawnforteleporter_wz(entity e, vector org, vector destination, float timetaken, vector down_dir, entity tracetest_ent);
+void waypoint_spawnforteleporter_wz(entity e, vector org, vector destination, float timetaken, vector down_dir_src, vector down_dir_dest, entity tracetest_ent);
 void botframe_showwaypointlinks();
 
 float waypoint_loadall();
index f8738f80fb5cdc855eda4bd6bb9ad351ddf9d5cb..0256a9d1dbe03c5a1711cd517c74b32add2af5de 100644 (file)
@@ -38,7 +38,7 @@ void waypoint_schedulerelink(entity wp) { }
 void waypoint_spawnforitem(entity e) { }
 void waypoint_spawnforitem_force(entity e, vector org) { }
 void waypoint_spawnforteleporter(entity e, vector destination, float timetaken, entity tracetest_ent) { }
-void waypoint_spawnforteleporter_wz(entity e, vector org, vector destination, float timetaken, vector down_dir, entity tracetest_ent) { }
+void waypoint_spawnforteleporter_wz(entity e, vector org, vector destination, float timetaken, vector down_dir_src, vector down_dir_dest, entity tracetest_ent) { }
 void waypoint_spawn_fromeditor(entity pl) { }
 entity waypoint_spawn(vector m1, vector m2, float f) { return NULL; }
 #endif
index 539b30d294ce0c68e43e80d81f9b0d7732353199..a9b8c66f7105ce5bcfc5e05079929798eadeaae1 100644 (file)
@@ -378,9 +378,13 @@ void WarpZone_PostInitialize_Callback()
                makevectors(e.warpzone_angles);
                src = src + ((e.warpzone_origin - src) * v_forward) * v_forward + 16 * v_right;
                dst = (e.enemy.absmin + e.enemy.absmax) * 0.5;
+               vector down_dir_src = -v_up;
+
                makevectors(e.enemy.warpzone_angles);
                dst = dst + ((e.enemy.warpzone_origin - dst) * v_forward) * v_forward - 16 * v_right;
-               waypoint_spawnforteleporter_wz(e, src, dst, 0, -v_up, tracetest_ent);
+               vector down_dir_dest = -v_up;
+
+               waypoint_spawnforteleporter_wz(e, src, dst, 0, down_dir_src, down_dir_dest, tracetest_ent);
        }
        delete(tracetest_ent);
 }