Skip to content

Commit

Permalink
Add NO_SKIN_CHANGE_FOR_FROZEN game info flag
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
Kaffeine committed Sep 6, 2023
1 parent 228d996 commit 07d8d59
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions datasrc/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)] + [
Expand Down Expand Up @@ -71,7 +71,7 @@
enum
{
GAMEINFO_CURVERSION=8,
GAMEINFO_CURVERSION=9,
};
'''

Expand Down
3 changes: 2 additions & 1 deletion src/game/client/components/players.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
6 changes: 6 additions & 0 deletions src/game/client/gameclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions src/game/client/gameclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class CGameInfo
bool m_HudDDRace;

bool m_NoWeakHookAndBounce;
bool m_NoSkinChangeForFrozen;
};

class CSnapEntities
Expand Down

0 comments on commit 07d8d59

Please sign in to comment.