Skip to content

Commit

Permalink
Support 'Invisible' infclass character property
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaffeine committed Apr 6, 2023
1 parent 8e32189 commit 6c1f27f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
2 changes: 2 additions & 0 deletions datasrc/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

InfClassPlayerFlags = ["INFECTED", "HOOK_PROTECTION_OFF"]
InfClassObjectFlags = ["HAS_SECOND_POSITION"]
InfClassClassInfoFlags = ["IS_INVISIBLE"]

Emoticons = ["OOP", "EXCLAMATION", "HEARTS", "DROP", "DOTDOT", "MUSIC", "SORRY", "GHOST", "SUSHI", "SPLATTEE", "DEVILTEE", "ZOMG", "ZZZ", "WTF", "EYES", "QUESTION"]

Expand Down Expand Up @@ -97,6 +98,7 @@
Flags("PROJECTILEFLAG", ProjectileFlags),
Flags("INFCLASS_PLAYER_FLAG", InfClassPlayerFlags),
Flags("INFCLASS_OBJECT_FLAG", InfClassObjectFlags),
Flags("INFCLASS_CLASSINFO_FLAG", InfClassClassInfoFlags),
]

Objects = [
Expand Down
26 changes: 24 additions & 2 deletions src/game/client/components/players.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,30 @@ void CPlayers::RenderPlayer(
bool Local = m_pClient->m_Snap.m_LocalClientID == ClientID;
bool OtherTeam = m_pClient->IsOtherTeam(ClientID);
float Alpha = (OtherTeam || ClientID < 0) ? g_Config.m_ClShowOthersAlpha / 100.0f : 1.0f;
if((PlayerClass == PLAYERCLASS_GHOST) && (Player.m_Emote == EMOTE_BLINK))
Alpha = 0.6;

if(pClientData)
{
bool Invisible = false;
if(m_pClient->m_InfclassDataVersion >= 2)
{
if(pClientData->m_InfClassClassFlags & INFCLASS_CLASSINFO_FLAG_IS_INVISIBLE)
{
Invisible = true;
}
}
else
{
if((PlayerClass == PLAYERCLASS_GHOST) && (Player.m_Emote == EMOTE_BLINK))
{
Invisible = true;
}
}

if(Invisible)
{
Alpha = 0.625f;
}
}

// set size
RenderInfo.m_Size = 64.0f;
Expand Down
2 changes: 2 additions & 0 deletions src/game/client/gameclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2095,6 +2095,7 @@ void CGameClient::CClientData::Reset()
m_InfClassPlayerClass = -1;
m_InfClassCustomSkin = false;

m_InfClassClassFlags = 0;
m_InfClassClassData1 = 0;

m_Solo = false;
Expand Down Expand Up @@ -2747,6 +2748,7 @@ void CGameClient::ProcessInfClassPlayerInfo(int ClientID, const CNetObj_InfClass
void CGameClient::ProcessInfClassClassInfo(int ClientID, const CNetObj_InfClassClassInfo *pClassInfo)
{
CClientData *pClient = &m_aClients[ClientID];
pClient->m_InfClassClassFlags = pClassInfo->m_Flags;
pClient->m_InfClassClassData1 = pClassInfo->m_Data1;
}

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 @@ -349,6 +349,7 @@ class CGameClient : public IGameClient
int m_InfClassPlayerClass;
bool m_InfClassCustomSkin;

int m_InfClassClassFlags;
int m_InfClassClassData1;

char m_aName[MAX_NAME_LENGTH];
Expand Down

0 comments on commit 6c1f27f

Please sign in to comment.