r2354 - branches/nexuiz-2.0/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Apr 20 05:52:15 EDT 2007


Author: div0
Date: 2007-04-20 05:52:15 -0400 (Fri, 20 Apr 2007)
New Revision: 2354

Modified:
   branches/nexuiz-2.0/data/qcsrc/server/bots.qc
   branches/nexuiz-2.0/data/qcsrc/server/cl_weaponsystem.qc
   branches/nexuiz-2.0/data/qcsrc/server/g_hook.qc
   branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc
Log:
fix: bots following carried flags, bot waypoints being in solid, hook having absolute velocity, disappearing weapon


Modified: branches/nexuiz-2.0/data/qcsrc/server/bots.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/bots.qc	2007-04-19 19:51:10 UTC (rev 2353)
+++ branches/nexuiz-2.0/data/qcsrc/server/bots.qc	2007-04-20 09:52:15 UTC (rev 2354)
@@ -580,7 +580,60 @@
 	w.classname = "waypoint";
 	w.wpflags = f;
 	setorigin(w, org);
+	setsize(w, PL_MIN + m1, PL_MAX + m2);
+
+	if(!(f & WAYPOINTFLAG_GENERATED))
+	{
+		org = w.origin + '0 0 2';
+		tracebox(org, w.mins, w.maxs, w.origin, MOVE_WORLDONLY, w);
+		if(trace_startsolid)
+		{
+			org = w.origin + '2 2 2';
+			tracebox(org, w.mins, w.maxs, w.origin, MOVE_WORLDONLY, w);
+			if(trace_startsolid)
+			{
+				org = w.origin + '-2 -2 2';
+				tracebox(org, w.mins, w.maxs, w.origin, MOVE_WORLDONLY, w);
+				if(trace_startsolid)
+				{
+					org = w.origin + '-2 2 2';
+					tracebox(org, w.mins, w.maxs, w.origin, MOVE_WORLDONLY, w);
+					if(trace_startsolid)
+					{
+						org = w.origin + '2 -2 2';
+						tracebox(org, w.mins, w.maxs, w.origin, MOVE_WORLDONLY, w);
+						if(trace_startsolid)
+						{
+							// this WP is in solid, refuse it
+							dprint("Killed a waypoint that was stuck in solid at ", vtos(org), "\n");
+							remove(w);
+							return world;
+						}
+					}
+				}
+			}
+		}
+
+		org = org * 0.05 + trace_endpos * 0.95; // don't trust the trace fully
+		tracebox(org, w.mins, w.maxs, org - '0 0 128', MOVE_WORLDONLY, w);
+
+		if(trace_fraction == 1 || trace_startsolid)
+		{
+			// this WP is in air, refuse it
+			dprint("Killed a waypoint that was stuck in air/ceiling at ", vtos(w.origin), "\n");
+			remove(w);
+			return world;
+		}
+		trace_endpos_z += 0.1; // don't trust the trace fully
+
+//		dprint("Moved waypoint at ", vtos(w.origin), " by ", ftos(vlen(w.origin - trace_endpos)));
+//		dprint(" direction: ", vtos((trace_endpos - w.origin)), "\n");
+
+		setorigin(w, trace_endpos);
+	}
+
 	setsize(w, m1, m2);
+
 	waypoint_clearlinks(w);
 	//waypoint_schedulerelink(w);
 	return w;
@@ -935,6 +988,8 @@
 	local float dist, bestdist;
 	local vector v, org;
 	org = player.origin + (player.mins_z - PL_MIN_z) * '0 0 1';
+	if(player.tag_entity)
+		org = org + player.tag_entity.origin;
 	if (navigation_testtracewalk)
 		te_plasmaburn(org);
 	best = world;

Modified: branches/nexuiz-2.0/data/qcsrc/server/cl_weaponsystem.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/cl_weaponsystem.qc	2007-04-19 19:51:10 UTC (rev 2353)
+++ branches/nexuiz-2.0/data/qcsrc/server/cl_weaponsystem.qc	2007-04-20 09:52:15 UTC (rev 2354)
@@ -291,7 +291,7 @@
 	if (self.weaponentity)
 	{
 		self.weaponentity.state = WS_CLEAR;
-		setmodel(self.weaponentity, ""); // precision already set
+		// self.weaponname = ""; // next frame will setmodel it to "" when needed anyway
 		self.weaponentity.effects = 0;
 	}
 };

Modified: branches/nexuiz-2.0/data/qcsrc/server/g_hook.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/g_hook.qc	2007-04-19 19:51:10 UTC (rev 2353)
+++ branches/nexuiz-2.0/data/qcsrc/server/g_hook.qc	2007-04-20 09:52:15 UTC (rev 2354)
@@ -233,6 +233,8 @@
 	missile.state = 0; // not latched onto anything
 
 	missile.velocity = v_forward * cvar("g_balance_grapplehook_speed_fly");
+	W_SetupProjectileVelocity(missile);
+
 	missile.angles = vectoangles (missile.velocity);
 	//missile.glow_color = 250; // 244, 250
 	//missile.glow_size = 120;

Modified: branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc	2007-04-19 19:51:10 UTC (rev 2353)
+++ branches/nexuiz-2.0/data/qcsrc/server/miscfunctions.qc	2007-04-20 09:52:15 UTC (rev 2354)
@@ -1,3 +1,53 @@
+void move_out_of_solid_expand(entity e, vector by)
+{
+	float eps = 0.0625;
+	tracebox(e.origin, e.mins - '1 1 1' * eps, e.maxs + '1 1 1' * eps, e.origin + by, MOVE_WORLDONLY, e);
+	if(trace_startsolid)
+		return;
+	if(trace_fraction < 1)
+	{
+		// hit something
+		// adjust origin in the other direction...
+		e.origin = e.origin - by * (1 - trace_fraction);
+	}
+}
+
+void move_out_of_solid(entity e)
+{
+	vector o, m0, m1;
+
+	o = e.origin;
+	traceline(o, o, MOVE_WORLDONLY, e);
+	if(trace_startsolid)
+	{
+		dprint("origin is in solid too! (", vtos(o), ")");
+		return;
+	}
+
+	tracebox(o, e.mins, e.maxs, o, MOVE_WORLDONLY, e);
+	if(!trace_startsolid)
+		return;
+
+	m0 = e.mins;
+	m1 = e.maxs;
+	e.mins = '0 0 0';
+	e.maxs = '0 0 0';
+	move_out_of_solid_expand(e, '1 0 0' * m0_x); e.mins_x = m0_x;
+	move_out_of_solid_expand(e, '1 0 0' * m1_x); e.maxs_x = m1_x;
+	move_out_of_solid_expand(e, '0 1 0' * m0_y); e.mins_y = m0_y;
+	move_out_of_solid_expand(e, '0 1 0' * m1_y); e.maxs_y = m1_y;
+	move_out_of_solid_expand(e, '0 0 1' * m0_z); e.mins_z = m0_z;
+	move_out_of_solid_expand(e, '0 0 1' * m1_z); e.maxs_z = m1_z;
+	setorigin(e, e.origin);
+
+	tracebox(e.origin, e.mins, e.maxs, e.origin, MOVE_WORLDONLY, e);
+	if(trace_startsolid)
+	{
+		dprint("could not get out of solid (", vtos(o), ")");
+		return;
+	}
+}
+
 // converts a number to a string with the indicated number of decimals
 // works for up to 10 decimals!
 string ftos_decimals(float number, float decimals)




More information about the nexuiz-commits mailing list