r3924 - in trunk/data: . qcsrc/client qcsrc/common qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Jul 26 12:05:07 EDT 2008


Author: div0
Date: 2008-07-26 12:05:05 -0400 (Sat, 26 Jul 2008)
New Revision: 3924

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/client/sbar.qc
   trunk/data/qcsrc/common/constants.qh
   trunk/data/qcsrc/server/arena.qc
   trunk/data/qcsrc/server/cl_client.qc
   trunk/data/qcsrc/server/cl_player.qc
   trunk/data/qcsrc/server/ctf.qc
   trunk/data/qcsrc/server/defs.qh
   trunk/data/qcsrc/server/g_damage.qc
   trunk/data/qcsrc/server/g_world.qc
   trunk/data/qcsrc/server/keyhunt.qc
   trunk/data/qcsrc/server/miscfunctions.qc
   trunk/data/qcsrc/server/teamplay.qc
Log:
CTF!


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2008-07-26 07:23:04 UTC (rev 3923)
+++ trunk/data/defaultNexuiz.cfg	2008-07-26 16:05:05 UTC (rev 3924)
@@ -319,13 +319,13 @@
 // this means that timelimit can be overidden globally and fraglimit can be overidden for each game mode: DM/TDM, Domination, CTF, and Runematch.
 seta timelimit_override -1
 seta fraglimit_override -1
-seta capturelimit_override -1 // actual captures, if g_ctf_win_mode 0 or 1
-seta g_ctf_capture_limit -1   // points, if g_ctf_win_mode 2
+seta capturelimit_override -1 // actual captures, if g_ctf_win_mode 0
+seta g_ctf_capture_limit -1   // points, if g_ctf_win_mode 1
 seta g_domination_point_limit -1
 seta g_runematch_point_limit -1
 seta g_keyhunt_point_limit -1
 
-seta g_ctf_win_mode 2 // 0: captures only, 1: captures, points if equal captures, 2: points
+seta g_ctf_win_mode 1 // 0: captures only, 1: points
 
 // 50% of the spawns shall be far away from any players
 set g_spawn_furthest 0.5

Modified: trunk/data/qcsrc/client/sbar.qc
===================================================================
--- trunk/data/qcsrc/client/sbar.qc	2008-07-26 07:23:04 UTC (rev 3923)
+++ trunk/data/qcsrc/client/sbar.qc	2008-07-26 16:05:05 UTC (rev 3924)
@@ -299,7 +299,7 @@
 	print("Additional columns:\n");
 	for(i = 0; i < MAX_SCORE; ++i)
 	{
-		if(scores_label[i])
+		if(scores_label[i] != "")
 			print(strcat(scores_label[i], "\n"));
 	}
 }
@@ -331,8 +331,31 @@
 	if(argc < 2) // no arguments provided
 		argc = tokenizebyseparator(strcat("x ", cvar_string("sbar_columns")), " ");
 
-	if(argc < 2 || (argc == 2 && argv(1) == "default"))
+	if(argc < 2)
 		argc = tokenizebyseparator(strcat("x ", Sbar_DefaultColumnLayout()), " ");
+
+	if(argc == 2)
+	{
+		if(argv(1) == "default")
+			argc = tokenizebyseparator(strcat("x ", Sbar_DefaultColumnLayout()), " ");
+		else if(argv(1) == "all")
+		{
+			string s;
+			s = "ping name |";
+			for(i = 0; i < MAX_SCORE; ++i)
+			{
+				if(i != ps_primary)
+				if(i != ps_secondary)
+				if(scores_label[i] != "")
+					s = strcat(s, " ", scores_label[i]);
+			}
+			if(ps_secondary != ps_primary)
+				s = strcat(s, " ", scores_label[ps_secondary]);
+			s = strcat(s, " ", scores_label[ps_primary]);
+			argc = tokenizebyseparator(strcat("x ", s), " ");
+		}
+	}
+		
 	
 	argc = min(MAX_SBAR_FIELDS, argc);
 	sbar_num_fields = 0;

Modified: trunk/data/qcsrc/common/constants.qh
===================================================================
--- trunk/data/qcsrc/common/constants.qh	2008-07-26 07:23:04 UTC (rev 3923)
+++ trunk/data/qcsrc/common/constants.qh	2008-07-26 16:05:05 UTC (rev 3924)
@@ -224,8 +224,9 @@
 #define ST_SCORE 0
 
 #define SP_CTF_CAPS 4
-#define SP_CTF_RETURNS 5
-#define SP_CTF_CARRIERKILLS 6
+#define SP_CTF_PICKUPS 5
+#define SP_CTF_FCKILLS 6
+#define SP_CTF_RETURNS 7
 #define ST_CTF_CAPS 1
 
 #define ST_DOM_DOMPOINTS 1
@@ -234,10 +235,10 @@
 #define SP_LMS_LIVES 4
 #define SP_LMS_PLACE 5
 
-#define SP_KH_COLLECT 4
-#define SP_KH_LOSEKEY 5
-#define SP_KH_CAPS 6
-#define SP_KH_PUSH 7
-#define SP_KH_DESTROYED 8
-#define SP_KH_KCFRAG 9
+#define SP_KH_CAPS 4
+#define SP_KH_PUSHES 5
+#define SP_KH_DESTROYS 6
+#define SP_KH_PICKUPS 7
+#define SP_KH_KCKILLS 8
+#define SP_KH_LOSSES 9
 #define ST_KH_CAPS 1

Modified: trunk/data/qcsrc/server/arena.qc
===================================================================
--- trunk/data/qcsrc/server/arena.qc	2008-07-26 07:23:04 UTC (rev 3923)
+++ trunk/data/qcsrc/server/arena.qc	2008-07-26 16:05:05 UTC (rev 3924)
@@ -130,7 +130,6 @@
 						PlayerScore_Clear(self);
 						if(g_lms)
 							PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives());
-						self.deaths = 0;
 						self.killcount = 0;
 						//stop the player from moving so that he stands still once he gets respawned
 						self.velocity = '0 0 0';

Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2008-07-26 07:23:04 UTC (rev 3923)
+++ trunk/data/qcsrc/server/cl_client.qc	2008-07-26 16:05:05 UTC (rev 3924)
@@ -351,8 +351,6 @@
 putting a client as observer in the server
 =============
 */
-void ctf_UpdateCaptures(float);
-void ctf_UpdateReturns(float);
 void PutObserverInServer (void)
 {
 	entity	spot;
@@ -408,9 +406,6 @@
 	self.damageforcescale = 0;
 	self.death_time = 0;
 	self.dead_frame = 0;
-	self.deaths = 0;
-	self.captures = 0;
-	self.returns = 0;
 	self.alpha = 0;
 	self.scale = 0;
 	self.fade_time = 0;
@@ -472,8 +467,6 @@
 	}
 	else
 		self.frags = -666;
-	
-	net_UpdateDeaths(MSG_BROADCAST);
 }
 
 float RestrictSkin(float s)
@@ -789,15 +782,6 @@
 
 void ClientKill_Now_TeamChange()
 {
-	if(g_ctf)
-	{
-		self.captures = 0;
-		self.returns = 0;
-		ctf_UpdateCaptures(MSG_BROADCAST);
-		ctf_UpdateReturns(MSG_BROADCAST);
-	}
-	self.deaths = 0;
-	net_UpdateDeaths(MSG_BROADCAST);
 	if(self.killindicator_teamchange == -1)
 	{
 		self.team = -1;
@@ -1149,9 +1133,6 @@
 		sprint(self, strcat("nexuiz-csqc protocol ", ftos(CSQC_REVISION), "\n"));
 		SendCSQCInfo();
 		msg_entity = self;
-		ctf_UpdateCaptures(MSG_ONE);
-		ctf_UpdateReturns(MSG_ONE);
-		net_UpdateDeaths(MSG_ONE);
 		if(mapvote_initialized && !cvar("g_maplist_textonly"))
 		{
 			MapVote_SendData(MSG_ONE);

Modified: trunk/data/qcsrc/server/cl_player.qc
===================================================================
--- trunk/data/qcsrc/server/cl_player.qc	2008-07-26 07:23:04 UTC (rev 3923)
+++ trunk/data/qcsrc/server/cl_player.qc	2008-07-26 16:05:05 UTC (rev 3924)
@@ -351,19 +351,6 @@
 
 void ClientKill_Now_TeamChange();
 
-void net_UpdateDeaths(float msg_target)
-{
-	entity p;
-	WriteByte(msg_target, SVC_TEMPENTITY);
-	WriteByte(msg_target, TE_CSQC_DEATHS);
-	FOR_EACH_PLAYER(p)
-	{
-		WriteByte(msg_target, num_for_edict(p));
-		WriteByte(msg_target, p.deaths);
-	}
-	WriteByte(msg_target, 0);
-}
-
 void PlayerDamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
 {
 	local float take, save, waves, sdelay;
@@ -459,9 +446,6 @@
 		float defer_ClientKill_Now_TeamChange;
 		defer_ClientKill_Now_TeamChange = FALSE;
 
-		self.deaths += 1;
-		net_UpdateDeaths(MSG_BROADCAST);
-
 		// get rid of kill indicator
 		if(self.killindicator)
 		{

Modified: trunk/data/qcsrc/server/ctf.qc
===================================================================
--- trunk/data/qcsrc/server/ctf.qc	2008-07-26 07:23:04 UTC (rev 3923)
+++ trunk/data/qcsrc/server/ctf.qc	2008-07-26 16:05:05 UTC (rev 3924)
@@ -230,34 +230,6 @@
 	}
 };
 
-void ctf_UpdateCaptures(float msg_target)
-{
-	entity p;
-	WriteByte(msg_target, SVC_TEMPENTITY);
-	WriteByte(msg_target, TE_CSQC_CAPTURES);
-	WriteByte(msg_target, cvar("g_ctf_win_mode"));
-	WriteByte(msg_target, caps_team1);
-	WriteByte(msg_target, caps_team2);
-	FOR_EACH_PLAYER(p)
-	{
-		WriteByte(msg_target, num_for_edict(p));
-		WriteByte(msg_target, p.captures);
-	}
-	WriteByte(msg_target, 0);
-}
-void ctf_UpdateReturns(float msg_target)
-{
-	entity p;
-	WriteByte(msg_target, SVC_TEMPENTITY);
-	WriteByte(msg_target, TE_CSQC_RETURNS);
-	FOR_EACH_PLAYER(p)
-	{
-		WriteByte(msg_target, num_for_edict(p));
-		WriteByte(msg_target, p.returns);
-	}
-	WriteByte(msg_target, 0);
-}
-
 void FlagTouch()
 {
 	if(gameover) return;
@@ -311,16 +283,7 @@
 			bprint(other.netname, "^7 captured the ", other.flagcarried.netname, " in ", s, ", failing to break ", strcat(h0, " record of ", s0, " seconds\n"));
 		}
 
-		other.captures += 1;
-		if(other.team == COLOR_TEAM1)
-			++caps_team1;
-		else if(other.team == COLOR_TEAM2)
-			++caps_team2;
-		else
-			print("Unknown team captured the flag!\n");
-		ctf_UpdateCaptures(MSG_BROADCAST);
-		// FIXME: When counting captures, should the score be updated?
-
+		PlayerTeamScore_Add(other, SP_CTF_CAPS, ST_CTF_CAPS, 1);
 		LogCTF("capture", other.flagcarried.team, other);
 		// give credit to the individual player
 		UpdateFrags(other, cvar("g_ctf_flagscore_capture"));
@@ -360,6 +323,7 @@
 		self.angles = '0 0 0';
 		bprint(other.netname, "^7 got the ", self.netname, "\n");
 		UpdateFrags(other, cvar("g_ctf_flagscore_pickup"));
+		PlayerScore_Add(other, SP_CTF_PICKUPS, 1);
 		LogCTF("steal", self.team, other);
 		sound (self, CHAN_AUTO, self.noise, 1, ATTN_NONE);
 
@@ -382,15 +346,11 @@
 		{
 			// return flag
 			bprint(other.netname, "^7 returned the ", self.netname, "\n");
-			if(cvar("g_ctf_win_mode") == 2)
-			{
-				if (other.team == COLOR_TEAM1 || other.team == COLOR_TEAM2)
-					UpdateFrags(other, cvar("g_ctf_flagscore_return"));
-				else
-					UpdateFrags(other, cvar("g_ctf_flagscore_return_rogue"));
-			}
-			other.returns += 1;
-			ctf_UpdateReturns(MSG_BROADCAST);
+			if (other.team == COLOR_TEAM1 || other.team == COLOR_TEAM2)
+				UpdateFrags(other, cvar("g_ctf_flagscore_return"));
+			else
+				UpdateFrags(other, cvar("g_ctf_flagscore_return_rogue"));
+			PlayerScore_Add(other, SP_CTF_RETURNS, 1);
 			LogCTF("return", self.team, other);
 			sound (self, CHAN_AUTO, self.noise1, 1, ATTN_NONE);
 			ReturnFlag(self);
@@ -707,20 +667,32 @@
 	// if no teams are found, spawn defaults
 	if (find(world, classname, "ctf_team") == world)
 		ctf_spawnteams();
+
+	float sp_score, sp_caps;
+	sp_score = sp_caps = SFL_SORT_PRIO_SECONDARY;
+	if(g_ctf_win_mode)
+		sp_score = SFL_SORT_PRIO_PRIMARY;
+	else
+		sp_caps = SFL_SORT_PRIO_PRIMARY;
+
+	CheckAllowedTeams(world);
+	ScoreInfo_Init(2 + (c3>=0)); // NOTE this assumes that the rogue team is team 3
+	ScoreInfo_SetLabel_TeamScore  (ST_SCORE,        "score",     sp_score);
+	ScoreInfo_SetLabel_TeamScore  (ST_CTF_CAPS,     "caps",      sp_caps);
+	ScoreInfo_SetLabel_PlayerScore(SP_KILLS,        "kills",     0);
+	ScoreInfo_SetLabel_PlayerScore(SP_DEATHS,       "deaths",    SFL_LOWER_IS_BETTER);
+	ScoreInfo_SetLabel_PlayerScore(SP_SUICIDES,     "suicides",  SFL_LOWER_IS_BETTER);
+	ScoreInfo_SetLabel_PlayerScore(SP_SCORE,        "score",     sp_score);
+	ScoreInfo_SetLabel_PlayerScore(SP_CTF_CAPS,     "caps",      sp_caps);
+	ScoreInfo_SetLabel_PlayerScore(SP_CTF_RETURNS,  "returns",   0);
+	ScoreInfo_SetLabel_PlayerScore(SP_CTF_FCKILLS,  "fckills",   0);
+	ScoreInfo_SetLabel_PlayerScore(SP_CTF_PICKUPS,  "pickups",   0);
 };
 
 void ctf_init()
 {
 	local entity e;
 
-	caps_team1 = caps_team2 = 0;
-	registercvar("capturelimit", "8");
-	registercvar("g_ctf_win_mode", "0");
-	//registercvar("g_overtime", "1");
-	registercvar("g_ctf_flagscore_kill", "6");
-	registercvar("g_ctf_flagpenalty_drop", "0");
-	//addstat(STAT_CTF_CAPTURES, AS_INT, captures);
-	//addstat(STAT_CTF_STATE, AS_FLOAT_TRUNCATED, ctf_state);
 	e = spawn();
 	e.think = ctf_delayedinit;
 	e.nextthink = time + 0.1;

Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh	2008-07-26 07:23:04 UTC (rev 3923)
+++ trunk/data/qcsrc/server/defs.qh	2008-07-26 16:05:05 UTC (rev 3924)
@@ -16,6 +16,7 @@
 float g_domination, g_ctf, g_tdm, g_keyhunt, g_onslaught, g_assault, g_arena, g_lms, g_runematch;
 float g_cloaked, g_footsteps, g_grappling_hook, g_instagib, g_laserguided_missile, g_midair, g_minstagib, g_nixnex, g_nixnex_with_laser, g_norecoil, g_rocketarena, g_vampire, g_minstagib_invis_alpha;
 float g_tourney;
+float g_ctf_win_mode;
 float tourneyInMatchStage;
 
 float sv_cheats;
@@ -289,7 +290,6 @@
 float timelimit_orig;
 
 .float winning;
-.float deaths;
 .float jointime;
 
 float isJoinAllowed();
@@ -444,7 +444,3 @@
 
 .float Version;
 .float(entity to) SendEntity;
-
-.float captures;
-.float returns;
-float caps_team1, caps_team2;

Modified: trunk/data/qcsrc/server/g_damage.qc
===================================================================
--- trunk/data/qcsrc/server/g_damage.qc	2008-07-26 07:23:04 UTC (rev 3923)
+++ trunk/data/qcsrc/server/g_damage.qc	2008-07-26 16:05:05 UTC (rev 3924)
@@ -345,7 +345,7 @@
 				if(g_ctf && targ.flagcarried)
 				{
 					GiveFrags(attacker, targ, cvar("g_ctf_flagscore_kill"));
-					PlayerScore_Add(attacker, SP_CTF_CARRIERKILLS, 1);
+					PlayerScore_Add(attacker, SP_CTF_FCKILLS, 1);
 				}
 				else
 					GiveFrags(attacker, targ, 1);

Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2008-07-26 07:23:04 UTC (rev 3923)
+++ trunk/data/qcsrc/server/g_world.qc	2008-07-26 16:05:05 UTC (rev 3924)
@@ -977,6 +977,7 @@
 	FOR_EACH_CLIENT(other)
 	{
 		// FIXME make this use the new score system
+		/*
 		if ((clienttype(other) == CLIENTTYPE_REAL) || (clienttype(other) == CLIENTTYPE_BOT && cvar("sv_logscores_bots")))
 		{
 			s = strcat(":player:", ftos(other.frags), ":");
@@ -991,8 +992,10 @@
 			if(to_file)
 				fputs(file, strcat(s, other.netname, "\n"));
 		}
+		*/
 	}
 
+	/*
 	if(g_ctf)
 	if(cvar("g_ctf_win_mode") != 2)
 	{
@@ -1007,6 +1010,7 @@
 		if(to_file)
 			fputs(file, strcat(s, "\n"));
 	}
+	*/
 
 	if(to_console)
 		ServerConsoleEcho(":end", FALSE);
@@ -1622,6 +1626,10 @@
 	{
 		status = WinningCondition_Onslaught(); // TODO remove this?
 	}
+	else if(g_ctf && !g_ctf_win_mode)
+	{
+		status = WinningCondition_Scores(capturelimit);
+	}
 	else
 	{
 		status = WinningCondition_Scores(fraglimit);

Modified: trunk/data/qcsrc/server/keyhunt.qc
===================================================================
--- trunk/data/qcsrc/server/keyhunt.qc	2008-07-26 07:23:04 UTC (rev 3923)
+++ trunk/data/qcsrc/server/keyhunt.qc	2008-07-26 16:05:05 UTC (rev 3924)
@@ -438,7 +438,7 @@
 	if(key.kh_dropperteam != player.team)
 	{
 		kh_Scores_Event(player, key, "collect", cvar("g_balance_keyhunt_score_collect"), 0);
-		PlayerScore_Add(player, SP_KH_COLLECT, 1);
+		PlayerScore_Add(player, SP_KH_PICKUPS, 1);
 	}
 	key.kh_dropperteam = 0;
 	bprint(player.netname, "^7 picked up the ", key.netname, "\n");
@@ -465,7 +465,7 @@
 		while((key = player.kh_next))
 		{
 			kh_Scores_Event(player, key, "losekey", 0, 0);
-			PlayerScore_Add(player, SP_KH_LOSEKEY, 1);
+			PlayerScore_Add(player, SP_KH_LOSSES, 1);
 			bprint(player.netname, "^7 died and lost the ", key.netname, "\n");
 			kh_Key_AssignTo(key, world);
 			makevectors('-1 0 0' * (45 + 45 * random()) + '0 360 0' * random());
@@ -670,7 +670,7 @@
 			kh_Scores_Event(lostkey.kh_previous_owner, world, "pushed", 0, -cvar("g_balance_keyhunt_score_push"));
 			// don't actually GIVE him the -nn points, just log
 		kh_Scores_Event(attacker, world, "push", cvar("g_balance_keyhunt_score_push"), 0);
-		PlayerScore_Add(attacker, SP_KH_PUSH, 1);
+		PlayerScore_Add(attacker, SP_KH_PUSHES, 1);
 		centerprint(attacker, "Your push is the best!\n\n\n");
 		bprint("The ", ColoredTeamName(teem), "^7 could not take care of the ", lostkey.netname, "^7 when ", attacker.netname, "^7 came\n");
 	}
@@ -691,7 +691,7 @@
 			kh_Scores_Event(lostkey.kh_previous_owner, world, "destroyed", 0, -cvar("g_balance_keyhunt_score_destroyed"));
 			// don't actually GIVE him the -nn points, just log
 
-		PlayerScore_Add(lostkey.kh_previous_owner, SP_KH_DESTROYED, 1);
+		PlayerScore_Add(lostkey.kh_previous_owner, SP_KH_DESTROYS, 1);
 
 		DistributeEvenly_Init(cvar("g_balance_keyhunt_score_destroyed"), keys * of + players);
 
@@ -903,7 +903,7 @@
 		else
 		{
 			kh_Scores_Event(attacker, targ.kh_next, "carrierfrag", cvar("g_balance_keyhunt_score_carrierfrag")-1, 0);
-			PlayerScore_Add(attacker, SP_KH_KCFRAG, 1);
+			PlayerScore_Add(attacker, SP_KH_KCKILLS, 1);
 			// the frag gets added later
 		}
 	}
@@ -977,15 +977,15 @@
 	ScoreInfo_SetLabel_TeamScore  (ST_SCORE,        "score",     SFL_SORT_PRIO_PRIMARY);
 	ScoreInfo_SetLabel_TeamScore  (ST_KH_CAPS,      "caps",      SFL_SORT_PRIO_SECONDARY);
 	ScoreInfo_SetLabel_PlayerScore(SP_KILLS,        "kills",     0);
-	ScoreInfo_SetLabel_PlayerScore(SP_DEATHS,       "deaths",    0);
+	ScoreInfo_SetLabel_PlayerScore(SP_DEATHS,       "deaths",    SFL_LOWER_IS_BETTER);
 	ScoreInfo_SetLabel_PlayerScore(SP_SUICIDES,     "suicides",  SFL_LOWER_IS_BETTER);
 	ScoreInfo_SetLabel_PlayerScore(SP_SCORE,        "score",     SFL_SORT_PRIO_PRIMARY);
-	ScoreInfo_SetLabel_PlayerScore(SP_KH_COLLECT,   "collect",   0);
-	ScoreInfo_SetLabel_PlayerScore(SP_KH_LOSEKEY,   "losekey",   SFL_LOWER_IS_BETTER);
+	ScoreInfo_SetLabel_PlayerScore(SP_KH_PICKUPS,   "pickups",   0);
+	ScoreInfo_SetLabel_PlayerScore(SP_KH_LOSSES,    "losses",    SFL_LOWER_IS_BETTER);
 	ScoreInfo_SetLabel_PlayerScore(SP_KH_CAPS,      "caps",      SFL_SORT_PRIO_SECONDARY);
-	ScoreInfo_SetLabel_PlayerScore(SP_KH_PUSH,      "push",      0);
-	ScoreInfo_SetLabel_PlayerScore(SP_KH_DESTROYED, "destroyed", SFL_LOWER_IS_BETTER);
-	ScoreInfo_SetLabel_PlayerScore(SP_KH_KCFRAG,    "kcfrag",    0);
+	ScoreInfo_SetLabel_PlayerScore(SP_KH_PUSHES,    "pushes",    0);
+	ScoreInfo_SetLabel_PlayerScore(SP_KH_DESTROYS,  "destroyed", SFL_LOWER_IS_BETTER);
+	ScoreInfo_SetLabel_PlayerScore(SP_KH_KCKILLS,   "kckills",   0);
 }
 
 void kh_finalize()

Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc	2008-07-26 07:23:04 UTC (rev 3923)
+++ trunk/data/qcsrc/server/miscfunctions.qc	2008-07-26 16:05:05 UTC (rev 3924)
@@ -754,6 +754,7 @@
 	sv_maxidle_spectatorsareidle = cvar("sv_maxidle_spectatorsareidle");
 	sv_pogostick = cvar("sv_pogostick");
 	sv_doublejump = cvar("sv_doublejump");
+	g_ctf_win_mode = cvar("g_ctf_win_mode");
 
 	g_pickup_shells                    = cvar("g_pickup_shells");
 	g_pickup_shells_max                = cvar("g_pickup_shells_max");

Modified: trunk/data/qcsrc/server/teamplay.qc
===================================================================
--- trunk/data/qcsrc/server/teamplay.qc	2008-07-26 07:23:04 UTC (rev 3923)
+++ trunk/data/qcsrc/server/teamplay.qc	2008-07-26 16:05:05 UTC (rev 3924)
@@ -100,6 +100,27 @@
 	cvar_set("teamplay", "0");
 }
 
+void default_delayedinit()
+{
+	remove(self);
+
+	if(!scores_initialized)
+	{
+		if(teamplay)
+		{
+			CheckAllowedTeams(world);
+			ScoreInfo_Init((c1>=0) + (c2>=0) + (c3>=0) + (c4>=0)); // NOTE this assumes that if team 2 is allowed, 1 is too, and if 3 is, 2 is, and if 4 is, 3 is!
+		}
+		else
+			ScoreInfo_Init(0); // NOTE this assumes that if team 2 is allowed, 1 is too, and if 3 is, 2 is, and if 4 is, 3 is!
+		ScoreInfo_SetLabel_TeamScore  (ST_SCORE,        "score",     SFL_SORT_PRIO_PRIMARY);
+		ScoreInfo_SetLabel_PlayerScore(SP_KILLS,        "kills",     0);
+		ScoreInfo_SetLabel_PlayerScore(SP_DEATHS,       "deaths",    SFL_LOWER_IS_BETTER);
+		ScoreInfo_SetLabel_PlayerScore(SP_SUICIDES,     "suicides",  SFL_LOWER_IS_BETTER);
+		ScoreInfo_SetLabel_PlayerScore(SP_SCORE,        "score",     SFL_SORT_PRIO_PRIMARY);
+	}
+}
+
 void ActivateTeamplay()
 {
 	float teamplay_default;
@@ -327,21 +348,10 @@
 	else if (game == GAME_ONSLAUGHT)
 		entcs_init();
 
-	if(!scores_initialized)
-	{
-		if(teamplay)
-		{
-			CheckAllowedTeams(world);
-			ScoreInfo_Init((c1>=0) + (c2>=0) + (c3>=0) + (c4>=0)); // NOTE this assumes that if team 2 is allowed, 1 is too, and if 3 is, 2 is, and if 4 is, 3 is!
-		}
-		else
-			ScoreInfo_Init(0); // NOTE this assumes that if team 2 is allowed, 1 is too, and if 3 is, 2 is, and if 4 is, 3 is!
-		ScoreInfo_SetLabel_TeamScore  (ST_SCORE,        "score",     SFL_SORT_PRIO_PRIMARY);
-		ScoreInfo_SetLabel_PlayerScore(SP_KILLS,        "kills",     0);
-		ScoreInfo_SetLabel_PlayerScore(SP_DEATHS,       "deaths",    0);
-		ScoreInfo_SetLabel_PlayerScore(SP_SUICIDES,     "suicides",  SFL_LOWER_IS_BETTER);
-		ScoreInfo_SetLabel_PlayerScore(SP_SCORE,        "score",     SFL_SORT_PRIO_PRIMARY);
-	}
+	entity e;
+	e = spawn();
+	e.nextthink = time + 0.3; // MUST be after all other delayed inits!
+	e.think = default_delayedinit;
 }
 
 string GetClientVersionMessage(float v) {




More information about the nexuiz-commits mailing list