seta hud_progressbar_vehicles_ammo1_color "0.77 0.67 0"
seta hud_progressbar_vehicles_ammo2_color "0.86 0.35 0"
-seta _hud_panelorder "17 15 12 9 5 10 6 14 0 7 4 11 2 1 3 8 13 16 18"
+seta _hud_panelorder "17 15 12 9 5 10 6 14 0 7 4 11 2 1 3 8 13 16 18 23 19 20 21 22 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.005000"
seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
-seta _hud_panelorder "17 15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 16 18 23 "
+seta _hud_panelorder "17 15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 16 18 23 19 20 21 22 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
-seta _hud_panelorder "17 10 3 0 14 6 9 13 4 1 2 11 12 7 5 8 15 16 18 23 "
+seta _hud_panelorder "17 10 3 0 14 6 9 13 4 1 2 11 12 7 5 8 15 16 18 23 19 20 21 22 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
-seta _hud_panelorder "17 15 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 16 18 23 "
+seta _hud_panelorder "17 15 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 16 18 23 19 20 21 22 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
-seta _hud_panelorder "17 15 10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 16 18 23 "
+seta _hud_panelorder "17 15 10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 16 18 23 19 20 21 22 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
-seta _hud_panelorder "17 15 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 16 18 23 "
+seta _hud_panelorder "17 15 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 16 18 23 19 20 21 22 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.01"
vector color;
// check to see if we want to continue
- if(intermission == 2) return;
if(hud != HUD_NORMAL) return;
if(!autocvar__hud_configure)
float nade_statuschange_time;
void HUD_Ammo(void)
{
- if(intermission == 2) return;
if(hud != HUD_NORMAL) return;
if(!autocvar__hud_configure)
{
void HUD_Powerups()
{
- if(intermission == 2) return;
-
int allItems = getstati(STAT_ITEMS, 0, 24);
int allBuffs = getstati(STAT_BUFFS, 0, 24);
int strengthTime, shieldTime, superTime;
void HUD_HealthArmor(void)
{
int armor, health, fuel;
- if(intermission == 2) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_healtharmor) return;
void HUD_Notify(void)
{
- if(intermission == 2) return;
if (!autocvar__hud_configure)
if (!autocvar_hud_panel_notify)
return;
void HUD_Timer(void)
{
- if(intermission == 2) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_timer) return;
void HUD_Radar(void)
{
- if(intermission == 2) return;
if (!autocvar__hud_configure)
{
if (hud_panel_radar_maximized)
void HUD_Score(void)
{
- if(intermission == 2) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_score) return;
//
void HUD_RaceTimer (void)
{
- if(intermission == 2) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_racetimer) return;
void HUD_Vote(void)
{
- if(intermission == 2) return;
if(autocvar_cl_allow_uid2name == -1 && (gametype == MAPINFO_TYPE_CTS || gametype == MAPINFO_TYPE_RACE || (serverflags & SERVERFLAG_PLAYERSTATS)))
{
vote_active = 1;
void HUD_ModIcons(void)
{
- if(intermission == 2) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_modicons) return;
//
void HUD_PressedKeys(void)
{
- if(intermission == 2) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_pressedkeys) return;
float frametimeavg2; // 2 frames ago
void HUD_EngineInfo(void)
{
- //if(intermission == 2) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_engineinfo) return;
} while(0)
void HUD_InfoMessages(void)
{
- if(intermission == 2) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_infomessages) return;
float physics_update_time, discrete_speed, discrete_acceleration;
void HUD_Physics(void)
{
- if(intermission == 2) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_physics) return;
float hud_configure_cp_generation_time;
void HUD_CenterPrint (void)
{
- if(intermission == 2) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_centerprint) return;
==================
*/
+void HUD_Vehicle()
+{
+ if(autocvar__hud_configure) return;
+ if(intermission == 2) return;
+
+ if(hud == HUD_BUMBLEBEE_GUN)
+ CSQC_BUMBLE_GUN_HUD();
+ else {
+ Vehicle info = get_vehicleinfo(hud);
+ info.vr_hud(info);
+ }
+}
+
bool HUD_Panel_CheckFlags(int showflags)
{
if ( HUD_Minigame_Showpanels() )
return showflags & PANEL_SHOW_MINIGAME;
+ if(intermission == 2)
+ return showflags & PANEL_SHOW_MAPVOTE;
return showflags & PANEL_SHOW_MAINGAME;
}
void HUD_Panel_Draw(entity panent)
{
panel = panent;
- if ( HUD_Panel_CheckFlags(panel.panel_showflags) )
+ if(autocvar__hud_configure)
+ {
+ if(panel.panel_configflags & PANEL_CONFIG_MAIN)
+ panel.panel_draw();
+ }
+ else if(HUD_Panel_CheckFlags(panel.panel_showflags))
panel.panel_draw();
}
-void HUD_Reset (void)
+void HUD_Reset(void)
{
// reset gametype specific icons
if(gametype == MAPINFO_TYPE_CTF)
HUD_Mod_CTF_Reset();
}
-void HUD_Main (void)
+void HUD_Main(void)
{
int i;
// global hud theAlpha fade
for(i = hud_panels_COUNT - 1; i >= 0; --i)
HUD_Panel_Draw(hud_panels[panel_order[i]]);
+ HUD_Vehicle();
+
hud_draw_maximized = 1; // panels that may be maximized must check this var
// draw maximized panels on top
if(hud_panel_radar_maximized)
if(hud_panel_quickmenu)
HUD_Panel_Draw(HUD_PANEL(QUICKMENU));
+ if (scoreboard_active || intermission == 2)
+ HUD_Reset();
+
HUD_Configure_PostDraw();
hud_configure_prev = autocvar__hud_configure;
REGISTRY(hud_panels, 24)
REGISTER_REGISTRY(Registerhud_panels)
-#define REGISTER_HUD_PANEL(id, draw_func, name, showflags) \
+#define REGISTER_HUD_PANEL(id, draw_func, name, configflags, showflags) \
void draw_func(); \
REGISTER(Registerhud_panels, HUD_PANEL, hud_panels, id, m_id, new(hud_panel)) { \
this.panel_id = this.m_id; \
this.panel_draw = draw_func; \
this.panel_name = #name; \
+ this.panel_configflags = configflags; \
this.panel_showflags = showflags; \
}
const int PANEL_SHOW_NEVER = 0x00;
const int PANEL_SHOW_MAINGAME = 0x01;
const int PANEL_SHOW_MINIGAME = 0x02;
+const int PANEL_SHOW_MAPVOTE = 0x04;
const int PANEL_SHOW_ALWAYS = 0xff;
bool HUD_Panel_CheckFlags(int showflags);
+.int panel_configflags;
+const int PANEL_CONFIG_NO = 0x00;
+const int PANEL_CONFIG_MAIN = 0x01;
+
// prev_* vars contain the health/armor at the previous FRAME
// set to -1 when player is dead or was not playing
void HUD_ItemsTime();
-REGISTER_HUD_PANEL(WEAPONS, HUD_Weapons, weapons, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(AMMO, HUD_Ammo, ammo, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(POWERUPS, HUD_Powerups, powerups, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(HEALTHARMOR, HUD_HealthArmor, healtharmor, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(NOTIFY, HUD_Notify, notify, PANEL_SHOW_ALWAYS )
-REGISTER_HUD_PANEL(TIMER, HUD_Timer, timer, PANEL_SHOW_ALWAYS )
-REGISTER_HUD_PANEL(RADAR, HUD_Radar, radar, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(SCORE, HUD_Score, score, PANEL_SHOW_ALWAYS )
-REGISTER_HUD_PANEL(RACETIMER, HUD_RaceTimer, racetimer, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(VOTE, HUD_Vote, vote, PANEL_SHOW_ALWAYS )
-REGISTER_HUD_PANEL(MODICONS, HUD_ModIcons, modicons, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(PRESSEDKEYS, HUD_PressedKeys, pressedkeys, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(CHAT, HUD_Chat, chat, PANEL_SHOW_ALWAYS )
-REGISTER_HUD_PANEL(ENGINEINFO, HUD_EngineInfo, engineinfo, PANEL_SHOW_ALWAYS )
-REGISTER_HUD_PANEL(INFOMESSAGES, HUD_InfoMessages, infomessages, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(PHYSICS, HUD_Physics, physics, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(CENTERPRINT, HUD_CenterPrint, centerprint, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(MINIGAME_BOARD, HUD_MinigameBoard, minigameboard, PANEL_SHOW_MINIGAME)
-REGISTER_HUD_PANEL(MINIGAME_STATUS, HUD_MinigameStatus, minigamestatus, PANEL_SHOW_MINIGAME)
-REGISTER_HUD_PANEL(MINIGAME_HELP, HUD_MinigameHelp, minigamehelp, PANEL_SHOW_MINIGAME)
-REGISTER_HUD_PANEL(MINIGAME_MENU, HUD_MinigameMenu, minigamemenu, PANEL_SHOW_ALWAYS )
-REGISTER_HUD_PANEL(MAPVOTE, MapVote_Draw, mapvote, PANEL_SHOW_ALWAYS )
-REGISTER_HUD_PANEL(ITEMSTIME, HUD_ItemsTime, itemstime, PANEL_SHOW_MAINGAME)
-REGISTER_HUD_PANEL(QUICKMENU, HUD_QuickMenu, quickmenu, PANEL_SHOW_MAINGAME)
+REGISTER_HUD_PANEL(WEAPONS, HUD_Weapons, weapons, PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
+REGISTER_HUD_PANEL(AMMO, HUD_Ammo, ammo, PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
+REGISTER_HUD_PANEL(POWERUPS, HUD_Powerups, powerups, PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
+REGISTER_HUD_PANEL(HEALTHARMOR, HUD_HealthArmor, healtharmor, PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
+REGISTER_HUD_PANEL(NOTIFY, HUD_Notify, notify, PANEL_CONFIG_MAIN, PANEL_SHOW_ALWAYS & ~PANEL_SHOW_MAPVOTE)
+REGISTER_HUD_PANEL(TIMER, HUD_Timer, timer, PANEL_CONFIG_MAIN, PANEL_SHOW_ALWAYS & ~PANEL_SHOW_MAPVOTE)
+REGISTER_HUD_PANEL(RADAR, HUD_Radar, radar, PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
+REGISTER_HUD_PANEL(SCORE, HUD_Score, score, PANEL_CONFIG_MAIN, PANEL_SHOW_ALWAYS & ~PANEL_SHOW_MAPVOTE)
+REGISTER_HUD_PANEL(RACETIMER, HUD_RaceTimer, racetimer, PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
+REGISTER_HUD_PANEL(VOTE, HUD_Vote, vote, PANEL_CONFIG_MAIN, PANEL_SHOW_ALWAYS )
+REGISTER_HUD_PANEL(MODICONS, HUD_ModIcons, modicons, PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
+REGISTER_HUD_PANEL(PRESSEDKEYS, HUD_PressedKeys, pressedkeys, PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
+REGISTER_HUD_PANEL(CHAT, HUD_Chat, chat, PANEL_CONFIG_MAIN, PANEL_SHOW_ALWAYS )
+REGISTER_HUD_PANEL(ENGINEINFO, HUD_EngineInfo, engineinfo, PANEL_CONFIG_MAIN, PANEL_SHOW_ALWAYS )
+REGISTER_HUD_PANEL(INFOMESSAGES, HUD_InfoMessages, infomessages, PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
+REGISTER_HUD_PANEL(PHYSICS, HUD_Physics, physics, PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
+REGISTER_HUD_PANEL(CENTERPRINT, HUD_CenterPrint, centerprint, PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
+REGISTER_HUD_PANEL(MINIGAME_BOARD, HUD_MinigameBoard, minigameboard, PANEL_CONFIG_NO , PANEL_SHOW_MINIGAME)
+REGISTER_HUD_PANEL(MINIGAME_STATUS, HUD_MinigameStatus, minigamestatus, PANEL_CONFIG_NO , PANEL_SHOW_MINIGAME)
+REGISTER_HUD_PANEL(MINIGAME_HELP, HUD_MinigameHelp, minigamehelp, PANEL_CONFIG_NO , PANEL_SHOW_MINIGAME)
+REGISTER_HUD_PANEL(MINIGAME_MENU, HUD_MinigameMenu, minigamemenu, PANEL_CONFIG_NO , PANEL_SHOW_ALWAYS )
+REGISTER_HUD_PANEL(MAPVOTE, MapVote_Draw, mapvote, PANEL_CONFIG_NO , PANEL_SHOW_MAPVOTE )
+REGISTER_HUD_PANEL(ITEMSTIME, HUD_ItemsTime, itemstime, PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
+REGISTER_HUD_PANEL(QUICKMENU, HUD_QuickMenu, quickmenu, PANEL_CONFIG_MAIN, PANEL_SHOW_MAINGAME)
// always add new panels to the end of list
// Because calling lots of functions in QC apparently cuts fps in half on many machines:
int i;
for (i = 0; i < hud_panels_COUNT; ++i) {
panel = hud_panels[i];
- if(panel == HUD_PANEL(MAPVOTE)) continue;
+ if(!(panel.panel_configflags & PANEL_CONFIG_MAIN)) continue;
if(panel == highlightedPanel) continue;
HUD_Panel_UpdatePosSize();
if(!panel_enabled) continue;
int i;
for (i = 0; i < hud_panels_COUNT; ++i) {
panel = hud_panels[i];
- if(panel == HUD_PANEL(MAPVOTE)) continue;
+ if(!(panel.panel_configflags & PANEL_CONFIG_MAIN)) continue;
if(panel == highlightedPanel) continue;
HUD_Panel_UpdatePosSize();
if(!panel_enabled) continue;
for(i = 0; i < hud_panels_COUNT; ++i)
{
panel = hud_panels[i];
- if(panel == HUD_PANEL(MAPVOTE))
+ if(!(panel.panel_configflags & PANEL_CONFIG_MAIN))
continue;
if (panel == tab_panels[i] || panel == starting_panel)
continue;
j += 1;
panel = hud_panels[i];
- if(panel == HUD_PANEL(MAPVOTE)) continue;
+ if(!(panel.panel_configflags & PANEL_CONFIG_MAIN)) continue;
HUD_Panel_UpdatePosSize();
float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
j += 1;
panel = hud_panels[i];
- if(panel == HUD_PANEL(MAPVOTE))
+ if(!(panel.panel_configflags & PANEL_CONFIG_MAIN))
continue;
HUD_Panel_UpdatePosSize();
return SHOTTYPE_HITWORLD;
}
-void CSQC_common_hud(void);
-
void PostInit(void);
void CSQC_Demo_Camera();
float HUD_WouldDrawScoreboard();
return false;
}
+void HUD_Crosshair_Vehicle()
+{
+ if(hud != HUD_BUMBLEBEE_GUN)
+ {
+ Vehicle info = get_vehicleinfo(hud);
+ info.vr_crosshair(info);
+ }
+}
+
vector damage_blurpostprocess, content_blurpostprocess;
float unaccounted_damage = 0;
spectatee_status_prev = spectatee_status;
}
-void UpdateHitsound()
+void HitSound()
{
// varying sound pitch
}
}
-void UpdateCrosshair()
+void HUD_Crosshair()
{SELFPARAM();
static float rainbow_last_flicker;
- static vector rainbow_prev_color;
+ static vector rainbow_prev_color;
entity e = self;
float f, i, j;
vector v;
- if(getstati(STAT_FROZEN))
- drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, ((getstatf(STAT_REVIVE_PROGRESS)) ? ('0.25 0.90 1' + ('1 0 0' * getstatf(STAT_REVIVE_PROGRESS)) + ('0 1 1' * getstatf(STAT_REVIVE_PROGRESS) * -1)) : '0.25 0.90 1'), autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
- else if (getstatf(STAT_HEALING_ORB)>time)
- drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, NADE_TYPE_HEAL.m_color, autocvar_hud_colorflash_alpha*getstatf(STAT_HEALING_ORB_ALPHA), DRAWFLAG_ADDITIVE);
- if(!intermission)
- if(getstatf(STAT_NADE_TIMER) && autocvar_cl_nade_timer) // give nade top priority, as it's a matter of life and death
- {
- DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", getstatf(STAT_NADE_TIMER), '0.25 0.90 1' + ('1 0 0' * getstatf(STAT_NADE_TIMER)) - ('0 1 1' * getstatf(STAT_NADE_TIMER)), autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
- drawstring_aspect(eY * 0.64 * vid_conheight, ((autocvar_cl_nade_timer == 2) ? _("Nade timer") : ""), eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL);
- }
- else if(getstatf(STAT_REVIVE_PROGRESS))
- {
- DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", getstatf(STAT_REVIVE_PROGRESS), '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
- drawstring_aspect(eY * 0.64 * vid_conheight, _("Revival progress"), eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL);
- }
-
- if(autocvar_r_letterbox == 0)
- if(autocvar_viewsize < 120)
- CSQC_common_hud();
-
- // crosshair goes VERY LAST
if(!scoreboard_active && !camera_active && intermission != 2 &&
- spectatee_status != -1 && hud == HUD_NORMAL && !csqcplayer.viewloc &&
+ spectatee_status != -1 && !csqcplayer.viewloc &&
!HUD_MinigameMenu_IsOpened() )
{
if (!autocvar_crosshair_enabled) // main toggle for crosshair rendering
return;
+ if (hud != HUD_NORMAL)
+ {
+ HUD_Crosshair_Vehicle();
+ return;
+ }
+
string wcross_style;
float wcross_alpha, wcross_resolution;
wcross_style = autocvar_crosshair;
}
}
+void HUD_Draw()
+{
+ if(getstati(STAT_FROZEN))
+ drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, ((getstatf(STAT_REVIVE_PROGRESS)) ? ('0.25 0.90 1' + ('1 0 0' * getstatf(STAT_REVIVE_PROGRESS)) + ('0 1 1' * getstatf(STAT_REVIVE_PROGRESS) * -1)) : '0.25 0.90 1'), autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
+ else if (getstatf(STAT_HEALING_ORB)>time)
+ drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, NADE_TYPE_HEAL.m_color, autocvar_hud_colorflash_alpha*getstatf(STAT_HEALING_ORB_ALPHA), DRAWFLAG_ADDITIVE);
+ if(!intermission)
+ if(getstatf(STAT_NADE_TIMER) && autocvar_cl_nade_timer) // give nade top priority, as it's a matter of life and death
+ {
+ DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", getstatf(STAT_NADE_TIMER), '0.25 0.90 1' + ('1 0 0' * getstatf(STAT_NADE_TIMER)) - ('0 1 1' * getstatf(STAT_NADE_TIMER)), autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
+ drawstring_aspect(eY * 0.64 * vid_conheight, ((autocvar_cl_nade_timer == 2) ? _("Nade timer") : ""), eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL);
+ }
+ else if(getstatf(STAT_REVIVE_PROGRESS))
+ {
+ DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", getstatf(STAT_REVIVE_PROGRESS), '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
+ drawstring_aspect(eY * 0.64 * vid_conheight, _("Revival progress"), eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL);
+ }
+
+ if(autocvar_r_letterbox == 0)
+ if(autocvar_viewsize < 120)
+ {
+ if(!(gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS))
+ Accuracy_LoadLevels();
+
+ HUD_Main();
+ HUD_DrawScoreboard();
+ }
+
+ // crosshair goes VERY LAST
+ UpdateDamage();
+ HUD_Crosshair();
+ HitSound();
+}
+
bool ov_enabled;
float oldr_nearclip;
float oldr_farclip_base;
if(autocvar_cl_gentle_damage == 2)
{
if(myhealth_flash < pain_threshold) // only randomize when the flash is gone
- {
myhealth_gentlergb = eX * random() + eY * random() + eZ * random();
- }
}
else
myhealth_gentlergb = stov(autocvar_hud_damage_gentle_color);
- drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, myhealth_gentlergb, autocvar_hud_damage_gentle_alpha_multiplier * bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage, DRAWFLAG_NORMAL);
+ if(myhealth_flash_temp > 0)
+ drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, myhealth_gentlergb, autocvar_hud_damage_gentle_alpha_multiplier * bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage, DRAWFLAG_NORMAL);
}
- else
+ else if(myhealth_flash_temp > 0)
drawpic(splash_pos, "gfx/blood", splash_size, stov(autocvar_hud_damage_color), bound(0, myhealth_flash_temp, 1) * autocvar_hud_damage, DRAWFLAG_NORMAL);
if(autocvar_hud_postprocessing) // we still need to set this anyway even when chase_active is set, this way it doesn't get stuck on.
scoreboard_active = HUD_WouldDrawScoreboard();
- UpdateDamage();
- UpdateCrosshair();
- UpdateHitsound();
+ HUD_Draw();
if(NextFrameCommand)
{
else
HUD_Radar_Mouse();
- if(hud && !intermission)
- if(hud == HUD_BUMBLEBEE_GUN)
- CSQC_BUMBLE_GUN_HUD();
- else {
- Vehicle info = get_vehicleinfo(hud);
- info.vr_hud(info);
- }
-
cl_notice_run();
// let's reset the view back to normal for the end
}
-void CSQC_common_hud(void)
-{
- if(!(gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS))
- Accuracy_LoadLevels();
-
- HUD_Main(); // always run these functions for alpha checks
- HUD_DrawScoreboard();
-
- // scoreboard/accuracy, map/gametype voting screen
- if (scoreboard_active || intermission == 2)
- HUD_Reset();
-}
-
-
// following vectors must be global to allow seamless switching between camera modes
vector camera_offset, current_camera_offset, mouse_angles, current_angles, current_origin, current_position;
void CSQC_Demo_Camera()
bool HUD_Minigame_Showpanels()
{
- return HUD_MinigameMenu_IsOpened() && ( autocvar__hud_configure || minigame_isactive() );
+ return (HUD_MinigameMenu_IsOpened() && minigame_isactive());
}
void AuxiliaryXhair_Draw2D(entity this)
{
- if (scoreboard_showscores)
+ if (scoreboard_active)
return;
vector size = draw_getimagesize(self.axh_image) * autocvar_cl_vehicles_crosshair_size;
string iconAmmo1,
vector colorAmmo1,
string iconAmmo2,
- vector colorAmmo2,
- string crosshair)
-{SELFPARAM();
- if(autocvar_r_letterbox)
- return;
-
- if(scoreboard_showscores)
- return;
-
+ vector colorAmmo2)
+{
+ SELFPARAM();
// Initialize
- vector hudSize = '0 0 0';
- vector hudPos = '0 0 0';
vector tmpSize = '0 0 0';
vector tmpPos = '0 0 0';
- float hudAlpha = autocvar_hud_panel_fg_alpha;
+ float hudAlpha = autocvar_hud_panel_fg_alpha * hud_fade_alpha;
float barAlpha = autocvar_hud_progressbar_alpha * hudAlpha;
float blinkValue = 0.55 + sin(time * 7) * 0.45;
if (precache_pic(frame) == "")
frame = "gfx/hud/default/vehicle_frame";
- hudSize = draw_getimagesize(frame) * autocvar_cl_vehicles_hudscale;
- hudPos.x = (vid_conwidth - hudSize.x) / 2;
- hudPos.y = vid_conheight - hudSize.y;
+ vehicleHud_Size = draw_getimagesize(frame) * autocvar_cl_vehicles_hudscale;
+ vehicleHud_Pos.x = (vid_conwidth - vehicleHud_Size.x) / 2;
+ vehicleHud_Pos.y = vid_conheight - vehicleHud_Size.y;
if(teamplay && autocvar_hud_panel_bg_color_team)
- drawpic(hudPos, frame, hudSize, myteamcolors * autocvar_hud_panel_bg_color_team, autocvar_hud_panel_bg_alpha, DRAWFLAG_NORMAL);
+ drawpic(vehicleHud_Pos, frame, vehicleHud_Size, myteamcolors * autocvar_hud_panel_bg_color_team, autocvar_hud_panel_bg_alpha * hud_fade_alpha, DRAWFLAG_NORMAL);
else
- drawpic(hudPos, frame, hudSize, autocvar_hud_panel_bg_color, autocvar_hud_panel_bg_alpha, DRAWFLAG_NORMAL);
+ drawpic(vehicleHud_Pos, frame, vehicleHud_Size, autocvar_hud_panel_bg_color, autocvar_hud_panel_bg_alpha * hud_fade_alpha, DRAWFLAG_NORMAL);
if(!autocvar__vehicles_shownchasemessage && time < vh_notice_time)
{
float tmpblinkValue = 0.55 + sin(time * 3) * 0.45;
- tmpPos.x = hudPos.x + hudSize.x * (96/256) - tmpSize.x;
- tmpPos.y = hudPos.y;
+ tmpPos.x = vehicleHud_Pos.x + vehicleHud_Size.x * (96/256) - tmpSize.x;
+ tmpPos.y = vehicleHud_Pos.y;
tmpSize = '1 1 1' * hud_fontsize;
drawstring(tmpPos, sprintf(_("Press %s"), getcommandkey("dropweapon", "dropweapon")), tmpSize, '1 0 0' + '0 1 1' * tmpblinkValue, hudAlpha, DRAWFLAG_NORMAL);
}
// Model
- tmpSize.x = hudSize.x / 3;
- tmpSize.y = hudSize.y;
- tmpPos.x = hudPos.x + hudSize.x / 3;
- tmpPos.y = hudPos.y;
+ tmpSize.x = vehicleHud_Size.x / 3;
+ tmpSize.y = vehicleHud_Size.y;
+ tmpPos.x = vehicleHud_Pos.x + vehicleHud_Size.x / 3;
+ tmpPos.y = vehicleHud_Pos.y;
if(health < 0.25)
drawpic_skin(tmpPos, vehicle, tmpSize, '1 0 0' + '0 1 1' * blinkValue, hudAlpha, DRAWFLAG_NORMAL);
drawpic_skin(tmpPos, "vehicle_shield", tmpSize, '1 1 1' * shield + '1 0 0' * (1 - shield), hudAlpha * shield, DRAWFLAG_NORMAL);
// Health bar
- tmpSize.y = hudSize.y / 2;
- tmpPos.x = hudPos.x + hudSize.x * (32/768);
- tmpPos.y = hudPos.y;
+ tmpSize.y = vehicleHud_Size.y / 2;
+ tmpPos.x = vehicleHud_Pos.x + vehicleHud_Size.x * (32/768);
+ tmpPos.y = vehicleHud_Pos.y;
drawsetcliparea(tmpPos.x + (tmpSize.x * (1 - health)), tmpPos.y, tmpSize.x, tmpSize.y);
drawpic_skin(tmpPos, "vehicle_bar_northwest", tmpSize, autocvar_hud_progressbar_health_color, barAlpha, DRAWFLAG_NORMAL);
// Shield bar
- tmpPos.y = hudPos.y + hudSize.y / 2;
+ tmpPos.y = vehicleHud_Pos.y + vehicleHud_Size.y / 2;
drawsetcliparea(tmpPos.x + (tmpSize.x * (1 - shield)), tmpPos.y, tmpSize.x, tmpSize.y);
drawpic_skin(tmpPos, "vehicle_bar_southwest", tmpSize, autocvar_hud_progressbar_armor_color, barAlpha, DRAWFLAG_NORMAL);
// Ammo1 bar
- tmpPos.x = hudPos.x + hudSize.x * (480/768);
- tmpPos.y = hudPos.y;
+ tmpPos.x = vehicleHud_Pos.x + vehicleHud_Size.x * (480/768);
+ tmpPos.y = vehicleHud_Pos.y;
if(ammo1)
drawsetcliparea(tmpPos.x, tmpPos.y, tmpSize.x * ammo1, tmpSize.y);
drawpic_skin(tmpPos, "vehicle_bar_northeast", tmpSize, colorAmmo1, barAlpha, DRAWFLAG_NORMAL);
// Ammo2 bar
- tmpPos.y = hudPos.y + hudSize.y / 2;
+ tmpPos.y = vehicleHud_Pos.y + vehicleHud_Size.y / 2;
if(ammo2)
drawsetcliparea(tmpPos.x, tmpPos.y, tmpSize.x * ammo2, tmpSize.y);
drawresetcliparea();
// Health icon
- tmpSize.x = hudSize.x * (80/768);
- tmpSize.y = hudSize.y * (80/256);
- tmpPos.x = hudPos.x + hudSize.x * (64/768);
- tmpPos.y = hudPos.y + hudSize.y * (48/256);
+ tmpSize.x = vehicleHud_Size.x * (80/768);
+ tmpSize.y = vehicleHud_Size.y * (80/256);
+ tmpPos.x = vehicleHud_Pos.x + vehicleHud_Size.x * (64/768);
+ tmpPos.y = vehicleHud_Pos.y + vehicleHud_Size.y * (48/256);
if(health < 0.25)
{
}
// Shield icon
- tmpPos.y = hudPos.y + hudSize.y / 2;
+ tmpPos.y = vehicleHud_Pos.y + vehicleHud_Size.y / 2;
if(shield < 0.25)
{
}
// Ammo1 icon
- tmpPos.x = hudPos.x + hudSize.x * (624/768);
- tmpPos.y = hudPos.y + hudSize.y * (48/256);
+ tmpPos.x = vehicleHud_Pos.x + vehicleHud_Size.x * (624/768);
+ tmpPos.y = vehicleHud_Pos.y + vehicleHud_Size.y * (48/256);
if(iconAmmo1)
{
}
// Ammo2 icon
- tmpPos.y = hudPos.y + hudSize.y / 2;
+ tmpPos.y = vehicleHud_Pos.y + vehicleHud_Size.y / 2;
if(iconAmmo2)
{
else
drawpic_skin(tmpPos, iconAmmo2, tmpSize, '1 1 1', hudAlpha * 0.2, DRAWFLAG_NORMAL);
}
+}
- // Bumblebee gunner crosshairs
- if(hud == VEH_BUMBLEBEE.vehicleid)
- {
- tmpSize = '1 1 1' * hud_fontsize;
- tmpPos.x = hudPos.x + hudSize.x * (520/768);
-
- if(!AuxiliaryXhair[1].draw2d)
- {
- tmpPos.y = hudPos.y + hudSize.y * (96/256) - tmpSize.y;
- drawstring(tmpPos, _("No right gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
- }
-
- if(!AuxiliaryXhair[2].draw2d)
- {
- tmpPos.y = hudPos.y + hudSize.y * (160/256);
- drawstring(tmpPos, _("No left gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
- }
- }
-
- // Raptor bomb crosshair
- if(hud == VEH_RAPTOR.vehicleid && weapon2mode != RSM_FLARE)
- {
- vector where;
-
- if(!dropmark)
- {
- dropmark = spawn();
- dropmark.owner = self;
- dropmark.gravity = 1;
- }
-
- if(reload2 == 1)
- {
- setorigin(dropmark, pmove_org);
- dropmark.velocity = pmove_vel;
- tracetoss(dropmark, self);
-
- where = project_3d_to_2d(trace_endpos);
-
- setorigin(dropmark, trace_endpos);
- tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size;
-
- if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
- {
- where.x -= tmpSize.x * 0.5;
- where.y -= tmpSize.y * 0.5;
- where.z = 0;
- drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
- drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
- }
- dropmark.cnt = time + 5;
- }
- else
- {
- if(dropmark.cnt > time)
- {
- where = project_3d_to_2d(dropmark.origin);
- tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size * 1.25;
-
- if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
- {
- where.x -= tmpSize.x * 0.5;
- where.y -= tmpSize.y * 0.5;
- where.z = 0;
- drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
- drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
- }
- }
- }
- }
+void Vehicles_drawCrosshair(string crosshair)
+{
+ SELFPARAM();
+ vector tmpSize = '0 0 0';
+ vector tmpPos = '0 0 0';
// Crosshair
if(crosshair)
#ifndef CL_VEHICLES_H
#define CL_VEHICLES_H
+vector vehicleHud_Size;
+vector vehicleHud_Pos;
+
void Net_AuXair2(float bIsNew);
void Net_VehicleSetup();
METHOD(Vehicle, vr_impact, void(Vehicle)) { }
/** (CLIENT) logic to run every frame */
METHOD(Vehicle, vr_hud, void(Vehicle)) { }
+ /** (CLIENT) logic to run every frame */
+ METHOD(Vehicle, vr_crosshair, void(Vehicle)) { }
ENDCLASS(Vehicle)
// vehicle spawn flags (need them here for common registrations)
{
Vehicles_drawHUD("vehicle_gunner", "vehicle_gunner_weapon1", string_null,
"vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
- string_null, '0 0 0',
- string_null);
+ string_null, '0 0 0');
}
METHOD(Bumblebee, vr_hud, void(Bumblebee thisveh))
{
Vehicles_drawHUD(VEH_BUMBLEBEE.m_icon, "vehicle_bumble_weapon1", "vehicle_bumble_weapon2",
"vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
- "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
- vCROSS_HEAL);
+ "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color);
+
+ float hudAlpha = autocvar_hud_panel_fg_alpha;
+ float blinkValue = 0.55 + sin(time * 7) * 0.45;
+ vector tmpPos = '0 0 0';
+ vector tmpSize = '1 1 1' * hud_fontsize;
+ tmpPos.x = vehicleHud_Pos.x + vehicleHud_Size.x * (520/768);
+
+ if(!AuxiliaryXhair[1].draw2d)
+ {
+ tmpPos.y = vehicleHud_Pos.y + vehicleHud_Size.y * (96/256) - tmpSize.y;
+ drawstring(tmpPos, _("No right gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
+ }
+
+ if(!AuxiliaryXhair[2].draw2d)
+ {
+ tmpPos.y = vehicleHud_Pos.y + vehicleHud_Size.y * (160/256);
+ drawstring(tmpPos, _("No left gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
+ }
+ }
+ METHOD(Bumblebee, vr_crosshair, void(Bumblebee thisveh))
+ {
+ Vehicles_drawCrosshair(vCROSS_HEAL);
}
METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh))
{
{
Vehicles_drawHUD(VEH_RACER.m_icon, "vehicle_racer_weapon1", "vehicle_racer_weapon2",
"vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
- "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color,
- vCROSS_GUIDE);
+ "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
+ }
+ METHOD(Racer, vr_crosshair, void(Racer thisveh))
+ {
+ Vehicles_drawCrosshair(vCROSS_GUIDE);
}
#endif
METHOD(Racer, vr_setup, void(Racer thisveh))
#ifdef CSQC
METHOD(Raptor, vr_hud, void(Raptor thisveh))
+ {
+ Vehicles_drawHUD(VEH_RAPTOR.m_icon, "vehicle_raptor_weapon1", "vehicle_raptor_weapon2",
+ "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
+ "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
+ }
+ METHOD(Raptor, vr_crosshair, void(Raptor thisveh))
{
string crosshair;
default: crosshair = vCROSS_BURST;
}
- Vehicles_drawHUD(VEH_RAPTOR.m_icon, "vehicle_raptor_weapon1", "vehicle_raptor_weapon2",
- "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
- "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color,
- crosshair);
+ vector tmpSize = '0 0 0';
+ if(weapon2mode != RSM_FLARE)
+ {
+ vector where;
+
+ if(!dropmark)
+ {
+ dropmark = spawn();
+ dropmark.owner = self;
+ dropmark.gravity = 1;
+ }
+
+ float reload2 = getstati(STAT_VEHICLESTAT_RELOAD2) * 0.01;
+ if(reload2 == 1)
+ {
+ setorigin(dropmark, pmove_org);
+ dropmark.velocity = pmove_vel;
+ tracetoss(dropmark, self);
+
+ where = project_3d_to_2d(trace_endpos);
+
+ setorigin(dropmark, trace_endpos);
+ tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size;
+
+ if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
+ {
+ where.x -= tmpSize.x * 0.5;
+ where.y -= tmpSize.y * 0.5;
+ where.z = 0;
+ drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
+ drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
+ }
+ dropmark.cnt = time + 5;
+ }
+ else
+ {
+ if(dropmark.cnt > time)
+ {
+ where = project_3d_to_2d(dropmark.origin);
+ tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size * 1.25;
+
+ if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight))
+ {
+ where.x -= tmpSize.x * 0.5;
+ where.y -= tmpSize.y * 0.5;
+ where.z = 0;
+ drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.9, DRAWFLAG_ADDITIVE);
+ drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', autocvar_crosshair_alpha * 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg
+ }
+ }
+ }
+ }
+
+ Vehicles_drawCrosshair(crosshair);
}
METHOD(Raptor, vr_setup, void(Raptor thisveh))
{
float autocvar_cl_vehicle_spiderbot_cross_size = 1;
METHOD(Spiderbot, vr_hud, void(Spiderbot thisveh))
+ {
+ Vehicles_drawHUD(VEH_SPIDERBOT.m_icon, "vehicle_spider_weapon1", "vehicle_spider_weapon2",
+ "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
+ "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color);
+ }
+ METHOD(Spiderbot, vr_crosshair, void(Spiderbot thisveh))
{
string crosshair;
default: crosshair = vCROSS_BURST;
}
- Vehicles_drawHUD(VEH_SPIDERBOT.m_icon, "vehicle_spider_weapon1", "vehicle_spider_weapon2",
- "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
- "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color,
- crosshair);
+ Vehicles_drawCrosshair(crosshair);
}
METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh))
{