r3929 - in trunk/data/qcsrc: client common server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Jul 26 13:54:31 EDT 2008


Author: div0
Date: 2008-07-26 13:54:30 -0400 (Sat, 26 Jul 2008)
New Revision: 3929

Modified:
   trunk/data/qcsrc/client/Defs.qc
   trunk/data/qcsrc/client/Main.qc
   trunk/data/qcsrc/client/View.qc
   trunk/data/qcsrc/client/csqc_constants.qc
   trunk/data/qcsrc/client/sbar.qc
   trunk/data/qcsrc/common/constants.qh
   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/teamplay.qc
Log:
remove crosshair when not needed; show map name, time limit, frag limit


Modified: trunk/data/qcsrc/client/Defs.qc
===================================================================
--- trunk/data/qcsrc/client/Defs.qc	2008-07-26 17:28:14 UTC (rev 3928)
+++ trunk/data/qcsrc/client/Defs.qc	2008-07-26 17:54:30 UTC (rev 3929)
@@ -173,3 +173,4 @@
 float vid_conwidth, vid_conheight;
 float caps_team1, caps_team2;
 float configdb;
+string shortmapname;

Modified: trunk/data/qcsrc/client/Main.qc
===================================================================
--- trunk/data/qcsrc/client/Main.qc	2008-07-26 17:28:14 UTC (rev 3928)
+++ trunk/data/qcsrc/client/Main.qc	2008-07-26 17:54:30 UTC (rev 3929)
@@ -373,17 +373,18 @@
 	local float file;
 	local vector mi_min, mi_max;
 
+	if(!strcasecmp(substring(mapname, 0, 5), "maps/"))
+		shortmapname = substring(mapname, 5, 999);
+	else
+		shortmapname = mapname;
+	len = strlen(shortmapname);
+	if(!strcasecmp(substring(shortmapname, len-4, 4), ".bsp"))
+		shortmapname = substring(shortmapname, 0, len-4);
+	shortmapname = strzone(shortmapname);
+
 	if(gametype == GAME_ONSLAUGHT) {
-		if(!strcasecmp(substring(mapname, 0, 5), "maps/"))
-			minimapname = substring(mapname, 5, 999);
-		else
-			minimapname = mapname;
-		len = strlen(minimapname);
-		if(!strcasecmp(substring(minimapname, len-4, 4), ".bsp"))
-			minimapname = substring(minimapname, 0, len-4);
-		
 		mapinfo = strcat("maps/", minimapname, ".info");
-		minimapname = strzone(strcat("gfx/", minimapname, "_mini.tga"));
+		minimapname = strzone(strcat("gfx/", shortmapname, "_mini.tga"));
 
 		mi_min = world.mins;
 		mi_max = world.maxs;

Modified: trunk/data/qcsrc/client/View.qc
===================================================================
--- trunk/data/qcsrc/client/View.qc	2008-07-26 17:28:14 UTC (rev 3928)
+++ trunk/data/qcsrc/client/View.qc	2008-07-26 17:54:30 UTC (rev 3929)
@@ -5,6 +5,7 @@
 void CSQC_kh_hud(void);
 void CSQC_ctf_hud(void);
 void PostInit(void);
+float Sbar_WouldDrawScoreboard ();
 void CSQC_UpdateView(void)
 {
 	// watch for gametype changes here...
@@ -31,7 +32,7 @@
 	R_SetView(VF_DRAWWORLD, 1);
 	
 	// Draw the Crosshair
-	R_SetView(VF_DRAWCROSSHAIR, 1);
+	R_SetView(VF_DRAWCROSSHAIR, !Sbar_WouldDrawScoreboard());
 	
 	// Draw the Engine Status Bar (the default Quake HUD)
 	draw_enginesbar = !cvar("sbar_usecsqc");

Modified: trunk/data/qcsrc/client/csqc_constants.qc
===================================================================
--- trunk/data/qcsrc/client/csqc_constants.qc	2008-07-26 17:28:14 UTC (rev 3928)
+++ trunk/data/qcsrc/client/csqc_constants.qc	2008-07-26 17:54:30 UTC (rev 3929)
@@ -59,6 +59,7 @@
 const float		STAT_ITEMS						= 15;
 const float		STAT_VIEWHEIGHT					= 16;
 
+const float		STAT_FRAGLIMIT					= 235;
 const float		STAT_TIMELIMIT					= 236;
 
 // Sound Constants

Modified: trunk/data/qcsrc/client/sbar.qc
===================================================================
--- trunk/data/qcsrc/client/sbar.qc	2008-07-26 17:28:14 UTC (rev 3928)
+++ trunk/data/qcsrc/client/sbar.qc	2008-07-26 17:54:30 UTC (rev 3929)
@@ -312,7 +312,7 @@
 
 string Sbar_DefaultColumnLayout()
 {
-	return "ping name | +kh,ctf/caps -ctf,kh/kills -ctf,kh/deaths -lms/score +lms/lives +lms/place";
+	return "ping name | +kh,ctf/caps -ctf,kh/kills -ctf,kh/deaths -lms/score +lms/lives +lms/rank";
 	/*
 	switch(gametype)
 	{
@@ -855,6 +855,36 @@
 		if(specs)
 			drawstring(rgb, "Spectators", sbar_fontsize, '1 1 1', 1, 0);
 	}
+
+	string str;
+	float tl, fl;
+	str = strcat("playing on ^2", shortmapname, "^7");
+	tl = getstatf(STAT_TIMELIMIT);
+	fl = getstatf(STAT_FRAGLIMIT);
+	if(gametype == GAME_LMS)
+	{
+		if(tl > 0)
+			str = strcat(str, " for up to ^1", ftos(tl), " minutes^7");
+	}
+	else
+	{
+		if(tl > 0)
+			str = strcat(str, " for ^1", ftos(tl), " minutes^7");
+		if(fl > 0)
+		{
+			if(tl > 0)
+				str = strcat(str, " or");
+			str = strcat(str, " until ^5", ftos(fl));
+			if(scores_label[ps_primary] == "score")
+				str = strcat(str, " points^7");
+			else
+				str = strcat(str, " ", scores_label[ps_primary]);
+		}
+	}
+	
+	pos_y += 1.5 * sbar_fontsize_y;
+	drawcolorcodedstring(pos + '0.5 0 0' * (sbwidth - sbar_fontsize_x * stringwidth(str, TRUE)), str, sbar_fontsize, 0.8, 0);
+
 	sbar = sbar_save;
 }
 
@@ -1080,6 +1110,17 @@
 	}
 }
 
+float Sbar_WouldDrawScoreboard ()
+{
+	if (sb_showscores)
+		return 1;
+	else if (intermission == 1)
+		return 1;
+	else if (intermission == 2)
+		return 1;
+	return 0;
+}
+
 void Sbar_Draw (void)
 {
 	float i;

Modified: trunk/data/qcsrc/common/constants.qh
===================================================================
--- trunk/data/qcsrc/common/constants.qh	2008-07-26 17:28:14 UTC (rev 3928)
+++ trunk/data/qcsrc/common/constants.qh	2008-07-26 17:54:30 UTC (rev 3929)
@@ -233,7 +233,7 @@
 #define SP_DOM_DOMPOINTS 4
 
 #define SP_LMS_LIVES 4
-#define SP_LMS_PLACE 5
+#define SP_LMS_RANK 5
 
 #define SP_KH_CAPS 4
 #define SP_KH_PUSHES 5

Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc	2008-07-26 17:28:14 UTC (rev 3928)
+++ trunk/data/qcsrc/server/cl_client.qc	2008-07-26 17:54:30 UTC (rev 3929)
@@ -378,7 +378,7 @@
 	{
 		if(g_lms)
 		{
-			if(PlayerScore_Add(self, SP_LMS_PLACE, 0) > 0)
+			if(PlayerScore_Add(self, SP_LMS_RANK, 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?
@@ -460,7 +460,7 @@
 	else if(g_lms)
 	{
 		// Only if the player cannot play at all
-		if(PlayerScore_Add(self, SP_LMS_PLACE, 0) == 666)
+		if(PlayerScore_Add(self, SP_LMS_RANK, 0) == 666)
 			self.frags = -666;
 		else
 			self.frags = -667;
@@ -557,7 +557,7 @@
 	// FIXME fix LMS scoring for new system
 	if(g_lms)
 	{
-		if(PlayerScore_Add(self, SP_LMS_PLACE, 0) > 0)
+		if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0)
 			self.classname = "observer";
 	}
 
@@ -1144,7 +1144,7 @@
 	{
 		if(PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives()) <= 0)
 		{
-			PlayerScore_Add(self, SP_LMS_PLACE, 666);
+			PlayerScore_Add(self, SP_LMS_RANK, 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-26 17:28:14 UTC (rev 3928)
+++ trunk/data/qcsrc/server/g_damage.qc	2008-07-26 17:54:30 UTC (rev 3929)
@@ -101,7 +101,7 @@
 		{
 			if(!lms_next_place)
 				lms_next_place = player_count;
-			PlayerScore_Add(targ, SP_LMS_PLACE, lms_next_place); // won't ever spawn again
+			PlayerScore_Add(targ, SP_LMS_RANK, lms_next_place); // won't ever spawn again
 			--lms_next_place;
 		}
 		f = 0;

Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2008-07-26 17:28:14 UTC (rev 3928)
+++ trunk/data/qcsrc/server/g_world.qc	2008-07-26 17:54:30 UTC (rev 3929)
@@ -1367,7 +1367,7 @@
 			{
 				// a winner!
 				// and assign him his first place
-				PlayerScore_Add(head, SP_LMS_PLACE, 1);
+				PlayerScore_Add(head, SP_LMS_RANK, 1);
 				return WINNING_YES;
 			}
 		}

Modified: trunk/data/qcsrc/server/teamplay.qc
===================================================================
--- trunk/data/qcsrc/server/teamplay.qc	2008-07-26 17:28:14 UTC (rev 3928)
+++ trunk/data/qcsrc/server/teamplay.qc	2008-07-26 17:54:30 UTC (rev 3929)
@@ -246,7 +246,7 @@
 		ScoreInfo_SetLabel_PlayerScore(SP_SUICIDES,     "suicides",  SFL_LOWER_IS_BETTER);
 		// do not define SP_SCORE for LMS
 		ScoreInfo_SetLabel_PlayerScore(SP_LMS_LIVES,    "lives",     SFL_SORT_PRIO_SECONDARY);
-		ScoreInfo_SetLabel_PlayerScore(SP_LMS_PLACE,    "place",     SFL_LOWER_IS_BETTER | SFL_HIDE_ZERO | SFL_SORT_PRIO_PRIMARY);
+		ScoreInfo_SetLabel_PlayerScore(SP_LMS_RANK,     "rank",      SFL_LOWER_IS_BETTER | SFL_HIDE_ZERO | SFL_SORT_PRIO_PRIMARY);
 	}
 	else if(game == GAME_ARENA || cvar("g_arena"))
 	{
@@ -401,7 +401,7 @@
 		{
 			if(g_lms)
 			{
-				p = PlayerScore_Add(self, SP_LMS_PLACE, 0);
+				p = PlayerScore_Add(self, SP_LMS_RANK, 0);
 				if(p >= 666)
 					return centerprint_atprio(self, CENTERPRIO_SPAM, strcat(NEWLINES, "^1Match has already begun\nwait for next round\n\n\n^7press attack to spectate other players"));
 				else if(p > 0)
@@ -412,7 +412,7 @@
 		{
 			if(g_lms)
 			{
-				p = PlayerScore_Add(self, SP_LMS_PLACE, 0);
+				p = PlayerScore_Add(self, SP_LMS_RANK, 0);
 				if(p)
 					return centerprint_atprio(self, CENTERPRIO_SPAM, strcat(NEWLINES, "spectating ", self.enemy.netname, "\n\n\n^7press attack for next player\npress attack2 for free fly mode"));
 			}




More information about the nexuiz-commits mailing list