[nexuiz-commits] r6778 - trunk/data/qcsrc/client

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue May 26 12:57:39 EDT 2009


Author: greenmarine
Date: 2009-05-26 12:57:39 -0400 (Tue, 26 May 2009)
New Revision: 6778

Modified:
   trunk/data/qcsrc/client/sbar.qc
Log:
fixed bug in the score-area of the HUD (showing your score, rank and difference to 1st placed), so that in case you are spectating someone and not playing yourself, it now shows the score of the spectated player

Modified: trunk/data/qcsrc/client/sbar.qc
===================================================================
--- trunk/data/qcsrc/client/sbar.qc	2009-05-26 13:59:56 UTC (rev 6777)
+++ trunk/data/qcsrc/client/sbar.qc	2009-05-26 16:57:39 UTC (rev 6778)
@@ -1094,12 +1094,20 @@
 
 void Sbar_Score(float margin)
 {
-	float timelimit, minutes, seconds, timeleft, minutesLeft, secondsLeft, distribution, myplace, score;
+	float timelimit, minutes, seconds, timeleft, minutesLeft, secondsLeft, distribution, myplace, score, desiredPlayerId;
 	vector sbar_save, place, timer_color;
 	entity tm, pl, me;
-	sbar_save = sbar;
-	
-	myteam = GetPlayerColor(player_localentnum - 1);
+	sbar_save = sbar;
+	
+	//get the ID (could be "me", or the player I'm spectating)
+	desiredPlayerId = player_localentnum - 1;
+	if (spectatee_status) {
+		if (spectatee_status != -1) {
+			desiredPlayerId = spectatee_status - 1;
+		}
+	}
+	
+	myteam = GetPlayerColor(desiredPlayerId);
 
 	sbar_y = vid_conheight - (32+12);
 	sbar_x -= margin;
@@ -1134,7 +1142,7 @@
 		{
 			if(me.team != COLOR_SPECTATOR)
 				++myplace;
-			if(me.sv_entnum == player_localentnum - 1)
+			if(me.sv_entnum == desiredPlayerId)
 				break;
 		}
 		pl = players.sort_next;



More information about the nexuiz-commits mailing list