]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Minor cleanups
authorterencehill <piuntn@gmail.com>
Thu, 27 May 2021 15:55:54 +0000 (17:55 +0200)
committerterencehill <piuntn@gmail.com>
Thu, 27 May 2021 15:55:54 +0000 (17:55 +0200)
qcsrc/client/hud/panel/notify.qc
qcsrc/server/player.qc

index ae4b92211d8bbb0fb621e43861aceda193bb5d6f..2f1b254b23fe9712df41297104e02fd69fdecb28 100644 (file)
@@ -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;
index 74259e3e826e620fe1f2bd7f9645aad1e37e4d8f..4ad0d7936d0f82d27bd34a0c693bfcb40a5cac65 100644 (file)
@@ -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)
                {