From: Severin Meyer Date: Thu, 23 Jul 2015 18:05:02 +0000 (+0200) Subject: Use existing cvars for the vehicle HUD, add new cvars for vehicle ammo bar colors X-Git-Tag: xonotic-v0.8.1~31^2~11 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=bac1028928187c9fffe9cc86507bb8cc95ce4c5a;p=xonotic%2Fxonotic-data.pk3dir.git Use existing cvars for the vehicle HUD, add new cvars for vehicle ammo bar colors --- diff --git a/_hud_descriptions.cfg b/_hud_descriptions.cfg index a47884ef0..8bbe38942 100644 --- a/_hud_descriptions.cfg +++ b/_hud_descriptions.cfg @@ -25,6 +25,8 @@ seta hud_progressbar_nexball_color "" "R G B vector of the progress bar backgrou seta hud_progressbar_speed_color "" "R G B vector of the progress bar background color" seta hud_progressbar_acceleration_color "" "R G B vector of the progress bar background color" seta hud_progressbar_acceleration_neg_color "" "R G B vector of the progress bar background color" +seta hud_progressbar_vehicles_ammo1_color "" "R G B vector of the progress bar background color" +seta hud_progressbar_vehicles_ammo2_color "" "R G B vector of the progress bar background color" seta _hud_panelorder "" "contains order in which panels are to be drawn" diff --git a/gfx/vehicles/frame.tga b/gfx/vehicles/frame.tga index 882bd5cbc..769c061ae 100644 Binary files a/gfx/vehicles/frame.tga and b/gfx/vehicles/frame.tga differ diff --git a/hud_luma.cfg b/hud_luma.cfg index 4f801509e..36af8de67 100644 --- a/hud_luma.cfg +++ b/hud_luma.cfg @@ -23,6 +23,8 @@ seta hud_progressbar_nexball_color "0.2 0.65 0.93" seta hud_progressbar_speed_color "0.77 0.67 0" seta hud_progressbar_acceleration_color "0.2 0.65 0.93" 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 "15 12 9 5 10 6 14 0 7 4 11 2 1 3 8 13 16 " diff --git a/hud_luminos.cfg b/hud_luminos.cfg index 34db2beb6..054254c06 100644 --- a/hud_luminos.cfg +++ b/hud_luminos.cfg @@ -23,6 +23,8 @@ seta hud_progressbar_nexball_color "0.7 0.1 0" seta hud_progressbar_speed_color "1 0.75 0" seta hud_progressbar_acceleration_color "0.5 0.75 1" 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 "15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 16 " diff --git a/hud_luminos_minimal.cfg b/hud_luminos_minimal.cfg index 39a6fd2ed..192ef68d9 100644 --- a/hud_luminos_minimal.cfg +++ b/hud_luminos_minimal.cfg @@ -23,6 +23,8 @@ seta hud_progressbar_nexball_color "0.7 0.1 0" seta hud_progressbar_speed_color "1 0.75 0" seta hud_progressbar_acceleration_color "0.5 0.75 1" 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 "10 3 0 14 6 9 13 4 1 2 11 12 7 5 8 15 16 " diff --git a/hud_luminos_minimal_xhair.cfg b/hud_luminos_minimal_xhair.cfg index 4b6b7e4a7..4045cc44d 100644 --- a/hud_luminos_minimal_xhair.cfg +++ b/hud_luminos_minimal_xhair.cfg @@ -23,6 +23,8 @@ seta hud_progressbar_nexball_color "0.7 0.1 0" seta hud_progressbar_speed_color "1 0.75 0" seta hud_progressbar_acceleration_color "0.5 0.75 1" 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 "15 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 16 " diff --git a/hud_luminos_old.cfg b/hud_luminos_old.cfg index 20650899e..4ec02c1b1 100644 --- a/hud_luminos_old.cfg +++ b/hud_luminos_old.cfg @@ -23,6 +23,8 @@ seta hud_progressbar_nexball_color "0.7 0.1 0" seta hud_progressbar_speed_color "1 0.75 0" seta hud_progressbar_acceleration_color "0.5 0.75 1" 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 "15 10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 16 " diff --git a/hud_nexuiz.cfg b/hud_nexuiz.cfg index 2d86881f5..6728107fb 100644 --- a/hud_nexuiz.cfg +++ b/hud_nexuiz.cfg @@ -23,6 +23,8 @@ seta hud_progressbar_nexball_color "0.7 0.1 0" seta hud_progressbar_speed_color "1 0.75 0" seta hud_progressbar_acceleration_color "0.5 0.75 1" 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 "15 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 16 " diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 065ddc475..0cd212f32 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -78,7 +78,6 @@ float autocvar_cl_spawnzoom_speed = 1; float autocvar_cl_spawnzoom_factor = 2; bool autocvar_cl_stripcolorcodes; bool autocvar_cl_vehicles_hud_tactical = 1; -float autocvar_cl_vehicles_hudalpha = 0.75; float autocvar_cl_vehicles_hudscale = 0.5; float autocvar_cl_vehicles_crosshair_size = 0.5; bool autocvar_cl_velocityzoom_enabled; @@ -372,6 +371,8 @@ vector autocvar_hud_progressbar_shield_color; vector autocvar_hud_progressbar_speed_color; vector autocvar_hud_progressbar_strength_color; vector autocvar_hud_progressbar_superweapons_color; +vector autocvar_hud_progressbar_vehicles_ammo1_color; +vector autocvar_hud_progressbar_vehicles_ammo2_color; bool autocvar_hud_showbinds; bool autocvar_hud_showbinds_limit; bool autocvar__hud_showbinds_reload; diff --git a/qcsrc/client/vehicles/all.qc b/qcsrc/client/vehicles/all.qc index 255b2ff58..d1943ea08 100644 --- a/qcsrc/client/vehicles/all.qc +++ b/qcsrc/client/vehicles/all.qc @@ -89,7 +89,7 @@ void AuxiliaryXhair_Draw2D() { pos.z = 0; size.z = 0; - drawpic(pos, self.axh_image, size, self.colormod, self.alpha, self.axh_drawflag); + drawpic(pos, self.axh_image, size, self.colormod, autocvar_crosshair_alpha * self.alpha, self.axh_drawflag); } if(time - self.cnt > self.axh_fadetime) @@ -197,7 +197,9 @@ void Vehicles_drawHUD( string modelWeapon1, string modelWeapon2, string iconAmmo1, + vector colorAmmo1, string iconAmmo2, + vector colorAmmo2, string crosshair, bool shouldDrawBumbleGunnerCrosshair, bool shouldDrawRaptorBombCrosshair) @@ -214,6 +216,8 @@ void Vehicles_drawHUD( vector tmpSize = '0 0 0'; vector tmpPos = '0 0 0'; + float hudAlpha = autocvar_hud_panel_fg_alpha; + float barAlpha = autocvar_hud_progressbar_alpha * hudAlpha; float blinkValue = 0.55 + sin(time * 7) * 0.45; float health = getstati(STAT_VEHICLESTAT_HEALTH) * 0.01; @@ -232,7 +236,10 @@ void Vehicles_drawHUD( hudPos.x = (vid_conwidth - hudSize.x) / 2; hudPos.y = vid_conheight - hudSize.y; - drawpic(hudPos, vFRAME, hudSize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL); + if(teamplay && autocvar_hud_panel_bg_color_team) + drawpic(hudPos, vFRAME, hudSize, myteamcolors * autocvar_hud_panel_bg_color_team, autocvar_hud_panel_bg_alpha, DRAWFLAG_NORMAL); + else + drawpic(hudPos, vFRAME, hudSize, autocvar_hud_panel_bg_color, autocvar_hud_panel_bg_alpha, DRAWFLAG_NORMAL); // Model tmpSize.x = hudSize.x / 3; @@ -241,13 +248,13 @@ void Vehicles_drawHUD( tmpPos.y = hudPos.y; if(health < 0.25) - drawpic(tmpPos, modelBase, tmpSize, '1 0 0' + '0 1 1' * blinkValue, 1, DRAWFLAG_NORMAL); + drawpic(tmpPos, modelBase, tmpSize, '1 0 0' + '0 1 1' * blinkValue, hudAlpha, DRAWFLAG_NORMAL); else - drawpic(tmpPos, modelBase, tmpSize, '1 1 1' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL); + drawpic(tmpPos, modelBase, tmpSize, '1 1 1' * health + '1 0 0' * (1 - health), hudAlpha, DRAWFLAG_NORMAL); - drawpic(tmpPos, modelWeapon1, tmpSize, '1 1 1' * ammo1 + '1 0 0' * (1 - ammo1), 1, DRAWFLAG_NORMAL); - drawpic(tmpPos, modelWeapon2, tmpSize, '1 1 1' * ammo2 + '1 0 0' * (1 - ammo2), 1, DRAWFLAG_NORMAL); - drawpic(tmpPos, vMODEL_SHIELD, tmpSize, '1 1 1' * shield + '1 0 0' * (1 - shield), shield, DRAWFLAG_NORMAL); + drawpic(tmpPos, modelWeapon1, tmpSize, '1 1 1' * ammo1 + '1 0 0' * (1 - ammo1), hudAlpha, DRAWFLAG_NORMAL); + drawpic(tmpPos, modelWeapon2, tmpSize, '1 1 1' * ammo2 + '1 0 0' * (1 - ammo2), hudAlpha, DRAWFLAG_NORMAL); + drawpic(tmpPos, vMODEL_SHIELD, tmpSize, '1 1 1' * shield + '1 0 0' * (1 - shield), hudAlpha * shield, DRAWFLAG_NORMAL); // Health bar tmpSize.y = hudSize.y / 2; @@ -255,13 +262,13 @@ void Vehicles_drawHUD( tmpPos.y = hudPos.y; drawsetcliparea(tmpPos.x + (tmpSize.x * (1 - health)), tmpPos.y, tmpSize.x, tmpSize.y); - drawpic(tmpPos, vBAR_HEALTH, tmpSize, '1 1 1', 1, DRAWFLAG_NORMAL); + drawpic(tmpPos, vBAR_HEALTH, tmpSize, autocvar_hud_progressbar_health_color, barAlpha, DRAWFLAG_NORMAL); // Shield bar tmpPos.y = hudPos.y + hudSize.y / 2; drawsetcliparea(tmpPos.x + (tmpSize.x * (1 - shield)), tmpPos.y, tmpSize.x, tmpSize.y); - drawpic(tmpPos, vBAR_SHIELD, tmpSize, '1 1 1', 1, DRAWFLAG_NORMAL); + drawpic(tmpPos, vBAR_SHIELD, tmpSize, autocvar_hud_progressbar_armor_color, barAlpha, DRAWFLAG_NORMAL); // Ammo1 bar tmpPos.x = hudPos.x + hudSize.x * (480/768); @@ -272,7 +279,7 @@ void Vehicles_drawHUD( else drawsetcliparea(tmpPos.x, tmpPos.y, tmpSize.x * reload1, tmpSize.y); - drawpic(tmpPos, vBAR_AMMO1, tmpSize, '1 1 1', 1, DRAWFLAG_NORMAL); + drawpic(tmpPos, vBAR_AMMO1, tmpSize, colorAmmo1, barAlpha, DRAWFLAG_NORMAL); // Ammo2 bar tmpPos.y = hudPos.y + hudSize.y / 2; @@ -282,7 +289,7 @@ void Vehicles_drawHUD( else drawsetcliparea(tmpPos.x, tmpPos.y, tmpSize.x * reload2, tmpSize.y); - drawpic(tmpPos, vBAR_AMMO2, tmpSize, '1 1 1', 1, DRAWFLAG_NORMAL); + drawpic(tmpPos, vBAR_AMMO2, tmpSize, colorAmmo2, barAlpha, DRAWFLAG_NORMAL); drawresetcliparea(); // Health icon @@ -298,7 +305,7 @@ void Vehicles_drawHUD( alarm1time = time + 2; sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTEN_NONE); } - drawpic(tmpPos, vICON_HEALTH, tmpSize, '1 1 1', blinkValue, DRAWFLAG_NORMAL); + drawpic(tmpPos, vICON_HEALTH, tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL); } else { @@ -307,7 +314,7 @@ void Vehicles_drawHUD( sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE); alarm1time = 0; } - drawpic(tmpPos, vICON_HEALTH, tmpSize, '1 1 1', 1, DRAWFLAG_NORMAL); + drawpic(tmpPos, vICON_HEALTH, tmpSize, '1 1 1', hudAlpha, DRAWFLAG_NORMAL); } // Shield icon @@ -320,7 +327,7 @@ void Vehicles_drawHUD( alarm2time = time + 1; sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTEN_NONE); } - drawpic(tmpPos, vICON_SHIELD, tmpSize, '1 1 1', blinkValue, DRAWFLAG_NORMAL); + drawpic(tmpPos, vICON_SHIELD, tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL); } else { @@ -329,7 +336,7 @@ void Vehicles_drawHUD( sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTEN_NONE); alarm2time = 0; } - drawpic(tmpPos, vICON_SHIELD, tmpSize, '1 1 1', 1, DRAWFLAG_NORMAL); + drawpic(tmpPos, vICON_SHIELD, tmpSize, '1 1 1', hudAlpha, DRAWFLAG_NORMAL); } // Ammo1 icon @@ -337,24 +344,17 @@ void Vehicles_drawHUD( tmpPos.y = hudPos.y + hudSize.y * (48/256); if(ammo1) - drawpic(tmpPos, iconAmmo1, tmpSize, '1 1 1', 1, DRAWFLAG_NORMAL); + drawpic(tmpPos, iconAmmo1, tmpSize, '1 1 1', hudAlpha, DRAWFLAG_NORMAL); else - drawpic(tmpPos, iconAmmo1, tmpSize, '1 1 1', 0.2, DRAWFLAG_NORMAL); + drawpic(tmpPos, iconAmmo1, tmpSize, '1 1 1', hudAlpha * 0.2, DRAWFLAG_NORMAL); // Ammo2 icon tmpPos.y = hudPos.y + hudSize.y / 2; if(ammo2) - drawpic(tmpPos, iconAmmo2, tmpSize, '1 1 1', 1, DRAWFLAG_NORMAL); + drawpic(tmpPos, iconAmmo2, tmpSize, '1 1 1', hudAlpha, DRAWFLAG_NORMAL); else - drawpic(tmpPos, iconAmmo2, tmpSize, '1 1 1', 0.2, DRAWFLAG_NORMAL); - - // Crosshair - tmpSize = draw_getimagesize(crosshair) * autocvar_cl_vehicles_crosshair_size; - tmpPos.x = (vid_conwidth - tmpSize.x) / 2; - tmpPos.y = (vid_conheight - tmpSize.y) / 2; - - drawpic(tmpPos, crosshair, tmpSize, '1 1 1', 1, DRAWFLAG_NORMAL); + drawpic(tmpPos, iconAmmo2, tmpSize, '1 1 1', hudAlpha * 0.2, DRAWFLAG_NORMAL); // Bumblebee gunner crosshairs if(shouldDrawBumbleGunnerCrosshair) @@ -365,13 +365,13 @@ void Vehicles_drawHUD( if(!AuxiliaryXhairs[1].draw2d) { tmpPos.y = hudPos.y + hudSize.y * (96/256) - tmpSize.y; - drawstring(tmpPos, _("No right gunner!"), tmpSize, '1 1 1', blinkValue, DRAWFLAG_NORMAL); + drawstring(tmpPos, _("No right gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL); } if(!AuxiliaryXhairs[2].draw2d) { tmpPos.y = hudPos.y + hudSize.y * (160/256); - drawstring(tmpPos, _("No left gunner!"), tmpSize, '1 1 1', blinkValue, DRAWFLAG_NORMAL); + drawstring(tmpPos, _("No left gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL); } } @@ -403,8 +403,8 @@ void Vehicles_drawHUD( where.x -= tmpSize.x * 0.5; where.y -= tmpSize.y * 0.5; where.z = 0; - drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', 0.9, DRAWFLAG_ADDITIVE); - drawpic(where, vCROSS_DROP, tmpSize, '0 1 0', 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg + 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; } @@ -420,22 +420,35 @@ void Vehicles_drawHUD( where.x -= tmpSize.x * 0.5; where.y -= tmpSize.y * 0.5; where.z = 0; - drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', 0.9, DRAWFLAG_ADDITIVE); - drawpic(where, vCROSS_DROP, tmpSize, '1 0 0', 0.6, DRAWFLAG_NORMAL); // Ensure visibility against bright bg + 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 } } } } + + // Crosshair + tmpSize = draw_getimagesize(crosshair) * autocvar_cl_vehicles_crosshair_size; + tmpPos.x = (vid_conwidth - tmpSize.x) / 2; + tmpPos.y = (vid_conheight - tmpSize.y) / 2; + + drawpic(tmpPos, crosshair, tmpSize, '1 1 1', autocvar_crosshair_alpha, DRAWFLAG_NORMAL); } void CSQC_BUMBLE_HUD() { - Vehicles_drawHUD(vMODEL_BUMBLE, vMODEL_BUMBLE_WEAPON1, vMODEL_BUMBLE_WEAPON2, vICON_AMMO1, vICON_AMMO1, vCROSS_HEAL, TRUE, FALSE); + Vehicles_drawHUD(vMODEL_BUMBLE, vMODEL_BUMBLE_WEAPON1, vMODEL_BUMBLE_WEAPON2, + vICON_AMMO1, autocvar_hud_progressbar_vehicles_ammo1_color, + vICON_AMMO1, autocvar_hud_progressbar_vehicles_ammo1_color, + vCROSS_HEAL, TRUE, FALSE); } void CSQC_BUMBLE_GUN_HUD() { - Vehicles_drawHUD(vMODEL_GUNNER, vMODEL_GUNNER_WEAPON1, vNULL, vICON_AMMO1, vNULL, vNULL, TRUE, FALSE); + Vehicles_drawHUD(vMODEL_GUNNER, vMODEL_GUNNER_WEAPON1, vNULL, + vICON_AMMO1, autocvar_hud_progressbar_vehicles_ammo1_color, + vNULL, '0 0 0', + vNULL, TRUE, FALSE); } void CSQC_SPIDER_HUD() @@ -449,7 +462,10 @@ void CSQC_SPIDER_HUD() default: crosshair = vCROSS_TAG; } - Vehicles_drawHUD(vMODEL_SPIDER, vMODEL_SPIDER_WEAPON1, vMODEL_SPIDER_WEAPON2, vICON_AMMO1, vICON_AMMO2, crosshair, FALSE, FALSE); + Vehicles_drawHUD(vMODEL_SPIDER, vMODEL_SPIDER_WEAPON1, vMODEL_SPIDER_WEAPON2, + vICON_AMMO1, autocvar_hud_progressbar_vehicles_ammo1_color, + vICON_AMMO2, autocvar_hud_progressbar_vehicles_ammo2_color, + crosshair, FALSE, FALSE); } void CSQC_RAPTOR_HUD() @@ -462,12 +478,18 @@ void CSQC_RAPTOR_HUD() default: crosshair = vCROSS_AIM; } - Vehicles_drawHUD(vMODEL_RAPTOR, vMODEL_RAPTOR_WEAPON1, vMODEL_RAPTOR_WEAPON2, vICON_AMMO1, vICON_AMMO2, crosshair, FALSE, TRUE); + Vehicles_drawHUD(vMODEL_RAPTOR, vMODEL_RAPTOR_WEAPON1, vMODEL_RAPTOR_WEAPON2, + vICON_AMMO1, autocvar_hud_progressbar_vehicles_ammo1_color, + vICON_AMMO2, autocvar_hud_progressbar_vehicles_ammo2_color, + crosshair, FALSE, TRUE); } void CSQC_WAKIZASHI_HUD() { - Vehicles_drawHUD(vMODEL_RACER, vMODEL_RACER_WEAPON1, vMODEL_RACER_WEAPON2, vICON_AMMO1, vICON_AMMO2, vCROSS_AIM, FALSE, FALSE); + Vehicles_drawHUD(vMODEL_RACER, vMODEL_RACER_WEAPON1, vMODEL_RACER_WEAPON2, + vICON_AMMO1, autocvar_hud_progressbar_vehicles_ammo1_color, + vICON_AMMO2, autocvar_hud_progressbar_vehicles_ammo2_color, + vCROSS_AIM, FALSE, FALSE); } void Vehicles_Precache() diff --git a/vehicles.cfg b/vehicles.cfg index ae252e301..290b12d8c 100644 --- a/vehicles.cfg +++ b/vehicles.cfg @@ -15,7 +15,6 @@ set g_vehicles_crush_force 50 set cl_vehicles_hud_tactical 1 set cl_vehicles_hudscale 0.5 -set cl_vehicles_hudalpha 0.75; set cl_vehicles_crosshair_size 0.5 set g_vehicles_delayspawn 1