Color the ammo hud text and progressbars
authork9er <k9wolf@pm.me>
Mon, 13 Jan 2025 17:51:25 +0000 (17:51 +0000)
committerterencehill <piuntn@gmail.com>
Mon, 13 Jan 2025 17:51:25 +0000 (17:51 +0000)
qcsrc/client/hud/panel/ammo.qc
qcsrc/common/items/item/jetpack.qh
qcsrc/common/mutators/mutator/instagib/items.qh
qcsrc/common/resources/all.inc

index 891123bf1e3693b8d2c1655dcd437a87f377c6dc..298a01ba16fdc210215c5286f8b767a03af59785 100644 (file)
@@ -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);
 }
index 57ea289196f1839c8739b6772e8f5b0285c191b7..03294ffb8b5a9e15f7021f1bdf32d0933ffd71ad 100644 (file)
@@ -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);
index 9858f4b7f47a75230ebc8fbf88ca8bb7a1235b9f..88cca94369948de0f27b0462a93693dccbbe4c1d 100644 (file)
@@ -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);
index 354aa63fc27699c8fd2e54eb66ea2a93185d63aa..eb0520db3f749d4308c36877b94c5d7f4b8da07b 100644 (file)
@@ -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