Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 39ff5cd

Browse files
committed
Updated LuaMan, NetworkClient and NetworkServer to support new/changed properties
1 parent 2f0b812 commit 39ff5cd

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

Managers/LuaMan.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -554,12 +554,12 @@ int LuaMan::Create()
554554
.def("HasAnySounds", &SoundContainer::HasAnySounds)
555555
.def("IsBeingPlayed", &SoundContainer::IsBeingPlayed)
556556
.def("Play", (bool (SoundContainer:: *)()) &SoundContainer::Play)
557-
.def("Play", (bool (SoundContainer:: *)(float attenuation)) &SoundContainer::Play)
558-
.def("Play", (bool (SoundContainer:: *)(float attenuation, int player)) &SoundContainer::Play)
557+
.def("Play", (bool (SoundContainer:: *)(const Vector &position)) &SoundContainer::Play)
558+
.def("Play", (bool (SoundContainer:: *)(const Vector &position, int player)) &SoundContainer::Play)
559559
.def("Stop", (bool (SoundContainer:: *)()) &SoundContainer::Stop)
560560
.def("Stop", (bool (SoundContainer:: *)(int player)) &SoundContainer::Stop)
561561
.def("AddSound", &SoundContainer::AddSound)
562-
.def("UpdateAttenuation", &SoundContainer::UpdateAttenuation)
562+
.def("SetPosition", &SoundContainer::SetPosition)
563563
.property("Loops", &SoundContainer::GetLoopSetting, &SoundContainer::SetLoopSetting)
564564
.property("Priority", &SoundContainer::GetPriority, &SoundContainer::SetPriority)
565565
.property("AffectedByGlobalPitch", &SoundContainer::IsAffectedByGlobalPitch, &SoundContainer::SetAffectedByGlobalPitch),
@@ -1487,7 +1487,7 @@ int LuaMan::Create()
14871487
.def("SetMusicPosition", &AudioMan::SetMusicPosition)
14881488
.def("SetMusicPitch", &AudioMan::SetMusicPitch)
14891489
.property("SoundsVolume", &AudioMan::GetSoundsVolume, &AudioMan::SetSoundsVolume)
1490-
.def("SetSoundAttenuation", &AudioMan::SetSoundAttenuation)
1490+
.def("SetSoundPosition", &AudioMan::SetSoundPosition)
14911491
.def("SetSoundPitch", &AudioMan::SetSoundPitch)
14921492
.def("StopAll", &AudioMan::StopMusic)
14931493
.def("PlayMusic", &AudioMan::PlayMusic)
@@ -1497,8 +1497,8 @@ int LuaMan::Create()
14971497
.def("QueueSilence", &AudioMan::QueueSilence)
14981498
.def("ClearMusicQueue", &AudioMan::ClearMusicQueue)
14991499
.def("PlaySound", (SoundContainer *(AudioMan:: *)(const char *filePath)) &AudioMan::PlaySound)
1500-
.def("PlaySound", (SoundContainer *(AudioMan:: *)(const char *filePath, float attenuation, int player)) &AudioMan::PlaySound)
1501-
.def("PlaySound", (SoundContainer * (AudioMan:: *)(const char *filePath, float attenuation, int player, int loops, int priority, double pitchOrAffectedByGlobalPitch)) &AudioMan::PlaySound)
1500+
.def("PlaySound", (SoundContainer *(AudioMan:: *)(const char *filePath, const Vector &position, int player)) &AudioMan::PlaySound)
1501+
.def("PlaySound", (SoundContainer *(AudioMan:: *)(const char *filePath, const Vector &position, int player, int loops, int priority, double pitchOrAffectedByGlobalPitch, float attenuationStartDistance, bool immobile)) &AudioMan::PlaySound)
15021502
.def("StopSound", (bool (AudioMan:: *)(SoundContainer *soundContainer)) &AudioMan::StopSound)
15031503
.def("StopSound", (bool (AudioMan:: *)(SoundContainer *soundContainer, int player)) &AudioMan::StopSound)
15041504
.def("FadeOutSound", &AudioMan::FadeOutSound),

Managers/NetworkClient.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -690,17 +690,17 @@ namespace RTE
690690
soundContainerToHandle->Stop();
691691
soundContainerToHandle->Reset();
692692
}
693-
soundContainerToHandle->Create(sndDataPtr->Loops, sndDataPtr->AffectedByGlobalPitch);
693+
soundContainerToHandle->Create(sndDataPtr->Loops, sndDataPtr->AffectedByGlobalPitch, sndDataPtr->AttenuationStartDistance, sndDataPtr->Immobile);
694694
for (size_t soundFileHash : sndDataPtr->SoundFileHashes) {
695695
if (soundFileHash != 0) { soundContainerToHandle->AddSound(ContentFile::GetPathFromHash(soundFileHash)); }
696696
}
697-
g_AudioMan.PlaySound(soundContainerToHandle, sndDataPtr->Distance, -1, -1, sndDataPtr->Pitch);
697+
g_AudioMan.PlaySound(soundContainerToHandle, Vector(sndDataPtr->Position[0], sndDataPtr->Position[1]), -1, -1, sndDataPtr->Pitch);
698698
break;
699699
case AudioMan::SOUND_STOP:
700700
soundContainerToHandle->Stop();
701701
break;
702-
case AudioMan::SOUND_SET_ATTENUATION:
703-
soundContainerToHandle->UpdateAttenuation(sndDataPtr->Distance);
702+
case AudioMan::SOUND_SET_POSITION:
703+
soundContainerToHandle->SetPosition(Vector(sndDataPtr->Position[0], sndDataPtr->Position[1]));
704704
break;
705705
case AudioMan::SOUND_SET_PITCH:
706706
g_AudioMan.SetSoundPitch(soundContainerToHandle, sndDataPtr->Pitch);

Managers/NetworkServer.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1228,10 +1228,13 @@ namespace RTE
12281228
sndDataPtr->State = (*eItr).State;
12291229
std::copy(std::begin(eItr->Channels), std::end(eItr->Channels), sndDataPtr->Channels);
12301230
std::copy(std::begin(eItr->SoundFileHashes), std::end(eItr->SoundFileHashes), sndDataPtr->SoundFileHashes);
1231-
sndDataPtr->Distance = (*eItr).Distance;
1231+
sndDataPtr->Position[0] = (*eItr).Position[0];
1232+
sndDataPtr->Position[1] = (*eItr).Position[1];
12321233
sndDataPtr->Loops = (*eItr).Loops;
12331234
sndDataPtr->Pitch = (*eItr).Pitch;
12341235
sndDataPtr->AffectedByGlobalPitch = (*eItr).AffectedByGlobalPitch;
1236+
sndDataPtr->AttenuationStartDistance = (*eItr).AttenuationStartDistance;
1237+
sndDataPtr->Immobile = (*eItr).Immobile;
12351238
sndDataPtr->FadeOutTime = (*eItr).FadeOutTime;
12361239

12371240
msg->SoundEventsCount++;

0 commit comments

Comments
 (0)