mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 09:38: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 Events = m_Core.m_TriggeredEvents;
|
||||||
int CID = m_pPlayer->GetCid();
|
int CID = m_pPlayer->GetCid();
|
||||||
|
|
||||||
CClientMask TeamMask = Teams()->TeamMask(Team(), -1, CID);
|
// Some sounds are triggered client-side for the acting player (or for all players on Sixup)
|
||||||
// Some sounds are triggered client-side for the acting player
|
|
||||||
// so we need to avoid duplicating them
|
// 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
|
// 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)
|
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)
|
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)
|
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)
|
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)
|
if(Events & COREEVENT_GROUND_JUMP)
|
||||||
m_TriggeredEvents7 |= protocol7::COREEVENTFLAG_GROUND_JUMP;
|
m_TriggeredEvents7 |= protocol7::COREEVENTFLAG_GROUND_JUMP;
|
||||||
|
|
|
@ -507,7 +507,7 @@ bool CGameTeams::TeamFinished(int Team)
|
||||||
return true;
|
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)
|
if(Team == TEAM_SUPER)
|
||||||
{
|
{
|
||||||
|
@ -523,6 +523,9 @@ CClientMask CGameTeams::TeamMask(int Team, int ExceptId, int Asker)
|
||||||
continue; // Explicitly excluded
|
continue; // Explicitly excluded
|
||||||
if(!GetPlayer(i))
|
if(!GetPlayer(i))
|
||||||
continue; // Player doesn't exist
|
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()))
|
if(!(GetPlayer(i)->GetTeam() == TEAM_SPECTATORS || GetPlayer(i)->IsPaused()))
|
||||||
{ // Not spectator
|
{ // Not spectator
|
||||||
|
|
|
@ -97,7 +97,7 @@ public:
|
||||||
|
|
||||||
void ChangeTeamState(int Team, int State);
|
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;
|
int Count(int Team) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue