]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Put eventchase conditions in a function for clearness sake
authorterencehill <piuntn@gmail.com>
Sun, 14 Dec 2014 17:50:48 +0000 (18:50 +0100)
committerterencehill <piuntn@gmail.com>
Sun, 14 Dec 2014 17:50:48 +0000 (18:50 +0100)
qcsrc/client/View.qc

index e4deda0341b161f4cc9114748544a074d203680c..ffdd89c97faa4cb0c72c64fdb4b91e94d256b49c 100644 (file)
@@ -394,6 +394,21 @@ float contentavgalpha, liquidalpha_prev;
 vector liquidcolor_prev;
 
 float eventchase_current_distance;
+float WantEventchase()
+{
+       if(autocvar_cl_orthoview)
+               return FALSE;
+       if(intermission)
+               return TRUE;
+       if(spectatee_status >= 0)
+       {
+               if(autocvar_cl_eventchase_death && (getstati(STAT_HEALTH) <= 0))
+                       return TRUE;
+               if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WepSet_FromWeapon(WEP_PORTO)))
+                       return TRUE;
+       }
+       return FALSE;
+}
 
 vector damage_blurpostprocess, content_blurpostprocess;
 
@@ -495,8 +510,7 @@ 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 && spectatee_status >= 0 && gametype == MAPINFO_TYPE_NEXBALL && !(weapons_stat & WepSet_FromWeapon(WEP_PORTO))))
+               if(WantEventchase())
                {
                        // 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);