CVAR_CREATE( "hud_classautokill", "1", FCVAR_ARCHIVE | FCVAR_USERINFO );
CVAR_CREATE( "hud_takesshots", "0", FCVAR_ARCHIVE );
Now add these 3 CVARs underneath them:
CVAR_CREATE( "hud_red","0", FCVAR_ARCHIVE );
CVAR_CREATE( "hud_green", "200", FCVAR_ARCHIVE );
CVAR_CREATE( "hud_blue", "0", FCVAR_ARCHIVE );
With hudcolor1 being red, 2 being green and 3 being blue (so 0, 200, 0 is a green color). Just make sure the number is between 0 and 255.inline void UnpackRGB(int &r, int &g, int &b, unsigned long ulRGB)
{
r = (ulRGB & 0xFF0000) >>16;
g = (ulRGB & 0xFF00) >> 8;
b = ulRGB & 0xFF;
}
With this:
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" );
}
else
{
r = (ulRGB & 0xFF0000) >>16;
g = (ulRGB & 0xFF00) >> 8;
b = ulRGB & 0xFF;
}
}
This part tells the engine to take the default color, but have the rgb values as the CVARs which we set earlier. Now, if we delete the CVARs, it will goto the default orange. Build this project and replace the cl_dll in the valve folder (MAKE A BACKUP FIRST!) and play Half-Life. Looks good huh? Except from one problem, the lil bar between the health and the rest of the HUD. But, there is a fix! Open up health.cpp and goto line 233. FillRGBA(x, y, iWidth, iHeight, 255, 160, 0, a);
With this:
FillRGBA(x, y, iWidth, iHeight, r, g, b, a);
This will tell the engine to read the health color from our CVARs.i = sqrt (i);
With this:
i = float sqrt (i);
Warning: I haven't tested this with multiplayer, but as most mods are SP, it shouldnt matter. You must log in to post a comment. You can login or register a new account.
EDIT: Nvm i got i used cmake to compile and notepad++ to edit