[nexuiz-commits] r7744 - in trunk/data: . qcsrc/client
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sat Sep 12 05:52:08 EDT 2009
Author: fruitiex
Date: 2009-09-12 05:52:05 -0400 (Sat, 12 Sep 2009)
New Revision: 7744
Modified:
trunk/data/defaultNexuiz.cfg
trunk/data/qcsrc/client/View.qc
trunk/data/qcsrc/client/sbar.qc
Log:
CSQC accelerometer! Please test (cl_showacceleration 1)
Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg 2009-09-11 19:37:54 UTC (rev 7743)
+++ trunk/data/defaultNexuiz.cfg 2009-09-12 09:52:05 UTC (rev 7744)
@@ -1588,6 +1588,14 @@
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 "1 0 0" "color of the bar"
+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"
Modified: trunk/data/qcsrc/client/View.qc
===================================================================
--- trunk/data/qcsrc/client/View.qc 2009-09-11 19:37:54 UTC (rev 7743)
+++ trunk/data/qcsrc/client/View.qc 2009-09-12 09:52:05 UTC (rev 7744)
@@ -554,6 +554,8 @@
if (cvar("cl_showspeed"))
Sbar_ShowSpeed();
+ if (cvar("cl_showacceleration"))
+ Sbar_ShowAcceleration();
Sbar_DrawCenterPrint(); // draw centerprint messages even if viewsize >= 120
}
Modified: trunk/data/qcsrc/client/sbar.qc
===================================================================
--- trunk/data/qcsrc/client/sbar.qc 2009-09-11 19:37:54 UTC (rev 7743)
+++ trunk/data/qcsrc/client/sbar.qc 2009-09-12 09:52:05 UTC (rev 7744)
@@ -1913,6 +1913,46 @@
drawstringcenter('1 0 0' + pos * '0 1 0', speed, numsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
}
+float acc_avgspeeds = 10; // amount of frames' speeds to average, increasing this value makes the meter smoother but less responsive
+float prev_speed[acc_avgspeeds];
+
+void Sbar_ShowAcceleration(void)
+{
+ float acceleration, avgspeed, size, scale, alpha, i;
+ vector pos, top, color;
+ 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;
+
+ if (cvar("cl_showacceleration_z") == 1)
+ acceleration = vlen(pmove_vel) - avgspeed;
+ else
+ acceleration = vlen(pmove_vel - pmove_vel_z * '0 0 1') - avgspeed;
+
+ for (i=acc_avgspeeds;i>=1;i-=1)
+ prev_speed[i] = prev_speed[i-1];
+
+ if (cvar("cl_showacceleration_z") == 1)
+ prev_speed[0] = vlen(pmove_vel);
+ else
+ 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);
+}
+
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