From: terencehill Date: Wed, 6 Apr 2016 23:08:40 +0000 (+0200) Subject: Fix hud shake being applied on respawn X-Git-Tag: xonotic-v0.8.2~882^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3f79cb166a46b006e182abf6158f958d40af6e20;p=xonotic%2Fxonotic-data.pk3dir.git Fix hud shake being applied on respawn --- diff --git a/qcsrc/client/hud/hud.qc b/qcsrc/client/hud/hud.qc index 49cf0a390..c87cb5a89 100644 --- a/qcsrc/client/hud/hud.qc +++ b/qcsrc/client/hud/hud.qc @@ -450,12 +450,15 @@ void Hud_Dynamic_Frame() hud_dynamic_shake_factor = 0; else { - float health = STAT(HEALTH); + static float old_health = 0; + float health = max(-1, STAT(HEALTH)); float new_hud_dynamic_shake_factor = 0; - if(prev_health - health >= autocvar_hud_dynamic_shake_damage_min && autocvar_hud_dynamic_shake_damage_max > autocvar_hud_dynamic_shake_damage_min) + if (old_health - health >= autocvar_hud_dynamic_shake_damage_min + && autocvar_hud_dynamic_shake_damage_max > autocvar_hud_dynamic_shake_damage_min + && old_health > 0 && !intermission) { float m = max(autocvar_hud_dynamic_shake_damage_min, 1); - new_hud_dynamic_shake_factor = (prev_health - health - m) / (autocvar_hud_dynamic_shake_damage_max - m); + new_hud_dynamic_shake_factor = (old_health - health - m) / (autocvar_hud_dynamic_shake_damage_max - m); if(new_hud_dynamic_shake_factor >= 1) new_hud_dynamic_shake_factor = 1; if(new_hud_dynamic_shake_factor >= hud_dynamic_shake_factor) @@ -464,6 +467,7 @@ void Hud_Dynamic_Frame() hud_dynamic_shake_time = time; } } + old_health = health; if(hud_dynamic_shake_factor) if(!Hud_Shake_Update()) hud_dynamic_shake_factor = 0;