#pragma once

#include <common/weapons/_all.qh>
#include <common/scores.qh>

vector OFFSET_CURSOR = '0 0 0';
vector SIZE_CURSOR = '32 32 0';
void draw_cursor(vector pos, vector ofs, string img, vector col, float a);
void draw_cursor_normal(vector pos, vector col, float a);
void LoadMenuSkinValues();

void HUD_Scale_Disable();
void HUD_Scale_Enable();

#define HUD_ScaleX(f) ((f) * hud_scale.x)
#define HUD_ScaleY(f) ((f) * hud_scale.y)
#define HUD_ShiftX(f) (f + hud_shift.x + hud_shift.z * (f - hud_scale_center.x))
#define HUD_ShiftY(f) (f + hud_shift.y + hud_shift.z * (f - hud_scale_center.y))
vector HUD_Scale(vector v);
vector HUD_Shift(vector v);

vector HUD_GetFontsize(string cvarname);

void Hud_Dynamic_Frame();

bool HUD_Radar_Clickable();
void HUD_Radar_Mouse();
bool HUD_WouldShowCursor();
bool QuickMenu_IsOpened();

REGISTRY(hud_panels, BITS(6))
REGISTER_REGISTRY(hud_panels)

REGISTRY_DEFINE_GET(hud_panels, NULL)

#define _REGISTER_HUD_PANEL(id, draw_func, export_func, configflags, showflags) \
	void draw_func(bool should_draw); \
	void export_func(int fh); \
	REGISTER(hud_panels, HUD_PANEL, id, m_id, new_pure(hud_panel)) \
	{ \
		this.panel_id = this.m_id; \
		this.panel_draw = draw_func; \
		this.panel_export = export_func; \
		this.panel_name = strzone(strtolower(#id)); \
		this.panel_configflags = configflags; \
		this.panel_showflags = showflags; \
	}

#define REGISTER_HUD_PANEL(id, draw_func, configflags, showflags) \
	_REGISTER_HUD_PANEL(id, draw_func, draw_func##_Export, configflags, showflags)

#define HUD_PANEL(NAME) HUD_PANEL_##NAME

// draw the background/borders
#define HUD_Panel_DrawBg() MACRO_BEGIN \
	if (panel.current_panel_bg != "0" && panel.current_panel_bg != "") \
		draw_BorderPicture( \
			HUD_Shift(panel_pos - '1 1 0' * panel_bg_border), \
			panel.current_panel_bg, \
			HUD_Scale(panel_size + '1 1 0' * 2 * panel_bg_border), \
			panel_bg_color, panel_bg_alpha, \
			HUD_Scale('1 1 0' * BORDER_MULTIPLIER * panel_bg_border) \
		); \
MACRO_END

int panel_order[REGISTRY_MAX(hud_panels)];
string hud_panelorder_prev;

bool hud_draw_maximized;
bool hud_panel_radar_maximized;
bool hud_panel_radar_mouse;
float hud_panel_radar_bottom;
bool hud_panel_radar_temp_hidden;
bool chat_panel_modified;
bool radar_panel_modified;

float HUD_Radar_InputEvent(float bInputType, float nPrimary, float nSecondary);
void HUD_Radar_Hide_Maximized();

float HUD_GetRowCount(int item_count, vector size, float item_aspect);
vector HUD_Get_Num_Color(float hp, float maxvalue, bool blink);
void DrawNumIcon(vector myPos, vector mySize, float theTime, string icon, bool vertical, bool isInfinite, bool icon_right_align, vector color, float theAlpha);
void DrawNumIcon_expanding(vector myPos, vector mySize, float theTime, string icon, bool vertical, bool isInfinite, int icon_right_align, vector color, float theAlpha, float fadelerp);
void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theAlpha, int drawflag);
vector HUD_GetTableSize_BestItemAR(int item_count, vector psize, float item_aspect);

void HUD_Reset ();
void HUD_Main ();

int race_CheckName(string net_name);
string MakeRaceString(int cp, float mytime, float theirtime, float othertime, float lapdelta, string theirname);

int vote_yescount;
int vote_nocount;
int vote_needed;
int vote_highlighted; // currently selected vote

int vote_active; // is there an active vote?
int vote_prev; // previous state of vote_active to check for a change
float vote_alpha;
float vote_change; // "time" when vote_active changed

vector mousepos;
vector panel_click_distance; // mouse cursor distance from the top left corner of the panel (saved only upon a click)
vector panel_click_resizeorigin; // coordinates for opposite point when resizing
float resizeCorner; // 1 = topleft, 2 = topright, 3 = bottomleft, 4 = bottomright
entity highlightedPanel;
float highlightedAction; // 0 = nothing, 1 = move, 2 = resize

const float BORDER_MULTIPLIER = 4;
int weapon_accuracy[REGISTRY_MAX(Weapons)];

entity complain_weapon;
int complain_weapon_type;
float complain_weapon_time;

PlayerScoreField ps_primary, ps_secondary;
int ts_primary, ts_secondary;

.Weapon last_switchweapon;
.Weapon last_activeweapon;
float weapontime;
float weaponprevtime;

float timer;
int teamnagger;

int hudShiftState;
const int S_SHIFT  = 1;
const int S_CTRL   = 2;
const int S_ALT    = 4;
const int S_TAB    = 8;

float hud_fade_alpha;

string hud_skin_path;
string hud_skin_prev;

vector myteamcolors;

entity highlightedPanel_backup;
vector panel_pos_backup;
vector panel_size_backup;

vector panel_size_copied;

entity panel;
entityclass(HUDPanel);
classfield(HUDPanel) .string panel_name;
classfield(HUDPanel) .int panel_id;
classfield(HUDPanel) .vector current_panel_pos;
classfield(HUDPanel) .vector current_panel_size;
classfield(HUDPanel) .string current_panel_bg;
classfield(HUDPanel) .float current_panel_bg_alpha;
classfield(HUDPanel) .float current_panel_bg_border;
classfield(HUDPanel) .vector current_panel_bg_color;
classfield(HUDPanel) .float current_panel_bg_color_team;
classfield(HUDPanel) .float current_panel_bg_padding;
classfield(HUDPanel) .float current_panel_fg_alpha;
classfield(HUDPanel) .float update_time;
float panel_enabled;
vector panel_pos;
vector panel_size;
string panel_bg_str; // "_str" vars contain the raw value of the cvar, non-"_str" contains what hud.qc code should use
vector panel_bg_color;
string panel_bg_color_str;
float panel_bg_color_team;
string panel_bg_color_team_str;
float panel_fg_alpha;
float panel_bg_alpha;
string panel_bg_alpha_str;
float panel_bg_border;
string panel_bg_border_str;
float panel_bg_padding;
string panel_bg_padding_str;

classfield(HUDPanel) .void(bool should_draw) panel_draw;
classfield(HUDPanel) .void(int fh) panel_export;

// chat panel can be reduced / moved while the mapvote is active
// let know the mapvote panel about chat pos and size
float chat_posy;
float chat_sizey;

float current_player;

float autocvar__menu_alpha; // updated by the menu VM, useful to tell when the menu is being drawn

string autocvar__hud_panelorder;

bool autocvar_hud_cursormode = true;
string autocvar_hud_dock;
float autocvar_hud_dock_alpha;
string autocvar_hud_dock_color;
bool autocvar_hud_dock_color_team;
string autocvar_hud_panel_bg;
float autocvar_hud_panel_bg_alpha;
float autocvar_hud_panel_bg_border;
vector autocvar_hud_panel_bg_color;
float autocvar_hud_panel_bg_color_team;
float autocvar_hud_panel_bg_padding;
float autocvar_hud_panel_fg_alpha;
string autocvar_hud_skin;
float autocvar_hud_progressbar_alpha;
float autocvar_hud_panel_update_interval;

int autocvar_hud_speed_unit;

float autocvar_hud_dynamic_follow;
float autocvar_hud_dynamic_follow_scale;
vector autocvar_hud_dynamic_follow_scale_xyz;

vector hud_dynamic_shake_realofs;
float hud_dynamic_shake_factor;
float hud_dynamic_shake_time;

// shared across viewmodel effects and dynamic hud code
vector cl_followmodel_ofs;
float cl_followmodel_time;

vector hud_scale;
vector hud_scale_current = '1 1 0';
vector hud_shift;
vector hud_shift_current = '0 0 0';
vector hud_scale_center;

void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float length_ratio, bool vertical, float baralign, vector theColor, float theAlpha, int drawflag);

.int panel_showflags;
const int PANEL_SHOW_MAINGAME  = BIT(0); ///< show in the main HUD
const int PANEL_SHOW_MINIGAME  = BIT(1); ///< show when minigames panels are shown
const int PANEL_SHOW_MAPVOTE   = BIT(2); ///< show during map vote
const int PANEL_SHOW_WITH_SB   = BIT(3); ///< show when scoreboard is on

.int panel_configflags;
const int PANEL_CONFIG_NO        = 0;
const int PANEL_CONFIG_MAIN      = BIT(0);
const int PANEL_CONFIG_CANBEOFF  = BIT(1); ///< panel can be disabled (if disabled it's displayed with a low alpha)


// prev_* vars contain the health/armor at the previous FRAME
// set to -1 when player is dead or was not playing
int prev_health, prev_armor;
// prev_p_* vars contain the health/armor progressbar value at the previous FRAME
// set to -1 to forcedly stop effects when we switch spectated player (e.g. from playerX: 70h to playerY: 50h)
int prev_p_health, prev_p_armor;

void HUD_ItemsTime(bool should_draw);

REGISTER_HUD_PANEL(WEAPONS,         HUD_Weapons,        PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // WEAPONS
REGISTER_HUD_PANEL(AMMO,            HUD_Ammo,           PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // AMMO
REGISTER_HUD_PANEL(POWERUPS,        HUD_Powerups,       PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // POWERUPS
REGISTER_HUD_PANEL(HEALTHARMOR,     HUD_HealthArmor,    PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // HEALTHARMOR
REGISTER_HUD_PANEL(NOTIFY,          HUD_Notify,         PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME                      | PANEL_SHOW_WITH_SB) // NOTIFY
REGISTER_HUD_PANEL(TIMER,           HUD_Timer,          PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME                      | PANEL_SHOW_WITH_SB) // TIMER
REGISTER_HUD_PANEL(RADAR,           HUD_Radar,          PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // RADAR
REGISTER_HUD_PANEL(SCORE,           HUD_Score,          PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME                                          ) // SCORE
REGISTER_HUD_PANEL(RACETIMER,       HUD_RaceTimer,      PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // RACETIMER
REGISTER_HUD_PANEL(VOTE,            HUD_Vote,           PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME | PANEL_SHOW_MAPVOTE | PANEL_SHOW_WITH_SB) // VOTE
REGISTER_HUD_PANEL(MODICONS,        HUD_ModIcons,       PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                            | PANEL_SHOW_WITH_SB) // MODICONS
REGISTER_HUD_PANEL(PRESSEDKEYS,     HUD_PressedKeys,    PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // PRESSEDKEYS
REGISTER_HUD_PANEL(CHAT,            HUD_Chat,           PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME | PANEL_SHOW_MAPVOTE | PANEL_SHOW_WITH_SB) // CHAT
REGISTER_HUD_PANEL(ENGINEINFO,      HUD_EngineInfo,     PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME | PANEL_SHOW_MAPVOTE | PANEL_SHOW_WITH_SB) // ENGINEINFO
REGISTER_HUD_PANEL(INFOMESSAGES,    HUD_InfoMessages,   PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // INFOMESSAGES
REGISTER_HUD_PANEL(PHYSICS,         HUD_Physics,        PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // PHYSICS
REGISTER_HUD_PANEL(CENTERPRINT,     HUD_CenterPrint,    PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                            | PANEL_SHOW_WITH_SB) // CENTERPRINT
REGISTER_HUD_PANEL(MINIGAMEBOARD,   HUD_MinigameBoard,  PANEL_CONFIG_NO                          ,                       PANEL_SHOW_MINIGAME                      | PANEL_SHOW_WITH_SB) // MINIGAMEBOARD
REGISTER_HUD_PANEL(MINIGAMESTATUS,  HUD_MinigameStatus, PANEL_CONFIG_NO                          ,                       PANEL_SHOW_MINIGAME                      | PANEL_SHOW_WITH_SB) // MINIGAMESTATUS
REGISTER_HUD_PANEL(MINIGAMEHELP,    HUD_MinigameHelp,   PANEL_CONFIG_NO                          ,                       PANEL_SHOW_MINIGAME                      | PANEL_SHOW_WITH_SB) // MINIGAMEHELP
REGISTER_HUD_PANEL(MINIGAMEMENU,    HUD_MinigameMenu,   PANEL_CONFIG_NO                          , PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME                      | PANEL_SHOW_WITH_SB) // MINIGAMEMENU
REGISTER_HUD_PANEL(MAPVOTE,         MapVote_Draw,       PANEL_CONFIG_NO                          ,                                             PANEL_SHOW_MAPVOTE                     ) // MAPVOTE
REGISTER_HUD_PANEL(ITEMSTIME,       HUD_ItemsTime,      PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // ITEMSTIME
REGISTER_HUD_PANEL(QUICKMENU,       HUD_QuickMenu,      PANEL_CONFIG_MAIN                        , PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME                                          ) // QUICKMENU
REGISTER_HUD_PANEL(SCOREBOARD,      Scoreboard_Draw,    PANEL_CONFIG_NO                          , PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME | PANEL_SHOW_MAPVOTE | PANEL_SHOW_WITH_SB) // SCOREBOARD
REGISTER_HUD_PANEL(STRAFEHUD,       HUD_StrafeHUD,      PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // STRAFEHUD
REGISTER_HUD_PANEL(PICKUP,          HUD_Pickup,         PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // PICKUP
REGISTER_HUD_PANEL(CHECKPOINTS,     HUD_Checkpoints,    PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME                                                                ) // CHECKPOINTS
// always add new panels to the end of list and add a comment in the form of
// "// Panel Name (#nr)" with the relative panel nr in your main panelname.qc

// Because calling lots of functions in QC apparently cuts fps in half on many machines:
// ----------------------
// MACRO HELL STARTS HERE
// ----------------------
// Little help for the poor people who have to make sense of this: Start from the bottom ;)

/// Get value for panel.current_panel_bg: if "" fetch default, else use panel_bg_str
#define HUD_Panel_GetBg() MACRO_BEGIN \
	string panel_bg; \
	if (!autocvar__hud_configure && panel_bg_str == "0") \
		panel_bg = "0"; \
	else \
	{ \
		if (panel_bg_str == "") \
			panel_bg_str = autocvar_hud_panel_bg; \
		if (panel_bg_str == "0" && !autocvar__hud_configure) \
			panel_bg = "0"; \
		else \
		{ \
			if (panel_bg_str == "0" && autocvar__hud_configure) \
				panel_bg_alpha_str = "0"; \
			panel_bg = strcat(hud_skin_path, "/", panel_bg_str); \
			if (precache_pic(panel_bg) == "") \
			{ \
				panel_bg = strcat(hud_skin_path, "/", "border_default"); \
				if (precache_pic(panel_bg) == "") \
					panel_bg = strcat("gfx/hud/default/", "border_default"); \
			} \
		} \
	} \
	strcpy(panel.current_panel_bg, panel_bg); \
	/* we probably want to see a background in config mode at all times... */ \
MACRO_END

/// Get value for panel_bg_color: if "" fetch default, else use panel_bg_color. Convert pants, shirt or teamcolor into a vector.
#define HUD_Panel_GetColor() MACRO_BEGIN \
	if (teamplay && panel_bg_color_team > 0) \
		panel_bg_color = (autocvar__hud_configure && myteam == NUM_SPECTATOR) \
			? '1 0 0' * panel_bg_color_team \
			: myteamcolors * panel_bg_color_team; \
	else if (autocvar_hud_configure_teamcolorforced && autocvar__hud_configure && panel_bg_color_team > 0) \
		panel_bg_color = '1 0 0' * panel_bg_color_team; \
	else \
	{ \
		if (panel_bg_color_str == "") \
			panel_bg_color = autocvar_hud_panel_bg_color; \
		else \
		{ \
			if (panel_bg_color_str == "shirt") \
				panel_bg_color = colormapPaletteColor(floor(entcs_GetClientColors(current_player) / 16), 0); \
			else if (panel_bg_color_str == "pants") \
				panel_bg_color = colormapPaletteColor(entcs_GetClientColors(current_player) % 16, 1); \
			else \
				panel_bg_color = stov(panel_bg_color_str); \
		} \
	} \
MACRO_END

/// Get value for panel_bg_color_team: if "" fetch default, else use panel_bg_color_team_str
#define HUD_Panel_GetColorTeam() \
	panel_bg_color_team = ((panel_bg_color_team_str == "") \
		? autocvar_hud_panel_bg_color_team \
		: stof(panel_bg_color_team_str))

/// Get value for panel_bg_alpha: if "" fetch default, else use panel_bg_alpha. Also do various menu dialog fadeout/in checks, and minalpha checks
#define HUD_Panel_GetBgAlpha() MACRO_BEGIN \
	if (panel_bg_alpha_str == "") \
		panel_bg_alpha_str = ftos(autocvar_hud_panel_bg_alpha); \
	panel_bg_alpha = stof(panel_bg_alpha_str); \
	if (autocvar__hud_configure) /* do not set a minalpha cap when showing the config dialog for this panel */ \
	{ \
		if (!panel_enabled) \
			panel_bg_alpha = 0.25; \
		else if (hud_configure_menu_open == 2 && panel == highlightedPanel) \
			panel_bg_alpha = (1 - autocvar__menu_alpha) * max(cvar("hud_configure_bg_minalpha"), panel_bg_alpha) + autocvar__menu_alpha * panel_bg_alpha; \
		else \
			panel_bg_alpha = max(cvar("hud_configure_bg_minalpha"), panel_bg_alpha); \
	} \
MACRO_END

/// Get value for panel_fg_alpha. Also do various minalpha checks
#define HUD_Panel_GetFgAlpha() \
	panel_fg_alpha = ((autocvar__hud_configure && !panel_enabled) \
		? panel_fg_alpha = 0.25 /* ALWAYS show disabled panels at 0.25 alpha when in config mode */ \
		: autocvar_hud_panel_fg_alpha)

/// Get border. See comments above, it's similar.
#define HUD_Panel_GetBorder() \
	panel_bg_border = ((panel_bg_border_str == "") \
		? autocvar_hud_panel_bg_border \
		: stof(panel_bg_border_str))

/// Get padding. See comments above, it's similar.
/// last line is a port of the old function, basically always make sure the panel contents are at least 5 pixels tall/wide, to disallow extreme padding values
#define HUD_Panel_GetPadding() MACRO_BEGIN \
	panel_bg_padding = ((panel_bg_padding_str == "") \
		? autocvar_hud_panel_bg_padding \
		: stof(panel_bg_padding_str)); \
	panel_bg_padding = min(min(panel_size.x, panel_size.y) * 0.5 - 5, panel_bg_padding); \
MACRO_END

/// return smoothly faded pos and size of given panel when a dialog is active
/// don't center too wide panels, it doesn't work with different resolutions
#define HUD_Panel_UpdatePosSize_ForMenu() MACRO_BEGIN \
	vector new_size = panel_size; \
	float max_panel_width = 0.52 * vid_conwidth; \
	if (panel_size.x > max_panel_width) \
	{ \
		new_size.x = max_panel_width; \
		new_size.y = panel_size.y * (new_size.x / panel_size.x); \
	} \
	vector new_pos = vec2(panel_bg_border + 0.5 * max_panel_width, 0.5 * vid_conheight) - 0.5 * new_size; \
	panel_pos = (1 - autocvar__menu_alpha) * panel_pos + (autocvar__menu_alpha) * new_pos; \
	panel_size = (1 - autocvar__menu_alpha) * panel_size + (autocvar__menu_alpha) * new_size; \
MACRO_END

/// Scale the pos and size vectors to absolute coordinates
#define HUD_Panel_ScalePosSize() MACRO_BEGIN \
	panel_pos.x *= vid_conwidth; \
	panel_pos.y *= vid_conheight; \
	panel_size.x *= vid_conwidth; \
	panel_size.y *= vid_conheight; \
MACRO_END

float panel_fade_alpha;
void HUD_Panel_LoadCvars();

#define HUD_Panel_GetPanelEnabled() \
	panel_enabled = ((panel.panel_configflags & PANEL_CONFIG_CANBEOFF) \
		? cvar(strcat("hud_panel_", panel.panel_name)) \
		: true)

#define HUD_Panel_UpdatePosSize() MACRO_BEGIN \
	HUD_Panel_GetPanelEnabled(); \
	panel_pos = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_pos"))); \
	panel_size = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_size"))); \
	HUD_Panel_ScalePosSize(); \
	if (hud_configure_menu_open == 2 && panel == highlightedPanel) \
		HUD_Panel_UpdatePosSize_ForMenu(); \
	panel_bg_border_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_border")); \
	HUD_Panel_GetBorder(); \
MACRO_END

const int NOTIFY_MAX_ENTRIES = 10;
const float NOTIFY_ICON_MARGIN = 0.02;

int notify_index;
int notify_count;
float notify_times[NOTIFY_MAX_ENTRIES];
string notify_attackers[NOTIFY_MAX_ENTRIES];
string notify_victims[NOTIFY_MAX_ENTRIES];
string notify_icons[NOTIFY_MAX_ENTRIES];

void HUD_Notify_Push(string icon, string attacker, string victim);

var void HUD_ModIcons_GameType(vector myPos, vector mySize, bool should_draw);
void HUD_ModIcons_SetFunc();
