Check out Half-Life Re-imagined competition results!
Check out Skewing textures in Hammer, our newest tutorial!
Welcome, Shadowx93ca, our newest member!


Site Stuff






Feeling Blue

What's your favourite shade of blue?














5 mins


9 mins


14 mins


27 mins

Instant Mix

32 mins


33 mins


34 mins

The Mad Carrot


A gaming and technology blog by TWHL admins Penguinboy and Ant. A music blog by TWHL users Ant and Hugh.

Customizable Hud Color

By J.P.Barry

Take a good look at the HUD of half-life. Bored with that ol' dull dank orangey yellow? Well if you are then, this tutorial will allow you and your friends to choose any colour for the HUD regardless. Now you can have the greenish blue HUD of your dreams, or show your true colours with a lovely bright red HUD and if you get bored of your new HUD you can change it whenever you want, even in game !

How do you do this? Well you have to open up the cl_dll project.

We are going to store the HUD colour for the client in three cvars, one for each RGB component. These are 'hud_red', 'hud_green' and 'hud_blue'. We need to initialize these first so open up hud.cpp and open up init() (line 306).

You will find two CVAR_CREATEs, add these three after them.

     CVAR_CREATE( "hud_red","255", FCVAR_ARCHIVE );
     CVAR_CREATE( "hud_green", "160", FCVAR_ARCHIVE );
     CVAR_CREATE( "hud_blue", "0", FCVAR_ARCHIVE );

The FCVAR_ARCHIVE ensures that they will be remembered when you quit Half-Life.

Now to business, load up cl_util.h and go to UnpackRGB() (line 153). We are going to 'hijack' the processing of the HUD colour as it is being separated from its hex value to its RGB components.


inline void UnpackRGB(int &r, int &g, int &b, unsigned long ulRGB)
     r = (ulRGB & 0xFF0000) >>16;
     g = (ulRGB & 0xFF00) >> 8;
     b = ulRGB & 0xFF;


inline void UnpackRGB(int &r, int &g, int &b, unsigned long ulRGB)
     if ( ulRGB == RGB_YELLOWISH )
          r = CVAR_GET_FLOAT( "hud_red" );
          g = CVAR_GET_FLOAT( "hud_green" );
          b = CVAR_GET_FLOAT( "hud_blue" );
          r = (ulRGB & 0xFF0000) >>16;
          g = (ulRGB & 0xFF00) >> 8;
          b = ulRGB & 0xFF;

What this does is it sees if the colour is the default yellow color of the HUD and if it is it replaces it with the our cvar's values.

This will ensure that all of the orange colored graphics will be coloured in your custom colour. This will work for all the graphics with one annoying exception (there's always one, isn't there?) The little bar between the health and the armor values has hard-coded values. This is an infamous problem for anyone whose tried to change the HUD's colour. To fix, open up health.cpp and scroll down to line 233.


FillRGBA(x, y, iWidth, iHeight, 255, 160, 0, a);


FillRGBA(x, y, iWidth, iHeight, r, g, b, a);

That's it, now recompile the DLL and run the game. You can now edit the three cvars to get the desired color of your choice.

Be forewarned though, the HUD is transparent so if you set all the cvars to 0, in order to get black, the HUD becomes totally transparent so use relatively high values and you'll be fine.

Additional Feature

You may have people who want to change their HUD but unfortunately they haven't a clue how to use the console. To fix this unavoidable problem you can add the cvars to the menu, under Multiplayer->Customize->Advanced Options. To do this open up user.scr in a text editor, scroll down to

          "Multiplayer decal limit"
          { NUMBER 0.000000 4096.000000 }
          { "300.000000" }

and add the following

          "Hud Red"
          { NUMBER 0 255 }
          { "255" }
          "Hud Green"
          { NUMBER 0 255 }
          { "160" }
          "Hud Blue"
          { NUMBER 0 255 }
          { "0" }

Close and Save.

There you are, now anyone and everyone can have the power to personalize their games. Power to the People!