]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud.qc
Manual riddance of remaining "if not".
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud.qc
index 273f427e49d11b182662b0a9566c80734e1051f7..293ad379e1d9bd3550a3cc20d7895196a1e754b4 100644 (file)
@@ -242,7 +242,7 @@ float GetPlayerColorForce(float i)
 
 float GetPlayerColor(float i)
 {
-       if not(playerslots[i].gotscores) // unconnected
+       if(!playerslots[i].gotscores) // unconnected
                return NUM_SPECTATOR;
        else if(stof(getplayerkeyvalue(i, "frags")) == FRAGS_SPECTATOR)
                return NUM_SPECTATOR;
@@ -447,8 +447,7 @@ float GetAmmoTypeForWep(float i)
 void HUD_Weapons(void)
 {
        // declarations
-       WEPSET_DECLARE_A(weapons_stat);
-       WEPSET_COPY_AS(weapons_stat);
+       WepSet weapons_stat = WepSet_GetFromStat();
        float i, f, a;
        float screen_ar, center_x = 0, center_y;
        float weapon_count, weapon_id;
@@ -532,9 +531,9 @@ void HUD_Weapons(void)
        {
                if(autocvar__hud_configure)
                {
-                       if (WEPSET_EMPTY_A(weapons_stat))
+                       if (!weapons_stat)
                                for(i = WEP_FIRST; i <= WEP_LAST; i += floor((WEP_LAST-WEP_FIRST)/5))
-                                       WEPSET_OR_AW(weapons_stat, i);
+                                       weapons_stat |= WepSet_FromWeapon(i);
 
                        if(menu_enabled != 2)
                                HUD_Panel_DrawBg(1); // also draw the bg of the entire panel
@@ -543,7 +542,7 @@ void HUD_Weapons(void)
                // do we own this weapon?
                weapon_count = 0;
                for(i = 0; i <= WEP_LAST-WEP_FIRST; ++i)
-                       if(WEPSET_CONTAINS_AW(weapons_stat, weaponorder[i].weapon))
+                       if(weapons_stat & WepSet_FromWeapon(weaponorder[i].weapon))
                                ++weapon_count;
 
                // add it anyway if weaponcomplain is shown
@@ -735,7 +734,7 @@ void HUD_Weapons(void)
 
                // skip this weapon if we don't own it (and onlyowned is enabled)-- or if weapons_complainbubble is showing for this weapon
                if(autocvar_hud_panel_weapons_onlyowned)
-               if not(WEPSET_CONTAINS_AW(weapons_stat, self.weapon) || (self.weapon == complain_weapon))
+               if (!((weapons_stat & WepSet_FromWeapon(self.weapon)) || (self.weapon == complain_weapon)))
                        continue;
 
                // figure out the drawing position of weapon
@@ -759,7 +758,7 @@ void HUD_Weapons(void)
                }
 
                // drawing all the weapon items
-               if(WEPSET_CONTAINS_AW(weapons_stat, self.weapon))
+               if(weapons_stat & WepSet_FromWeapon(self.weapon))
                {
                        // draw the weapon image
                        drawpic_aspect_skin(weapon_pos, strcat("weapon", self.netname), weapon_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
@@ -1134,7 +1133,7 @@ void HUD_Powerups(void)
        {
                if(!autocvar_hud_panel_powerups) return;
                if(spectatee_status == -1) return;
-               if not(getstati(STAT_ITEMS, 0, 24) & (IT_STRENGTH | IT_INVINCIBLE | IT_SUPERWEAPON)) return;
+               if(!(getstati(STAT_ITEMS, 0, 24) & (IT_STRENGTH | IT_INVINCIBLE | IT_SUPERWEAPON))) return;
                if (getstati(STAT_HEALTH) <= 0) return;
 
                strength_time = bound(0, getstatf(STAT_STRENGTH_FINISHED) - time, 99);
@@ -1417,7 +1416,7 @@ void HUD_HealthArmor(void)
        if(autocvar_hud_panel_healtharmor == 2) // combined health and armor display
        {
                vector v;
-               v = healtharmor_maxdamage(health, armor, armorblockpercent);
+               v = healtharmor_maxdamage(health, armor, armorblockpercent, DEATH_WEAPON);
 
                float x;
                x = floor(v_x + 1);
@@ -3124,7 +3123,7 @@ void HUD_Mod_Race(vector pos, vector mySize)
        float f; // yet another function has this
        score = me.(scores[ps_primary]);
 
-       if not((scores_flags[ps_primary] & SFL_TIME) && !teamplay) // race/cts record display on HUD
+       if(!(scores_flags[ps_primary] & SFL_TIME) || teamplay) // race/cts record display on HUD
                return; // no records in the actual race
 
        // clientside personal record
@@ -3140,7 +3139,7 @@ void HUD_Mod_Race(vector pos, vector mySize)
                if(autocvar_cl_autodemo_delete_keeprecords)
                {
                        f = autocvar_cl_autodemo_delete;
-                       f &~= 1;
+                       f &= ~1;
                        cvar_set("cl_autodemo_delete", ftos(f)); // don't delete demo with new record!
                }
        }
@@ -4209,7 +4208,7 @@ void HUD_CenterPrint (void)
                        float r;
                        r = random();
                        if (r > 0.9)
-                               centerprint_generic(floor(r*1000), strcat(sprintf("^3Countdown message at time %s", seconds_tostring(time)), ", seconds left: %d"), 1, 10);
+                               centerprint_generic(floor(r*1000), strcat(sprintf("^3Countdown message at time %s", seconds_tostring(time)), ", seconds left: ^COUNT"), 1, 10);
                        else if (r > 0.8)
                                centerprint_generic(0, sprintf("^1Multiline message at time %s that\n^1lasts longer than normal", seconds_tostring(time)), 20, 0);
                        else
@@ -4593,7 +4592,7 @@ void HUD_Main (void)
                                hud_panel[panel_order[i]].update_time = time;
                }
        }
-       else if (hud_configure_prev && autocvar_hud_cursormode)
+       else if(hud_configure_prev && hud_configure_prev != -1 && autocvar_hud_cursormode)
                setcursormode(0);
 
        hud_configure_prev = autocvar__hud_configure;