The code for this is my own, I implemented it in a different engine, thus it may require changes for stock Quake, but hey you never know.
Somewhere near the top of cl_main.c, where the other cvar_t lines are add this line of code:
Code: Select all
cvar_t nohud = {"nohud", "0"}; //TeamXlink - nohud cvar
Now in CL_init add this along with all of the other cvar register lines:
Code: Select all
Cvar_RegisterVariable (&nohud); //TeamXlink - nohud cvar
This is where it starts to get engine specific.
If your using the PSP open video_hardware_draw.cpp if your using another engine open the equivalent file, it may be gl_draw.c if I'm not mistaken.
Go to Draw_Crosshair.
And before this line:
Code: Select all
if (crosshair.value >= 2)
Code: Select all
//TeamXlink - nohud cvar start
if ( nohud.value )
return;
//TeamXlink - nohud cvar end
This line simply makes it not continue and return back.
Now, that was for the crosshair, this next part is for the actual hud.
Open sbar.c and near the top add this line:
Code: Select all
extern cvar_t nohud; //TeamXlink - nohud cvar
Now find the Sbar_Draw function, and near the top add this:
Code: Select all
//TeamXlink - nohud cvar start
if ( nohud.value )
return;
//TeamXlink - nohud cvar end
That is all.
This code I wrote for this tutorial was written a long time ago, and it probably has some improvements that could and should be made.
As usual post questions, comments, concerns, hate mail etc, at the bottom of this post.
Thank you.
Credits:
TeamXlink