r4070 - in trunk/data: . qcsrc/common qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Aug 9 08:15:49 EDT 2008


Author: div0
Date: 2008-08-09 08:15:49 -0400 (Sat, 09 Aug 2008)
New Revision: 4070

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/common/mapinfo.qc
   trunk/data/qcsrc/server/race.qc
   trunk/data/qcsrc/server/race.qh
   trunk/data/qcsrc/server/scores_rules.qc
   trunk/data/qcsrc/server/teamplay.qc
Log:
new cvar g_race_teams


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2008-08-09 11:04:02 UTC (rev 4069)
+++ trunk/data/defaultNexuiz.cfg	2008-08-09 12:15:49 UTC (rev 4070)
@@ -489,6 +489,7 @@
 set g_race_qualifying 0
 // Qualifying uses timelimit, and the one with the best time wins. Fraglimit is nonfunctional then.
 // Normal race uses fraglimit as a limit for the laps.
+set g_race_teams 0 // when 2, 3, or 4, the race is played as a team game (the team members can add up their laps)
 
 // server game balance settings
 set g_balance_armor_regen 0

Modified: trunk/data/qcsrc/common/mapinfo.qc
===================================================================
--- trunk/data/qcsrc/common/mapinfo.qc	2008-08-09 11:04:02 UTC (rev 4069)
+++ trunk/data/qcsrc/common/mapinfo.qc	2008-08-09 12:15:49 UTC (rev 4070)
@@ -510,6 +510,14 @@
 			cvar_set("fraglimit", sa);
 		s = cdr(s);
 	}
+
+	if(pWantedType == MAPINFO_TYPE_RACE)
+	{
+		sa = car(s); if(sa == "") sa = cvar_string("fraglimit");
+		if(cvar("g_race_teams"))
+			cvar_set("fraglimit", sa);
+		s = cdr(s);
+	}
 }
 
 float MapInfo_Type_FromString(string t)
@@ -570,7 +578,7 @@
 		if(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ARENA)           fputs(fh, "type arena 10 20\n");
 		if(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_KEYHUNT)         fputs(fh, "type kh 1000 20 3\n");
 		if(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ASSAULT)         fputs(fh, "type as 20\n");
-		if(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_RACE)            fputs(fh, "type race 5 20 0\n");
+		if(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_RACE)            fputs(fh, "type race 5 20 15\n");
 		if(MapInfo_Map_supportedGametypes & MAPINFO_TYPE_ONSLAUGHT)       fputs(fh, "type ons 20\n");
 
 		fh2 = fopen(strcat("scripts/", pFilename, ".arena"), FILE_READ);

Modified: trunk/data/qcsrc/server/race.qc
===================================================================
--- trunk/data/qcsrc/server/race.qc	2008-08-09 11:04:02 UTC (rev 4069)
+++ trunk/data/qcsrc/server/race.qc	2008-08-09 12:15:49 UTC (rev 4070)
@@ -50,7 +50,7 @@
 		s = PlayerScore_Add(e, SP_RACE_FASTEST, 0);
 		if(!s || t < s)
 			PlayerScore_Add(e, SP_RACE_FASTEST, t - s);
-		PlayerScore_Add(e, SP_RACE_LAPS, 1);
+		PlayerTeamScore_Add(e, SP_RACE_LAPS, ST_RACE_LAPS, 1);
 	}
 
 	float recordtime;

Modified: trunk/data/qcsrc/server/race.qh
===================================================================
--- trunk/data/qcsrc/server/race.qh	2008-08-09 11:04:02 UTC (rev 4069)
+++ trunk/data/qcsrc/server/race.qh	2008-08-09 12:15:49 UTC (rev 4070)
@@ -1 +1,2 @@
 void race_PreparePlayer();
+float race_teams;

Modified: trunk/data/qcsrc/server/scores_rules.qc
===================================================================
--- trunk/data/qcsrc/server/scores_rules.qc	2008-08-09 11:04:02 UTC (rev 4069)
+++ trunk/data/qcsrc/server/scores_rules.qc	2008-08-09 12:15:49 UTC (rev 4070)
@@ -121,13 +121,20 @@
 }
 
 // Race stuff
+#define ST_RACE_LAPS 1
 #define SP_RACE_LAPS 4
 #define SP_RACE_FASTEST 5
 void ScoreRules_race()
 {
-	ScoreRules_basics(0, 0);
-	if(cvar("g_race_qualifying"))
+	ScoreRules_basics(race_teams, 0);
+	if(race_teams)
 	{
+		ScoreInfo_SetLabel_TeamScore(  ST_RACE_LAPS,    "laps",      SFL_SORT_PRIO_PRIMARY);
+		ScoreInfo_SetLabel_PlayerScore(SP_RACE_LAPS,    "laps",      SFL_SORT_PRIO_PRIMARY);
+		ScoreInfo_SetLabel_PlayerScore(SP_RACE_FASTEST, "fastest",   SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER | SFL_TIME);
+	}
+	else if(cvar("g_race_qualifying"))
+	{
 		ScoreInfo_SetLabel_PlayerScore(SP_RACE_LAPS,    "laps",      0);
 		ScoreInfo_SetLabel_PlayerScore(SP_RACE_FASTEST, "fastest",   SFL_SORT_PRIO_PRIMARY | SFL_LOWER_IS_BETTER | SFL_TIME);
 	}

Modified: trunk/data/qcsrc/server/teamplay.qc
===================================================================
--- trunk/data/qcsrc/server/teamplay.qc	2008-08-09 11:04:02 UTC (rev 4069)
+++ trunk/data/qcsrc/server/teamplay.qc	2008-08-09 12:15:49 UTC (rev 4070)
@@ -271,8 +271,19 @@
 		cvar_set("g_race", "1");
 		fraglimit_override = cvar("g_race_laps_limit");
 		gamemode_name = "Race";
-		teams_matter = 0;
 
+		if(cvar("g_race_teams"))
+		{
+			ActivateTeamplay();
+			teams_matter = 1;
+			race_teams = bound(2, cvar("g_race_teams"), 4);
+		}
+		else
+		{
+			race_teams = 0;
+			teams_matter = 0;
+		}
+
 		ScoreRules_race();
 	}
 	else
@@ -610,6 +621,8 @@
 		// cover anything else by treating it like tdm with no teams spawned
 		if(g_keyhunt)
 			dm = kh_teams;
+		else if(g_race)
+			dm = race_teams;
 		else
 			dm = cvar("g_tdm_teams");
 		if(dm < 2)




More information about the nexuiz-commits mailing list