From 07d8d591c808cad8a1fed0d0b12e7ce22ce983d3 Mon Sep 17 00:00:00 2001 From: Alexander Akulich Date: Tue, 5 Sep 2023 03:02:13 +0300 Subject: [PATCH] Add NO_SKIN_CHANGE_FOR_FROZEN game info flag The flag is wanted for mods which use freeze state but need or want to keep the player skins (the skin is critical for some mods). --- datasrc/network.py | 4 ++-- src/game/client/components/players.cpp | 3 ++- src/game/client/gameclient.cpp | 6 ++++++ src/game/client/gameclient.h | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/datasrc/network.py b/datasrc/network.py index 6175cf16f65..27b013953f7 100644 --- a/datasrc/network.py +++ b/datasrc/network.py @@ -26,7 +26,7 @@ ] GameInfoFlags2 = [ "ALLOW_X_SKINS", "GAMETYPE_CITY", "GAMETYPE_FDDRACE", "ENTITIES_FDDRACE", "HUD_HEALTH_ARMOR", "HUD_AMMO", - "HUD_DDRACE", "NO_WEAK_HOOK" + "HUD_DDRACE", "NO_WEAK_HOOK", "NO_SKIN_CHANGE_FOR_FROZEN" ] ExPlayerFlags = ["AFK", "PAUSED", "SPEC"] LegacyProjectileFlags = [f"CLIENTID_BIT{i}" for i in range(8)] + [ @@ -71,7 +71,7 @@ enum { - GAMEINFO_CURVERSION=8, + GAMEINFO_CURVERSION=9, }; ''' diff --git a/src/game/client/components/players.cpp b/src/game/client/components/players.cpp index 0ab994cf408..95e137b78b1 100644 --- a/src/game/client/components/players.cpp +++ b/src/game/client/components/players.cpp @@ -763,7 +763,8 @@ void CPlayers::OnRender() m_aRenderInfo[i].m_TeeRenderFlags |= TEE_EFFECT_FROZEN; const CGameClient::CSnapState::CCharacterInfo &CharacterInfo = m_pClient->m_Snap.m_aCharacters[i]; - if((CharacterInfo.m_Cur.m_Weapon == WEAPON_NINJA || (CharacterInfo.m_HasExtendedData && CharacterInfo.m_ExtendedData.m_FreezeEnd != 0)) && g_Config.m_ClShowNinja) + const bool Frozen = CharacterInfo.m_HasExtendedData && CharacterInfo.m_ExtendedData.m_FreezeEnd != 0; + if((CharacterInfo.m_Cur.m_Weapon == WEAPON_NINJA || (Frozen && !m_pClient->m_GameInfo.m_NoSkinChangeForFrozen)) && g_Config.m_ClShowNinja) { // change the skin for the player to the ninja const auto *pSkin = m_pClient->m_Skins.FindOrNullptr("x_ninja"); diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index 7bf4acfd8f9..0c531554ce8 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -1188,6 +1188,7 @@ static CGameInfo GetGameInfo(const CNetObj_GameInfoEx *pInfoEx, int InfoExSize, Info.m_HudAmmo = true; Info.m_HudDDRace = false; Info.m_NoWeakHookAndBounce = false; + Info.m_NoSkinChangeForFrozen = false; if(Version >= 0) { @@ -1243,6 +1244,11 @@ static CGameInfo GetGameInfo(const CNetObj_GameInfoEx *pInfoEx, int InfoExSize, { Info.m_NoWeakHookAndBounce = Flags2 & GAMEINFOFLAG2_NO_WEAK_HOOK; } + if(Version >= 9) + { + Info.m_NoSkinChangeForFrozen = Flags2 & GAMEINFOFLAG2_NO_SKIN_CHANGE_FOR_FROZEN; + } + return Info; } diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h index f82fc9513ea..8e4056959c6 100644 --- a/src/game/client/gameclient.h +++ b/src/game/client/gameclient.h @@ -96,6 +96,7 @@ class CGameInfo bool m_HudDDRace; bool m_NoWeakHookAndBounce; + bool m_NoSkinChangeForFrozen; }; class CSnapEntities