mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
make spectators team independent
This commit is contained in:
parent
76cb097997
commit
4619e825f3
|
@ -117,6 +117,7 @@ enum
|
|||
VERSION_DDNET_GAMETICK = 10042,
|
||||
VERSION_DDNET_MSG_LEGACY = 15040,
|
||||
VERSION_DDNET_SWITCH = 15060,
|
||||
VERSION_DDNET_INDEPENDENT_SPECTATORS_TEAM = 16000,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -170,10 +170,7 @@ void CMenus::RenderGame(CUIRect MainView)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_Snap.m_pGameInfoObj)
|
||||
{
|
||||
if(m_pClient->m_Snap.m_pLocalInfo->m_Team != TEAM_SPECTATORS)
|
||||
{
|
||||
ButtonBar.VSplitLeft(5.0f, 0, &ButtonBar);
|
||||
|
|
|
@ -241,7 +241,7 @@ void CNamePlates::RenderNameplatePos(vec2 Position, const CNetObj_PlayerInfo *pP
|
|||
|
||||
if((g_Config.m_Debug || g_Config.m_ClNameplatesStrong) && g_Config.m_ClNameplates)
|
||||
{
|
||||
if(m_pClient->m_Snap.m_aCharacters[pPlayerInfo->m_ClientID].m_HasExtendedData && m_pClient->m_Snap.m_aCharacters[m_pClient->m_Snap.m_LocalClientID].m_HasExtendedData)
|
||||
if(m_pClient->m_Snap.m_LocalClientID != -1 && m_pClient->m_Snap.m_aCharacters[pPlayerInfo->m_ClientID].m_HasExtendedData && m_pClient->m_Snap.m_aCharacters[m_pClient->m_Snap.m_LocalClientID].m_HasExtendedData)
|
||||
{
|
||||
CCharacter *pLocalChar = m_pClient->m_GameWorld.GetCharacterByID(m_pClient->m_Snap.m_LocalClientID);
|
||||
CCharacter *pCharacter = m_pClient->m_GameWorld.GetCharacterByID(pPlayerInfo->m_ClientID);
|
||||
|
|
|
@ -413,7 +413,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
|||
OldDDTeam = DDTeam;
|
||||
|
||||
// background so it's easy to find the local player or the followed one in spectator mode
|
||||
if(pInfo->m_Local || (m_pClient->m_Snap.m_SpecInfo.m_Active && pInfo->m_ClientID == m_pClient->m_Snap.m_SpecInfo.m_SpectatorID))
|
||||
if((!m_pClient->m_Snap.m_SpecInfo.m_Active && pInfo->m_Local) || (m_pClient->m_Snap.m_SpecInfo.m_SpectatorID == SPEC_FREEVIEW && pInfo->m_Local) || (m_pClient->m_Snap.m_SpecInfo.m_Active && pInfo->m_ClientID == m_pClient->m_Snap.m_SpecInfo.m_SpectatorID))
|
||||
{
|
||||
Graphics()->TextureClear();
|
||||
Graphics()->QuadsBegin();
|
||||
|
@ -701,7 +701,7 @@ bool CScoreboard::Active()
|
|||
if(m_Active)
|
||||
return true;
|
||||
|
||||
if(m_pClient->m_Snap.m_pLocalInfo && m_pClient->m_Snap.m_pLocalInfo->m_Team != TEAM_SPECTATORS)
|
||||
if(m_pClient->m_Snap.m_pLocalInfo && !m_pClient->m_Snap.m_SpecInfo.m_Active)
|
||||
{
|
||||
// we are not a spectator, check if we are dead
|
||||
if(!m_pClient->m_Snap.m_pLocalCharacter && g_Config.m_ClScoreboardOnDeath)
|
||||
|
|
|
@ -136,7 +136,7 @@ void CSpectator::ConSpectateClosest(IConsole::IResult *pResult, void *pUserData)
|
|||
int ClosestDistance = INT_MAX;
|
||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
{
|
||||
if(i == SpectatorID || !Snap.m_paPlayerInfos[i] || Snap.m_paPlayerInfos[i]->m_Team == TEAM_SPECTATORS)
|
||||
if(i == SpectatorID || !Snap.m_paPlayerInfos[i] || Snap.m_paPlayerInfos[i]->m_Team == TEAM_SPECTATORS || (SpectatorID == SPEC_FREEVIEW && i == Snap.m_LocalClientID))
|
||||
continue;
|
||||
const CNetObj_Character &MaybeClosestCharacter = Snap.m_aCharacters[i].m_Cur;
|
||||
int Distance = distance(CurPosition, vec2(MaybeClosestCharacter.m_X, MaybeClosestCharacter.m_Y));
|
||||
|
|
|
@ -1245,6 +1245,12 @@ void CGameClient::OnNewSnapshot()
|
|||
m_aClients[Item.m_ID].m_Afk = pInfo->m_Flags & EXPLAYERFLAG_AFK;
|
||||
m_aClients[Item.m_ID].m_Paused = pInfo->m_Flags & EXPLAYERFLAG_PAUSED;
|
||||
m_aClients[Item.m_ID].m_Spec = pInfo->m_Flags & EXPLAYERFLAG_SPEC;
|
||||
|
||||
if(Item.m_ID == m_Snap.m_LocalClientID && (m_aClients[Item.m_ID].m_Paused || m_aClients[Item.m_ID].m_Spec))
|
||||
{
|
||||
m_Snap.m_SpecInfo.m_Active = true;
|
||||
m_Snap.m_SpecInfo.m_SpectatorID = SPEC_FREEVIEW;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(Item.m_Type == NETOBJTYPE_CHARACTER)
|
||||
|
@ -2591,7 +2597,7 @@ bool CGameClient::IsOtherTeam(int ClientID)
|
|||
|
||||
if(m_Snap.m_LocalClientID < 0)
|
||||
return false;
|
||||
else if((m_aClients[m_Snap.m_LocalClientID].m_Team == TEAM_SPECTATORS && m_Snap.m_SpecInfo.m_SpectatorID == SPEC_FREEVIEW) || ClientID < 0)
|
||||
else if((m_Snap.m_SpecInfo.m_Active && m_Snap.m_SpecInfo.m_SpectatorID == SPEC_FREEVIEW) || ClientID < 0)
|
||||
return false;
|
||||
else if(m_Snap.m_SpecInfo.m_Active && m_Snap.m_SpecInfo.m_SpectatorID != SPEC_FREEVIEW)
|
||||
{
|
||||
|
|
|
@ -359,10 +359,12 @@ void CPlayer::Snap(int SnappingClient)
|
|||
pPlayerInfo->m_Score = Score;
|
||||
pPlayerInfo->m_Local = (int)(m_ClientID == SnappingClient && (m_Paused != PAUSE_PAUSED || SnappingClientVersion >= VERSION_DDNET_OLD));
|
||||
pPlayerInfo->m_ClientID = id;
|
||||
pPlayerInfo->m_Team = (SnappingClientVersion < VERSION_DDNET_OLD || m_Paused != PAUSE_PAUSED || m_ClientID != SnappingClient) && m_Paused < PAUSE_SPEC ? m_Team : TEAM_SPECTATORS;
|
||||
|
||||
if(m_ClientID == SnappingClient && m_Paused == PAUSE_PAUSED && SnappingClientVersion < VERSION_DDNET_OLD)
|
||||
pPlayerInfo->m_Team = TEAM_SPECTATORS;
|
||||
pPlayerInfo->m_Team = m_Team;
|
||||
if(SnappingClientVersion < VERSION_DDNET_INDEPENDENT_SPECTATORS_TEAM)
|
||||
{
|
||||
// In older versions the SPECTATORS TEAM was also used if the own player is in PAUSE_PAUSED or if any player is in PAUSE_SPEC.
|
||||
pPlayerInfo->m_Team = (m_Paused != PAUSE_PAUSED || m_ClientID != SnappingClient) && m_Paused < PAUSE_SPEC ? m_Team : TEAM_SPECTATORS;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue