r3913 - in trunk/data/qcsrc: common server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Jul 25 13:08:00 EDT 2008


Author: div0
Date: 2008-07-25 13:08:00 -0400 (Fri, 25 Jul 2008)
New Revision: 3913

Modified:
   trunk/data/qcsrc/common/constants.qh
   trunk/data/qcsrc/server/arena.qc
   trunk/data/qcsrc/server/cl_client.qc
   trunk/data/qcsrc/server/g_damage.qc
   trunk/data/qcsrc/server/g_world.qc
   trunk/data/qcsrc/server/keyhunt.qc
   trunk/data/qcsrc/server/teamplay.qc
Log:
either a total screwup, or LMS support


Modified: trunk/data/qcsrc/common/constants.qh
===================================================================
--- trunk/data/qcsrc/common/constants.qh	2008-07-25 16:33:06 UTC (rev 3912)
+++ trunk/data/qcsrc/common/constants.qh	2008-07-25 17:08:00 UTC (rev 3913)
@@ -228,6 +228,9 @@
 #define ST_DOM_DOMPOINTS 1
 #define SP_DOM_DOMPOINTS 4
 
+#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

Modified: trunk/data/qcsrc/server/arena.qc
===================================================================
--- trunk/data/qcsrc/server/arena.qc	2008-07-25 16:33:06 UTC (rev 3912)
+++ trunk/data/qcsrc/server/arena.qc	2008-07-25 17:08:00 UTC (rev 3913)
@@ -86,7 +86,6 @@
 		{
 			removedecor(self);
 		}
-		// TODO properly reset Onslaught
 		else if(self.classname == "onslaught_generator")
 		{
 			onslaught_generator_reset();
@@ -129,8 +128,8 @@
 					//NEW: changed behaviour so that it prevents that previous spectators/observers suddenly spawn as players
 					if (self.classname == "player") {
 						PlayerScore_Clear(self);
-						// FIXME decide what LMS does in the new scoring system!
-						self.frags = (g_lms)?LMS_NewPlayerLives():0;
+						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

Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2008-07-25 16:33:06 UTC (rev 3912)
+++ trunk/data/qcsrc/server/cl_client.qc	2008-07-25 17:08:00 UTC (rev 3913)
@@ -373,11 +373,18 @@
 
 	WaypointSprite_PlayerDead();
 	
-	// FIXME LMS needs the new scoring system
-	if(self.frags <= 0 && self.frags > -666 && g_lms && self.killcount != -666)
-		bprint ("^4", self.netname, "^4 has no more lives left\n");
-	else if(self.killcount != -666)
-		bprint ("^4", self.netname, "^4 is spectating now\n");
+	if(self.killcount != -666)
+	{
+		if(g_lms)
+		{
+			if(PlayerScoreAdd(self, SP_LMS_PLACE, 0) > 0)
+				bprint ("^4", self.netname, "^4 has no more lives left\n");
+			else
+				bprint ("^4", self.netname, "^4 is spectating now\n"); // TODO turn this into a proper forfeit?
+		}
+		else
+			bprint ("^4", self.netname, "^4 is spectating now\n");
+	}
 
 	PlayerScore_Clear(self); // clear scores when needed
 
@@ -444,6 +451,7 @@
 		if(self.frags != -2)
 		{
 			Spawnqueue_Insert(self);
+			// FIXME what IS this?
 		}
 		else
 		{
@@ -451,7 +459,7 @@
 			Spawnqueue_Remove(self);
 		}
 	}
-	else if(!g_lms)
+	else
 		self.frags = -666;
 	
 	net_UpdateDeaths(MSG_BROADCAST);
@@ -543,8 +551,11 @@
 
 	// player is dead and becomes observer
 	// FIXME fix LMS scoring for new system
-	if(g_lms && self.frags < 1)
-		self.classname = "observer";
+	if(g_lms)
+	{
+		if(PlayerScoreAdd(self, SP_LMS_PLACE, 0) > 0)
+			self.classname = "observer";
+	}
 
 	if(g_arena)
 	if(!self.spawned)
@@ -1096,15 +1107,8 @@
 
 	stuffcmd(self, strcat("set gametype ", ftos(game), "\n"));
 
-	if(g_lms)
+	if(g_arena)
 	{
-		// FIXME fix LMS lives for new system
-		self.frags = LMS_NewPlayerLives();
-		if(!self.frags)
-			self.frags = -666;
-	}
-	else if(g_arena)
-	{
 		self.classname = "observer";
 		Spawnqueue_Insert(self);
 	}
@@ -1143,6 +1147,15 @@
 			MapVote_UpdateData(MSG_ONE);
 		}
 	}
+
+	if(g_lms)
+	{
+		if(PlayerScoreAdd(self, SP_LMS_LIVES, LMS_NewPlayerLives()) <= 0)
+		{
+			PlayerScoreAdd(self, SP_LMS_PLACE, 666);
+			self.frags = -666; // FIXME do we still need this?
+		}
+	}
 }
 
 /*

Modified: trunk/data/qcsrc/server/g_damage.qc
===================================================================
--- trunk/data/qcsrc/server/g_damage.qc	2008-07-25 16:33:06 UTC (rev 3912)
+++ trunk/data/qcsrc/server/g_damage.qc	2008-07-25 17:08:00 UTC (rev 3913)
@@ -54,17 +54,37 @@
 		if(cvar("g_arena_roundbased"))
 			return;
 
+	if(f < 0)
+	{
+		if(targ == attacker)
+		{
+			// suicide
+			PlayerScore_Add(attacker, SP_SUICIDES, 1);
+		}
+		else
+		{
+			// teamkill
+			PlayerScore_Add(attacker, SP_KILLS, -1); // or maybe add a teamkills field?
+		}
+	}
+	else
+	{
+		// regular frag
+		PlayerScore_Add(attacker, SP_KILLS, 1);
+	}
+
+	PlayerScore_Add(targ, SP_DEATHS, 1);
+
 	// FIXME fix the mess this is (we have REAL points now!)
 	if(g_domination)
 	{
 		if(cvar("g_domination_disable_frags"))
 			if(f > 0)
-				return;
+				f = 0;
 	}
 	else if(g_runematch)
 	{
-		if(f > 0)
-			f = RunematchHandleFrags(attacker, targ, f);
+		f = RunematchHandleFrags(attacker, targ, f);
 	}
 	else if(g_keyhunt)
 	{
@@ -72,21 +92,19 @@
 	}
 	else if(g_lms)
 	{
-		// FIXME fix LMS mode for new scoreboard
-		// count remaining lives, not frags in lms
-		targ.frags -= 1;
-		// keep track of the worst players lives
-		if(targ.frags < lms_lowest_lives)
-			lms_lowest_lives = targ.frags;
-		// player has no more lives left
-		if (!targ.frags)
+		// remove a life
+		float tl;
+		tl = PlayerScore_Add(targ, SP_LMS_LIVES, -1);
+		if(tl < lms_lowest_lives)
+			lms_lowest_lives = tl;
+		if(tl <= 0)
 		{
 			if(!lms_next_place)
 				lms_next_place = player_count;
-			targ.frags = -lms_next_place;
-			lms_next_place -= 1;
+			PlayerScore_Add(targ, SP_LMS_PLACE, lms_next_place); // won't ever spawn again
+			--lms_next_place;
 		}
-		return;
+		f = 0;
 	}
 
 	if(f)
@@ -193,8 +211,6 @@
 				if(deathtype != DEATH_TEAMCHANGE)
 				{
 					LogDeath("suicide", deathtype, targ, targ);
-					PlayerScore_Add(targ, SP_SUICIDES, 1);
-					PlayerScore_Add(targ, SP_DEATHS, 1);
 					GiveFrags(attacker, targ, -1);
 				}
 				if (targ.killcount > 2)
@@ -226,8 +242,6 @@
 				if(deathtype != DEATH_TEAMCHANGE)
 				{
 					LogDeath("suicide", deathtype, targ, targ);
-					PlayerScore_Add(targ, SP_SUICIDES, 1);
-					PlayerScore_Add(targ, SP_DEATHS, 1);
 					GiveFrags(attacker, targ, -1);
 				}
 				if (targ.killcount > 2)
@@ -246,8 +260,6 @@
 					bprint ("^1", a, "^1 mows down a teammate\n");
 				}
 				GiveFrags(attacker, targ, -1);
-				PlayerScore_Add(attacker, SP_KILLS, -1); // teamkills DO cound as -1 kill right? or make separate teamkill counter?
-				PlayerScore_Add(targ, SP_DEATHS, 1);
 				if (targ.killcount > 2) {
 					if(sv_gentle)
 						bprint ("^1",s,"'s ^1",ftos(targ.killcount)," scoring spree was ended by a teammate!\n");
@@ -335,8 +347,6 @@
 				}
 				else
 					GiveFrags(attacker, targ, 1);
-				PlayerScore_Add(attacker, SP_KILLS, 1);
-				PlayerScore_Add(targ, SP_DEATHS, 1);
 				if (targ.killcount > 2) {
 					if(sv_gentle)
 						bprint ("^1",s,"'s ^1", ftos(targ.killcount), " scoring spree was ended by ", a, "\n");
@@ -455,8 +465,6 @@
 				else
 					bprint ("^1",s, "^1 died\n");
 			GiveFrags(targ, targ, -1);
-			PlayerScore_Add(targ, SP_SUICIDES, 1);
-			PlayerScore_Add(targ, SP_DEATHS, 1);
 			// FIXME move this into winning condition checking? or allow READING of the scores?
 			if(targ.frags == -5) {
 				announce(targ, "announcer/male/botlike.ogg");

Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2008-07-25 16:33:06 UTC (rev 3912)
+++ trunk/data/qcsrc/server/g_world.qc	2008-07-25 17:08:00 UTC (rev 3913)
@@ -1266,11 +1266,11 @@
 
 	// first player has left the game for dying too much? Nobody else can get in.
 	if(lms_lowest_lives < 1)
-		return FALSE;
+		return 0;
 
 	if(!cvar("g_lms_join_anytime"))
 		if(lms_lowest_lives < fl - cvar("g_lms_last_join"))
-			return FALSE;
+			return 0;
 
 	return bound(1, lms_lowest_lives, fl);
 }
@@ -1361,15 +1361,18 @@
 		else
 		{
 			// exactly one player?
+
+			ClearWinners();
+			SetWinners(winning, 0); // NOTE: exactly one player is still "player", so this works out
+
 			if(l)
 			{
-				// but no game has taken place yet
+				// game still running (that is, nobody got removed from the game by a frag yet)? then continue
+				return WINNING_NO;
 			}
 			else
 			{
 				// a winner!
-				ClearWinners(); SetWinners(winning, 0); // NOTE: exactly one player is still "player", so this works out
-				dprint("Have a winner, ending game.\n");
 				return WINNING_YES;
 			}
 		}
@@ -1391,28 +1394,13 @@
 	}
 
 	// When we get here, we have at least two players who are actually LIVING,
-	// or one player who is still waiting for a victim to join the server. Now
-	// check if the top two players have equal score.
+	// now check if the top two players have equal score.
+	WinningConditionHelper();
 
-	checkrules_leaderfrags = 0;
-	checkrules_equality = FALSE;
-	FOR_EACH_PLAYER(head)
-	{
-		if(head.frags > checkrules_leaderfrags)
-		{
-			checkrules_leaderfrags = head.frags;
-			checkrules_equality = FALSE;
-		}
-		else if(head.frags > 0 && head.frags == checkrules_leaderfrags)
-			checkrules_equality = TRUE;
-	}
-
-	SetWinners(frags, checkrules_leaderfrags);
-
-	// The top two players have the same amount of lives? No timelimit then,
-	// enter overtime...
-
-	if(checkrules_equality)
+	ClearWinners();
+	if(WinningConditionHelper_winner)
+		WinningConditionHelper_winner.winning = TRUE;
+	if(WinningConditionHelper_equality)
 		return WINNING_NEVER;
 
 	// Top two have different scores? Way to go for our beloved TIMELIMIT!

Modified: trunk/data/qcsrc/server/keyhunt.qc
===================================================================
--- trunk/data/qcsrc/server/keyhunt.qc	2008-07-25 16:33:06 UTC (rev 3912)
+++ trunk/data/qcsrc/server/keyhunt.qc	2008-07-25 17:08:00 UTC (rev 3913)
@@ -975,7 +975,7 @@
 
 	ScoreInfo_Init(kh_teams);
 	ScoreInfo_SetLabel_TeamScore  (ST_SCORE,        "score",     SFL_SORT_PRIO_PRIMARY);
-	ScoreInfo_SetLabel_TeamScore  (ST_KH_CAPS,      "caps",      SFL_SORT_PRIO_MED);
+	ScoreInfo_SetLabel_TeamScore  (ST_KH_CAPS,      "caps",      SFL_SORT_PRIO_HIGH);
 	ScoreInfo_SetLabel_PlayerScore(SP_KILLS,        "kills",     0);
 	ScoreInfo_SetLabel_PlayerScore(SP_DEATHS,       "deaths",    0);
 	ScoreInfo_SetLabel_PlayerScore(SP_SUICIDES,     "suicides",  SFL_DECREASING);

Modified: trunk/data/qcsrc/server/teamplay.qc
===================================================================
--- trunk/data/qcsrc/server/teamplay.qc	2008-07-25 16:33:06 UTC (rev 3912)
+++ trunk/data/qcsrc/server/teamplay.qc	2008-07-25 17:08:00 UTC (rev 3913)
@@ -217,7 +217,15 @@
 			fraglimit_override = -1;
 		gamemode_name = "Last Man Standing";
 		teams_matter = 0;
-		lms_lowest_lives = 999;
+		lms_lowest_lives = 9999;
+
+		ScoreInfo_Init(0);
+		ScoreInfo_SetLabel_PlayerScore(SP_KILLS,        "kills",     0);
+		ScoreInfo_SetLabel_PlayerScore(SP_DEATHS,       "deaths",    0);
+		ScoreInfo_SetLabel_PlayerScore(SP_SUICIDES,     "suicides",  SFL_DECREASING);
+		// do not define SP_SCORE for LMS
+		ScoreInfo_SetLabel_PlayerScore(SP_LMS_LIVES,    "lives",     SFL_SORT_PRIO_MED);
+		ScoreInfo_SetLabel_PlayerScore(SP_LMS_PLACE,    "place",     SFL_SORT_PRIO_PRIMARY);
 	}
 	else if(game == GAME_ARENA || cvar("g_arena"))
 	{




More information about the nexuiz-commits mailing list