diff --git a/datasrc/network.py b/datasrc/network.py index d03edce9795..f021a24c116 100644 --- a/datasrc/network.py +++ b/datasrc/network.py @@ -4,7 +4,7 @@ from datatypes import Enum, Flags, NetArray, NetBool, NetEvent, NetEventEx, NetIntAny, NetIntRange, NetMessage, NetMessageEx, NetObject, NetObjectEx, NetString, NetStringHalfStrict, NetStringStrict, NetTick Emotes = ["NORMAL", "PAIN", "HAPPY", "SURPRISE", "ANGRY", "BLINK"] -PlayerFlags = ["PLAYING", "IN_MENU", "CHATTING", "SCOREBOARD", "AIM", "SPEC_CAM"] +PlayerFlags = ["PLAYING", "IN_MENU", "CHATTING", "SCOREBOARD", "AIM"] GameFlags = ["TEAMS", "FLAGS"] GameStateFlags = ["GAMEOVER", "SUDDENDEATH", "PAUSED", "RACETIME"] CharacterFlags = ["SOLO", "JETPACK", "COLLISION_DISABLED", "ENDLESS_HOOK", "ENDLESS_JUMP", "SUPER", diff --git a/src/engine/shared/protocol.h b/src/engine/shared/protocol.h index 2608a9297ee..7655765c5f7 100644 --- a/src/engine/shared/protocol.h +++ b/src/engine/shared/protocol.h @@ -127,7 +127,7 @@ enum VERSION_DDNET_MULTI_LASER = 16040, VERSION_DDNET_ENTITY_NETOBJS = 16200, VERSION_DDNET_REDIRECT = 17020, - VERSION_DDNET_PLAYERFLAG_SPEC_CAM = 18090, + VERSION_DDNET_PLAYERFLAG_PLAYING = 18090, }; typedef std::bitset CClientMask; diff --git a/src/game/client/components/controls.cpp b/src/game/client/components/controls.cpp index a2a1fc0712c..c0c2ee8a629 100644 --- a/src/game/client/components/controls.cpp +++ b/src/game/client/components/controls.cpp @@ -181,12 +181,13 @@ void CControls::OnMessage(int Msg, void *pRawMsg) int CControls::SnapInput(int *pData) { // update player state + bool IsPlaying = false; if(m_pClient->m_Chat.IsActive()) m_aInputData[g_Config.m_ClDummy].m_PlayerFlags = PLAYERFLAG_CHATTING; else if(m_pClient->m_Menus.IsActive()) m_aInputData[g_Config.m_ClDummy].m_PlayerFlags = PLAYERFLAG_IN_MENU; else - m_aInputData[g_Config.m_ClDummy].m_PlayerFlags = PLAYERFLAG_PLAYING; + IsPlaying = true; if(m_pClient->m_Scoreboard.Active()) m_aInputData[g_Config.m_ClDummy].m_PlayerFlags |= PLAYERFLAG_SCOREBOARD; @@ -194,15 +195,16 @@ int CControls::SnapInput(int *pData) if(Client()->ServerCapAnyPlayerFlag() && m_pClient->m_Controls.m_aShowHookColl[g_Config.m_ClDummy]) m_aInputData[g_Config.m_ClDummy].m_PlayerFlags |= PLAYERFLAG_AIM; - if(Client()->ServerCapAnyPlayerFlag() && m_pClient->m_Camera.CamType() == CCamera::CAMTYPE_SPEC) - m_aInputData[g_Config.m_ClDummy].m_PlayerFlags |= PLAYERFLAG_SPEC_CAM; + // set PLAYING flag if the server should use out inputs + if(IsPlaying && m_pClient->m_Camera.CamType() != CCamera::CAMTYPE_SPEC) + m_aInputData[g_Config.m_ClDummy].m_PlayerFlags = PLAYERFLAG_PLAYING; bool Send = m_aLastData[g_Config.m_ClDummy].m_PlayerFlags != m_aInputData[g_Config.m_ClDummy].m_PlayerFlags; m_aLastData[g_Config.m_ClDummy].m_PlayerFlags = m_aInputData[g_Config.m_ClDummy].m_PlayerFlags; // we freeze the input if chat or menu is activated - if(!(m_aInputData[g_Config.m_ClDummy].m_PlayerFlags & PLAYERFLAG_PLAYING)) + if(!IsPlaying) { if(!GameClient()->m_GameInfo.m_BugDDRaceInput) ResetInput(g_Config.m_ClDummy); diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index 9f280760796..f7dbf30d3cf 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -513,7 +513,7 @@ void CPlayer::OnPredictedInput(CNetObj_PlayerInput *pNewInput) m_NumInputs++; - if(m_pCharacter && !m_Paused && !(pNewInput->m_PlayerFlags & PLAYERFLAG_SPEC_CAM)) + if(m_pCharacter && !m_Paused && pNewInput->m_PlayerFlags & PLAYERFLAG_PLAYING) m_pCharacter->OnPredictedInput(pNewInput); // Magic number when we can hope that client has successfully identified itself @@ -529,7 +529,8 @@ void CPlayer::OnDirectInput(CNetObj_PlayerInput *pNewInput) AfkTimer(); - if(((pNewInput->m_PlayerFlags & PLAYERFLAG_SPEC_CAM) || GetClientVersion() < VERSION_DDNET_PLAYERFLAG_SPEC_CAM) && ((!m_pCharacter && m_Team == TEAM_SPECTATORS) || m_Paused) && m_SpectatorId == SPEC_FREEVIEW) + if((!(pNewInput->m_PlayerFlags & PLAYERFLAG_PLAYING) || GetClientVersion() < VERSION_DDNET_PLAYERFLAG_PLAYING) + && ((!m_pCharacter && m_Team == TEAM_SPECTATORS) || m_Paused) && m_SpectatorId == SPEC_FREEVIEW) m_ViewPos = vec2(pNewInput->m_TargetX, pNewInput->m_TargetY); // check for activity @@ -555,7 +556,7 @@ void CPlayer::OnPredictedEarlyInput(CNetObj_PlayerInput *pNewInput) if(m_PlayerFlags & PLAYERFLAG_CHATTING) return; - if(m_pCharacter && !m_Paused && !(m_PlayerFlags & PLAYERFLAG_SPEC_CAM)) + if(m_pCharacter && !m_Paused && m_PlayerFlags & PLAYERFLAG_PLAYING) m_pCharacter->OnDirectInput(pNewInput); }