[nexuiz-commits] r7788 - in trunk/data: . qcsrc/client
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Mon Sep 14 11:44:04 EDT 2009
Author: fruitiex
Date: 2009-09-14 11:44:04 -0400 (Mon, 14 Sep 2009)
New Revision: 7788
Modified:
trunk/data/defaultNexuiz.cfg
trunk/data/qcsrc/client/sbar.qc
Log:
add units support to cl_showspeed and bump up the scale for the acceleration meter to make it more useful
Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg 2009-09-14 14:57:53 UTC (rev 7787)
+++ trunk/data/defaultNexuiz.cfg 2009-09-14 15:44:04 UTC (rev 7788)
@@ -1586,7 +1586,7 @@
seta cl_showpressedkeys 0 "Show which movement keys someone is pressing: 1 for spectating, 2 for always"
seta cl_showpressedkeys_position "0.5 0.8" "1 0 would be upper right corner, 0.5 0.5 the center"
-seta cl_showspeed 0 "show the XY speed of the player"
+seta cl_showspeed 0 "show the XY speed of the player, number selects unit (1 = qu/s (no postfix), 2 = qu/s, 3 = m/s, 4 = km/h, 5 = mph, 6 = knots)"
seta cl_showspeed_z 0 "include the speed on the Z-axis"
seta cl_showspeed_size 30 "size of the numbers"
seta cl_showspeed_position 0.7 "Y-axis positioning of the numbers"
@@ -1594,7 +1594,7 @@
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_scale 10 "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"
Modified: trunk/data/qcsrc/client/sbar.qc
===================================================================
--- trunk/data/qcsrc/client/sbar.qc 2009-09-14 14:57:53 UTC (rev 7787)
+++ trunk/data/qcsrc/client/sbar.qc 2009-09-14 15:44:04 UTC (rev 7788)
@@ -1898,17 +1898,45 @@
void Sbar_ShowSpeed(void)
{
vector numsize;
- float pos;
- string speed;
+ float pos, conversion_factor;
+ string speed, unit;
+ switch(cvar("cl_showspeed"))
+ {
+ default:
+ case 1:
+ unit = "";
+ conversion_factor = 1.0;
+ break;
+ case 2:
+ unit = " qu/s";
+ conversion_factor = 1.0;
+ break;
+ case 3:
+ unit = " m/s";
+ conversion_factor = 0.0254;
+ break;
+ case 4:
+ unit = " km/h";
+ conversion_factor = 0.0254 * 3.6;
+ break;
+ case 5:
+ unit = " mph";
+ conversion_factor = 0.0254 * 3.6 * 0.6213711922;
+ break;
+ case 6:
+ unit = " knots";
+ conversion_factor = 0.0254 * 1.943844492; // 1 m/s = 1.943844492 knots, because 1 knot = 1.852 km/h
+ break;
+ }
+
if (cvar("cl_showspeed_z") == 1)
- speed = ftos(floor(vlen(pmove_vel) + 0.5));
+ speed = strcat(ftos(floor( vlen(pmove_vel) * conversion_factor + 0.5 )), unit);
else
- speed = ftos(floor(vlen(pmove_vel - pmove_vel_z * '0 0 1') + 0.5));
+ speed = strcat(ftos(floor( vlen(pmove_vel - pmove_vel_z * '0 0 1') * conversion_factor + 0.5 )), unit);
- pos = cvar("cl_showspeed_position");
numsize_x = numsize_y = cvar("cl_showspeed_size");
- pos = (vid_conheight - numsize_y) * pos;
+ pos = (vid_conheight - numsize_y) * cvar("cl_showspeed_position");
drawfont = sbar_bigfont;
drawstringcenter('1 0 0' + pos * '0 1 0', speed, numsize, '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
More information about the nexuiz-commits
mailing list