[nexuiz-commits] r8409 - trunk/data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Dec 18 16:21:31 EST 2009
Author: div0
Date: 2009-12-18 16:21:31 -0500 (Fri, 18 Dec 2009)
New Revision: 8409
Modified:
trunk/data/qcsrc/server/cl_client.qc
trunk/data/qcsrc/server/race.qc
Log:
fix race spawnpoint bug
Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc 2009-12-18 20:30:32 UTC (rev 8408)
+++ trunk/data/qcsrc/server/cl_client.qc 2009-12-18 21:21:31 UTC (rev 8409)
@@ -107,7 +107,7 @@
// Returns:
// -1 if a spawn can't be used
// otherwise, a weight of the spawnpoint
-float Spawn_Score(entity spot, entity playerlist, float teamcheck)
+float Spawn_Score(entity spot, entity playerlist, float teamcheck, float anypoint)
{
float shortest, thisdist;
entity player;
@@ -137,6 +137,7 @@
local entity ent;
float good, found;
ent = find(world, targetname, spot.target);
+
while(ent) {
if(ent.classname == "target_objective")
{
@@ -148,7 +149,8 @@
else if(ent.classname == "trigger_race_checkpoint")
{
found = 1;
- if(self.classname == "player") // spectators may spawn everywhere
+ if(!anypoint) // spectators may spawn everywhere
+
{
if(g_race_qualifying)
{
@@ -162,14 +164,18 @@
{
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(pl == 0 && !self.race_started)
- pl = race_highest_place_spawn; // use last place if he has not even touched finish yet
- if(spot.race_place != pl)
- return -1;
+ if(ent.race_checkpoint == 0)
+ {
+ float pl;
+ pl = self.race_place;
+ if(pl > race_highest_place_spawn)
+ pl = 0;
+ if(pl == 0 && !self.race_started)
+ pl = race_highest_place_spawn; // use last place if he has not even touched finish yet
+ print("race started? ", ftos(self.race_started), "\n");
+ if(spot.race_place != pl)
+ return -1;
+ }
}
}
good = 1;
@@ -195,7 +201,7 @@
float spawn_allbad;
float spawn_allgood;
-entity Spawn_FilterOutBadSpots(entity firstspot, entity playerlist, float mindist, float teamcheck)
+entity Spawn_FilterOutBadSpots(entity firstspot, entity playerlist, float mindist, float teamcheck, float anypoint)
{
local entity spot, spotlist, spotlistend;
spawn_allgood = TRUE;
@@ -206,7 +212,7 @@
for(spot = firstspot; spot; spot = spot.chain)
{
- spot.SPAWNPOINT_SCORE = Spawn_Score(spot, playerlist, teamcheck);
+ spot.SPAWNPOINT_SCORE = Spawn_Score(spot, playerlist, teamcheck, anypoint);
if(cvar("spawn_debugview"))
{
@@ -315,9 +321,9 @@
}
else
{
- firstspot_new = Spawn_FilterOutBadSpots(firstspot, playerlist, 100, teamcheck);
+ firstspot_new = Spawn_FilterOutBadSpots(firstspot, playerlist, 100, teamcheck, anypoint);
if(!firstspot_new)
- firstspot_new = Spawn_FilterOutBadSpots(firstspot, playerlist, -1, teamcheck);
+ firstspot_new = Spawn_FilterOutBadSpots(firstspot, playerlist, -1, teamcheck, anypoint);
firstspot = firstspot_new;
// there is 50/50 chance of choosing a random spot or the furthest spot
@@ -325,7 +331,7 @@
// usually won't get fragged at spawn twice in a row)
if (arena_roundbased && !g_ca)
{
- firstspot_new = Spawn_FilterOutBadSpots(firstspot, playerlist, 800, teamcheck);
+ firstspot_new = Spawn_FilterOutBadSpots(firstspot, playerlist, 800, teamcheck, anypoint);
if(firstspot_new)
firstspot = firstspot_new;
spot = Spawn_WeightedPoint(firstspot, 1, 1, 1);
Modified: trunk/data/qcsrc/server/race.qc
===================================================================
--- trunk/data/qcsrc/server/race.qc 2009-12-18 20:30:32 UTC (rev 8408)
+++ trunk/data/qcsrc/server/race.qc 2009-12-18 21:21:31 UTC (rev 8409)
@@ -525,7 +525,7 @@
// race only (middle of the race)
g_race_qualifying = 0;
self.race_place = 0;
- if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), world, 0, FALSE))
+ if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), world, 0, FALSE, FALSE))
error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for respawning in race) - bailing out"));
if(i == 0)
@@ -533,7 +533,7 @@
// qualifying only
g_race_qualifying = 1;
self.race_place = race_lowest_place_spawn;
- if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), world, 0, FALSE))
+ if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), world, 0, FALSE, FALSE))
error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for qualifying) - bailing out"));
// race only (initial spawn)
@@ -541,7 +541,7 @@
for(p = 1; p <= race_highest_place_spawn; ++p)
{
self.race_place = p;
- if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), world, 0, FALSE))
+ if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), world, 0, FALSE, FALSE))
error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for initially spawning in race) - bailing out"));
}
}
@@ -553,7 +553,7 @@
self.race_checkpoint = race_NextCheckpoint(0);
g_race_qualifying = 1;
self.race_place = race_lowest_place_spawn;
- if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), world, 0, FALSE))
+ if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), world, 0, FALSE, FALSE))
error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for qualifying) - bailing out"));
}
else
More information about the nexuiz-commits
mailing list