mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 05:58:19 +00:00
Merge pull request #9099 from infclass/ddnet-sound-channels
Use CHN_WORLD for MAPSOUNDWORLD and CHN_GLOBAL for MAPSOUNDGLOBAL
This commit is contained in:
commit
154b6d79f7
|
@ -17,20 +17,20 @@ CMapSounds::CMapSounds()
|
|||
m_Count = 0;
|
||||
}
|
||||
|
||||
void CMapSounds::Play(int SoundId)
|
||||
void CMapSounds::Play(int Channel, int SoundId)
|
||||
{
|
||||
if(SoundId < 0 || SoundId >= m_Count)
|
||||
return;
|
||||
|
||||
m_pClient->m_Sounds.PlaySample(CSounds::CHN_MAPSOUND, m_aSounds[SoundId], 0, 1.0f);
|
||||
m_pClient->m_Sounds.PlaySample(Channel, m_aSounds[SoundId], 0, 1.0f);
|
||||
}
|
||||
|
||||
void CMapSounds::PlayAt(int SoundId, vec2 Position)
|
||||
void CMapSounds::PlayAt(int Channel, int SoundId, vec2 Position)
|
||||
{
|
||||
if(SoundId < 0 || SoundId >= m_Count)
|
||||
return;
|
||||
|
||||
m_pClient->m_Sounds.PlaySampleAt(CSounds::CHN_MAPSOUND, m_aSounds[SoundId], 0, 1.0f, Position);
|
||||
m_pClient->m_Sounds.PlaySampleAt(Channel, m_aSounds[SoundId], 0, 1.0f, Position);
|
||||
}
|
||||
|
||||
void CMapSounds::OnMapLoad()
|
||||
|
|
|
@ -33,8 +33,8 @@ public:
|
|||
CMapSounds();
|
||||
virtual int Sizeof() const override { return sizeof(*this); }
|
||||
|
||||
void Play(int SoundId);
|
||||
void PlayAt(int SoundId, vec2 Position);
|
||||
void Play(int Channel, int SoundId);
|
||||
void PlayAt(int Channel, int SoundId, vec2 Position);
|
||||
|
||||
virtual void OnMapLoad() override;
|
||||
virtual void OnRender() override;
|
||||
|
|
|
@ -1105,7 +1105,7 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker, int Conn, bool Dumm
|
|||
return;
|
||||
|
||||
CNetMsg_Sv_MapSoundGlobal *pMsg = (CNetMsg_Sv_MapSoundGlobal *)pRawMsg;
|
||||
m_MapSounds.Play(pMsg->m_SoundId);
|
||||
m_MapSounds.Play(CSounds::CHN_GLOBAL, pMsg->m_SoundId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1286,7 +1286,7 @@ void CGameClient::ProcessEvents()
|
|||
if(!Config()->m_SndGame)
|
||||
continue;
|
||||
|
||||
m_MapSounds.PlayAt(pEvent->m_SoundId, vec2(pEvent->m_X, pEvent->m_Y));
|
||||
m_MapSounds.PlayAt(CSounds::CHN_WORLD, pEvent->m_SoundId, vec2(pEvent->m_X, pEvent->m_Y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue