float i;
for (i = 0; i < HUD_PANEL_NUM; ++i)
{
- HUD_Panel_GetName(i)
+ HUD_Panel_GetName(i);
fputs(fh, strcat("seta hud_panel_", panel_name, " ", cvar_string(strcat("hud_panel_", panel_name)), "\n"));
fputs(fh, strcat("seta hud_panel_", panel_name, "_pos \"", cvar_string(strcat("hud_panel_", panel_name, "_pos")), "\"", "\n"));
if(panel_bg != "0")\
draw_BorderPicture(panel_pos - '1 1 0' * panel_bg_border, panel_bg, panel_size + '1 1 0' * 2 * panel_bg_border, panel_bg_color, panel_bg_alpha * alpha, '1 1 0' * (panel_bg_border/BORDER_MULTIPLIER));\
if(highlightedPanel_prev == active_panel && autocvar__hud_configure)\
- HUD_Panel_HlBorder(panel_bg_border + 1.5 * hlBorderSize, '0 0.5 1', 0.25 * (1 - autocvar__menu_alpha) * alpha);
+{\
+ HUD_Panel_HlBorder(panel_bg_border + 1.5 * hlBorderSize, '0 0.5 1', 0.25 * (1 - autocvar__menu_alpha) * alpha);\
+} ENDS_WITH_CURLY_BRACE
void HUD_Panel_DrawProgressBar(vector pos, float vertical, vector mySize, vector color, float alpha, float drawflag)
{
vector myTarget;
myTarget = myPos;
- vector targPos;
- vector targSize;
vector myCenter;
vector targCenter;
myCenter = '0 0 0'; // shut up fteqcc, there IS a reference
if(i == highlightedPanel || !panel_enabled)
continue;
- HUD_Panel_UpdatePosSizeForId(i)
+ HUD_Panel_UpdatePosSizeForId(i);
panel_pos -= '1 1 0' * panel_bg_border;
panel_size += '2 2 0' * panel_bg_border;
void HUD_Panel_SetPos(vector pos)
{
- HUD_Panel_UpdatePosSizeForId(highlightedPanel)
+ HUD_Panel_UpdatePosSizeForId(highlightedPanel);
vector mySize;
mySize = panel_size;
vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
float i;
- float targBorder;
- vector targPos;
- vector targSize;
vector targEndPos;
- vector dist;
+ float dist_x, dist_y;
float ratio;
ratio = mySize_x/mySize_y;
if(i == highlightedPanel || !panel_enabled)
continue;
- HUD_Panel_UpdatePosSizeForId(i)
+ HUD_Panel_UpdatePosSizeForId(i);
panel_pos -= '1 1 0' * panel_bg_border;
panel_size += '2 2 0' * panel_bg_border;
void HUD_Panel_SetPosSize(vector mySize)
{
- HUD_Panel_UpdatePosSizeForId(highlightedPanel)
+ HUD_Panel_UpdatePosSizeForId(highlightedPanel);
vector resizeorigin;
resizeorigin = panel_click_resizeorigin;
vector myPos;
highlightedPanel = highlightedPanel_prev;
- HUD_Panel_UpdatePosSizeForId(highlightedPanel)
+ HUD_Panel_UpdatePosSizeForId(highlightedPanel);
vector prev_pos, prev_size;
prev_pos = panel_pos;
HUD_Panel_SetPos(pos);
}
- HUD_Panel_UpdatePosSizeForId(highlightedPanel)
+ HUD_Panel_UpdatePosSizeForId(highlightedPanel);
if (prev_pos != panel_pos || prev_size != panel_size)
{
float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
{
+ string s;
+
if(!autocvar__hud_configure)
return false;
if (highlightedPanel_copied == -1 || highlightedPanel_prev == -1)
return true;
- HUD_Panel_UpdatePosSizeForId(highlightedPanel_prev)
+ HUD_Panel_UpdatePosSizeForId(highlightedPanel_prev);
// reduce size if it'd go beyond screen boundaries
vector tmp_size = panel_size_copied;
panel_size_backup = panel_size;
highlightedPanel_backup = highlightedPanel_prev;
- string s;
s = strcat(ftos(tmp_size_x/vid_conwidth), " ", ftos(tmp_size_y/vid_conheight));
cvar_set(strcat("hud_panel_", panel_name, "_size"), s);
}
//restore previous values
if (highlightedPanel_backup != -1)
{
- HUD_Panel_GetName(highlightedPanel_backup)
- string s;
+ HUD_Panel_GetName(highlightedPanel_backup);
s = strcat(ftos(panel_pos_backup_x/vid_conwidth), " ", ftos(panel_pos_backup_y/vid_conheight));
cvar_set(strcat("hud_panel_", panel_name, "_pos"), s);
s = strcat(ftos(panel_size_backup_x/vid_conwidth), " ", ftos(panel_size_backup_y/vid_conheight));
i = panel_order[j];
j += 1;
- HUD_Panel_UpdatePosSizeForId(i)
+ HUD_Panel_UpdatePosSizeForId(i);
panelPos = panel_pos;
panelSize = panel_size;
i = panel_order[j];
j += 1;
- HUD_Panel_UpdatePosSizeForId(i)
+ HUD_Panel_UpdatePosSizeForId(i);
panelPos = panel_pos;
panelSize = panel_size;
prev_size = panel_size;
}
else
- HUD_Panel_UpdatePosSizeForId(highlightedPanel)
+ HUD_Panel_UpdatePosSizeForId(highlightedPanel);
if (prev_pos != panel_pos || prev_size != panel_size)
{
mouseClicked = 0; // to prevent spam, I guess.
menu_enabled = 2;
menu_enabled_time = time;
- HUD_Panel_GetName(highlightedPanel)
+ HUD_Panel_GetName(highlightedPanel);
localcmd("menu_showhudoptions ", panel_name, "\n");
return;
}
highlightcheck = HUD_Panel_HighlightCheck();
}
// draw cursor after performing move/resize to have the panel pos/size updated before highlightcheck
- string cursor;
vector cursorsize;
cursorsize = '32 32 0';
#define HUD_Weapons_Clear()\
float idx;\
for(idx = 0; idx < 10; ++idx)\
- weaponspace[idx] = 0;
+ weaponspace[idx] = 0
entity weaponorder[WEP_MAXCOUNT];
void weaponorder_swap(float i, float j, entity pass)
weaponorder[j] = h;
}
-string weaponorder_cmp_str_save;
string weaponorder_cmp_str;
float weaponorder_cmp(float i, float j, entity pass)
{
{
case WEP_SHOTGUN: return 0;
case WEP_UZI: return 1;
- case WEP_CAMPINGRIFLE: return 1;
case WEP_GRENADE_LAUNCHER: return 2;
case WEP_MINE_LAYER: return 2;
case WEP_ELECTRO: return 3;
case WEP_HLAC: return 3;
case WEP_MINSTANEX: return 3;
case WEP_NEX: return 3;
+ case WEP_CAMPINGRIFLE: return 1;
case WEP_HAGAR: return 2;
case WEP_ROCKET_LAUNCHER: return 2;
case WEP_SEEKER: return 2;
void HUD_Weapons(void)
{
+ float f, screen_ar;
+ float center_x, center_y;
+
if(!autocvar_hud_panel_weapons && !autocvar__hud_configure)
return;
if (timeout && time >= weapontime + timeout && !autocvar__hud_configure)
{
- float f = (time - (weapontime + timeout)) / timeout_effect_length;
+ f = (time - (weapontime + timeout)) / timeout_effect_length;
if (cvar("hud_panel_weapons_timeout_effect"))
{
panel_bg_alpha *= (1 - f);
if (cvar("hud_panel_weapons_timeout_effect") == 1)
{
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;
+ 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
}
else if (timeout && time < weaponprevtime + timein_effect_length && !autocvar__hud_configure)
{
- float f = (time - weaponprevtime) / timein_effect_length;
+ f = (time - weaponprevtime) / timein_effect_length;
if (cvar("hud_panel_weapons_timeout_effect"))
{
panel_bg_alpha *= (f);
{
f *= f; // for a cooler movement
f = 1 - f;
- 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;
+ 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
}
// TODO make this configurable
- weaponorder_cmp_str = strcat(" ", weaponorder_byimpulse, " ");
-
- if(weaponorder_cmp_str != weaponorder_cmp_str_save)
+ if(weaponorder_bypriority != cvar_string("cl_weaponpriority"))
{
- if(weaponorder_cmp_str_save)
- strunzone(weaponorder_cmp_str_save);
- weaponorder_cmp_str_save = strzone(weaponorder_cmp_str);
+ if(weaponorder_bypriority)
+ strunzone(weaponorder_bypriority);
+ if(weaponorder_byimpulse)
+ strunzone(weaponorder_byimpulse);
+
+ weaponorder_bypriority = strzone(cvar_string("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)
{
}
}
heapsort(weapon_cnt, weaponorder_swap, weaponorder_cmp, world);
+
+ weaponorder_cmp_str = string_null;
}
HUD_Panel_DrawBg(1);
default: fullammo = 60;
}
- vector barsize;
- vector barpos;
+ float barsize_x, barsize_y, barpos_x, barpos_y;
if(wpnsize_x/wpnsize_y > autocvar_hud_panel_weapons_aspect)
{
barsize_x = autocvar_hud_panel_weapons_aspect * wpnsize_y;
void DrawNumIcon(float iconalign, vector myPos, vector mySize, float x, string icon, float left, vector color, float alpha)
{
- vector newSize, newPos;
+ vector newPos;
+ float newSize_x, newSize_y;
if(mySize_x/mySize_y > 3)
{
newSize_x = 3 * mySize_y;
if(autocvar_hud_panel_powerups_progressbar)
{
- HUD_Panel_GetProgressBarColor(leftname)
+ HUD_Panel_GetProgressBarColorForString(leftname);
HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1), DRAWFLAG_NORMAL);
}
if(leftcnt > 1)
if(autocvar_hud_panel_powerups_progressbar)
{
- HUD_Panel_GetProgressBarColor(rightname)
+ HUD_Panel_GetProgressBarColorForString(rightname);
HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1) * panel_fg_alpha, DRAWFLAG_NORMAL);
}
if(rightcnt > 1)
if(autocvar_hud_panel_powerups_progressbar)
{
- HUD_Panel_GetProgressBarColor(leftname)
+ HUD_Panel_GetProgressBarColorForString(leftname);
HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1) * panel_fg_alpha, DRAWFLAG_NORMAL);
}
if(leftcnt > 1)
if(autocvar_hud_panel_powerups_progressbar)
{
- HUD_Panel_GetProgressBarColor(rightname)
+ HUD_Panel_GetProgressBarColorForString(rightname);
HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1) * panel_fg_alpha, DRAWFLAG_NORMAL);
}
if(rightcnt > 1)
if(autocvar_hud_panel_powerups_progressbar)
{
- HUD_Panel_GetProgressBarColor(leftname)
+ HUD_Panel_GetProgressBarColorForString(leftname);
HUD_Panel_DrawProgressBar(barpos, 1, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1) * panel_fg_alpha, DRAWFLAG_NORMAL);
}
if(leftcnt <= 5)
if(autocvar_hud_panel_powerups_progressbar)
{
- HUD_Panel_GetProgressBarColor(rightname)
+ HUD_Panel_GetProgressBarColorForString(rightname);
HUD_Panel_DrawProgressBar(barpos, 1, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1) * panel_fg_alpha, DRAWFLAG_NORMAL);
}
if(rightcnt <= 5)
biggercount = "health";
if(autocvar_hud_panel_healtharmor_progressbar)
{
- HUD_Panel_GetProgressBarColor("health")
+ HUD_Panel_GetProgressBarColor(health);
HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
}
if(armor)
biggercount = "armor";
if(autocvar_hud_panel_healtharmor_progressbar)
{
- HUD_Panel_GetProgressBarColor("armor")
+ HUD_Panel_GetProgressBarColor(armor);
HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
}
if(health)
barpos = pos;
barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.2 * mySize_y;
}
- HUD_Panel_GetProgressBarColor("fuel")
+ HUD_Panel_GetProgressBarColor(fuel);
HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
}
}
if(autocvar_hud_panel_healtharmor_progressbar)
{
- HUD_Panel_GetProgressBarColor(leftname)
+ HUD_Panel_GetProgressBarColorForString(leftname);
HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
}
DrawNumIcon(autocvar_hud_panel_healtharmor_iconalign, pos, eX * 0.5 * mySize_x + eY * mySize_y, leftcnt, leftname, 1, HUD_Get_Num_Color(leftcnt, 200), 1);
if(autocvar_hud_panel_healtharmor_progressbar)
{
- HUD_Panel_GetProgressBarColor(rightname)
+ HUD_Panel_GetProgressBarColorForString(rightname);
HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
}
DrawNumIcon(autocvar_hud_panel_healtharmor_iconalign, pos + eX * 0.5 * mySize_x, eX * 0.5 * mySize_x + eY * mySize_y, rightcnt, rightname, 0, HUD_Get_Num_Color(rightcnt, 200), 1);
barpos = pos;
barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.2 * mySize_y;
}
- HUD_Panel_GetProgressBarColor("fuel")
+ HUD_Panel_GetProgressBarColor(fuel);
HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
}
}
if(autocvar_hud_panel_healtharmor_progressbar)
{
- HUD_Panel_GetProgressBarColor(leftname)
+ HUD_Panel_GetProgressBarColorForString(leftname);
HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
}
DrawNumIcon(autocvar_hud_panel_healtharmor_iconalign, pos, eX * mySize_x + eY * 0.5 * mySize_y, leftcnt, leftname, 1, HUD_Get_Num_Color(leftcnt, 200), 1);
if(autocvar_hud_panel_healtharmor_progressbar)
{
- HUD_Panel_GetProgressBarColor(rightname)
+ HUD_Panel_GetProgressBarColorForString(rightname);
HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
}
DrawNumIcon(autocvar_hud_panel_healtharmor_iconalign, pos + eY * 0.5 * mySize_y, eX * mySize_x + eY * 0.5 * mySize_y, rightcnt, rightname, 0, HUD_Get_Num_Color(rightcnt, 200), 1);
barpos = pos;
barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.1 * mySize_y;
}
- HUD_Panel_GetProgressBarColor("fuel")
+ HUD_Panel_GetProgressBarColor(fuel);
HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
}
}
if(autocvar_hud_panel_healtharmor_progressbar)
{
- HUD_Panel_GetProgressBarColor(leftname)
+ HUD_Panel_GetProgressBarColorForString(leftname);
HUD_Panel_DrawProgressBar(barpos, 1, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
}
drawpic_aspect_skin(picpos, leftname, '0.4 0.4 0' * mySize_x, '1 1 1', leftalpha * panel_fg_alpha, DRAWFLAG_NORMAL);
if(autocvar_hud_panel_healtharmor_progressbar)
{
- HUD_Panel_GetProgressBarColor(rightname)
+ HUD_Panel_GetProgressBarColorForString(rightname);
HUD_Panel_DrawProgressBar(barpos, 1, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
}
drawpic_aspect_skin(picpos, rightname, '0.4 0.4 0' * mySize_x, '1 1 1', rightalpha * panel_fg_alpha, DRAWFLAG_NORMAL);
barpos = pos + eY * mySize_y - eY * mySize_y * min(1, fuel/100);
barsize = eX * 0.05 * mySize_x + eY * mySize_y * min(1, fuel/100);
}
- HUD_Panel_GetProgressBarColor("fuel")
+ HUD_Panel_GetProgressBarColor(fuel);
HUD_Panel_DrawProgressBar(barpos, 1, barsize, progressbar_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
}
}
barsize = eX * mySize_x + eY * p * mySize_y;
vertical = 1;
}
- HUD_Panel_GetProgressBarColor("nexball")
+ HUD_Panel_GetProgressBarColor(nexball);
HUD_Panel_DrawProgressBar(pos, vertical, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
}
} else {
// text on top
squareSize = min(mySize_x, mySize_y/2);
- textPos = pos + eY * 0.5 * max(0, mySize_y/2 - squareSize) + eX * 0.5 * (mySize_x - squareSize);;
+ textPos = pos + eY * 0.5 * max(0, mySize_y/2 - squareSize) + eX * 0.5 * (mySize_x - squareSize);
medalPos = pos + eY * 0.5 * max(0, mySize_y/2 - squareSize) + eY * 0.5 * mySize_y + eX * 0.5 * (mySize_x - squareSize);
}
HUD_EngineInfo(); break;\
case (HUD_PANEL_INFOMESSAGES):\
HUD_InfoMessages(); break;\
-}
+} ENDS_WITH_CURLY_BRACE
void HUD_Main (void)
{
+ float i;
+
hud_skin_path = strcat("gfx/hud/", autocvar_hud_skin);
// global hud alpha fade
// HUD configure visible grid
if(autocvar__hud_configure && autocvar_hud_configure_grid && autocvar_hud_configure_grid_alpha)
{
- float i;
// x-axis
for(i = 0; i < 1/bound(0.005, autocvar_hud_configure_grid_xsize, 0.2); ++i)
{
// draw chat panel on top if it is maximized
if(autocvar__con_chat_maximized)
- HUD_DrawPanel(HUD_PANEL_CHAT);
+ HUD_Chat(); // HUD_DrawPanel(HUD_PANEL_CHAT);
// TODO hud_'ify these
if (cvar("cl_showspeed"))