From: terencehill Date: Sun, 30 Sep 2018 13:53:16 +0000 (+0200) Subject: cl_eventchase_spectated_change: disable chase_active while eventchase is still enable... X-Git-Tag: xonotic-v0.8.5~1792^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=15289956b1d74f0c29b79243b08b2aa65311c298;p=xonotic%2Fxonotic-data.pk3dir.git cl_eventchase_spectated_change: disable chase_active while eventchase is still enabled so to avoid a glicth --- diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 00c3001c1..126815cc1 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -803,37 +803,41 @@ vector liquidcolor_prev; float eventchase_current_distance; float eventchase_running; -bool WantEventchase(entity this) +int WantEventchase(entity this) { if(autocvar_cl_orthoview) - return false; + return 0; if(STAT(GAME_STOPPED) || intermission) - return true; + return 1; if(this.viewloc) - return true; + return 1; if(spectatee_status >= 0) { if(hud != HUD_NORMAL && (autocvar_cl_eventchase_vehicle || spectatee_status > 0)) - return true; + return 1; if(MUTATOR_CALLHOOK(WantEventchase, this)) - return true; + return 1; if(autocvar_cl_eventchase_frozen && STAT(FROZEN)) - return true; + return 1; if(autocvar_cl_eventchase_death && (STAT(HEALTH) <= 0)) { if(autocvar_cl_eventchase_death == 2) { // don't stop eventchase once it's started (even if velocity changes afterwards) if(this.velocity == '0 0 0' || eventchase_running) - return true; + return 1; } - else return true; + else return 1; + } + if (spectatee_status > 0 && autocvar_cl_eventchase_spectated_change) + { + if (time <= spectatee_status_changed_time + 0.5) + return 1; + else if (eventchase_running) + return -1; // disable chase_active while eventchase is still enabled so to avoid a glicth } - if (spectatee_status > 0 && autocvar_cl_eventchase_spectated_change - && time <= spectatee_status_changed_time + 0.5) - return true; } - return false; + return 0; } void HUD_Crosshair_Vehicle(entity this) @@ -1743,7 +1747,8 @@ void CSQC_UpdateView(entity this, float w, float h) } } - if(WantEventchase(this)) + int eventchase = WantEventchase(this); + if (eventchase) { vector current_view_origin_override = '0 0 0'; vector view_offset_override = '0 0 0'; @@ -1821,7 +1826,8 @@ void CSQC_UpdateView(entity this, float w, float h) if(!local_player.viewloc) setproperty(VF_ANGLES, WarpZone_TransformVAngles(WarpZone_trace_transform, view_angles)); } - else if(autocvar_chase_active < 0) // time to disable chase_active if it was set by this code + + if (eventchase <= 0 && autocvar_chase_active < 0) // time to disable chase_active if it was set by this code { eventchase_running = false; cvar_set("chase_active", "0");