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");
84 TC(
int, i);
TC(
int, j);
93 TC(
int, i);
TC(
int, j);
99#define HUD_WEAPONS_GET_FULL_LAYOUT() MACRO_BEGIN \
101 FOREACH(Weapons, it != WEP_Null, \
103 if (weapons_stat & WepSet_FromWeapon(it)) \
105 if (it.spawnflags & (WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED)) \
108 vector table_size = HUD_GetTableSize_BestItemAR((REGISTRY_COUNT(Weapons) - 1) - nHidden, panel_size, aspect); \
109 columns = table_size.x; \
110 rows = table_size.y; \
111 weapon_size.x = panel_size.x / columns; \
112 weapon_size.y = panel_size.y / rows; \
133 if (timeout &&
time >=
weapontime + timeout + timeout_effect_length)
150 vector weapon_size =
'0 0 0';
179 if (wepent.switchweapon == WEP_Null)
180 panel_switchweapon =
NULL;
181 else if (!panel_switchweapon)
182 panel_switchweapon = wepent.switchweapon;
189 FOREACH(
Weapons, it != WEP_Null && it.impulse >= 0 && (it.impulse % 3 != 0) && j < 6,
191 if (!(it.spawnflags & (WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_SPECIALATTACK)))
193 if (!panel_switchweapon || j < 4)
194 panel_switchweapon = it;
195 weapons_stat |= it.m_wepset;
207 weapons_stat =
'0 0 0';
222 int rows = 0, columns = 0;
223 bool vertical_order =
true;
249 if (weapon_count == 0)
264 rows =
min(rows,
ceil(weapon_count / max_columns));
265 columns =
ceil(weapon_count / rows);
266 weapon_size.x =
min(
panel_size.x / columns, aspect * weapon_size.y);
267 weapon_size.y =
min(
panel_size.y / rows, weapon_size.x / aspect);
272 columns =
min(columns,
ceil(weapon_count / max_rows));
273 rows =
ceil(weapon_count / columns);
274 weapon_size.y =
min(
panel_size.y / rows, weapon_size.x / aspect);
275 weapon_size.x =
min(
panel_size.x / columns, aspect * weapon_size.y);
309 Weapons_Draw(panel_switchweapon, weapons_stat, center, weapon_size, aspect, when,
fadetime, rows, columns, vertical_order);
347 if (center.x / center.y < screen_ar)
391 if (center.x / center.y < screen_ar)
413 int rows,
int columns,
bool vertical_order)
426 vector barsize =
'0 0 0', baroffset =
'0 0 0';
428 vector ammo_color =
'1 0 1';
429 float ammo_alpha = 1;
432 int row = 0, column = 0;
454 if (weapon_size.x / weapon_size.y > aspect)
456 barsize.x = aspect * weapon_size.y;
457 barsize.y = weapon_size.y;
458 baroffset.x = (weapon_size.x - barsize.x) * 0.5;
462 barsize.y = 1 / aspect * weapon_size.x;
463 barsize.x = weapon_size.x;
464 baroffset.y = (weapon_size.y - barsize.y) * 0.5;
474 static vector weapon_pos_current =
'-1 0 0';
475 if (weapon_pos_current.x == -1)
485 if (panel_switchweapon)
492 int weapon_id = it.impulse;
495 if (!it || weapon_id < 0)
525 if (it == panel_switchweapon)
527 if (weapon_pos_current.y > weapon_pos.y)
528 weapon_pos_current.y =
max(weapon_pos.y, weapon_pos_current.y - switch_speed * (weapon_pos_current.y - weapon_pos.y));
529 else if (weapon_pos_current.y < weapon_pos.y)
530 weapon_pos_current.y =
min(weapon_pos.y, weapon_pos_current.y + switch_speed * (weapon_pos.y - weapon_pos_current.y));
531 if (weapon_pos_current.x > weapon_pos.x)
532 weapon_pos_current.x =
max(weapon_pos.x, weapon_pos_current.x - switch_speed * (weapon_pos_current.x - weapon_pos.x));
533 else if (weapon_pos_current.x < weapon_pos.x)
534 weapon_pos_current.x =
min(weapon_pos.x, weapon_pos_current.x + switch_speed * (weapon_pos.x - weapon_pos_current.x));
542 panel_weapon_accuracy = (it.m_id % 7 - 2) * 0.11 + 0.3;
543 if (panel_weapon_accuracy >= 0)
550 vector weapon_size_real = noncurrent_size;
551 float weapon_alpha_real = noncurrent_alpha;
552 float radius_factor_x = 1 -
bound(0,
fabs(weapon_pos.x - weapon_pos_current.x) / radius_size.x, 1);
553 float radius_factor_y = 1 -
bound(0,
fabs(weapon_pos.y - weapon_pos_current.y) / radius_size.y, 1);
554 if (radius_factor_x || radius_factor_y)
556 weapon_size_real.x += (weapon_size.x - noncurrent_size.x) * radius_factor_x;
557 weapon_size_real.y += (weapon_size.y - noncurrent_size.y) * radius_factor_y;
558 weapon_alpha_real += (
panel_fg_alpha - noncurrent_alpha) *
min(radius_factor_x, radius_factor_y);
561 vector weapon_pos_real = weapon_pos;
562 weapon_pos_real.x = weapon_pos.x + (weapon_size.x - weapon_size_real.x) * 0.5;
563 weapon_pos_real.y = weapon_pos.y + (weapon_size.y - weapon_size_real.y) * 0.5;
602 switch (it.ammo_type)
609 default: ammo_full = 60;
613 weapon_pos.x + baroffset.x,
614 weapon_pos.y + baroffset.y,
615 barsize.x *
bound(0, a / ammo_full, 1),
645 s = _(
"Out of ammo");
655 s = _(
"Unavailable");
676 if (column >= columns)
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
void drawstring_aspect(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag)
#define drawsetcliparea(xposition, yposition, w, h)
#define drawstring(position, text, scale, rgb, alpha, flag)
#define drawpic_aspect_skin(pos, pic, sz, color, theAlpha, drawflag)
#define drawfill(position, size, rgb, alpha, flag)
#define getcommandkey(cmd_name, command)
int spectatee_status
the -1 disables HUD panels before CSQC receives necessary data
const int IT_UNLIMITED_AMMO
string strtolower(string s)
const float DRAWFLAG_NORMAL
#define pass(name, colormin, colormax)
void HUD_Panel_LoadCvars()
float complain_weapon_time
int weapon_accuracy[REGISTRY_MAX(Weapons)]
#define HUD_Panel_DrawBg()
#define HUD_Write_Cvar(cvar)
bool autocvar__hud_configure
float hud_configure_menu_open
#define FOREACH(list, cond, body)
noref float vid_conheight
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
#define REGISTRY_COUNT(id)
ERASEABLE void heapsort(int n, swapfunc_t swap, comparefunc_t cmp, entity pass)
entity viewmodels[MAX_WEAPONSLOTS]
string W_FixWeaponOrder_ForceComplete(string order)
int GetAmmoStat(Resource ammotype)
string W_NumberWeaponOrder(string order)
string W_FixWeaponOrder_BuildImpulseList(string o)
WepSet WepSet_GetFromStat()
#define WepSet_FromWeapon(it)
const int WEP_FLAG_MUTATORBLOCKED
const int WEP_FLAG_HIDDEN
string cl_weaponpriority_old
#define HUD_WEAPONS_GET_FULL_LAYOUT()
int weaponorder_cmp(int i, int j, entity pass)
vector Accuracy_GetColor(float accuracy)
void weaponorder_swap(int i, int j, entity pass)
void Accuracy_LoadLevels()
string weaponorder_cmp_str
bool weapons_orderbyimpulse_old
void Accuracy_LoadColors()
void Weapons_Draw(entity panel_switchweapon, WepSet weapons_stat, vector center, vector weapon_size, float aspect, float when, float fadetime, int rows, int columns, bool vertical_order)
entity weaponorder[REGISTRY_MAX(Weapons)]
void Weapons_Fade(vector center)
void HUD_Weapons_Export(int fh)
bool autocvar_hud_panel_weapons
vector acc_col[MAX_ACCURACY_LEVELS]
int autocvar_hud_panel_weapons_onlyowned
float autocvar_hud_panel_weapons_selection_radius
bool autocvar_hud_panel_weapons_complainbubble
float autocvar_hud_panel_weapons_timeout_fadefgmin
float acc_lev[MAX_ACCURACY_LEVELS]
float autocvar_hud_panel_weapons_ammo_alpha
float autocvar_hud_panel_weapons_timeout_fadebgmin
bool autocvar_hud_panel_weapons_hide_ondeath
bool autocvar_hud_panel_weapons_ammo
int autocvar_hud_panel_weapons_ammo_full_nails
float autocvar_hud_panel_weapons_aspect
float autocvar_hud_panel_weapons_timeout_speed_out
int autocvar_hud_panel_weapons_ammo_full_fuel
string autocvar_accuracy_color_levels
string autocvar_cl_weaponpriority
bool autocvar_hud_panel_weapons_accuracy
float autocvar_hud_panel_weapons_label_scale
string autocvar_hud_panel_weapons_ammo_color
int autocvar_hud_panel_weapons_ammo_full_shells
float autocvar_hud_panel_weapons_complainbubble_padding
int autocvar_hud_panel_weapons_label
float autocvar_hud_panel_weapons_complainbubble_time
string autocvar_hud_panel_weapons_complainbubble_color_outofammo
bool autocvar_hud_panel_weapons_dynamichud
bool autocvar_hud_panel_weapons_orderbyimpulse
int autocvar_hud_panel_weapons_timeout_effect
int autocvar_hud_panel_weapons_ammo_full_cells
string autocvar_hud_panel_weapons_complainbubble_color_donthave
float autocvar_hud_panel_weapons_selection_speed
int autocvar_hud_panel_weapons_ammo_full_rockets
float autocvar_hud_panel_weapons_noncurrent_scale
float autocvar_hud_panel_weapons_timeout_speed_in
float autocvar_hud_panel_weapons_timeout
float autocvar_hud_panel_weapons_complainbubble_fadetime
const int MAX_ACCURACY_LEVELS
string autocvar_hud_panel_weapons_complainbubble_color_unavailable
float autocvar_hud_panel_weapons_noncurrent_alpha