X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fhud%2Fpanel%2Fweapons.qc;h=db25d532a016f938e31a04045ac54e1886f03617;hb=618b27c49c9370497f003c7d8e816ed85c41ec77;hp=a30006c26377f7b93f3fdd9d37f35d934cd73221;hpb=2300937585fd409c578a516ed5e051ba389646d4;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/hud/panel/weapons.qc b/qcsrc/client/hud/panel/weapons.qc index a30006c26..db25d532a 100644 --- a/qcsrc/client/hud/panel/weapons.qc +++ b/qcsrc/client/hud/panel/weapons.qc @@ -1,5 +1,7 @@ #include "weapons.qh" -// Weapon icons (#0) + + +// Weapons (#0) entity weaponorder[Weapons_MAX]; void weaponorder_swap(int i, int j, entity pass) @@ -23,7 +25,7 @@ int weaponorder_cmp(int i, int j, entity pass) int nHidden = 0; \ FOREACH(Weapons, it != WEP_Null, { \ if (weapons_stat & WepSet_FromWeapon(it)) continue; \ - if (it.spawnflags & WEP_FLAG_MUTATORBLOCKED) nHidden += 1; \ + if (it.spawnflags & WEP_FLAG_HIDDEN || it.spawnflags & WEP_FLAG_MUTATORBLOCKED) nHidden += 1; \ }); \ vector table_size = HUD_GetTableSize_BestItemAR((Weapons_COUNT - 1) - nHidden, panel_size, aspect); \ columns = table_size.x; \ @@ -70,6 +72,8 @@ void HUD_Weapons() { if((!autocvar_hud_panel_weapons) || (spectatee_status == -1)) return; + if(STAT(HEALTH) <= 0 && autocvar_hud_panel_weapons_hide_ondeath) + return; if(timeout && time >= weapontime + timeout + timeout_effect_length) if(autocvar_hud_panel_weapons_timeout_effect == 3 || (autocvar_hud_panel_weapons_timeout_effect == 1 && !(autocvar_hud_panel_weapons_timeout_fadebgmin + autocvar_hud_panel_weapons_timeout_fadefgmin))) { @@ -79,7 +83,7 @@ void HUD_Weapons() } // update generic hud functions - HUD_Panel_UpdateCvars(); + HUD_Panel_LoadCvars(); // figure out weapon order (how the weapons are sorted) // TODO make this configurable if(weaponorder_bypriority != autocvar_cl_weaponpriority || !weaponorder[0]) @@ -149,8 +153,8 @@ void HUD_Weapons() { if(autocvar__hud_configure) { - if(menu_enabled != 2) - HUD_Panel_DrawBg(1); // also draw the bg of the entire panel + if(hud_configure_menu_open != 2) + HUD_Panel_DrawBg(); // also draw the bg of the entire panel } // do we own this weapon? @@ -312,7 +316,7 @@ void HUD_Weapons() HUD_Scale_Enable(); else HUD_Scale_Disable(); - HUD_Panel_DrawBg(1); + HUD_Panel_DrawBg(); if(center.x == -1) return; // panel has gone off screen @@ -358,7 +362,6 @@ void HUD_Weapons() vector label_size = '1 1 0' * min(weapon_size.x, weapon_size.y) * bound(0, autocvar_hud_panel_weapons_label_scale, 1); vector noncurrent_size = weapon_size * bound(0.01, autocvar_hud_panel_weapons_noncurrent_scale, 1); float noncurrent_alpha = panel_fg_alpha * bound(0, autocvar_hud_panel_weapons_noncurrent_alpha, 1); - bool isCurrent; static vector weapon_pos_current = '-1 0 0'; if(weapon_pos_current.x == -1) weapon_pos_current = panel_pos; @@ -370,7 +373,9 @@ void HUD_Weapons() switch_speed = frametime * autocvar_hud_panel_weapons_selection_speed; vector radius_size = weapon_size * (autocvar_hud_panel_weapons_selection_radius + 1); - if(!panel_switchweapon) + if(switchweapon == WEP_Null) + panel_switchweapon = NULL; + else if(!panel_switchweapon) panel_switchweapon = switchweapon; // draw background behind currently selected weapon @@ -403,8 +408,7 @@ void HUD_Weapons() weapon_pos = (panel_pos + eX * column * weapon_size.x + eY * row * weapon_size.y); // update position of the currently selected weapon - isCurrent = (it == panel_switchweapon); - if(isCurrent) + if(it == panel_switchweapon) { if(weapon_pos_current.y > weapon_pos.y) weapon_pos_current.y = max(weapon_pos.y, weapon_pos_current.y - switch_speed * (weapon_pos_current.y - weapon_pos.y));