r4537 - in trunk/data: . qcsrc/client

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Sep 28 05:29:43 EDT 2008


Author: div0
Date: 2008-09-28 05:29:43 -0400 (Sun, 28 Sep 2008)
New Revision: 4537

Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/client/mapvoting.qc
   trunk/data/qcsrc/client/miscfunctions.qc
   trunk/data/qcsrc/client/sbar.qc
Log:
sbar_width cvar


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2008-09-28 09:14:05 UTC (rev 4536)
+++ trunk/data/defaultNexuiz.cfg	2008-09-28 09:29:43 UTC (rev 4537)
@@ -1092,7 +1092,8 @@
 set capturelimit 0
 
 // sbar: font size
-set sbar_fontsize 11
+seta sbar_fontsize 11
+seta sbar_width 640
 alias sbar_font "loadfont user1 $*; loadfont user2 ${*}-big; sbar_columns_set"
 seta sbar_columns default
 sbar_font gfx/vera-sans

Modified: trunk/data/qcsrc/client/mapvoting.qc
===================================================================
--- trunk/data/qcsrc/client/mapvoting.qc	2008-09-28 09:14:05 UTC (rev 4536)
+++ trunk/data/qcsrc/client/mapvoting.qc	2008-09-28 09:29:43 UTC (rev 4537)
@@ -130,11 +130,7 @@
 		ymax = vid_conheight - ymin;
 
 	drawfont = sbar_bigfont;
-	sbar_fontsize = stov(cvar_string("sbar_fontsize"));
-	if(sbar_fontsize_x == 0)
-		sbar_fontsize = '8 8 0';
-	if(sbar_fontsize_y == 0)
-		sbar_fontsize_y = sbar_fontsize_x;
+	sbar_fontsize = Sbar_GetFontsize();
 
 	pos_y = ymin;
 	pos_z = 0;

Modified: trunk/data/qcsrc/client/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/client/miscfunctions.qc	2008-09-28 09:14:05 UTC (rev 4536)
+++ trunk/data/qcsrc/client/miscfunctions.qc	2008-09-28 09:29:43 UTC (rev 4537)
@@ -154,6 +154,23 @@
 	return '8 8 0' ;
 }
 
+float Sbar_GetWidth(float teamcolumnwidth)
+{
+	if(csqc_flags & CSQC_FLAG_READPICTURE)
+	{
+		float f;
+		f = stof(cvar_string("sbar_width"));
+		if(f == 0)
+			f = 640;
+		if(f < 320)
+			f = 320;
+		if(f > vid_conwidth - 2 * teamcolumnwidth)
+			f = vid_conwidth - 2 * teamcolumnwidth;
+		return f;
+	}
+	return 640;
+}
+
 float PreviewExists(string name)
 {
 	float f;

Modified: trunk/data/qcsrc/client/sbar.qc
===================================================================
--- trunk/data/qcsrc/client/sbar.qc	2008-09-28 09:14:05 UTC (rev 4536)
+++ trunk/data/qcsrc/client/sbar.qc	2008-09-28 09:29:43 UTC (rev 4537)
@@ -346,7 +346,7 @@
 
 string Sbar_DefaultColumnLayout()
 {
-	return "ping pl name | -ctf,kh/kills -ctf,kh/deaths +kh/caps +kh/pushes +kh/destroyed +ctf/caps +ctf/pickups +ctf/drops +ctf/fckills +ctf/returns -lms/score";
+	return "ping pl name | -ctf,kh/kills -ctf,kh/deaths +kh/caps +kh/pushes +kh/destroyed +ctf/caps +ctf/pickups +ctf/fckills +ctf/returns -lms/score";
 }
 
 void Cmd_Sbar_SetFields(float argc)
@@ -636,7 +636,7 @@
 		return strcat(substring(theText, 0, textLengthUpToWidth(theText, maxWidth - stringwidth("...", handleColors), handleColors)), "...");
 }
 
-float xmin, xmax, ymin, ymax, sbwidth, sbheight;
+float xmin, xmax, ymin, ymax, sbwidth;
 
 void Sbar_PrintScoreboardItem(vector pos, entity pl, float is_self)
 {
@@ -749,15 +749,14 @@
 		lastpingstime = time;
 	}
 
-	xmin = vid_conwidth / 10;
+	sbwidth = Sbar_GetWidth(6.5 * sbar_fontsize_y);
+
+	xmin = 0.5 * (vid_conwidth - sbwidth);
 	ymin = 20;
 
 	xmax = vid_conwidth - xmin;
-	ymax = vid_conheight - 0.2*vid_conheight;
+    ymax = vid_conheight - 0.2*vid_conheight;
 
-	sbwidth = xmax - xmin;
-	sbheight = ymax - ymin;
-
 	center_x = xmin + 0.5*sbwidth;
 
 	//Sbar_UpdateFields();




More information about the nexuiz-commits mailing list