mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 05:58:19 +00:00
Never send sounds to sixup that are played on the client side
Closed #2523
This commit is contained in:
parent
00b9eab2ce
commit
dcd1fefa7e
|
@ -851,24 +851,23 @@ void CCharacter::TickDeferred()
|
|||
int Events = m_Core.m_TriggeredEvents;
|
||||
int CID = m_pPlayer->GetCid();
|
||||
|
||||
CClientMask TeamMask = Teams()->TeamMask(Team(), -1, CID);
|
||||
// Some sounds are triggered client-side for the acting player
|
||||
// Some sounds are triggered client-side for the acting player (or for all players on Sixup)
|
||||
// so we need to avoid duplicating them
|
||||
CClientMask TeamMaskExceptSelf = Teams()->TeamMask(Team(), CID, CID);
|
||||
CClientMask TeamMaskExceptSelfAndSixup = Teams()->TeamMask(Team(), -1, CID, CGameContext::FLAG_SIX);
|
||||
// Some are triggered client-side but only on Sixup
|
||||
CClientMask TeamMaskExceptSelfIfSixup = Server()->IsSixup(CID) ? TeamMaskExceptSelf : TeamMask;
|
||||
CClientMask TeamMaskExceptSixup = Teams()->TeamMask(Team(), -1, CID, CGameContext::FLAG_SIX);
|
||||
|
||||
if(Events & COREEVENT_GROUND_JUMP)
|
||||
GameServer()->CreateSound(m_Pos, SOUND_PLAYER_JUMP, TeamMaskExceptSelf);
|
||||
GameServer()->CreateSound(m_Pos, SOUND_PLAYER_JUMP, TeamMaskExceptSelfAndSixup);
|
||||
|
||||
if(Events & COREEVENT_HOOK_ATTACH_PLAYER)
|
||||
GameServer()->CreateSound(m_Pos, SOUND_HOOK_ATTACH_PLAYER, TeamMaskExceptSelfIfSixup);
|
||||
GameServer()->CreateSound(m_Pos, SOUND_HOOK_ATTACH_PLAYER, TeamMaskExceptSixup);
|
||||
|
||||
if(Events & COREEVENT_HOOK_ATTACH_GROUND)
|
||||
GameServer()->CreateSound(m_Pos, SOUND_HOOK_ATTACH_GROUND, TeamMaskExceptSelf);
|
||||
GameServer()->CreateSound(m_Pos, SOUND_HOOK_ATTACH_GROUND, TeamMaskExceptSelfAndSixup);
|
||||
|
||||
if(Events & COREEVENT_HOOK_HIT_NOHOOK)
|
||||
GameServer()->CreateSound(m_Pos, SOUND_HOOK_NOATTACH, TeamMaskExceptSelf);
|
||||
GameServer()->CreateSound(m_Pos, SOUND_HOOK_NOATTACH, TeamMaskExceptSelfAndSixup);
|
||||
|
||||
if(Events & COREEVENT_GROUND_JUMP)
|
||||
m_TriggeredEvents7 |= protocol7::COREEVENTFLAG_GROUND_JUMP;
|
||||
|
|
|
@ -507,7 +507,7 @@ bool CGameTeams::TeamFinished(int Team)
|
|||
return true;
|
||||
}
|
||||
|
||||
CClientMask CGameTeams::TeamMask(int Team, int ExceptId, int Asker)
|
||||
CClientMask CGameTeams::TeamMask(int Team, int ExceptId, int Asker, int VersionFlags)
|
||||
{
|
||||
if(Team == TEAM_SUPER)
|
||||
{
|
||||
|
@ -523,6 +523,9 @@ CClientMask CGameTeams::TeamMask(int Team, int ExceptId, int Asker)
|
|||
continue; // Explicitly excluded
|
||||
if(!GetPlayer(i))
|
||||
continue; // Player doesn't exist
|
||||
if(!((Server()->IsSixup(i) && (VersionFlags & CGameContext::FLAG_SIXUP)) ||
|
||||
(!Server()->IsSixup(i) && (VersionFlags & CGameContext::FLAG_SIX))))
|
||||
continue;
|
||||
|
||||
if(!(GetPlayer(i)->GetTeam() == TEAM_SPECTATORS || GetPlayer(i)->IsPaused()))
|
||||
{ // Not spectator
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
|
||||
void ChangeTeamState(int Team, int State);
|
||||
|
||||
CClientMask TeamMask(int Team, int ExceptId = -1, int Asker = -1);
|
||||
CClientMask TeamMask(int Team, int ExceptId = -1, int Asker = -1, int VersionFlags = CGameContext::FLAG_SIX | CGameContext::FLAG_SIXUP);
|
||||
|
||||
int Count(int Team) const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue