seta cl_reticle_item_normal 1 "draw reticle when zooming with the zoom button, 0 disables and values between 0 and 1 change alpha"
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_velocityzoom_type 3 "how to factor in speed, 1 = all velocity in all directions, 2 = velocity only in forward direction (can be negative), 3 = velocity only in forward direction (limited to forward only)"
+seta cl_velocityzoom_speed 1000 "target speed for fov factoring"
+seta cl_velocityzoom_time 0.2 "time value for averaging speed values"
seta cl_zoomfactor 5 "how much +zoom will zoom (1-16)"
seta cl_zoomspeed 8 "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)"
float avgspeed;
vector GetCurrentFov(float fov)
{
- float zoomsensitivity, zoomspeed, zoomfactor, zoomdir, velocityzoom;
+ float zoomsensitivity, zoomspeed, zoomfactor, zoomdir;
+ float velocityzoom, curspeed;
zoomsensitivity = autocvar_cl_zoomsensitivity;
zoomfactor = autocvar_cl_zoomfactor;
setsensitivityscale(pow(current_viewzoom, 1 - zoomsensitivity));
else
setsensitivityscale(1);
+
+ makevectors(view_angles);
- if (autocvar_cl_velocityzoom)
+ if(autocvar_cl_velocityzoom)
{
- velocityzoom = bound(0, drawframetime / max(0.000000001, autocvar_cl_velocityzoomtime), 1);
- avgspeed = avgspeed * (1 - velocityzoom) + (vlen(pmove_vel) / 1000) * velocityzoom;
+ switch(autocvar_cl_velocityzoom_type)
+ {
+ case 3: curspeed = max(0, v_forward * pmove_vel); break;
+ case 2: curspeed = (v_forward * pmove_vel); break;
+ case 1: default: curspeed = vlen(pmove_vel); break;
+ }
+
+ velocityzoom = bound(0, drawframetime / max(0.000000001, autocvar_cl_velocityzoom_time), 1); // speed at which the zoom adapts to player velocity
+ avgspeed = avgspeed * (1 - velocityzoom) + (curspeed / autocvar_cl_velocityzoom_speed) * velocityzoom;
velocityzoom = exp(float2range11(avgspeed * -autocvar_cl_velocityzoom / 1) * 1);
- //print(ftos(avgspeed), " avgspeed, ", ftos(autocvar_cl_velocityzoom), " cvar, ", ftos(velocityzoom), " return\n"); // for debugging
+
+ print(ftos(avgspeed), " avgspeed, ", ftos(curspeed), " curspeed, ", ftos(velocityzoom), " return\n"); // for debugging
}
else
velocityzoom = 1;
var float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6;
var float autocvar_cl_vehicle_spiderbot_cross_size = 1;
float autocvar_cl_velocityzoom;
-var float autocvar_cl_velocityzoomtime = 0.3;
+float autocvar_cl_velocityzoom_type;
+float autocvar_cl_velocityzoom_speed;
+float autocvar_cl_velocityzoom_time;
string autocvar_cl_weaponpriority;
float autocvar_cl_zoomfactor;
float autocvar_cl_zoomsensitivity;