18 HUD_Write_Cvar(
"hud_panel_weapons_complainbubble_color_outofammo");
20 HUD_Write_Cvar(
"hud_panel_weapons_complainbubble_color_unavailable");
47 LOG_INFO(
"Warning: accuracy_color_levels must contain at least 2 values");
76 while(j && accuracy <
acc_lev[j])
89 TC(
int, i);
TC(
int, j);
98 TC(
int, i);
TC(
int, j);
104 #define HUD_WEAPONS_GET_FULL_LAYOUT() MACRO_BEGIN \ 106 FOREACH(Weapons, it != WEP_Null, { \ 107 if (weapons_stat & WepSet_FromWeapon(it)) continue; \ 108 if (it.spawnflags & (WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_SPECIALATTACK)) nHidden += 1; \ 110 vector table_size = HUD_GetTableSize_BestItemAR((REGISTRY_COUNT(Weapons) - 1) - nHidden, panel_size, aspect); \ 111 columns = table_size.x; \ 112 rows = table_size.y; \ 113 weapon_size.x = panel_size.x / columns; \ 114 weapon_size.y = panel_size.y / rows; \ 122 WepSet weapons_stat = WepSet_GetFromStat();
127 int weapon_count, weapon_id;
128 int row, column, rows = 0, columns = 0;
129 bool vertical_order =
true;
136 vector barsize =
'0 0 0', baroffset =
'0 0 0';
137 vector ammo_color =
'1 0 1';
138 float ammo_alpha = 1;
143 bool infinite_ammo = (STAT(ITEMS) & IT_UNLIMITED_AMMO);
145 vector weapon_pos, weapon_size =
'0 0 0';
151 if(
hud != HUD_NORMAL)
return;
159 if(timeout &&
time >=
weapontime + timeout + timeout_effect_length)
196 if (wepent.switchweapon == WEP_Null)
197 panel_switchweapon =
NULL;
198 else if (!panel_switchweapon)
199 panel_switchweapon = wepent.switchweapon;
206 FOREACH(Weapons, it != WEP_Null && it.impulse >= 0 && (it.impulse % 3 != 0) && j < 6, {
207 if(!(it.spawnflags & WEP_FLAG_MUTATORBLOCKED) && !(it.spawnflags & WEP_FLAG_SPECIALATTACK))
209 if(!panel_switchweapon || j < 4)
210 panel_switchweapon = it;
211 weapons_stat |= it.m_wepset;
223 FOREACH(Weapons, it != WEP_Null, {
226 weapons_stat =
'0 0 0';
228 for(i = 0, j = 0; i <= (
REGISTRY_COUNT(Weapons) - 1) && j < countw; ++i)
264 if (weapon_count == 0)
278 columns =
min(columns,
ceil(weapon_count / max_rows));
279 rows =
ceil(weapon_count / columns);
280 weapon_size.y =
min(
panel_size.y / rows, weapon_size.x / aspect);
281 weapon_size.x =
min(
panel_size.x / columns, aspect * weapon_size.y);
282 vertical_order =
false;
287 rows =
min(rows,
ceil(weapon_count / max_columns));
288 columns =
ceil(weapon_count / rows);
289 weapon_size.x =
min(
panel_size.x / columns, aspect * weapon_size.y);
290 weapon_size.y =
min(
panel_size.y / rows, weapon_size.x / aspect);
291 vertical_order =
true;
349 if (center.x/center.y < screen_ar)
392 if (center.x/center.y < screen_ar)
440 if(weapon_size.x/weapon_size.y > aspect)
442 barsize.x = aspect * weapon_size.y;
443 barsize.y = weapon_size.y;
444 baroffset.x = (weapon_size.x - barsize.x) / 2;
448 barsize.y = 1/aspect * weapon_size.x;
449 barsize.x = weapon_size.x;
450 baroffset.y = (weapon_size.y - barsize.y) / 2;
461 static vector weapon_pos_current =
'-1 0 0';
462 if(weapon_pos_current.x == -1)
474 if(panel_switchweapon)
481 weapon_id = it.impulse;
484 if(!it || weapon_id < 0) {
continue; }
510 weapon_pos =
panel_pos +
vec2(column * weapon_size.x, row * weapon_size.y);
513 if(it == panel_switchweapon)
515 if(weapon_pos_current.y > weapon_pos.y)
516 weapon_pos_current.y =
max(weapon_pos.y, weapon_pos_current.y - switch_speed * (weapon_pos_current.y - weapon_pos.y));
517 else if(weapon_pos_current.y < weapon_pos.y)
518 weapon_pos_current.y =
min(weapon_pos.y, weapon_pos_current.y + switch_speed * (weapon_pos.y - weapon_pos_current.y));
519 if(weapon_pos_current.x > weapon_pos.x)
520 weapon_pos_current.x =
max(weapon_pos.x, weapon_pos_current.x - switch_speed * (weapon_pos_current.x - weapon_pos.x));
521 else if(weapon_pos_current.x < weapon_pos.x)
522 weapon_pos_current.x =
min(weapon_pos.x, weapon_pos_current.x + switch_speed * (weapon_pos.x - weapon_pos_current.x));
529 if(panel_weapon_accuracy >= 0)
536 vector weapon_size_real = noncurrent_size;
537 float weapon_alpha_real = noncurrent_alpha;
538 float radius_factor_x = 1 -
bound(0,
fabs(weapon_pos.x - weapon_pos_current.x) / radius_size.x, 1);
539 float radius_factor_y = 1 -
bound(0,
fabs(weapon_pos.y - weapon_pos_current.y) / radius_size.y, 1);
540 if(radius_factor_x || radius_factor_y)
542 weapon_size_real.x += (weapon_size.x - noncurrent_size.x) * radius_factor_x;
543 weapon_size_real.y += (weapon_size.y - noncurrent_size.y) * radius_factor_y;
544 weapon_alpha_real += (
panel_fg_alpha - noncurrent_alpha) *
min(radius_factor_x, radius_factor_y);
547 vector weapon_pos_real = weapon_pos;
548 weapon_pos_real.x = weapon_pos.x + (weapon_size.x - weapon_size_real.x) / 2;
549 weapon_pos_real.y = weapon_pos.y + (weapon_size.y - weapon_size_real.y) / 2;
580 a = getstati(GetAmmoStat(it.ammo_type));
585 switch (it.ammo_type)
593 default: ammo_full = 60;
597 weapon_pos.x + baroffset.x,
598 weapon_pos.y + baroffset.y,
599 barsize.x *
bound(0, a/ammo_full, 1),
631 s = _(
"Out of ammo");
639 s = _(
"Unavailable");
660 if(column >= columns)
int autocvar_hud_panel_weapons_label
int autocvar_hud_panel_weapons_ammo_full_rockets
int autocvar_hud_panel_weapons_ammo_full_fuel
void drawstring_aspect(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag)
int autocvar_hud_panel_weapons_ammo_full_plasma
float autocvar_hud_panel_weapons_aspect
float acc_lev[MAX_ACCURACY_LEVELS]
bool autocvar_hud_panel_weapons_accuracy
int weaponorder_cmp(int i, int j, entity pass)
bool autocvar__hud_configure
float autocvar_hud_panel_weapons_complainbubble_fadetime
bool autocvar_hud_panel_weapons_complainbubble
entity viewmodels[MAX_WEAPONSLOTS]
bool autocvar_hud_panel_weapons_hide_ondeath
#define getcommandkey(cmd_name, command)
string autocvar_hud_panel_weapons_complainbubble_color_donthave
float autocvar_hud_panel_weapons_selection_radius
int autocvar_hud_panel_weapons_ammo_full_cells
float autocvar_hud_panel_weapons_ammo_alpha
ERASEABLE void heapsort(int n, swapfunc_t swap, comparefunc_t cmp, entity pass)
int autocvar_hud_panel_weapons_ammo_full_shells
const int WEP_FLAG_HIDDEN
bool autocvar_hud_panel_weapons_orderbyimpulse
string cl_weaponpriority_old
string W_FixWeaponOrder_ForceComplete(string order)
float autocvar_hud_panel_weapons_noncurrent_alpha
void weaponorder_swap(int i, int j, entity pass)
#define REGISTRY_COUNT(id)
float autocvar_hud_panel_weapons_timeout_fadefgmin
string W_NumberWeaponOrder(string order)
#define HUD_Panel_DrawBg()
float autocvar_hud_panel_weapons_timeout
#define drawpic_aspect_skin(pos, pic, sz, color, theAlpha, drawflag)
float complain_weapon_time
int autocvar_hud_panel_weapons_ammo_full_nails
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
bool weapons_orderbyimpulse_old
string autocvar_accuracy_color_levels
string W_FixWeaponOrder_BuildImpulseList(string o)
string autocvar_cl_weaponpriority
float autocvar_hud_panel_weapons_noncurrent_scale
string weaponorder_cmp_str
bool autocvar_hud_panel_weapons_ammo
const float DRAWFLAG_NORMAL
string autocvar_hud_panel_weapons_complainbubble_color_unavailable
float autocvar_hud_panel_weapons_label_scale
float autocvar_hud_panel_weapons_timeout_fadebgmin
#define HUD_WEAPONS_GET_FULL_LAYOUT()
vector(float skel, float bonenum) _skel_get_boneabs_hidden
entity weaponorder[REGISTRY_MAX(Weapons)]
int autocvar_hud_panel_weapons_onlyowned
vector acc_col[MAX_ACCURACY_LEVELS]
const int MAX_ACCURACY_LEVELS
const int WEP_FLAG_SPECIALATTACK
bool autocvar_hud_panel_weapons
void HUD_Weapons_Export(int fh)
float autocvar_hud_panel_weapons_complainbubble_padding
float autocvar_hud_panel_weapons_timeout_speed_in
float autocvar_hud_panel_weapons_complainbubble_time
float hud_configure_menu_open
int autocvar_hud_panel_weapons_timeout_effect
bool autocvar_hud_panel_weapons_dynamichud
const int WEP_FLAG_MUTATORBLOCKED
#define WepSet_FromWeapon(it)
string autocvar_hud_panel_weapons_complainbubble_color_outofammo
void Accuracy_LoadColors()
#define HUD_Write_Cvar(cvar)
#define pass(name, colormin, colormax)
float autocvar_hud_panel_weapons_selection_speed
void Accuracy_LoadLevels()
vector Accuracy_GetColor(float accuracy)
#define FOREACH(list, cond, body)
string autocvar_hud_panel_weapons_ammo_color
int weapon_accuracy[REGISTRY_MAX(Weapons)]
float autocvar_hud_panel_weapons_timeout_speed_out
void HUD_Panel_LoadCvars()