From: Samual Date: Wed, 17 Aug 2011 01:13:18 +0000 (-0400) Subject: Merge remote branch 'origin/master' into terencehill/essential_weapons_panel X-Git-Tag: xonotic-v0.6.0~40^2~118^2~18^2~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=6491d84c152f73b11edbd0c5a74317461b0045cb;p=xonotic%2Fxonotic-data.pk3dir.git Merge remote branch 'origin/master' into terencehill/essential_weapons_panel Conflicts: qcsrc/client/hud.qc --- 6491d84c152f73b11edbd0c5a74317461b0045cb diff --cc qcsrc/client/hud.qc index 38de30ed2,4eafa2bf6..87ab32080 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@@ -639,74 -466,8 +462,75 @@@ void HUD_Weapons(void } HUD_Panel_UpdateCvars(weapons); + HUD_Panel_ApplyFadeAlpha(); + // TODO make this configurable + if(weaponorder_bypriority != autocvar_cl_weaponpriority || !weaponorder[0]) + { + float weapon_cnt; + if(weaponorder_bypriority) + strunzone(weaponorder_bypriority); + if(weaponorder_byimpulse) + strunzone(weaponorder_byimpulse); + + weaponorder_bypriority = strzone(autocvar_cl_weaponpriority); + weaponorder_byimpulse = strzone(W_FixWeaponOrder_BuildImpulseList(W_FixWeaponOrder_ForceComplete(W_NumberWeaponOrder(weaponorder_bypriority)))); + weaponorder_cmp_str = strcat(" ", weaponorder_byimpulse, " "); + + weapon_cnt = 0; + for(i = WEP_FIRST; i <= WEP_LAST; ++i) + { + self = get_weaponinfo(i); + if(self.impulse >= 0) + { + weaponorder[weapon_cnt] = self; + ++weapon_cnt; + } + } + for(i = weapon_cnt; i < WEP_MAXCOUNT; ++i) + weaponorder[i] = NULL; + heapsort(weapon_cnt, weaponorder_swap, weaponorder_cmp, world); + + weaponorder_cmp_str = string_null; + } + + float when, fadetime; + when = autocvar_hud_panel_weapons_complainbubble_time; + fadetime = autocvar_hud_panel_weapons_complainbubble_fadetime; + float weapons_st = getstati(STAT_WEAPONS); + float weapon_count; + if (autocvar_hud_panel_weapons_onlyowned) + { + if(autocvar__hud_configure && menu_enabled != 2) + HUD_Panel_DrawBg(1); // also draw the bg of the entire panel + + vector old_panel_size; + for(i = 0; i <= WEP_LAST-WEP_FIRST; ++i) + { + if(weapons_st & weaponorder[i].weapons) + ++weapon_count; + } + if(!autocvar__hud_configure && (autocvar_hud_panel_weapons_complainbubble && time - complain_weapon_time < when + fadetime))// && complain_weapon >= 0 + ++weapon_count; + if (weapon_count == 0) + return; + // reduce size of the panel + if (panel_size_y > panel_size_x) + { + old_panel_size_y = panel_size_y; + panel_size_y *= weapon_count / WEP_COUNT; + panel_pos_y += (old_panel_size_y - panel_size_y) / 2; + } + else + { + old_panel_size_x = panel_size_x; + panel_size_x *= weapon_count / WEP_COUNT; + panel_pos_x += (old_panel_size_x - panel_size_x) / 2; + } + } + else + weapon_count = WEP_COUNT; + if (timeout && time >= weapontime + timeout && !autocvar__hud_configure) { f = (time - (weapontime + timeout)) / timeout_effect_length; @@@ -4739,21 -4835,10 +4867,18 @@@ void HUD_Main (void if(autocvar__con_chat_maximized) HUD_Chat(); // HUD_DrawPanel(HUD_PANEL_CHAT); - if (autocvar__hud_configure && spectatee_status && hud_configure_prev == -1) // try to join if we are in hud_configure mode, but still spectating, and in the first frame (in order to get rid of motd when launching a server via the menu "HUD Setup" button) - localcmd("cmd selectteam auto; cmd join\n"); - - if(autocvar__hud_configure && tab_panel != -1) + if(autocvar__hud_configure) { - HUD_Panel_UpdatePosSizeForId(tab_panel) - drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .2, DRAWFLAG_NORMAL); + if(tab_panel != -1) + { + HUD_Panel_UpdatePosSizeForId(tab_panel) + drawfill(panel_pos - '1 1 0' * panel_bg_border, panel_size + '2 2 0' * panel_bg_border, '1 1 1', .2, DRAWFLAG_NORMAL); + } + if(highlightedPanel != -1) + { + HUD_Panel_UpdatePosSizeForId(highlightedPanel); + HUD_Panel_HlBorder(panel_bg_border + 1.5 * hlBorderSize, '0 0.5 1', 0.25 * (1 - autocvar__menu_alpha)); + } } hud_configure_prev = autocvar__hud_configure;