r4465 - in trunk/data: qcsrc/server scripts

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Sep 17 04:34:39 EDT 2008


Author: div0
Date: 2008-09-17 04:34:24 -0400 (Wed, 17 Sep 2008)
New Revision: 4465

Modified:
   trunk/data/qcsrc/server/cl_client.qc
   trunk/data/qcsrc/server/race.qc
   trunk/data/qcsrc/server/race.qh
   trunk/data/scripts/entities.def
Log:
support race_place -1 to mark a qualifying-only finish spawn point


Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2008-09-16 18:46:09 UTC (rev 4464)
+++ trunk/data/qcsrc/server/cl_client.qc	2008-09-17 08:34:24 UTC (rev 4465)
@@ -63,14 +63,25 @@
 			{
 				if(self.classname == "player") // spectators may spawn everywhere
 				{
-					if(ent.race_checkpoint != race_PreviousCheckpoint(self.race_checkpoint))
-						return -1;
-					float pl;
-					pl = self.race_place;
-					if(pl > race_highest_place_spawn)
-						pl = 0;
-					if(spot.race_place != pl)
-						return -1;
+					if(g_race_qualifying)
+					{
+						// spawn at first
+						if(ent.race_checkpoint != 0)
+							return -1;
+						if(ent.race_place != race_lowest_place_spawn)
+							return -1;
+					}
+					else
+					{
+						if(ent.race_checkpoint != race_PreviousCheckpoint(self.race_checkpoint))
+							return -1;
+						float pl;
+						pl = self.race_place;
+						if(pl > race_highest_place_spawn)
+							pl = 0;
+						if(spot.race_place != pl)
+							return -1;
+					}
 				}
 				good = 1;
 			}

Modified: trunk/data/qcsrc/server/race.qc
===================================================================
--- trunk/data/qcsrc/server/race.qc	2008-09-16 18:46:09 UTC (rev 4464)
+++ trunk/data/qcsrc/server/race.qc	2008-09-17 08:34:24 UTC (rev 4465)
@@ -12,7 +12,6 @@
 entity race_checkpoint_lastplayers[MAX_CHECKPOINTS];
 
 float race_highest_checkpoint;
-float race_highest_place_spawn;
 
 float race_NextCheckpoint(float f)
 {
@@ -301,13 +300,11 @@
 	}
 }
 
-void checkpoint_touch()
+void checkpoint_passed()
 {
 	string oldmsg;
 	entity oldself;
 
-	EXACTTRIGGER_TOUCH;
-
 	if(other.classname == "porto")
 	{
 		// do not allow portalling through checkpoints
@@ -381,10 +378,16 @@
 	}
 }
 
+void checkpoint_touch()
+{
+	EXACTTRIGGER_TOUCH;
+	checkpoint_passed();
+}
+
 void checkpoint_use()
 {
 	other = activator;
-	checkpoint_touch();
+	checkpoint_passed();
 }
 
 float race_waypointsprite_for_player(entity e)
@@ -518,6 +521,8 @@
 
 	if(self.race_place > race_highest_place_spawn)
 		race_highest_place_spawn = self.race_place;
+	if(self.race_place < race_lowest_place_spawn)
+		race_lowest_place_spawn = self.race_place;
 }
 
 void race_ClearRecords()

Modified: trunk/data/qcsrc/server/race.qh
===================================================================
--- trunk/data/qcsrc/server/race.qh	2008-09-16 18:46:09 UTC (rev 4464)
+++ trunk/data/qcsrc/server/race.qh	2008-09-17 08:34:24 UTC (rev 4465)
@@ -7,7 +7,8 @@
 float race_spawns;
 float race_PreviousCheckpoint(float f);
 float race_NextCheckpoint(float f);
-float race_highest_place_spawn;
+float race_highest_place_spawn; // number of places; a place higher gets spawned at 0
+float race_lowest_place_spawn; // where to spawn in qualifying
 float race_fraglimit;
 .float race_place;
 .float race_completed;

Modified: trunk/data/scripts/entities.def
===================================================================
--- trunk/data/scripts/entities.def	2008-09-16 18:46:09 UTC (rev 4464)
+++ trunk/data/scripts/entities.def	2008-09-17 08:34:24 UTC (rev 4465)
@@ -938,7 +938,7 @@
 -------- KEYS --------
 target: this should point to a trigger_race_checkpoint to decide when this spawning point is active. The checkpoint has to be AFTER this spawn.
 cnt: weight of spawn point for random selection. Set to a lower value if you have many spawn points close together. Default value is 1.
-race_place: if target points to the trigger_race_checkpoint with cnt 0 (finish line), this sets which place the spawn corresponds to
+race_place: if target points to the trigger_race_checkpoint with cnt 0 (finish line), this sets which place the spawn corresponds to; the special value 0 stands for spawns for players who come in later (have to be behind the ones with race_place set to an actual place), and -1 marks the spawnpoint for qualifying mode only
 */
 
 /*QUAKED func_pointparticles (.5 .5 .5) ? START_ON




More information about the nexuiz-commits mailing list