Make spectators hear the same thing as the player they spectate

This commit is contained in:
Ravomavain 2011-12-31 11:06:34 +01:00 committed by GreYFoX
parent af8fac1bac
commit c85d7bcc0f

View file

@ -42,14 +42,14 @@ void CEventHandler::Clear()
void CEventHandler::Snap(int SnappingClient) void CEventHandler::Snap(int SnappingClient)
{ {
bool IsSpectator = false; if (SnappingClient != -1 && GameServer()->m_apPlayers[SnappingClient]->m_Paused)
SnappingClient = GameServer()->m_apPlayers[SnappingClient]->m_SpectatorID;
for(int i = 0; i < m_NumEvents; i++) for(int i = 0; i < m_NumEvents; i++)
{ {
IsSpectator = (SnappingClient == -1 || GameServer()->m_apPlayers[SnappingClient]->m_Paused >= CPlayer::PAUSED_PAUSED); if(SnappingClient == -1 || CmaskIsSet(m_aClientMasks[i], SnappingClient))
if(IsSpectator || CmaskIsSet(m_aClientMasks[i], SnappingClient))
{ {
CNetEvent_Common *ev = (CNetEvent_Common *)&m_aData[m_aOffsets[i]]; CNetEvent_Common *ev = (CNetEvent_Common *)&m_aData[m_aOffsets[i]];
if(IsSpectator || distance(GameServer()->m_apPlayers[SnappingClient]->m_ViewPos, vec2(ev->m_X, ev->m_Y)) < 1500.0f) if(SnappingClient == -1 || distance(GameServer()->m_apPlayers[SnappingClient]->m_ViewPos, vec2(ev->m_X, ev->m_Y)) < 1500.0f)
{ {
void *d = GameServer()->Server()->SnapNewItem(m_aTypes[i], i, m_aSizes[i]); void *d = GameServer()->Server()->SnapNewItem(m_aTypes[i], i, m_aSizes[i]);
if(d) if(d)