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

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Sep 12 06:24:14 EDT 2009


Author: fruitiex
Date: 2009-09-12 06:24:04 -0400 (Sat, 12 Sep 2009)
New Revision: 7745

Added:
   trunk/data/gfx/hud/accelerometer_gradient.tga
Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/client/sbar.qc
Log:
use a gradient for the accelerometer, dynamically change it's color


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2009-09-12 09:52:05 UTC (rev 7744)
+++ trunk/data/defaultNexuiz.cfg	2009-09-12 10:24:04 UTC (rev 7745)
@@ -1593,7 +1593,8 @@
 seta cl_showacceleration_size 40 "height of the bar"
 seta cl_showacceleration_scale 1 "X-axis scale of the bar"
 seta cl_showacceleration_alpha 0.5 "alpha of the bar"
-seta cl_showacceleration_color "1 0 0" "color of the bar"
+seta cl_showacceleration_color_custom 0 "0 = dynamic color depending on acceleration, 1 = use custom color"
+seta cl_showacceleration_color "1 0 0" "color of the bar, needs cl_showacceleration_color_custom to be 1"
 seta cl_showacceleration_position 0.6 "Y-axis positioning of the bar"
 
 set g_jetpack 0 "Jetpack mutator (uses the hook's button, can't coexist with the offhand hook, but only with the onhand one)"

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


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

Modified: trunk/data/qcsrc/client/sbar.qc
===================================================================
--- trunk/data/qcsrc/client/sbar.qc	2009-09-12 09:52:05 UTC (rev 7744)
+++ trunk/data/qcsrc/client/sbar.qc	2009-09-12 10:24:04 UTC (rev 7745)
@@ -1923,11 +1923,6 @@
 	top_x = vid_conwidth/2;
 	top_y = 0;
 
-	size = cvar("cl_showacceleration_size");
-	scale = cvar("cl_showacceleration_scale");
-	alpha = cvar("cl_showacceleration_alpha");
-	color = stov(cvar_string("cl_showacceleration_color"));
-
 	for(i=0;i<=acc_avgspeeds;i+=1)
 		avgspeed += prev_speed[i];
 	avgspeed /= acc_avgspeeds;
@@ -1946,11 +1941,27 @@
 		prev_speed[0] = vlen(pmove_vel - pmove_vel_z * '0 0 1');
 
 	pos = top - size/2 * '0 1 0' + (cvar("cl_showacceleration_position") * vid_conheight) * '0 1 0';
-	
-	if (acceleration >= 0)
-		drawfill(pos, acceleration * scale * '10 0 0' + size * '0 1 0', color, alpha, DRAWFLAG_NORMAL);
-	else
-		drawfill(pos + acceleration * scale * '10 0 0', -acceleration * scale * '10 0 0' + size * '0 1 0', color, alpha, DRAWFLAG_NORMAL);
+
+	size = cvar("cl_showacceleration_size");
+	scale = cvar("cl_showacceleration_scale");
+	alpha = cvar("cl_showacceleration_alpha");
+	if (cvar("cl_showacceleration_color_custom"))
+		color = stov(cvar_string("cl_showacceleration_color"));
+	else {
+		color = '1 1 1';
+		if (acceleration < 0) {
+			color_y = 1 - (-acceleration * 0.05);
+			color_z = 1 - (-acceleration * 0.05);
+		} else if (acceleration > 0) {
+			color_x = 1 - (acceleration * 0.05);
+			color_z = 1 - (acceleration * 0.05);
+		}
+	}
+		
+	if (acceleration > 0)
+		drawpic(pos, "gfx/hud/accelerometer_gradient", acceleration * scale * '10 0 0' + size * '0 1 0', color, alpha, DRAWFLAG_NORMAL);
+	else if (acceleration < 0)
+		drawpic(pos + acceleration * scale * '10 0 0', "gfx/hud/accelerometer_gradient", -acceleration * scale * '10 0 0' + size * '0 1 0', color, alpha, DRAWFLAG_NORMAL);
 }
 
 void Sbar_DrawAccuracyStats_Description_Hitscan(vector position)



More information about the nexuiz-commits mailing list