mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
fixed #633 Correct sound effects in following spectactor mode
This commit is contained in:
parent
eae1a97297
commit
558b110504
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue