Skip to content

Commit

Permalink
Client: Check for build when setting rich presence
Browse files Browse the repository at this point in the history
  • Loading branch information
tmp64 committed Oct 6, 2024
1 parent 3aa7e69 commit e1aa9f0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/game/client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ add_sources(
demo.h
engfuncs.cpp
engfuncs.h
engine_builds.h
engine_patches.cpp
engine_patches.h
entity.cpp
Expand Down
8 changes: 6 additions & 2 deletions src/game/client/hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "svc_messages.h"
#include "sdl_rt.h"
#include "fog.h"
#include "engine_builds.h"

#if USE_UPDATER
#include "updater/update_checker.h"
Expand Down Expand Up @@ -419,8 +420,11 @@ void CHud::Init(void)

UpdateSupportsCvar();

gEngfuncs.pfnClientCmd("richpresence_gamemode\n"); // reset
gEngfuncs.pfnClientCmd("richpresence_update\n");
if (GetEngineBuild() >= ENGINE_BUILD_ANNIVERSARY_FIRST)
{
gEngfuncs.pfnClientCmd("richpresence_gamemode\n"); // reset
gEngfuncs.pfnClientCmd("richpresence_update\n");
}
}

void CHud::VidInit(void)
Expand Down
14 changes: 9 additions & 5 deletions src/game/client/hud_msg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "hud/ammo.h"
#include "hud/status_icons.h"
#include "hud/ammo.h"
#include "engine_builds.h"

#include "particleman.h"
extern IParticleMan *g_pParticleMan;
Expand Down Expand Up @@ -128,12 +129,15 @@ int CHud::MsgFunc_GameMode(const char *pszName, int iSize, void *pbuf)
BEGIN_READ(pbuf, iSize);
m_Teamplay = READ_BYTE();

if (m_Teamplay)
gEngfuncs.pfnClientCmd("richpresence_gamemode Teamplay\n");
else
gEngfuncs.pfnClientCmd("richpresence_gamemode\n"); // reset
if (GetEngineBuild() >= ENGINE_BUILD_ANNIVERSARY_FIRST)
{
if (m_Teamplay)
gEngfuncs.pfnClientCmd("richpresence_gamemode Teamplay\n");
else
gEngfuncs.pfnClientCmd("richpresence_gamemode\n"); // reset

gEngfuncs.pfnClientCmd("richpresence_update\n");
gEngfuncs.pfnClientCmd("richpresence_update\n");
}

return 1;
}
Expand Down

0 comments on commit e1aa9f0

Please sign in to comment.