Changing HUD colors with Solokiller's halflife-op4-updated SDK Created 1 week ago2021-06-04 11:30:03 UTC by GeckoOrange GeckoOrange

Created 1 week ago2021-06-04 11:30:03 UTC by GeckoOrange GeckoOrange

Posted 1 week ago2021-06-04 11:30:03 UTC Post #345675

I am following this tutorial and I run into the problem. I compile everything without errors, but hud remains green even if I try to change it's color via options.

Any ideas on how to resolve this problem? Maybe there are additional steps while working with op4 SDK?
Posted 1 week ago2021-06-04 13:00:12 UTC Post #345676
Opposing Force handles HUD colors a bit differently since the CTF gamemode requires changing colors.

To change the default color you need to change this code instead:

Change RGB_HUD_COLOR to the color you want to use.

If you want to change it dynamically (e.g. with cvars) then you'll need to move this code:

To here:

Put the code before the voice manager code like this:
void DLLEXPORT HUD_Frame( double time )
//    RecClHudFrame(time);

    UnpackRGB(giR, giG, giB, RGB_HUD_COLOR);

And change it so the RGB value is set to whatever you want it to be. If you're using separate cvars for the color then it should be like this:
giR = CVAR_GET_FLOAT( "hud_red" );
giG = CVAR_GET_FLOAT( "hud_green" );
giB = CVAR_GET_FLOAT( "hud_blue" );
Note that if you do this, CTF's HUD colors will no longer work since you're overriding the color every frame.

You may also want to cache the pointers to the cvars so avoid the costly lookup every frame.
Posted 5 days ago2021-06-08 10:09:46 UTC Post #345688
Thanks for the help! Everything works fine instead of crosshairs, they remain the same color. But I guess that's the reason of sprite itself, as it is already colored.
Posted 5 days ago2021-06-08 12:53:54 UTC Post #345689
Yeah the sprites have the color because autoaim has a red color, and sprite coloring done through code requires monochrome sprites that will be shades of the given color.
You must be logged in to post a response.