if(!autocvar_hud_panel_weapons && !autocvar__hud_configure)
return;
+ float timeout = cvar("hud_panel_weapons_timeout");
+ float timeout_effect_lenght;
+ if (cvar("hud_panel_weapons_timeout_effect") == 0)
+ timeout_effect_lenght = 0;
+ else
+ timeout_effect_lenght = 0.75;
+
+ if (timeout && time >= weapontime + timeout + timeout_effect_lenght && !autocvar__hud_configure)
+ return;
+
active_panel = HUD_PANEL_WEAPONS;
HUD_Panel_UpdateCvars(weapons);
- vector pos, mySize;
- float i, weapid, fade, weapon_stats, weapon_number, weapon_cnt;
- pos = panel_pos;
- mySize = panel_size;
+ if (timeout && time >= weapontime + timeout && !autocvar__hud_configure)
+ {
+ float f = (time - (weapontime + timeout)) / timeout_effect_lenght;
+ if (cvar("hud_panel_weapons_timeout_effect") == 2)
+ {
+ panel_bg_alpha *= (1 - f);
+ panel_fg_alpha *= (1 - f);
+ }
+ else
+ {
+ f *= f; // for a cooler movement
+ vector center;
+ center_x = panel_pos_x + panel_size_x/2;
+ center_y = panel_pos_y + panel_size_y/2;
+ float screen_ar = vid_conwidth/vid_conheight;
+ if (center_x/center_y < screen_ar) //bottom left
+ {
+ if ((vid_conwidth - center_x)/center_y < screen_ar) //bottom
+ panel_pos_y += f * (vid_conheight - panel_pos_y);
+ else //left
+ panel_pos_x -= f * (panel_pos_x + panel_size_x);
+ }
+ else //top right
+ {
+ if ((vid_conwidth - center_x)/center_y < screen_ar) //right
+ panel_pos_x += f * (vid_conwidth - panel_pos_x);
+ else //top
+ panel_pos_y -= f * (panel_pos_y + panel_size_y);
+ }
+ }
+ }
+ float i, weapid, fade, weapon_stats, weapon_number, weapon_cnt;
weapon_cnt = 0;
for(i = WEP_FIRST; i <= WEP_LAST; ++i)
{
HUD_Panel_DrawBg(1);
if(panel_bg_padding)
{
- pos += '1 1 0' * panel_bg_padding;
- mySize -= '2 2 0' * panel_bg_padding;
+ panel_pos += '1 1 0' * panel_bg_padding;
+ panel_size -= '2 2 0' * panel_bg_padding;
}
// hits
HUD_Weapons_Clear();
float rows, columns;
- rows = mySize_y/mySize_x;
+ rows = panel_size_y/panel_size_x;
rows = bound(1, floor((sqrt(4 * autocvar_hud_panel_weapons_aspect * rows * WEP_COUNT + rows * rows) + rows + 0.5) / 2), WEP_COUNT);
columns = ceil(WEP_COUNT/rows);
for(i = 0; i < weapon_cnt; ++i)
{
- wpnpos = pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows);
- wpnsize = eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows);
+ wpnpos = panel_pos + eX * column * panel_size_x*(1/columns) + eY * row * panel_size_y*(1/rows);
+ wpnsize = eX * panel_size_x*(1/columns) + eY * panel_size_y*(1/rows);
self = weaponorder[i];
weapid = self.impulse;
drawpic_aspect_skin(wpnpos, strcat("weapon", self.netname), wpnsize, '1 1 1', fade * panel_fg_alpha, DRAWFLAG_NORMAL);
if(autocvar_hud_panel_weapons_label == 1) // weapon number
- drawstring(wpnpos, ftos(weapid), '1 1 0' * 0.5 * mySize_y*(1/rows), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring(wpnpos, ftos(weapid), '1 1 0' * 0.5 * panel_size_y*(1/rows), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
else if(autocvar_hud_panel_weapons_label == 2) // bind
- drawstring(wpnpos, getcommandkey(ftos(weapid), strcat("impulse ", ftos(weapid))), '1 1 0' * 0.5 * mySize_y*(1/rows), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring(wpnpos, getcommandkey(ftos(weapid), strcat("impulse ", ftos(weapid))), '1 1 0' * 0.5 * panel_size_y*(1/rows), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
// draw ammo status bar
if(autocvar_hud_panel_weapons_ammo && weapid != WEP_TUBA && weapid != WEP_LASER && weapid != WEP_PORTO)