From: terencehill Date: Thu, 15 Dec 2016 00:04:36 +0000 (+0100) Subject: KeyHunt panel: if there is no key to show return early (avoiding a division by 0... X-Git-Tag: xonotic-v0.8.2~375 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4f970c38b05e468092cb3a6b66efb614eb9f6fcd;p=xonotic%2Fxonotic-data.pk3dir.git KeyHunt panel: if there is no key to show return early (avoiding a division by 0 too); also do a small cleanup --- diff --git a/qcsrc/client/hud/panel/modicons.qc b/qcsrc/client/hud/panel/modicons.qc index c3310b25a..bf302fdfa 100644 --- a/qcsrc/client/hud/panel/modicons.qc +++ b/qcsrc/client/hud/panel/modicons.qc @@ -283,8 +283,9 @@ void HUD_Mod_KH(vector pos, vector mySize) mod_active = 1; // keyhunt should never hide the mod icons panel // Read current state - int state = STAT(KH_KEYS); + if(!state) return; + int i, key_state; int all_keys, team1_keys, team2_keys, team3_keys, team4_keys, dropped_keys, carrying_keys; all_keys = team1_keys = team2_keys = team3_keys = team4_keys = dropped_keys = carrying_keys = 0; @@ -315,9 +316,7 @@ void HUD_Mod_KH(vector pos, vector mySize) } // Calculate slot measurements - vector slot_size; - if(all_keys == 4 && mySize.x * 0.5 < mySize.y && mySize.y * 0.5 < mySize.x) { // Quadratic arrangement @@ -347,11 +346,10 @@ void HUD_Mod_KH(vector pos, vector mySize) // Make icons blink in case of RUN HERE - float blink = 0.6 + sin(2*M_PI*time) / 2.5; // Oscillate between 0.2 and 1 - float alpha; - alpha = 1; - + float alpha = 1; if(carrying_keys) + { + float blink = 0.6 + sin(2 * M_PI * time) * 0.4; // Oscillate between 0.2 and 1 switch(myteam) { case NUM_TEAM_1: if(team1_keys == all_keys) alpha = blink; break; @@ -359,6 +357,7 @@ void HUD_Mod_KH(vector pos, vector mySize) case NUM_TEAM_3: if(team3_keys == all_keys) alpha = blink; break; case NUM_TEAM_4: if(team4_keys == all_keys) alpha = blink; break; } + } // Draw icons