Skip to content

Commit

Permalink
Add hud_watermark command
Browse files Browse the repository at this point in the history
Command to toggle the HUD watermark that displays upon connecting to a server. Default value is 1.
  • Loading branch information
sabianroberts committed Oct 28, 2024
1 parent 7c35c77 commit 004cdc1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 28 deletions.
3 changes: 3 additions & 0 deletions cl_dll/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ cvar_t *cl_righthand = nullptr;
cvar_t *cl_viewrollangle;
cvar_t *cl_viewrollspeed;
cvar_t *cl_bob_angled;
cvar_t *hud_watermark;

void ShutdownInput (void);

Expand Down Expand Up @@ -500,6 +501,8 @@ void CHud :: Init( void )
cl_viewrollspeed = CVAR_CREATE ( "cl_viewrollspeed", "300", FCVAR_CLIENTDLL | FCVAR_ARCHIVE );
cl_bob_angled = CVAR_CREATE ( "cl_bob_angled", "0", FCVAR_CLIENTDLL | FCVAR_ARCHIVE );

hud_watermark = CVAR_CREATE ( "hud_watermark", "1", FCVAR_CLIENTDLL | FCVAR_ARCHIVE );

HOOK_MESSAGE( CheatCheck );
HOOK_MESSAGE( WhString );
HOOK_MESSAGE( SpikeCheck );
Expand Down
48 changes: 26 additions & 22 deletions cl_dll/hud_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,36 +49,40 @@ int CHudSettings::Draw(float time)

char str[32];

sprintf(str, "AG version %s", ag_version);
gEngfuncs.pfnDrawString(x, (y += gHUD.m_scrinfo.iCharHeight), str, r, g, b);

gEngfuncs.pfnDrawString(x, (y += gHUD.m_scrinfo.iCharHeight), gamemode, r, g, b);

sprintf(str, "Time limit: %hhd", time_limit);
gEngfuncs.pfnDrawString(x, (y += gHUD.m_scrinfo.iCharHeight / 2 * 3), str, r, g, b);

sprintf(str, "Frag limit: %hhd", frag_limit);
gEngfuncs.pfnDrawString(x, (y += gHUD.m_scrinfo.iCharHeight), str, r, g, b);
extern cvar_t* hud_watermark;
if (hud_watermark->value == 1)
{
sprintf(str, "AG version %s", ag_version);
gEngfuncs.pfnDrawString(x, (y += gHUD.m_scrinfo.iCharHeight), str, r, g, b);

sprintf(str, "Friendly fire: %s", friendly_fire ? "On" : "Off");
gEngfuncs.pfnDrawString(x, (y += gHUD.m_scrinfo.iCharHeight), str, r, g, b);
gEngfuncs.pfnDrawString(x, (y += gHUD.m_scrinfo.iCharHeight), gamemode, r, g, b);

sprintf(str, "Weaponstay: %s", weapon_stay ? "On" : "Off");
gEngfuncs.pfnDrawString(x, (y += gHUD.m_scrinfo.iCharHeight), str, r, g, b);
sprintf(str, "Time limit: %hhd", time_limit);
gEngfuncs.pfnDrawString(x, (y += gHUD.m_scrinfo.iCharHeight / 2 * 3), str, r, g, b);

if (wallgauss[0]) {
sprintf(str, "Wallgauss: %sx (1)", wallgauss);
sprintf(str, "Frag limit: %hhd", frag_limit);
gEngfuncs.pfnDrawString(x, (y += gHUD.m_scrinfo.iCharHeight), str, r, g, b);
}

if (headshot[0]) {
sprintf(str, "Headshot: %sx (3)", headshot);
sprintf(str, "Friendly fire: %s", friendly_fire ? "On" : "Off");
gEngfuncs.pfnDrawString(x, (y += gHUD.m_scrinfo.iCharHeight), str, r, g, b);
}

if (blast_radius[0]) {
sprintf(str, "Blast radius: %sx (1)", blast_radius);
sprintf(str, "Weaponstay: %s", weapon_stay ? "On" : "Off");
gEngfuncs.pfnDrawString(x, (y += gHUD.m_scrinfo.iCharHeight), str, r, g, b);

if (wallgauss[0]) {
sprintf(str, "Wallgauss: %sx (1)", wallgauss);
gEngfuncs.pfnDrawString(x, (y += gHUD.m_scrinfo.iCharHeight), str, r, g, b);
}

if (headshot[0]) {
sprintf(str, "Headshot: %sx (3)", headshot);
gEngfuncs.pfnDrawString(x, (y += gHUD.m_scrinfo.iCharHeight), str, r, g, b);
}

if (blast_radius[0]) {
sprintf(str, "Blast radius: %sx (1)", blast_radius);
gEngfuncs.pfnDrawString(x, (y += gHUD.m_scrinfo.iCharHeight), str, r, g, b);
}
}

if (match_is_on) {
Expand Down
15 changes: 9 additions & 6 deletions cl_dll/hud_watermark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@ int CHudWatermark::Draw(float time)
int r, g, b;
UnpackRGB(r, g, b, gHUD.m_iDefaultHUDColor);

gEngfuncs.pfnDrawString(ScreenWidth / 20, gHUD.m_scrinfo.iCharHeight, "OpenAG client build " __DATE__, r, g, b);
gEngfuncs.pfnDrawString(ScreenWidth / 20, gHUD.m_scrinfo.iCharHeight * 2, "j.mp/OpenAG", r, g, b);

if (update_is_available)
gEngfuncs.pfnDrawString(ScreenWidth / 20, gHUD.m_scrinfo.iCharHeight / 2 * 7, "An update is available.", r, g, b);

extern cvar_t* hud_watermark;
if (hud_watermark->value == 1)
{
gEngfuncs.pfnDrawString(ScreenWidth / 20, gHUD.m_scrinfo.iCharHeight, "OpenAG client build " __DATE__, r, g, b);
gEngfuncs.pfnDrawString(ScreenWidth / 20, gHUD.m_scrinfo.iCharHeight * 2, "j.mp/OpenAG", r, g, b);

if (update_is_available)
gEngfuncs.pfnDrawString(ScreenWidth / 20, gHUD.m_scrinfo.iCharHeight / 2 * 7, "An update is available.", r, g, b);
}
return 0;
}

0 comments on commit 004cdc1

Please sign in to comment.