From: Mario Date: Sat, 24 Oct 2015 10:38:06 +0000 (+0000) Subject: Merge branch 'terencehill/hud_cleanups' into 'master' X-Git-Tag: xonotic-v0.8.2~1799 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=ae8867e3301e6cdda736e245858932f8f36d71f1;hp=7423204e596642ed532162a4bd8fd47836e25781 Merge branch 'terencehill/hud_cleanups' into 'master' HUD cleanups * Code cleanups of normal and vehicle HUD + crosshair, with minor fixes and improvements (vehicle HUD now fades in/out) * Small cleanup and fix to the HUD editor (minigame panels weren't properly hidden) See merge request !240 --- diff --git a/hud_luma.cfg b/hud_luma.cfg index 639d08af67..efc6ccf8e0 100644 --- a/hud_luma.cfg +++ b/hud_luma.cfg @@ -26,7 +26,7 @@ seta hud_progressbar_acceleration_neg_color "0.86 0.35 0" 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" diff --git a/hud_luminos.cfg b/hud_luminos.cfg index 4184531eb6..9f9afdd8ba 100644 --- a/hud_luminos.cfg +++ b/hud_luminos.cfg @@ -26,7 +26,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5" 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" diff --git a/hud_luminos_minimal.cfg b/hud_luminos_minimal.cfg index bfa36b80a2..97d39ee5be 100644 --- a/hud_luminos_minimal.cfg +++ b/hud_luminos_minimal.cfg @@ -26,7 +26,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5" 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" diff --git a/hud_luminos_minimal_xhair.cfg b/hud_luminos_minimal_xhair.cfg index 8189ade09c..cd777e1d2b 100644 --- a/hud_luminos_minimal_xhair.cfg +++ b/hud_luminos_minimal_xhair.cfg @@ -26,7 +26,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5" 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" diff --git a/hud_luminos_old.cfg b/hud_luminos_old.cfg index 29fa1df665..0496ba9ae4 100644 --- a/hud_luminos_old.cfg +++ b/hud_luminos_old.cfg @@ -26,7 +26,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5" 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" diff --git a/hud_nexuiz.cfg b/hud_nexuiz.cfg index c706b7a7c7..b520b776cb 100644 --- a/hud_nexuiz.cfg +++ b/hud_nexuiz.cfg @@ -26,7 +26,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5" 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" diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 042536aa76..a00a9c3a4c 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -367,7 +367,6 @@ void HUD_Weapons(void) vector color; // check to see if we want to continue - if(intermission == 2) return; if(hud != HUD_NORMAL) return; if(!autocvar__hud_configure) @@ -953,7 +952,6 @@ int nade_prevframe; float nade_statuschange_time; void HUD_Ammo(void) { - if(intermission == 2) return; if(hud != HUD_NORMAL) return; if(!autocvar__hud_configure) { @@ -1228,8 +1226,6 @@ int getPowerupItemAlign(int align, int column, int row, int columns, int rows, b 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; @@ -1393,7 +1389,6 @@ void HUD_Powerups() void HUD_HealthArmor(void) { int armor, health, fuel; - if(intermission == 2) return; if(!autocvar__hud_configure) { if(!autocvar_hud_panel_healtharmor) return; @@ -1700,7 +1695,6 @@ void HUD_Notify_Push(string icon, string attacker, string victim) void HUD_Notify(void) { - if(intermission == 2) return; if (!autocvar__hud_configure) if (!autocvar_hud_panel_notify) return; @@ -1814,7 +1808,6 @@ void HUD_Notify(void) void HUD_Timer(void) { - if(intermission == 2) return; if(!autocvar__hud_configure) { if(!autocvar_hud_panel_timer) return; @@ -2035,7 +2028,6 @@ void HUD_Radar_Mouse() void HUD_Radar(void) { - if(intermission == 2) return; if (!autocvar__hud_configure) { if (hud_panel_radar_maximized) @@ -2384,7 +2376,6 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me) void HUD_Score(void) { - if(intermission == 2) return; if(!autocvar__hud_configure) { if(!autocvar_hud_panel_score) return; @@ -2568,7 +2559,6 @@ void HUD_Score(void) // void HUD_RaceTimer (void) { - if(intermission == 2) return; if(!autocvar__hud_configure) { if(!autocvar_hud_panel_racetimer) return; @@ -2719,7 +2709,6 @@ void HUD_RaceTimer (void) 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; @@ -3596,7 +3585,6 @@ float mod_change; // "time" when mod_active changed void HUD_ModIcons(void) { - if(intermission == 2) return; if(!autocvar__hud_configure) { if(!autocvar_hud_panel_modicons) return; @@ -3638,7 +3626,6 @@ void HUD_ModIcons(void) // void HUD_PressedKeys(void) { - if(intermission == 2) return; if(!autocvar__hud_configure) { if(!autocvar_hud_panel_pressedkeys) return; @@ -3802,7 +3789,6 @@ float frametimeavg1; // 1 frame ago float frametimeavg2; // 2 frames ago void HUD_EngineInfo(void) { - //if(intermission == 2) return; if(!autocvar__hud_configure) { if(!autocvar_hud_panel_engineinfo) return; @@ -3864,7 +3850,6 @@ void HUD_EngineInfo(void) } while(0) void HUD_InfoMessages(void) { - if(intermission == 2) return; if(!autocvar__hud_configure) { if(!autocvar_hud_panel_infomessages) return; @@ -4046,7 +4031,6 @@ float acc_prevtime, acc_avg, top_speed, top_speed_time; 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; @@ -4438,7 +4422,6 @@ void reset_centerprint_messages(void) float hud_configure_cp_generation_time; void HUD_CenterPrint (void) { - if(intermission == 2) return; if(!autocvar__hud_configure) { if(!autocvar_hud_panel_centerprint) return; @@ -4682,28 +4665,48 @@ Main HUD system ================== */ +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 @@ -4832,6 +4835,8 @@ void HUD_Main (void) 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) @@ -4841,6 +4846,9 @@ void HUD_Main (void) 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; diff --git a/qcsrc/client/hud.qh b/qcsrc/client/hud.qh index 517fd8c07b..ba9cb171e9 100644 --- a/qcsrc/client/hud.qh +++ b/qcsrc/client/hud.qh @@ -9,12 +9,13 @@ void HUD_Radar_Mouse(); 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; \ } @@ -156,9 +157,14 @@ void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, flo 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 @@ -174,30 +180,30 @@ int prev_p_health, prev_p_armor; 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: diff --git a/qcsrc/client/hud_config.qc b/qcsrc/client/hud_config.qc index 148c0ec8e0..48b3c821d2 100644 --- a/qcsrc/client/hud_config.qc +++ b/qcsrc/client/hud_config.qc @@ -235,7 +235,7 @@ vector HUD_Panel_CheckMove(vector myPos, vector mySize) 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; @@ -332,7 +332,7 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) { 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; @@ -784,7 +784,7 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary) 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; @@ -933,7 +933,7 @@ float HUD_Panel_Check_Mouse_Pos(float allow_move) 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 @@ -1015,7 +1015,7 @@ void HUD_Panel_Highlight(float allow_move) j += 1; panel = hud_panels[i]; - if(panel == HUD_PANEL(MAPVOTE)) + if(!(panel.panel_configflags & PANEL_CONFIG_MAIN)) continue; HUD_Panel_UpdatePosSize(); diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 4430c94e28..c7144372a3 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -398,8 +398,6 @@ float TrueAimCheck() return SHOTTYPE_HITWORLD; } -void CSQC_common_hud(void); - void PostInit(void); void CSQC_Demo_Camera(); float HUD_WouldDrawScoreboard(); @@ -461,6 +459,15 @@ bool WantEventchase() 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; @@ -488,7 +495,7 @@ void UpdateDamage() spectatee_status_prev = spectatee_status; } -void UpdateHitsound() +void HitSound() { // varying sound pitch @@ -537,41 +544,26 @@ void UpdateHitsound() } } -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; @@ -1011,6 +1003,40 @@ void UpdateCrosshair() } } +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; @@ -1715,16 +1741,15 @@ void CSQC_UpdateView(float w, float h) 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. @@ -1814,9 +1839,7 @@ void CSQC_UpdateView(float w, float h) scoreboard_active = HUD_WouldDrawScoreboard(); - UpdateDamage(); - UpdateCrosshair(); - UpdateHitsound(); + HUD_Draw(); if(NextFrameCommand) { @@ -1860,14 +1883,6 @@ void CSQC_UpdateView(float w, float h) 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 @@ -1876,20 +1891,6 @@ void CSQC_UpdateView(float w, float h) } -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() diff --git a/qcsrc/common/minigames/cl_minigames_hud.qc b/qcsrc/common/minigames/cl_minigames_hud.qc index f1ee4f675c..5cb21de80f 100644 --- a/qcsrc/common/minigames/cl_minigames_hud.qc +++ b/qcsrc/common/minigames/cl_minigames_hud.qc @@ -692,5 +692,5 @@ void HUD_Minigame_Mouse() bool HUD_Minigame_Showpanels() { - return HUD_MinigameMenu_IsOpened() && ( autocvar__hud_configure || minigame_isactive() ); + return (HUD_MinigameMenu_IsOpened() && minigame_isactive()); } diff --git a/qcsrc/common/vehicles/cl_vehicles.qc b/qcsrc/common/vehicles/cl_vehicles.qc index 3472a7f1c7..b24097c033 100644 --- a/qcsrc/common/vehicles/cl_vehicles.qc +++ b/qcsrc/common/vehicles/cl_vehicles.qc @@ -28,7 +28,7 @@ void vehicle_alarm(entity e, int ch, string s0und) void AuxiliaryXhair_Draw2D(entity this) { - if (scoreboard_showscores) + if (scoreboard_active) return; vector size = draw_getimagesize(self.axh_image) * autocvar_cl_vehicles_crosshair_size; @@ -119,22 +119,14 @@ void Vehicles_drawHUD( 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; @@ -154,29 +146,29 @@ void Vehicles_drawHUD( 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); @@ -191,22 +183,22 @@ void Vehicles_drawHUD( 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); @@ -216,7 +208,7 @@ void Vehicles_drawHUD( 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); @@ -227,10 +219,10 @@ void Vehicles_drawHUD( 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) { @@ -252,7 +244,7 @@ void Vehicles_drawHUD( } // Shield icon - tmpPos.y = hudPos.y + hudSize.y / 2; + tmpPos.y = vehicleHud_Pos.y + vehicleHud_Size.y / 2; if(shield < 0.25) { @@ -274,8 +266,8 @@ void Vehicles_drawHUD( } // 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) { @@ -286,7 +278,7 @@ void Vehicles_drawHUD( } // Ammo2 icon - tmpPos.y = hudPos.y + hudSize.y / 2; + tmpPos.y = vehicleHud_Pos.y + vehicleHud_Size.y / 2; if(iconAmmo2) { @@ -295,77 +287,13 @@ void Vehicles_drawHUD( 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) diff --git a/qcsrc/common/vehicles/cl_vehicles.qh b/qcsrc/common/vehicles/cl_vehicles.qh index bf96d95ea3..87f0751af8 100644 --- a/qcsrc/common/vehicles/cl_vehicles.qh +++ b/qcsrc/common/vehicles/cl_vehicles.qh @@ -1,6 +1,9 @@ #ifndef CL_VEHICLES_H #define CL_VEHICLES_H +vector vehicleHud_Size; +vector vehicleHud_Pos; + void Net_AuXair2(float bIsNew); void Net_VehicleSetup(); diff --git a/qcsrc/common/vehicles/vehicle.qh b/qcsrc/common/vehicles/vehicle.qh index 80787b4ae6..58a2b7330e 100644 --- a/qcsrc/common/vehicles/vehicle.qh +++ b/qcsrc/common/vehicles/vehicle.qh @@ -48,6 +48,8 @@ CLASS(Vehicle, Object) 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) diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index 45003cb296..2eee4dcf5a 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -953,16 +953,36 @@ void CSQC_BUMBLE_GUN_HUD() { 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)) { diff --git a/qcsrc/common/vehicles/vehicle/racer.qc b/qcsrc/common/vehicles/vehicle/racer.qc index 8d87fd7603..8c45b4aa9d 100644 --- a/qcsrc/common/vehicles/vehicle/racer.qc +++ b/qcsrc/common/vehicles/vehicle/racer.qc @@ -654,8 +654,11 @@ void racer_draw() { 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)) diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index 1c5c85b8d7..58a189a850 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -773,6 +773,12 @@ spawnfunc(vehicle_raptor) #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; @@ -783,10 +789,60 @@ spawnfunc(vehicle_raptor) 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)) { diff --git a/qcsrc/common/vehicles/vehicle/spiderbot.qc b/qcsrc/common/vehicles/vehicle/spiderbot.qc index cf1be2432c..019f5889e0 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot.qc @@ -645,6 +645,12 @@ float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6; 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; @@ -656,10 +662,7 @@ float autocvar_cl_vehicle_spiderbot_cross_size = 1; 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)) {