]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Code far better handling of zoom upon spawn
authorSamual Lenks <samual@xonotic.org>
Thu, 7 Feb 2013 05:19:54 +0000 (00:19 -0500)
committerSamual Lenks <samual@xonotic.org>
Thu, 7 Feb 2013 05:19:54 +0000 (00:19 -0500)
qcsrc/client/Main.qc
qcsrc/client/View.qc
qcsrc/client/autocvars.qh

index 3e5deb104d6674735d53bae5e40b618cb6dcbcf6..57cf97c998889ce4576be0b839a5d8618e50da53 100644 (file)
@@ -1100,7 +1100,7 @@ void Net_ReadRace()
 void Net_ReadSpawn()
 {
        zoomin_effect = 1;
-       current_viewzoom = 0.6;
+       current_viewzoom = (1 / bound(1, autocvar_cl_spawnzoom_factor, 16));
 }
 
 void Net_TeamNagger()
index e07a44b48c6e78dbd433d746e61b20fddccfee51..117de38c496108d24874d35130917cdf5477a591 100644 (file)
@@ -104,9 +104,13 @@ vector GetCurrentFov(float fov)
                zoomfactor = 2.5;
        zoomspeed = autocvar_cl_zoomspeed;
        if(zoomspeed >= 0)
-               if(zoomspeed < 0.5 || zoomspeed > 16)
+       if(zoomspeed < 0.5 || zoomspeed > 16)
                        zoomspeed = 3.5;
 
+
+       float spawnzoomfactor = bound(1, autocvar_cl_spawnzoom_factor, 16);
+       float spawnzoomspeed = autocvar_cl_spawnzoom_speed;
+
        zoomdir = button_zoom;
        if(hud == HUD_NORMAL)
        if((activeweapon == WEP_NEX && nex_scope) || (activeweapon == WEP_RIFLE && rifle_scope)) // do NOT use switchweapon here
@@ -123,13 +127,21 @@ vector GetCurrentFov(float fov)
                // fteqcc failed twice here already, don't optimize this
        }
 
-       if(zoomdir)
-               zoomin_effect = 0;
+       if(zoomdir) { zoomin_effect = 0; }
 
-       if(zoomin_effect || camera_active)
+       if(camera_active)
        {
                current_viewzoom = min(1, current_viewzoom + drawframetime);
        }
+       else if(zoomin_effect)
+       {
+               /*if(autocvar_cl_spawnzoom_type == 1) { current_viewzoom = (current_viewzoom + drawframetime * spawnzoomspeed * (1 - 1 / spawnzoomfactor)); }
+               else                                                            { */
+               
+               current_viewzoom += (spawnzoomspeed * (spawnzoomfactor - current_viewzoom) * drawframetime); 
+               current_viewzoom = bound(1 / spawnzoomfactor, current_viewzoom, 1);
+               if(current_viewzoom == 1) { zoomin_effect = 0; }
+       }
        else
        {
                if(zoomspeed < 0) // instant zoom
index 72d7ec557c642eb28cd6a256ce5df913c383f9ea..779815ad4c161051002aff34c2791963089b23a9 100644 (file)
@@ -63,6 +63,8 @@ var float autocvar_cl_reticle = 1;
 float autocvar_cl_reticle_item_nex;
 float autocvar_cl_reticle_item_normal;
 float autocvar_cl_reticle_stretch;
+var float autocvar_cl_spawnzoom_speed = 2;
+var float autocvar_cl_spawnzoom_factor = 2;
 float autocvar_cl_stripcolorcodes;
 var float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6;
 var float autocvar_cl_vehicle_spiderbot_cross_size = 1;