Skip to content

Commit

Permalink
Prototype 'forced-to-spectate' player flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaffeine committed Jan 5, 2022
1 parent 85266b8 commit 1793597
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion datasrc/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

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

InfClassPlayerFlags = ["INFECTED", "HOOK_PROTECTION_OFF"]
InfClassPlayerFlags = ["INFECTED", "HOOK_PROTECTION_OFF", "FORCED_TO_SPECTATE"]

InfClassObjectFlags = ["HAS_SECOND_POSITION"]

Expand Down
3 changes: 2 additions & 1 deletion src/game/client/components/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ void CCamera::OnRender()
else
s_CurrentCameraOffset[g_Config.m_ClDummy] = TargetCameraOffset;

if(m_pClient->m_Snap.m_SpecInfo.m_Active)
bool InfSpecTarget = m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_aClients[m_pClient->m_Snap.m_pLocalInfo->m_ClientID].m_InfClassPlayerFlags & INFCLASS_PLAYER_FLAG_FORCED_TO_SPECTATE;
if(m_pClient->m_Snap.m_SpecInfo.m_Active || InfSpecTarget)
m_Center = m_pClient->m_Snap.m_SpecInfo.m_Position + s_CurrentCameraOffset[g_Config.m_ClDummy];
else
m_Center = m_pClient->m_LocalCharacterPos + s_CurrentCameraOffset[g_Config.m_ClDummy];
Expand Down
3 changes: 2 additions & 1 deletion src/game/client/gameclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,8 @@ void CGameClient::UpdatePositions()
}

// spectator position
if(m_Snap.m_SpecInfo.m_Active)
bool InfForcedToSpectate = m_Snap.m_pLocalInfo && m_aClients[m_Snap.m_pLocalInfo->m_ClientID].m_InfClassPlayerFlags & INFCLASS_PLAYER_FLAG_FORCED_TO_SPECTATE;
if(m_Snap.m_SpecInfo.m_Active || InfForcedToSpectate)
{
if(Client()->State() == IClient::STATE_DEMOPLAYBACK && m_DemoSpecID != SPEC_FOLLOW && m_Snap.m_SpecInfo.m_SpectatorID != SPEC_FREEVIEW)
{
Expand Down

0 comments on commit 1793597

Please sign in to comment.