From e1aa9f01a64cf97dd8ef46f8d97a35be5782b1b9 Mon Sep 17 00:00:00 2001 From: tmp64 Date: Sun, 6 Oct 2024 11:51:32 +0700 Subject: [PATCH] Client: Check for build when setting rich presence --- src/game/client/CMakeLists.txt | 1 + src/game/client/hud.cpp | 8 ++++++-- src/game/client/hud_msg.cpp | 14 +++++++++----- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/game/client/CMakeLists.txt b/src/game/client/CMakeLists.txt index 6b6bb666..c7bc6dd0 100644 --- a/src/game/client/CMakeLists.txt +++ b/src/game/client/CMakeLists.txt @@ -21,6 +21,7 @@ add_sources( demo.h engfuncs.cpp engfuncs.h + engine_builds.h engine_patches.cpp engine_patches.h entity.cpp diff --git a/src/game/client/hud.cpp b/src/game/client/hud.cpp index 51f971b9..4c488464 100644 --- a/src/game/client/hud.cpp +++ b/src/game/client/hud.cpp @@ -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" @@ -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) diff --git a/src/game/client/hud_msg.cpp b/src/game/client/hud_msg.cpp index 809bc058..5954cc6b 100644 --- a/src/game/client/hud_msg.cpp +++ b/src/game/client/hud_msg.cpp @@ -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; @@ -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; }