From: terencehill Date: Thu, 27 May 2021 15:55:54 +0000 (+0200) Subject: Minor cleanups X-Git-Tag: xonotic-v0.8.5~405^2~27 X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=be64ed76fa9770eb88714e6ce21ddb4563560a82 Minor cleanups --- diff --git a/qcsrc/client/hud/panel/notify.qc b/qcsrc/client/hud/panel/notify.qc index ae4b92211..2f1b254b2 100644 --- a/qcsrc/client/hud/panel/notify.qc +++ b/qcsrc/client/hud/panel/notify.qc @@ -58,9 +58,8 @@ void HUD_Notify_Push(string icon, string attacker, string victim) void HUD_Notify() { - if (!autocvar__hud_configure) - if (!autocvar_hud_panel_notify) - return; + if (!autocvar__hud_configure && !autocvar_hud_panel_notify) + return; HUD_Panel_LoadCvars(); @@ -87,9 +86,8 @@ void HUD_Notify() HUD_Scale_Disable(); HUD_Panel_DrawBg(); - if (!autocvar__hud_configure) - if (notify_count == 0) - return; + if (!autocvar__hud_configure && notify_count == 0) + return; vector pos, size; pos = panel_pos; diff --git a/qcsrc/server/player.qc b/qcsrc/server/player.qc index 74259e3e8..4ad0d7936 100644 --- a/qcsrc/server/player.qc +++ b/qcsrc/server/player.qc @@ -228,8 +228,8 @@ void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float da void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force) { vector v; - float dh = max(GetResource(this, RES_HEALTH), 0); - float da = max(GetResource(this, RES_ARMOR), 0); + float initial_health = max(GetResource(this, RES_HEALTH), 0); + float initial_armor = max(GetResource(this, RES_ARMOR), 0); float take = 0, save = 0; if (damage) @@ -320,7 +320,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, if(sound_allowed(MSG_BROADCAST, attacker)) { - if (save > 10 && (dh - take) > 0) // don't play armor sound if the attack is fatal + if (save > 10 && (initial_health - take) > 0) // don't play armor sound if the attack is fatal sound (this, CH_SHOTS, SND_ARMORIMPACT, VOL_BASE, ATTEN_NORM); else if (take > 30) sound (this, CH_SHOTS, SND_BODYIMPACT2, VOL_BASE, ATTEN_NORM); @@ -426,8 +426,8 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, valid_damage_for_weaponstats = true; } - dh -= max(GetResource(this, RES_HEALTH), 0); // health difference - da -= max(GetResource(this, RES_ARMOR), 0); // armor difference + float dh = initial_health - max(GetResource(this, RES_HEALTH), 0); // health difference + float da = initial_armor - max(GetResource(this, RES_ARMOR), 0); // armor difference if(valid_damage_for_weaponstats) { WeaponStats_LogDamage(awep.m_id, abot, this.(weaponentity).m_weapon.m_id, vbot, dh + da); @@ -437,8 +437,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, if (GetResource(this, RES_HEALTH) < 1) { - float defer_ClientKill_Now_TeamChange; - defer_ClientKill_Now_TeamChange = false; + bool defer_ClientKill_Now_TeamChange = false; if(this.alivetime) {