[nexuiz-commits] r7765 - in branches/nexuiz-2.0: . data data/demos data/gfx/hud data/qcsrc/client

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Sep 12 13:20:57 EDT 2009


Author: div0
Date: 2009-09-12 13:20:56 -0400 (Sat, 12 Sep 2009)
New Revision: 7765

Added:
   branches/nexuiz-2.0/data/demos/piece-o-cake.dem
   branches/nexuiz-2.0/data/gfx/hud/accelerometer_gradient.tga
Modified:
   branches/nexuiz-2.0/.patchsets
   branches/nexuiz-2.0/data/defaultNexuiz.cfg
   branches/nexuiz-2.0/data/qcsrc/client/View.qc
   branches/nexuiz-2.0/data/qcsrc/client/csqc_constants.qc
   branches/nexuiz-2.0/data/qcsrc/client/sbar.qc
Log:
r7763 | fruitiex | 2009-09-12 13:00:24 -0400 (Sat, 12 Sep 2009) | 2 lines
piece-o-cake demo ;)
r7744 | fruitiex | 2009-09-12 05:52:05 -0400 (Sat, 12 Sep 2009) | 2 lines
CSQC accelerometer! Please test (cl_showacceleration 1)
r7745 | fruitiex | 2009-09-12 06:24:04 -0400 (Sat, 12 Sep 2009) | 2 lines
use a gradient for the accelerometer, dynamically change it's color
r7752 | div0 | 2009-09-12 09:05:17 -0400 (Sat, 12 Sep 2009) | 2 lines
better accelerometer, now fps independent
r7756 | div0 | 2009-09-12 10:15:45 -0400 (Sat, 12 Sep 2009) | 2 lines
fix warnings in accelerometer


Modified: branches/nexuiz-2.0/.patchsets
===================================================================
--- branches/nexuiz-2.0/.patchsets	2009-09-12 17:04:16 UTC (rev 7764)
+++ branches/nexuiz-2.0/.patchsets	2009-09-12 17:20:56 UTC (rev 7765)
@@ -1,2 +1,2 @@
 master = svn://svn.icculus.org/nexuiz/trunk
-revisions_applied = 1-7563,7565-7586,7589-7589,7592-7592,7595-7595,7597-7597,7599-7602,7605-7610,7612-7615,7619-7620,7623-7623,7626-7628,7630-7630,7644-7651,7656-7656,7658-7660,7663-7665,7670-7670,7672-7676,7678-7680,7686-7687,7689-7698,7701-7701,7703-7714,7717-7723,7731-7731,7735-7741,7753-7754,7758-7758,7761-7761
+revisions_applied = 1-7563,7565-7586,7589-7589,7592-7592,7595-7595,7597-7597,7599-7602,7605-7610,7612-7615,7619-7620,7623-7623,7626-7628,7630-7630,7644-7651,7656-7656,7658-7660,7663-7665,7670-7670,7672-7676,7678-7680,7686-7687,7689-7698,7701-7701,7703-7714,7717-7723,7731-7731,7735-7741,7744-7745,7752-7754,7756-7756,7758-7758,7761-7763

Modified: branches/nexuiz-2.0/data/defaultNexuiz.cfg
===================================================================
--- branches/nexuiz-2.0/data/defaultNexuiz.cfg	2009-09-12 17:04:16 UTC (rev 7764)
+++ branches/nexuiz-2.0/data/defaultNexuiz.cfg	2009-09-12 17:20:56 UTC (rev 7765)
@@ -1580,6 +1580,15 @@
 seta cl_showspeed_size 14 "size of the numbers"
 seta cl_showspeed_position 0.7 "Y-axis positioning of the numbers"
 
+seta cl_showacceleration 0 "show the XY acceleration of the player"
+seta cl_showacceleration_z 0 "include the speed on the Z-axis"
+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_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)"
 set g_jetpack_antigravity 0.8 "factor of gravity compensation of the jetpack"
 set g_jetpack_acceleration_side 1200 "acceleration of the jetpack in xy direction"

Copied: branches/nexuiz-2.0/data/demos/piece-o-cake.dem (from rev 7763, trunk/data/demos/piece-o-cake.dem)
===================================================================
(Binary files differ)

Copied: branches/nexuiz-2.0/data/gfx/hud/accelerometer_gradient.tga (from rev 7745, trunk/data/gfx/hud/accelerometer_gradient.tga)
===================================================================
(Binary files differ)

Modified: branches/nexuiz-2.0/data/qcsrc/client/View.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/client/View.qc	2009-09-12 17:04:16 UTC (rev 7764)
+++ branches/nexuiz-2.0/data/qcsrc/client/View.qc	2009-09-12 17:20:56 UTC (rev 7765)
@@ -550,6 +550,8 @@
 		
 		if (cvar("cl_showspeed"))
 			Sbar_ShowSpeed();
+		if (cvar("cl_showacceleration"))
+			Sbar_ShowAcceleration();
 		
  		Sbar_DrawCenterPrint(); // draw centerprint messages even if viewsize >= 120
 	}

Modified: branches/nexuiz-2.0/data/qcsrc/client/csqc_constants.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/client/csqc_constants.qc	2009-09-12 17:04:16 UTC (rev 7764)
+++ branches/nexuiz-2.0/data/qcsrc/client/csqc_constants.qc	2009-09-12 17:20:56 UTC (rev 7765)
@@ -63,6 +63,7 @@
 const float		STAT_FRAGLIMIT					= 235;
 const float		STAT_TIMELIMIT					= 236;
 const float     STAT_MOVEVARS_GRAVITY           = 242;
+const float     STAT_MOVEVARS_MAXSPEED          = 244;
 
 // Sound Constants
 //const float		CHAN_AUTO						= 0;

Modified: branches/nexuiz-2.0/data/qcsrc/client/sbar.qc
===================================================================
--- branches/nexuiz-2.0/data/qcsrc/client/sbar.qc	2009-09-12 17:04:16 UTC (rev 7764)
+++ branches/nexuiz-2.0/data/qcsrc/client/sbar.qc	2009-09-12 17:20:56 UTC (rev 7765)
@@ -1952,6 +1952,51 @@
 	drawstringcenter('1 0 0' + pos * '0 1 0', speed, numsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
 }
 
+vector acc_prevspeed;
+float acc_prevtime;
+float acc_avg;
+
+void Sbar_ShowAcceleration(void)
+{
+	float acceleration, sz, scale, alpha, f;
+	vector pos, top, rgb;
+	top_x = vid_conwidth/2;
+	top_y = 0;
+
+	f = time - acc_prevtime;
+	if(cvar("cl_showacceleration_z"))
+		acceleration = (vlen(pmove_vel) - vlen(acc_prevspeed)) * (1 / f);
+	else
+		acceleration = (vlen(pmove_vel - '0 0 1' * pmove_vel_z) - vlen(acc_prevspeed - '0 0 1' * acc_prevspeed_z)) * (1 / f);
+	acc_prevspeed = pmove_vel;
+	acc_prevtime = time;
+
+	f = bound(0, f * 10, 1);
+	acc_avg = acc_avg * (1 - f) + acceleration * f;
+	acceleration = acc_avg / getstatf(STAT_MOVEVARS_MAXSPEED);
+
+	pos = top - sz/2 * '0 1 0' + (cvar("cl_showacceleration_position") * vid_conheight) * '0 1 0';
+
+	sz = cvar("cl_showacceleration_size");
+	scale = cvar("cl_showacceleration_scale");
+	alpha = cvar("cl_showacceleration_alpha");
+	if (cvar("cl_showacceleration_color_custom"))
+		rgb = stov(cvar_string("cl_showacceleration_color"));
+	else {
+		rgb = '1 1 1';
+		if (acceleration < 0) {
+			rgb = '1 .5 .5' - '0 .5 .5' * bound(0, -acceleration * 0.2, 1);
+		} else if (acceleration > 0) {
+			rgb = '.5 1 .5' - '.5 0 .5' * bound(0, +acceleration * 0.2, 1);
+		}
+	}
+		
+	if (acceleration > 0)
+		drawpic(pos, "gfx/hud/accelerometer_gradient", acceleration * scale * '40 0 0' + sz * '0 1 0', rgb, alpha, DRAWFLAG_NORMAL);
+	else if (acceleration < 0)
+		drawpic(pos + acceleration * scale * '40 0 0', "gfx/hud/accelerometer_gradient", -acceleration * scale * '40 0 0' + sz * '0 1 0', rgb, alpha, DRAWFLAG_NORMAL);
+}
+
 void Sbar_DrawAccuracyStats_Description_Hitscan(vector position)
 {
 	drawstring(position + '0 3 0' * sbar_fontsize_y, "Shots fired:", sbar_fontsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);



More information about the nexuiz-commits mailing list