r3123 - trunk/data/qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Jan 11 08:39:24 EST 2008


Author: div0
Date: 2008-01-11 08:39:23 -0500 (Fri, 11 Jan 2008)
New Revision: 3123

Modified:
   trunk/data/qcsrc/server/cl_client.qc
   trunk/data/qcsrc/server/cl_impulse.qc
   trunk/data/qcsrc/server/ctf.qc
   trunk/data/qcsrc/server/defs.qh
Log:
Speedrun mode: impulse 77 now:
- also restores velocity
- sets huge counts of rockets, nails, cells, shells
- gives you all weapons the map has
- gives you spawn health and armor
- enters speedrun mode
In speedrun mode, a flag capture that takes longer than the record time
automatically gets aborted. The only way to leave speedrun mode is to die. If
you die in speedrun mode, the flag is returned immediately. The timelimit
display of the HUD shows the remaining time to beat the capture record.


Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2008-01-10 12:23:29 UTC (rev 3122)
+++ trunk/data/qcsrc/server/cl_client.qc	2008-01-11 13:39:23 UTC (rev 3123)
@@ -559,6 +559,7 @@
 
 		self.lms_nextcheck = time + cvar("g_lms_campcheck_interval")*2;
 		self.lms_traveled_distance = 0;
+		self.speedrunning = FALSE;
 
 		if(cvar("spawn_debug"))
 		{

Modified: trunk/data/qcsrc/server/cl_impulse.qc
===================================================================
--- trunk/data/qcsrc/server/cl_impulse.qc	2008-01-10 12:23:29 UTC (rev 3122)
+++ trunk/data/qcsrc/server/cl_impulse.qc	2008-01-11 13:39:23 UTC (rev 3123)
@@ -1,4 +1,5 @@
 .vector personal_v_angle; // view angles to restore on impulse 77
+.vector personal_velocity; // velocity to restore on impulse 77
 
 void CopyBody(float keepvelocity);
 
@@ -97,18 +98,21 @@
 		{
 			WaypointSprite_DeployPersonal("waypoint", self.origin);
 			self.personal_v_angle = self.v_angle;
+			self.personal_velocity = self.velocity;
 			sprint(self, "personal waypoint spawned at location\n");
 		}
 		else if(imp == 31)
 		{
 			WaypointSprite_DeployPersonal("waypoint", self.cursor_trace_endpos);
 			self.personal_v_angle = self.v_angle;
+			self.personal_velocity = '0 0 0';
 			sprint(self, "personal waypoint spawned at crosshair\n");
 		}
 		else if(imp == 32 && vlen(self.death_origin))
 		{
 			WaypointSprite_DeployPersonal("waypoint", self.death_origin);
 			self.personal_v_angle = self.v_angle;
+			self.personal_velocity = '0 0 0';
 			sprint(self, "personal waypoint spawned at death location\n");
 		}
 		else if(imp == 33 && self.deadflag == DEAD_NO && teams_matter)
@@ -189,6 +193,7 @@
 				{
 					if(self.waypointsprite_deployed_personal)
 					{
+						self.speedrunning = TRUE;
 						tracebox(self.waypointsprite_deployed_personal.origin, self.mins, self.maxs, self.waypointsprite_deployed_personal.origin, MOVE_WORLDONLY, self);
 						if(trace_startsolid)
 						{
@@ -198,7 +203,7 @@
 						{
 							// Abort speedrun, teleport back
 							setorigin(self, self.waypointsprite_deployed_personal.origin);
-							self.velocity = '0 0 0';
+							self.oldvelocity = self.velocity = self.personal_velocity;
 							self.angles = self.personal_v_angle;
 							self.fixangle = TRUE;
 							if(self.flagcarried)
@@ -207,6 +212,16 @@
 								ReturnFlag(self.flagcarried);
 							}
 						}
+						self.ammo_rockets = 999;
+						self.ammo_nails = 999;
+						self.ammo_cells = 999;
+						self.ammo_shells = 999;
+						self.health = start_health;
+						self.armorvalue = start_armorvalue;
+						self.items |= itemsInMap & (IT_LASER | IT_SHOTGUN | IT_UZI | IT_GRENADE_LAUNCHER | IT_ELECTRO | IT_CRYLINK | IT_NEX | IT_HAGAR | IT_ROCKET_LAUNCHER);
+						self.pauserotarmor_finished = time + cvar("g_balance_pause_armor_rot_spawn");
+						self.pauserothealth_finished = time + cvar("g_balance_pause_health_rot_spawn");
+						self.pauseregen_finished = time + cvar("g_balance_pause_health_regen_spawn");
 					}
 					else
 						sprint(self, "No waypoint set, cheater (use g_waypointsprite_personal to set one)\n");

Modified: trunk/data/qcsrc/server/ctf.qc
===================================================================
--- trunk/data/qcsrc/server/ctf.qc	2008-01-10 12:23:29 UTC (rev 3122)
+++ trunk/data/qcsrc/server/ctf.qc	2008-01-11 13:39:23 UTC (rev 3123)
@@ -10,6 +10,20 @@
 
 #define FLAG_CARRY_POS '-15 0 7'
 
+void FakeTimeLimit(entity e, float t)
+{
+	msg_entity = e;
+	WriteByte(MSG_ONE, 3); // svc_updatestat
+	WriteByte(MSG_ONE, 236); // STAT_TIMELIMIT
+	if(t < 0)
+		WriteCoord(MSG_ONE, cvar("timelimit"));
+	else
+		WriteCoord(MSG_ONE, (t + 1) / 60);
+}
+
+float   flagcaptimerecord;
+.float  flagpickuptime;
+
 void() FlagThink;
 void() FlagTouch;
 
@@ -81,6 +95,9 @@
 	{
 		WaypointSprite_DetachCarrier(e.owner);
 		e.owner.flagcarried = world;
+
+		if(e.speedrunning)
+			FakeTimeLimit(e.owner, -1);
 	}
 	e.owner = world;
 	RegenFlag(e);
@@ -90,6 +107,12 @@
 {
 	local entity p;
 
+	if(e.speedrunning)
+	{
+		ReturnFlag(e);
+		return;
+	}
+
 	if (!e.owner)
 	{
 		dprint("FLAG: drop - no owner?!?!\n");
@@ -147,6 +170,25 @@
 
 	AnimateFlag();
 
+	if(self.speedrunning)
+	if(self.cnt == FLAG_CARRY)
+	{
+		if(self.owner)
+		if(flagcaptimerecord)
+		if(time >= self.flagpickuptime + flagcaptimerecord)
+		{
+			bprint("The ", self.netname, " became impatient after ", ftos_decimals(flagcaptimerecord, 2), " seconds and returned itself\n");
+
+			self.owner.impulse = 77; // returning!
+			e = self;
+			self = self.owner;
+			ReturnFlag(e);
+			ImpulseCommands();
+			self = e;
+			return;
+		}
+	}
+
 	if (self.cnt == FLAG_BASE)
 		return;
 
@@ -178,9 +220,6 @@
 	}
 };
 
-float   flagcaptimerecord;
-.float  flagpickuptime;
-
 void() FlagTouch =
 {
 	if(gameover) return;
@@ -236,6 +275,8 @@
 
 		sound (self, CHAN_AUTO, self.noise2, 1, ATTN_NONE);
 		WaypointSprite_DetachCarrier(other);
+		if(self.speedrunning)
+			FakeTimeLimit(other, -1);
 		RegenFlag (other.flagcarried);
 		other.flagcarried = world;
 		other.next_take_time = time + 1;
@@ -249,6 +290,10 @@
 			return;
 		// pick up
 		self.flagpickuptime = time; // used for timing runs
+		self.speedrunning = other.speedrunning; // if speedrunning, flag will self-return and teleport the owner back after the record
+		if(other.speedrunning)
+		if(flagcaptimerecord)
+			FakeTimeLimit(other, time + flagcaptimerecord);
 		self.solid = SOLID_NOT;
 		setorigin(self, self.origin); // relink
 		self.owner = other;

Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh	2008-01-10 12:23:29 UTC (rev 3122)
+++ trunk/data/qcsrc/server/defs.qh	2008-01-11 13:39:23 UTC (rev 3123)
@@ -371,3 +371,6 @@
 
 // assault game mode: Which team is attacking in this round?
 float assault_attacker_team;
+
+// speedrun: when 1, player auto teleports back when capture timeout happens
+.float speedrunning;




More information about the nexuiz-commits mailing list