return new_org;
}
+void crosshair_trace_waypoints(entity pl);
+void waypoint_lock(entity pl)
+{
+ crosshair_trace_waypoints(pl);
+ pl.wp_locked = trace_ent;
+}
+
bool waypoint_has_hardwiredlinks(entity wp)
{
if (!wp)
LOG_INFO("^xf80Start waypoint has been cleared.\n");
}
-void waypoint_start_hardwiredlink(entity pl)
+void waypoint_start_hardwiredlink(entity pl, bool at_crosshair)
{
entity wp = pl.nearestwaypoint;
- if ((!start_wp_is_spawned || start_wp_is_hardwired) && wp && !(wp.wpflags & WPFLAGMASK_NORELINK))
+ if (at_crosshair)
+ {
+ crosshair_trace_waypoints(pl);
+ wp = trace_ent;
+ }
+ string err = "";
+ if (start_wp_is_spawned && !start_wp_is_hardwired)
+ err = "can't hardwire while in the process of creating a special link";
+ else if (!wp)
+ {
+ if (at_crosshair)
+ err = "couldn't find any waypoint at crosshair";
+ else
+ err = "couldn't find any waypoint nearby";
+ }
+ else if (wp.wpflags & WPFLAGMASK_NORELINK)
+ err = "can't hardwire a waypoint with special links";
+
+ if (err == "")
{
start_wp_is_hardwired = true;
start_wp_is_spawned = true;
start_wp_origin = wp.origin;
pl.wp_locked = wp;
- LOG_INFOF("^x80fNearest waypoint %s marked as hardwired link origin.\n", vtos(wp.origin));
+ LOG_INFOF("^x80fWaypoint %s marked as hardwired link origin.\n", vtos(wp.origin));
}
else
+ {
start_wp_is_hardwired = false;
+ LOG_INFO("Error: ", err, "\n");
+ }
}
void waypoint_spawn_fromeditor(entity pl, bool at_crosshair, bool is_jump_wp, bool is_crouch_wp, bool is_support_wp)
vector org = pl.origin;
if (at_crosshair)
{
- crosshair_trace(pl);
- org = trace_endpos - eZ * PL_MIN_CONST.z;
+ crosshair_trace_waypoints(pl);
+ org = trace_endpos;
+ if (!trace_ent)
+ org.z -= PL_MIN_CONST.z;
if (!(start_wp_is_hardwired || start_wp_is_support))
IL_EACH(g_jumppads, boxesoverlap(org + PL_MIN_CONST, org + PL_MAX_CONST, it.absmin, it.absmax),
{
jp = it;
break;
});
+ if (!jp && !start_wp_is_spawned && trace_ent)
+ {
+ if (trace_ent.wpflags & (WAYPOINTFLAG_JUMP))
+ is_jump_wp = true;
+ else if (trace_ent.wpflags & (WAYPOINTFLAG_SUPPORT))
+ is_support_wp = true;
+ }
}
if (jp || is_jump_wp || is_support_wp)
{
}
bprint(strcat("Waypoint removed at ", vtos(e.origin), "\n"));
+ te_explosion(e.origin);
waypoint_remove(e);
if (sym && wp_sym)
if (autocvar_g_waypointeditor && autocvar_g_waypointeditor_symmetrical_allowload)
{
+ string sym_str = "";
cvar_set("g_waypointeditor_symmetrical", ftos(sym));
if (sym == 1 && sym_param3 < 2)
cvar_set("g_waypointeditor_symmetrical_order", "0"); // make sure this is reset if not loaded
cvar_set("g_waypointeditor_symmetrical_origin", params);
}
cvar_set("g_waypointeditor_symmetrical_order", ftos(sym_param3));
- LOG_INFO("Waypoint editor: loaded symmetry ", ftos(sym), " with origin ", params, " and order ", ftos(sym_param3));
+ sym_str = strcat(ftos(sym), " with origin ", params, " and order ", ftos(sym_param3));
}
else if (sym == -2)
{
string params = strcat(ftos(sym_param1), " ", ftos(sym_param2));
cvar_set("g_waypointeditor_symmetrical_axis", params);
- LOG_INFO("Waypoint editor: loaded symmetry ", ftos(sym), " with axis ", params);
+ sym_str = strcat(ftos(sym), " with axis ", params);
}
else
- LOG_INFO("Waypoint editor: loaded symmetry ", ftos(sym));
+ sym_str = ftos(sym);
+ if (sym_str != "")
+ LOG_INFO("Waypoint editor: loaded symmetry ", sym_str);
LOG_INFO(strcat("g_waypointeditor_symmetrical", " has been set to ", cvar_string("g_waypointeditor_symmetrical")));
}
setsize(it, '-16 -16 -16', '16 16 16');
});
- crosshair_trace(pl);
+ WarpZone_crosshair_trace(pl);
IL_EACH(g_waypoints, true, {
it.solid = SOLID_TRIGGER;
if (!it.wpisbox)
setsize(it, '0 0 0', '0 0 0');
});
+
if (trace_ent.classname != "waypoint")
trace_ent = NULL;
+ else if (!trace_ent.wpisbox)
+ trace_endpos = trace_ent.origin;
}
void botframe_showwaypointlinks()
it.wp_aimed = NULL;
if (wasfreed(it.wp_locked))
it.wp_locked = NULL;
- if (PHYS_INPUT_BUTTON_USE(it))
- it.wp_locked = it.wp_aimed;
entity head = it.wp_locked;
if (!head)
head = navigation_findnearestwaypoint(it, false);