From 51861c767f6a85f58cd6666a291fe61ef2e433bc Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sat, 30 Jul 2022 19:20:13 +0300 Subject: [PATCH] [Client] Send ObjectSound for items dropped locally --- apps/openmw/mwmp/ObjectList.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwmp/ObjectList.cpp b/apps/openmw/mwmp/ObjectList.cpp index f8ec5fddb..bc647659e 100644 --- a/apps/openmw/mwmp/ObjectList.cpp +++ b/apps/openmw/mwmp/ObjectList.cpp @@ -413,6 +413,11 @@ void ObjectList::activateObjects(MWWorld::CellStore* cellStore) void ObjectList::placeObjects(MWWorld::CellStore* cellStore) { MWBase::World *world = MWBase::Environment::get().getWorld(); + + static mwmp::ObjectList soundObjectList; + soundObjectList.reset(); + soundObjectList.packetOrigin = mwmp::CLIENT_GAMEPLAY; + soundObjectList.cell = cell; for (const auto &baseObject : baseObjects) { @@ -455,10 +460,13 @@ void ObjectList::placeObjects(MWWorld::CellStore* cellStore) if (baseObject.droppedByPlayer) { - MWBase::Environment::get().getSoundManager()->playSound3D(newPtr, newPtr.getClass().getDownSoundId(newPtr), 1.f, 1.f); - if (guid == Main::get().getLocalPlayer()->guid) + { world->PCDropped(newPtr); + + // If this item was dropped locally, queue item drop sound + soundObjectList.addObjectSound(newPtr, newPtr.getClass().getDownSoundId(newPtr), 1.0, 1.0); + } } } catch (std::exception&) @@ -469,6 +477,11 @@ void ObjectList::placeObjects(MWWorld::CellStore* cellStore) else LOG_APPEND(TimedLog::LOG_VERBOSE, "-- Object already existed!"); } + + if (soundObjectList.baseObjects.size() > 0) + { + soundObjectList.sendObjectSound(); + } } void ObjectList::spawnObjects(MWWorld::CellStore* cellStore)