[nexuiz-commits] r7219 - in trunk/data: . gfx/hud qcsrc/client

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Jul 14 01:37:17 EDT 2009


Author: div0
Date: 2009-07-14 01:37:16 -0400 (Tue, 14 Jul 2009)
New Revision: 7219

Added:
   trunk/data/gfx/hud/num_dot.tga
   trunk/data/gfx/hud/num_dot_stroke.tga
Modified:
   trunk/data/build-compat-pack.sh
   trunk/data/qcsrc/client/sbar.qc
Log:
race HUD


Modified: trunk/data/build-compat-pack.sh
===================================================================
--- trunk/data/build-compat-pack.sh	2009-07-13 11:41:39 UTC (rev 7218)
+++ trunk/data/build-compat-pack.sh	2009-07-14 05:37:16 UTC (rev 7219)
@@ -57,6 +57,7 @@
 	gfx/hud/num_9.tga
 	gfx/hud/num_colon_stroke.tga
 	gfx/hud/num_colon.tga
+	gfx/hud/num_dot.tga
 	gfx/hud/num_minus_stroke.tga
 	gfx/hud/num_minus.tga
 	gfx/hud/num_plus_stroke.tga

Added: trunk/data/gfx/hud/num_dot.tga
===================================================================
(Binary files differ)


Property changes on: trunk/data/gfx/hud/num_dot.tga
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/gfx/hud/num_dot_stroke.tga
===================================================================
(Binary files differ)


Property changes on: trunk/data/gfx/hud/num_dot_stroke.tga
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/data/qcsrc/client/sbar.qc
===================================================================
--- trunk/data/qcsrc/client/sbar.qc	2009-07-13 11:41:39 UTC (rev 7218)
+++ trunk/data/qcsrc/client/sbar.qc	2009-07-14 05:37:16 UTC (rev 7219)
@@ -1249,7 +1249,9 @@
 void Sbar_Score(float margin)
 {
 	float timelimit, minutes, seconds, timeleft, minutesLeft, secondsLeft, distribution, score, desiredPlayerId;
-	vector sbar_save, score_offset, timer_color, offset;
+	float racemin, racesec, racemsec;
+	float distsec, distmsec;
+	vector sbar_save, score_offset, timer_color, offset, distribution_color, minuspos;
 	entity tm, pl, me;
 	sbar_save = sbar;
 
@@ -1285,79 +1287,152 @@
 	}
 	score_offset_z = 0;
 	
-	if(teamplay)
+	if((scores_flags[ps_primary] & SFL_TIME) && !teamplay)
 	{
-		// Layout:
-		//
-		//   team1 team3 team4
-		//
-		//         TEAM2
-		//for(i = 0; i < 4; ++i)
+		// me vector := [team/connected frags id]
 
-		float max_fragcount;
-		max_fragcount = -999;
+		pl = players.sort_next;
+		if(pl == me)
+			pl = pl.sort_next;
+		if(scores_flags[ps_primary] & SFL_ZERO_IS_WORST)
+			if(pl.scores[ps_primary] == 0)
+				pl = world;
 
-		for(tm = teams.sort_next; tm; tm = tm.sort_next)
+		score = me.(scores[ps_primary]);
+		
+		racemin = floor(score/600);
+		racesec = floor((score - racemin*600)/10);
+		racemsec = score - racemin*600 - racesec*10;
+		
+		if (pl && ((!(scores_flags[ps_primary] & SFL_ZERO_IS_WORST)) || score)) {
+			
+			// distribution display
+			distribution = me.(scores[ps_primary]);
+			distribution -= pl.(scores[ps_primary]);
+			
+			if (distribution < 10 && distribution > -10)
+				distmsec = fabs(distribution);
+			else {
+				distsec = floor(fabs(distribution)/10);
+				distmsec = fabs(distribution) - distsec*10;
+			}
+			
+			if (distribution < 100 && distribution > -100) 
+				minuspos = bottomright - element_offset - score_offset + '130 -6 0' + '16 0 0';
+			else if (distribution < 1000 && distribution > -1000)
+				minuspos = bottomright - element_offset - score_offset + '130 -6 0';
+			else if (distribution < 10000 && distribution > -10000)
+				minuspos = bottomright - element_offset - score_offset + '130 -6 0' - '16 0 0';
+			else
+				minuspos = bottomright - element_offset - score_offset + '130 -6 0' - '32 0 0';
+				
+			if (distribution <= 0) {
+				distribution_color = '0 1 0';
+				drawpic(minuspos, "gfx/hud/num_minus", '16 16 0', distribution_color, sbar_alpha_fg, DRAWFLAG_ADDITIVE);
+			}
+			else {
+				distribution_color = '1 0 0';
+				drawpic(minuspos, "gfx/hud/num_plus", '16 16 0', distribution_color, sbar_alpha_fg, DRAWFLAG_ADDITIVE);
+			}
+			
+			Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0', distmsec, 4, 16, distribution_color, 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);
+			Sbar_DrawXNum(bottomright - element_offset - score_offset + '112 -6 0', distsec, 4, 16, distribution_color, 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);
+			drawpic(bottomright - element_offset - score_offset + '170 -6 0', "gfx/hud/num_dot", '16 16 0', distribution_color, sbar_alpha_fg, DRAWFLAG_ADDITIVE);
+		}
+		if (distribution <= 0 || distribution == score) // draw the highlight background behind the timer if we have the lead
+			drawpic(bottomright - element_offset - score_offset + '20 10 0', "gfx/hud/sb_highlight_4", '178 28 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+		
+		// big timer
+		Sbar_DrawXNum(bottomright - element_offset - score_offset + '76 10 0', racemsec, 4, 30, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);
+		Sbar_DrawXNum(bottomright - element_offset - score_offset + '36 10 0', racesec, 4, 30, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);
+		if (racesec < 10)
+			Sbar_DrawXNum(bottomright - element_offset - score_offset + '8 10 0', 0, 4, 30, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);
+		drawpic(bottomright - element_offset - score_offset + '145 10 0', "gfx/hud/num_dot", '30 30 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE);
+		
+		if (racemin < 10) {
+			Sbar_DrawXNum(bottomright - element_offset - score_offset + '-36 10 0', racemin, 4, 30, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);
+			Sbar_DrawXNum(bottomright - element_offset - score_offset + '-66 10 0', 0, 4, 30, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);
+		}
+		else {
+			Sbar_DrawXNum(bottomright - element_offset - score_offset + '-36 10 0', racemin, 4, 30, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);
+		}
+		drawpic(bottomright - element_offset - score_offset + '76 8 0', "gfx/hud/num_colon", '30 30 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE);
+	}
+	else {
+		if(teamplay)
 		{
-			if(tm.team == COLOR_SPECTATOR || !tm.team_size) // no players? don't display
-				continue;
-			// -32*4 = -128
-			score = tm.(teamscores[ts_primary]);
+			// Layout:
+			//
+			//   team1 team3 team4
+			//
+			//         TEAM2
+			//for(i = 0; i < 4; ++i)
 
-			if (score > max_fragcount)
-				max_fragcount = score;
+			float max_fragcount;
+			max_fragcount = -999;
 
-			if(tm.team == myteam) {
-				if (max_fragcount == score)
-					Sbar_DrawXNum(bottomright - element_offset - score_offset, score, 4, 34, GetTeamRGB(tm.team) * 0.8, 1, 1, sbar_alpha_fg, DRAWFLAG_NORMAL);
-				else
-					Sbar_DrawXNum(bottomright - element_offset - score_offset, score, 4, 34, GetTeamRGB(tm.team) * 0.8, 0, 1, sbar_alpha_fg, DRAWFLAG_NORMAL);
-			}
-			else
+			for(tm = teams.sort_next; tm; tm = tm.sort_next)
 			{
-				if (max_fragcount == score)
-					Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0' - offset, score, 4, 16, GetTeamRGB(tm.team) * 0.8, 1, 1, sbar_alpha_fg, DRAWFLAG_NORMAL);
+				if(tm.team == COLOR_SPECTATOR || !tm.team_size) // no players? don't display
+					continue;
+				// -32*4 = -128
+				score = tm.(teamscores[ts_primary]);
+
+				if (score > max_fragcount)
+					max_fragcount = score;
+
+				if(tm.team == myteam) {
+					if (max_fragcount == score)
+						Sbar_DrawXNum(bottomright - element_offset - score_offset, score, 4, 34, GetTeamRGB(tm.team) * 0.8, 1, 1, sbar_alpha_fg, DRAWFLAG_NORMAL);
+					else
+						Sbar_DrawXNum(bottomright - element_offset - score_offset, score, 4, 34, GetTeamRGB(tm.team) * 0.8, 0, 1, sbar_alpha_fg, DRAWFLAG_NORMAL);
+				}
 				else
-					Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0' - offset, score, 4, 16, GetTeamRGB(tm.team) * 0.8, 0, 1, sbar_alpha_fg, DRAWFLAG_NORMAL);
-				offset_y -= 16;
+				{
+					if (max_fragcount == score)
+						Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0' - offset, score, 4, 16, GetTeamRGB(tm.team) * 0.8, 1, 1, sbar_alpha_fg, DRAWFLAG_NORMAL);
+					else
+						Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0' - offset, score, 4, 16, GetTeamRGB(tm.team) * 0.8, 0, 1, sbar_alpha_fg, DRAWFLAG_NORMAL);
+					offset_y -= 16;
+				}
 			}
-		}
-	} else {
-		// me vector := [team/connected frags id]
+		} else {
+			// me vector := [team/connected frags id]
 
-		pl = players.sort_next;
-		if(pl == me)
-			pl = pl.sort_next;
+			pl = players.sort_next;
+			if(pl == me)
+				pl = pl.sort_next;
 
-		if(pl) {
-			distribution = me.(scores[ps_primary]);
-			distribution -= pl.(scores[ps_primary]);
-		} else
-			distribution = 0;
+			if(pl) {
+				distribution = me.(scores[ps_primary]);
+				distribution -= pl.(scores[ps_primary]);
+			} else
+				distribution = 0;
 
-		score = me.(scores[ps_primary]);
+			score = me.(scores[ps_primary]);
 
-		if(distribution >= 0)
-		{
-			if (distribution != 0) {
-				// draw a + sign in front of the score
-				if (distribution < 10) { drawpic(bottomright - element_offset - score_offset + '132 -6 0' + '32 0 0', "gfx/hud/num_plus", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); }
-				else if (distribution < 100) { drawpic(bottomright - element_offset - score_offset + '132 -6 0' + '16 0 0', "gfx/hud/num_plus", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); }
-				else if (distribution < 1000) { drawpic(bottomright - element_offset - score_offset + '132 -6 0', "gfx/hud/num_plus", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); }
+			if(distribution >= 0)
+			{
+				if (distribution != 0) {
+					// draw a + sign in front of the score
+					if (distribution < 10) { drawpic(bottomright - element_offset - score_offset + '132 -6 0' + '32 0 0', "gfx/hud/num_plus", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); }
+					else if (distribution < 100) { drawpic(bottomright - element_offset - score_offset + '132 -6 0' + '16 0 0', "gfx/hud/num_plus", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); }
+					else if (distribution < 1000) { drawpic(bottomright - element_offset - score_offset + '132 -6 0', "gfx/hud/num_plus", '16 16 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_ADDITIVE); }
+				}
+
+				Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0', distribution, 4, 16, ' 1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);
+				Sbar_DrawXNum(bottomright - element_offset - score_offset, score, 4, 34, '1 1 1', 1, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);
 			}
-
-			Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0', distribution, 4, 16, ' 1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);
-			Sbar_DrawXNum(bottomright - element_offset - score_offset, score, 4, 34, '1 1 1', 1, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);
+			else if(distribution >= -5)
+			{
+				Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0', distribution, 4, 16, ' 1 1 0', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);
+				Sbar_DrawXNum(bottomright - element_offset - score_offset, score, 4, 34, '1 1 0', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);
+			}
+			else {
+				Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0', distribution, 4, 16, ' 1 0 0', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);
+				Sbar_DrawXNum(bottomright - element_offset - score_offset, score, 4, 34, '1 0 0', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);
+			}
 		}
-		else if(distribution >= -5)
-		{
-			Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0', distribution, 4, 16, ' 1 1 0', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);
-			Sbar_DrawXNum(bottomright - element_offset - score_offset, score, 4, 34, '1 1 0', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);
-		}
-		else {
-			Sbar_DrawXNum(bottomright - element_offset - score_offset + '132 -6 0', distribution, 4, 16, ' 1 0 0', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);
-			Sbar_DrawXNum(bottomright - element_offset - score_offset, score, 4, 34, '1 0 0', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);
-		}
 	}
 
 	//draw the remaining or elapsed time



More information about the nexuiz-commits mailing list