Make spectators see the same thing as the player they spectate

This commit is contained in:
Ravomavain 2011-12-31 13:54:29 +01:00 committed by GreYFoX
parent 02372ac0b0
commit ebf64758b1
2 changed files with 20 additions and 13 deletions

View file

@ -890,15 +890,14 @@ void CCharacter::Snap(int SnappingClient)
return;
CCharacter* SnapChar = GameServer()->GetPlayerChar(SnappingClient);
if(SnapChar && !SnapChar->m_Super && !SnapChar->IsPaused() &&
GameServer()->m_apPlayers[SnappingClient]->GetTeam() != -1 &&
!CanCollide(SnappingClient) &&
(!GameServer()->m_apPlayers[SnappingClient]->m_IsUsingDDRaceClient ||
(GameServer()->m_apPlayers[SnappingClient]->m_IsUsingDDRaceClient &&
!GameServer()->m_apPlayers[SnappingClient]->m_ShowOthers
)
)
)
CPlayer* SnapPlayer = GameServer()->m_apPlayers[SnappingClient];
if((SnapPlayer->GetTeam() == TEAM_SPECTATORS || SnapPlayer->m_Paused) && SnapPlayer->m_SpectatorID != -1
&& !CanCollide(SnapPlayer->m_SpectatorID) && !SnapPlayer->m_ShowOthers)
return;
if( SnapPlayer->GetTeam() != TEAM_SPECTATORS && !SnapPlayer->m_Paused && SnapChar && !SnapChar->m_Super
&& !CanCollide(SnappingClient) && !SnapPlayer->m_ShowOthers)
return;
if (m_Paused)

View file

@ -87,6 +87,7 @@ void CPlasma::Snap(int SnappingClient)
if (NetworkClipped(SnappingClient))
return;
CCharacter* SnapChar = GameServer()->GetPlayerChar(SnappingClient);
CPlayer* SnapPlayer = GameServer()->m_apPlayers[SnappingClient];
int Tick = (Server()->Tick() % Server()->TickSpeed()) % 11;
if (SnapChar && SnapChar->IsAlive()
@ -94,11 +95,18 @@ void CPlasma::Snap(int SnappingClient)
&& !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[SnapChar->Team()])
&& (!Tick))
return;
if (SnapChar && (SnapChar->Team() != m_ResponsibleTeam)
&& (!SnapChar->GetPlayer()->m_IsUsingDDRaceClient
|| (GameServer()->m_apPlayers[SnappingClient]->m_IsUsingDDRaceClient
&& !GameServer()->m_apPlayers[SnappingClient]->m_ShowOthers)))
if((SnapPlayer->GetTeam() == TEAM_SPECTATORS || SnapPlayer->m_Paused) && SnapPlayer->m_SpectatorID != -1
&& GameServer()->GetPlayerChar(SnapPlayer->m_SpectatorID)
&& GameServer()->GetPlayerChar(SnapPlayer->m_SpectatorID)->Team() != m_ResponsibleTeam
&& !SnapPlayer->m_ShowOthers)
return;
if( SnapPlayer->GetTeam() != TEAM_SPECTATORS && !SnapPlayer->m_Paused && SnapChar
&& SnapChar && SnapChar->Team() != m_ResponsibleTeam
&& !SnapPlayer->m_ShowOthers)
return;
CNetObj_Laser *pObj = static_cast<CNetObj_Laser *>(Server()->SnapNewItem(
NETOBJTYPE_LASER, m_ID, sizeof(CNetObj_Laser)));
pObj->m_X = (int) m_Pos.x;