fixed #633 Correct sound effects in following spectactor mode

This commit is contained in:
Choupom 2011-06-02 11:44:35 +02:00 committed by oy
parent eae1a97297
commit 558b110504
2 changed files with 16 additions and 5 deletions

View file

@ -756,7 +756,15 @@ bool CCharacter::TakeDamage(vec2 Force, int Dmg, int From, int Weapon)
// do damage Hit sound
if(From >= 0 && From != m_pPlayer->GetCID() && GameServer()->m_apPlayers[From])
GameServer()->CreateSound(GameServer()->m_apPlayers[From]->m_ViewPos, SOUND_HIT, CmaskOne(From));
{
int Mask = CmaskOne(From);
for(int i = 0; i < MAX_CLIENTS; i++)
{
if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() == TEAM_SPECTATORS && GameServer()->m_apPlayers[i]->m_SpectatorID == From)
Mask |= CmaskOne(i);
}
GameServer()->CreateSound(GameServer()->m_apPlayers[From]->m_ViewPos, SOUND_HIT, Mask);
}
// check for death
if(m_Health <= 0)

View file

@ -220,13 +220,16 @@ void CGameControllerCTF::Tick()
for(int c = 0; c < MAX_CLIENTS; c++)
{
if(!GameServer()->m_apPlayers[c])
CPlayer *pPlayer = GameServer()->m_apPlayers[c];
if(!pPlayer)
continue;
if(GameServer()->m_apPlayers[c]->GetTeam() == fi)
GameServer()->CreateSoundGlobal(SOUND_CTF_GRAB_EN, GameServer()->m_apPlayers[c]->GetCID());
if(pPlayer->GetTeam() == TEAM_SPECTATORS && pPlayer->m_SpectatorID != SPEC_FREEVIEW && GameServer()->m_apPlayers[pPlayer->m_SpectatorID] && GameServer()->m_apPlayers[pPlayer->m_SpectatorID]->GetTeam() == fi)
GameServer()->CreateSoundGlobal(SOUND_CTF_GRAB_EN, c);
else if(pPlayer->GetTeam() == fi)
GameServer()->CreateSoundGlobal(SOUND_CTF_GRAB_EN, c);
else
GameServer()->CreateSoundGlobal(SOUND_CTF_GRAB_PL, GameServer()->m_apPlayers[c]->GetCID());
GameServer()->CreateSoundGlobal(SOUND_CTF_GRAB_PL, c);
}
break;
}