From c0251f1368998fd5ac1df6402c616b9cce7cc2c6 Mon Sep 17 00:00:00 2001 From: k9er Date: Mon, 13 Jan 2025 17:51:25 +0000 Subject: [PATCH] Color the ammo hud text and progressbars --- qcsrc/client/hud/panel/ammo.qc | 4 +-- qcsrc/common/items/item/jetpack.qh | 1 + .../common/mutators/mutator/instagib/items.qh | 1 + qcsrc/common/resources/all.inc | 30 +++++++++++-------- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/qcsrc/client/hud/panel/ammo.qc b/qcsrc/client/hud/panel/ammo.qc index 891123bf1..298a01ba1 100644 --- a/qcsrc/client/hud/panel/ammo.qc +++ b/qcsrc/client/hud/panel/ammo.qc @@ -97,10 +97,10 @@ void DrawAmmoItem(vector myPos, vector mySize, Resource ammoType, bool isCurrent drawpic_aspect_skin(myPos, "ammo_current_bg", mySize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); if(ammo > 0 && autocvar_hud_panel_ammo_progressbar) - HUD_Panel_DrawProgressBar(myPos + eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize.x, mySize - eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize.x, autocvar_hud_panel_ammo_progressbar_name, ammo/autocvar_hud_panel_ammo_maxammo, 0, 0, textColor, autocvar_hud_progressbar_alpha * alpha, DRAWFLAG_NORMAL); + HUD_Panel_DrawProgressBar(myPos + eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize.x, mySize - eX * autocvar_hud_panel_ammo_progressbar_xoffset * mySize.x, autocvar_hud_panel_ammo_progressbar_name, ammo/autocvar_hud_panel_ammo_maxammo, 0, 0, textColor * 0.2 + ammoType.m_color * 0.8, autocvar_hud_progressbar_alpha * alpha, DRAWFLAG_NORMAL); if(autocvar_hud_panel_ammo_text) - drawstring_aspect(textPos, text, eX * (2/3) * mySize.x + eY * mySize.y, textColor, alpha, DRAWFLAG_NORMAL); + drawstring_aspect(textPos, text, eX * (2/3) * mySize.x + eY * mySize.y, textColor * 0.6 + ammoType.m_color * 0.4, alpha, DRAWFLAG_NORMAL); drawpic_aspect_skin(iconPos, ammoType.m_icon, '1 1 0' * mySize.y, iconColor, alpha, DRAWFLAG_NORMAL); } diff --git a/qcsrc/common/items/item/jetpack.qh b/qcsrc/common/items/item/jetpack.qh index 57ea28919..03294ffb8 100644 --- a/qcsrc/common/items/item/jetpack.qh +++ b/qcsrc/common/items/item/jetpack.qh @@ -73,6 +73,7 @@ CLASS(JetpackFuel, Ammo) /* refname */ ATTRIB(JetpackFuel, netname, string, "fuel"); /* itemname */ ATTRIB(JetpackFuel, m_name, string, _("Fuel")); /* icon */ ATTRIB(JetpackFuel, m_icon, string, "ammo_fuel"); +/* color */ ATTRIB(JetpackFuel, m_color, vector, '0.984 0.878 0.506'); #ifdef SVQC /* botvlaue */ ATTRIB(JetpackFuel, m_botvalue, int, 2000); /* itemid */ ATTRIB(JetpackFuel, m_itemid, int, IT_RESOURCE); diff --git a/qcsrc/common/mutators/mutator/instagib/items.qh b/qcsrc/common/mutators/mutator/instagib/items.qh index 9858f4b7f..88cca9436 100644 --- a/qcsrc/common/mutators/mutator/instagib/items.qh +++ b/qcsrc/common/mutators/mutator/instagib/items.qh @@ -33,6 +33,7 @@ CLASS(VaporizerCells, Ammo) /* refname */ ATTRIB(VaporizerCells, netname, string, "vaporizer_cells"); /* itemname */ ATTRIB(VaporizerCells, m_name, string, _("Vaporizer ammo")); /* icon */ ATTRIB(VaporizerCells, m_icon, string, "ammo_supercells"); +/* color */ ATTRIB(VaporizerCells, m_color, vector, '0.816 0.941 0.541'); #ifdef SVQC /* botvalue */ ATTRIB(VaporizerCells, m_botvalue, int, 2000); /* itemid */ ATTRIB(VaporizerCells, m_itemid, int, IT_RESOURCE); diff --git a/qcsrc/common/resources/all.inc b/qcsrc/common/resources/all.inc index 354aa63fc..eb0520db3 100644 --- a/qcsrc/common/resources/all.inc +++ b/qcsrc/common/resources/all.inc @@ -15,6 +15,7 @@ CLASS(AmmoResource, Resource) #ifdef CSQC ATTRIB(AmmoResource, m_hidden, bool, false); #endif + ATTRIB(AmmoResource, m_color, vector, '1 1 1'); ENDCLASS(AmmoResource) // NOTE: ammo resource registration order should match ammo (item) registration order @@ -26,40 +27,45 @@ REGISTER_RESOURCE(SHELLS, NEW(AmmoResource)) { #ifdef GAMEQC this.m_field = ammo_shells; #endif - this.m_name = _("Shells"); - this.m_icon = "ammo_shells"; + this.m_name = _("Shells"); + this.m_icon = "ammo_shells"; + this.m_color = '0.604 0.647 0.671'; } REGISTER_RESOURCE(BULLETS, NEW(AmmoResource)) { this.netname = "bullets"; #ifdef GAMEQC this.m_field = ammo_nails; #endif - this.m_name = _("Bullets"); - this.m_icon = "ammo_bullets"; + this.m_name = _("Bullets"); + this.m_icon = "ammo_bullets"; + this.m_color = '0.678 0.941 0.522'; } REGISTER_RESOURCE(ROCKETS, NEW(AmmoResource)) { this.netname = "rockets"; #ifdef GAMEQC this.m_field = ammo_rockets; #endif - this.m_name = _("Rockets"); - this.m_icon = "ammo_rockets"; + this.m_name = _("Rockets"); + this.m_icon = "ammo_rockets"; + this.m_color = '0.918 0.686 0.525'; } REGISTER_RESOURCE(CELLS, NEW(AmmoResource)) { this.netname = "cells"; #ifdef GAMEQC this.m_field = ammo_cells; #endif - this.m_name = _("Cells"); - this.m_icon = "ammo_cells"; + this.m_name = _("Cells"); + this.m_icon = "ammo_cells"; + this.m_color = '0.545 0.882 0.969'; } REGISTER_RESOURCE(FUEL, NEW(AmmoResource)) { - this.netname = "fuel"; + this.netname = "fuel"; #ifdef GAMEQC - this.m_field = ammo_fuel; + this.m_field = ammo_fuel; #endif - this.m_name = _("Fuel"); - this.m_icon = "ammo_fuel"; + this.m_name = _("Fuel"); + this.m_icon = "ammo_fuel"; + this.m_color = '0.984 0.878 0.506'; #ifdef CSQC this.m_hidden = true; // displayed in a separate panel #endif -- 2.39.5