You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 5, 2024. It is now read-only.
Made NetworkClient m_Sounds and unordered map for quicker insertion and deletion (which is most of what's being done) and renamed it to m_ServerSounds to make it clearer.
Rewrote the ReceiveSoundEvents method to accomodate changes and be cleaner and, hopefully still efficient despite SoundContainers being able to have multiple channels
for (std::unordered_set<shortint>::iterator channelIterator = sndDataPtr->Channels.begin(); channelIterator != sndDataPtr->Channels.end(); ++channelIterator) {
690
-
if (m_Sounds.count(*channelIterator) > 0) {
691
-
m_Sounds[(*channelIterator)]->Stop();
692
-
delete m_Sounds[(*channelIterator)];
693
-
}
694
-
695
-
m_Sounds[(*channelIterator)] = pSound;
674
+
for (int msgIndex = 0; msgIndex < msg->SoundEventsCount; msgIndex++) {
675
+
if (sndDataPtr->State == AudioMan::SOUND_SET_GLOBAL_PITCH) {
676
+
g_AudioMan.SetGlobalPitch(sndDataPtr->Pitch, sndDataPtr->AffectedByGlobalPitch); //Note AffectedByGlobalPitch is hackily used to determine whether this affects music
//sprintf_s(buf, sizeof(buf), "Not found %d", sndDataPtr->Channel);
730
-
//g_ConsoleMan.PrintString(buf);
687
+
688
+
// The set of channels that have already been handled for this event, used to potentially avoid repeating actions while still keeping being sure to potentially iterate over every provided channel index
// We always have to add the newly made sound container to the map of server sounds, regardless of whether we were able to delete existing sounds above
719
+
if (sndDataPtr->State == AudioMan::SOUND_PLAY) { m_ServerSounds[serverSoundChannelIndex] = newlyMadeSoundContainer; }
0 commit comments