]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/View.qc
Merge branch 'master' into Mario/overkill
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / View.qc
index 120b682a3020f083e28856052cd5980d74c17129..0a5f73b55fe05a3eda69637907e5642e50fd44e6 100644 (file)
@@ -162,7 +162,7 @@ vector GetCurrentFov(float fov)
        else
                setsensitivityscale(1);
 
-       if(autocvar_cl_velocityzoom && autocvar_cl_velocityzoom_type) // _type = 0 disables velocity zoom too
+       if(autocvar_cl_velocityzoom_enabled && autocvar_cl_velocityzoom_type) // _type = 0 disables velocity zoom too
        {
                if(intermission) { curspeed = 0; }
                else
@@ -183,7 +183,7 @@ vector GetCurrentFov(float fov)
 
                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);
+               velocityzoom = exp(float2range11(avgspeed * -autocvar_cl_velocityzoom_factor / 1) * 1);
 
                //print(ftos(avgspeed), " avgspeed, ", ftos(curspeed), " curspeed, ", ftos(velocityzoom), " return\n"); // for debugging
        }
@@ -394,6 +394,30 @@ float contentavgalpha, liquidalpha_prev;
 vector liquidcolor_prev;
 
 float eventchase_current_distance;
+float eventchase_running;
+float WantEventchase()
+{
+       if(autocvar_cl_orthoview)
+               return FALSE;
+       if(intermission)
+               return TRUE;
+       if(spectatee_status >= 0)
+       {
+               if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WepSet_FromWeapon(WEP_PORTO)))
+                       return TRUE;
+               if(autocvar_cl_eventchase_death && (getstati(STAT_HEALTH) <= 0))
+               {
+                       if(autocvar_cl_eventchase_death == 2)
+                       {
+                               // don't stop eventchase once it's started (even if velocity changes afterwards)
+                               if(self.velocity == '0 0 0' || eventchase_running)
+                                       return TRUE;
+                       }
+                       else return TRUE;
+               }
+       }
+       return FALSE;
+}
 
 vector damage_blurpostprocess, content_blurpostprocess;
 
@@ -495,9 +519,10 @@ void CSQC_UpdateView(float w, float h)
        // event chase camera
        if(autocvar_chase_active <= 0) // greater than 0 means it's enabled manually, and this code is skipped
        {
-               WepSet weapons_stat = WepSet_GetFromStat();
-               if(((spectatee_status >= 0 && (autocvar_cl_eventchase_death && is_dead)) || intermission) && !autocvar_cl_orthoview || (autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(weapons_stat & WepSet_FromWeapon(WEP_PORTO))))
+               if(WantEventchase())
                {
+                       eventchase_running = TRUE;
+
                        // make special vector since we can't use view_origin (It is one frame old as of this code, it gets set later with the results this code makes.)
                        vector current_view_origin = (csqcplayer ? csqcplayer.origin : pmove_org);
 
@@ -538,6 +563,7 @@ void CSQC_UpdateView(float w, float h)
                }
                else if(autocvar_chase_active < 0) // time to disable chase_active if it was set by this code
                {
+                       eventchase_running = FALSE;
                        cvar_set("chase_active", "0");
                        eventchase_current_distance = 0; // start from 0 next time
                }
@@ -821,10 +847,7 @@ void CSQC_UpdateView(float w, float h)
        {
                // apply night vision effect
                vector tc_00, tc_01, tc_10, tc_11;
-               vector rgb;
-               rgb_x = 0; // fteqcc sucks
-               rgb_y = 0; // fteqcc sucks
-               rgb_z = 0; // fteqcc sucks
+               vector rgb = '0 0 0';
 
                if(!nightvision_noise)
                {