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, entity tracetest_ent);
+void waypoint_spawnforteleporter_wz(entity e, vector org, vector destination, float timetaken, vector down_dir, entity tracetest_ent);
void waypoint_spawn_fromeditor(entity pl);
entity waypoint_spawn(vector m1, vector m2, float f);
void waypoint_unreachable(entity pl);
return cwp + cwb;
}
-vector waypoint_fixorigin(vector position, entity tracetest_ent)
+#define waypoint_fixorigin(position, tracetest_ent) \
+ waypoint_fixorigin_down_dir(position, tracetest_ent, '0 0 -1')
+
+vector waypoint_fixorigin_down_dir(vector position, entity tracetest_ent, vector down_dir)
{
- tracebox(position + '0 0 1' * (1 - PL_MIN_CONST.z), PL_MIN_CONST, PL_MAX_CONST, position + '0 0 -512', MOVE_NOMONSTERS, tracetest_ent);
+ tracebox(position + '0 0 1', PL_MIN_CONST, PL_MAX_CONST, position + down_dir * 3000, MOVE_NOMONSTERS, tracetest_ent);
+ if(trace_startsolid)
+ tracebox(position + '0 0 1' * (1 - PL_MIN_CONST.z / 2), PL_MIN_CONST, PL_MAX_CONST, position + down_dir * 3000, MOVE_NOMONSTERS, tracetest_ent);
+ if(trace_startsolid)
+ tracebox(position + '0 0 1' * (1 - PL_MIN_CONST.z), PL_MIN_CONST, PL_MAX_CONST, position + down_dir * 3000, MOVE_NOMONSTERS, tracetest_ent);
if(trace_fraction < 1)
position = trace_endpos;
return position;
e.nearestwaypointtimeout = -1;
}
-void waypoint_spawnforteleporter_wz(entity e, vector org, 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)
{
- org = waypoint_fixorigin(org, tracetest_ent);
- destination = waypoint_fixorigin(destination, 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);
}
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, entity tracetest_ent);
+void waypoint_spawnforteleporter_wz(entity e, vector org, vector destination, float timetaken, vector down_dir, entity tracetest_ent);
void botframe_showwaypointlinks();
float waypoint_loadall();
void waypoint_unreachable(entity pl);
-vector waypoint_fixorigin(vector position, entity tracetest_ent);
+vector waypoint_fixorigin_down_dir(vector position, entity tracetest_ent, vector down_dir);
void botframe_autowaypoints();
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, entity tracetest_ent) { }
+void waypoint_spawnforteleporter_wz(entity e, vector org, vector destination, float timetaken, vector down_dir, entity tracetest_ent) { }
void waypoint_spawn_fromeditor(entity pl) { }
entity waypoint_spawn(vector m1, vector m2, float f) { return NULL; }
#endif
dst = (e.enemy.absmin + e.enemy.absmax) * 0.5;
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, tracetest_ent);
+ waypoint_spawnforteleporter_wz(e, src, dst, 0, -v_up, tracetest_ent);
}
delete(tracetest_ent);
}