Skip to content

Commit

Permalink
fix: don't apply patch when at defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
ThisAMJ committed Dec 5, 2024
1 parent b23954d commit df7fe43
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Modules/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,9 @@ Memory::Patch *g_drawPortalGhostPatch;
// C_Prop_Portal::DrawPortal
extern Hook g_DrawPortalHook;
DETOUR(Client::DrawPortal, void *pRenderContext) {
if (sar_portalcolor_enable.GetBool()) {
if (sar_portalcolor_enable.GetBool() &&
!(!strcmp(sar_portalcolor_sp_1.GetString(), sar_portalcolor_sp_1.ThisPtr()->m_pszDefaultValue) &&
!strcmp(sar_portalcolor_sp_2.GetString(), sar_portalcolor_sp_2.ThisPtr()->m_pszDefaultValue))) {
g_drawPortalPatch->Execute();
} else {
g_drawPortalPatch->Restore();
Expand All @@ -353,7 +355,9 @@ static void (*g_DrawPortalGhost)(void *pRenderContext);
// C_Prop_Portal::DrawPortalGhostLocations
extern Hook g_DrawPortalGhostHook;
static void DrawPortalGhost_Hook(void *pRenderContext) {
if (sar_portalcolor_enable.GetBool()) {
if (sar_portalcolor_enable.GetBool() &&
!(!strcmp(sar_portalcolor_sp_1.GetString(), sar_portalcolor_sp_1.ThisPtr()->m_pszDefaultValue) &&
!strcmp(sar_portalcolor_sp_2.GetString(), sar_portalcolor_sp_2.ThisPtr()->m_pszDefaultValue))) {
g_drawPortalGhostPatch->Execute();
} else {
g_drawPortalGhostPatch->Restore();
Expand Down

0 comments on commit df7fe43

Please sign in to comment.