From cd80ac2655f4f65d960a650cf4d8a05de56720b0 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sun, 7 Aug 2011 16:31:17 +0200 Subject: [PATCH] improve bot waypoint auditing --- qcsrc/server/bot/waypoints.qc | 5 +++- qcsrc/server/cl_impulse.qc | 47 +++++++++++++++++++++++++++++++---- qcsrc/server/t_teleporters.qc | 3 +-- 3 files changed, 47 insertions(+), 8 deletions(-) diff --git a/qcsrc/server/bot/waypoints.qc b/qcsrc/server/bot/waypoints.qc index b39e59f76..3bfb53264 100644 --- a/qcsrc/server/bot/waypoints.qc +++ b/qcsrc/server/bot/waypoints.qc @@ -776,7 +776,10 @@ void waypoint_spawnforteleporter(entity e, vector destination, float timetaken) { local entity w; local entity dw; - w = waypoint_spawn(e.absmin, e.absmax, WAYPOINTFLAG_GENERATED | WAYPOINTFLAG_TELEPORT | WAYPOINTFLAG_NORELINK); + vector org; + org = (e.absmin + e.absmax) * 0.5; + org = waypoint_fixorigin(org); + w = waypoint_spawn(org, org, WAYPOINTFLAG_GENERATED | WAYPOINTFLAG_TELEPORT | WAYPOINTFLAG_NORELINK); dw = waypoint_spawn(destination, destination, WAYPOINTFLAG_GENERATED); // one way link to the destination w.wp00 = dw; diff --git a/qcsrc/server/cl_impulse.qc b/qcsrc/server/cl_impulse.qc index 3dfd2a6aa..3ae62bc56 100644 --- a/qcsrc/server/cl_impulse.qc +++ b/qcsrc/server/cl_impulse.qc @@ -260,7 +260,7 @@ void ImpulseCommands (void) for(e = findchain(classname, "waypoint"); e; e = e.chain) { e.colormod_x = 1; - e.effects &~= EF_NODEPTHTEST | EF_RED | EF_BLUE; + e.effects &~= EF_NODEPTHTEST | EF_RED | EF_BLUE | EF_BRIGHTLIGHT; } e2 = navigation_findnearestwaypoint(self, FALSE); navigation_markroutes(e2); @@ -272,7 +272,7 @@ void ImpulseCommands (void) { print("unreachable: ", etos(e), " ", vtos(e.origin), "\n"); e.colormod_x = 0.1; - e.effects |= EF_NODEPTHTEST | EF_BLUE; + e.effects |= EF_NODEPTHTEST | EF_BLUE | EF_BRIGHTLIGHT; ++i; ++m; } @@ -289,7 +289,7 @@ void ImpulseCommands (void) e.colormod_x = 0.1; if not(e.effects & EF_NODEPTHTEST) // not already reported before ++m; - e.effects |= EF_NODEPTHTEST | EF_RED; + e.effects |= EF_NODEPTHTEST | EF_RED | EF_BRIGHTLIGHT; ++i; } } @@ -306,14 +306,14 @@ void ImpulseCommands (void) if(navigation_findnearestwaypoint(e, FALSE)) { setorigin(e, org); - e.effects &~= EF_NODEPTHTEST; + e.effects &~= EF_NODEPTHTEST | EF_BRIGHTLIGHT; e.model = ""; } else { setorigin(e, org); print("spawn without waypoint: ", etos(e), " ", vtos(e.origin), "\n"); - e.effects |= EF_NODEPTHTEST; + e.effects |= EF_NODEPTHTEST | EF_BRIGHTLIGHT; setmodel(e, self.model); e.frame = self.frame; e.skin = self.skin; @@ -323,6 +323,43 @@ void ImpulseCommands (void) } if(i) print(ftos(i), " spawnpoints have no nearest waypoint (marked by player model)\n"); + i = 0; + entity start; + start = findchainflags(flags, FL_ITEM); + for(e = start; e; e = e.chain) + { + e.effects &~= EF_NODEPTHTEST | EF_RED | EF_BLUE | EF_BRIGHTLIGHT; + } + for(e = start; e; e = e.chain) + { + if(navigation_findnearestwaypoint(e, FALSE)) + { + } + else + { + print("item without waypoint: ", etos(e), " ", vtos(e.origin), "\n"); + e.effects |= EF_NODEPTHTEST | EF_RED | EF_BRIGHTLIGHT; + ++i; + } + } + if(i) + print(ftos(i), " items have no nearest waypoint and cannot be walked away from (marked with red light)\n"); + i = 0; + for(e = start; e; e = e.chain) + { + org = e.origin; + if(navigation_findnearestwaypoint(e, TRUE)) + { + } + else + { + print("item without waypoint: ", etos(e), " ", vtos(e.origin), "\n"); + e.effects |= EF_NODEPTHTEST | EF_BLUE | EF_BRIGHTLIGHT; + ++i; + } + } + if(i) + print(ftos(i), " items have no nearest waypoint and cannot be walked to (marked with blue light)\n"); break; } } diff --git a/qcsrc/server/t_teleporters.qc b/qcsrc/server/t_teleporters.qc index 4d7bd92cf..003fcbc05 100644 --- a/qcsrc/server/t_teleporters.qc +++ b/qcsrc/server/t_teleporters.qc @@ -256,13 +256,12 @@ void teleport_findtarget (void) for(e = world; (e = find(e, targetname, self.target)); ) { ++n; + waypoint_spawnforteleporter(self, e.origin, 0); if(e.movetype == MOVETYPE_NONE) RandomSelection_Add(e, 0, string_null, 1, 1); if(e.classname != "info_teleport_destination") print("^3MAPPER ERROR: teleporter does target an invalid teleport destination entity. Angles will not work.\n"); } - if(RandomSelection_chosen_ent) - waypoint_spawnforteleporter(self, RandomSelection_chosen_ent.origin, 0); if(n == 0) { -- 2.39.2