[nexuiz-commits] r8220 - in trunk/data: . qcsrc/client
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Nov 6 16:31:57 EST 2009
Author: samual
Date: 2009-11-06 16:31:57 -0500 (Fri, 06 Nov 2009)
New Revision: 8220
Modified:
trunk/data/defaultNexuiz.cfg
trunk/data/qcsrc/client/View.qc
Log:
cl_velocityzoom: velocity based zooming of fov -- div0: The bounding on line 200 was needed else it would make avgspeed return a negative value at low fps, I did extensive testing and saw no drawback of this.
Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg 2009-11-06 19:56:01 UTC (rev 8219)
+++ trunk/data/defaultNexuiz.cfg 2009-11-06 21:31:57 UTC (rev 8220)
@@ -216,6 +216,8 @@
seta crosshair_fireball_color_alpha 1 "crosshair alpha value to display when wielding the fireball"
seta crosshair_fireball_size 1 "crosshair size when wielding the fireball"
fov 90
+seta cl_velocityzoom 0 "velocity based zooming of fov, negative values zoom out"
+seta cl_velocityzoomtime 0.3 "time value for averaging speed values"
seta cl_zoomfactor 5 "how much +zoom will zoom (1-16)"
seta cl_zoomspeed 3.5 "how fast it will zoom (0.5-16), negative values mean instant zoom"
seta cl_zoomsensitivity 0 "how zoom changes sensitivity (0 = weakest, 1 = strongest)"
Modified: trunk/data/qcsrc/client/View.qc
===================================================================
--- trunk/data/qcsrc/client/View.qc 2009-11-06 19:56:01 UTC (rev 8219)
+++ trunk/data/qcsrc/client/View.qc 2009-11-06 21:31:57 UTC (rev 8220)
@@ -134,10 +134,10 @@
v = vectoangles(v);
return v_y * 0.01745329251994329576;
}
-
+float avgspeed;
vector GetCurrentFov(float fov)
{
- float zoomsensitivity, zoomspeed, zoomfactor, zoomdir;
+ float zoomsensitivity, zoomspeed, zoomfactor, zoomdir, velocityzoom;
zoomsensitivity = cvar("cl_zoomsensitivity");
zoomfactor = cvar("cl_zoomfactor");
@@ -196,9 +196,15 @@
setsensitivityscale(pow(current_viewzoom, 1 - zoomsensitivity));
else
setsensitivityscale(1);
-
+
+ velocityzoom = bound(0, drawframetime / max(0.000000001, cvar_or("cl_velocityzoomtime", 0.3)), 1);
+ avgspeed = avgspeed * (1 - velocityzoom) + (vlen(pmove_vel) / 1000) * velocityzoom;
+ velocityzoom = pow(2.718281828459, float2range11(avgspeed * -cvar_or("cl_velocityzoom", 0) / 1) * 1);
+
+ //print(ftos(avgspeed), " avgspeed, ", ftos(cvar_or("cl_velocityzoom", 0)), " cvar, ", ftos(velocityzoom), " return\n"); // for debugging
+
float frustumx, frustumy, fovx, fovy;
- frustumy = tan(fov * 0.00872664625997164788) * 0.75 * current_viewzoom;
+ frustumy = tan(fov * 0.00872664625997164788) * 0.75 * current_viewzoom * velocityzoom;
frustumx = frustumy * vid_width / vid_height / vid_pixelheight;
fovx = atan2(frustumx, 1) / 0.00872664625997164788;
fovy = atan2(frustumy, 1) / 0.00872664625997164788;
More information about the nexuiz-commits
mailing list