mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
[Client] Play sounds at fixed position if the object is in current cell
This commit is contained in:
parent
06a3604f9e
commit
3476bd7d04
1 changed files with 14 additions and 2 deletions
|
@ -792,9 +792,21 @@ void ObjectList::playObjectSounds(MWWorld::CellStore* cellStore)
|
||||||
if (ptrFound)
|
if (ptrFound)
|
||||||
{
|
{
|
||||||
LOG_APPEND(TimedLog::LOG_VERBOSE, "- Playing sound %s on %s", baseObject.soundId.c_str(), objectDescription.c_str());
|
LOG_APPEND(TimedLog::LOG_VERBOSE, "- Playing sound %s on %s", baseObject.soundId.c_str(), objectDescription.c_str());
|
||||||
|
bool playAtPosition = false;
|
||||||
|
if (ptrFound.isInCell()) {
|
||||||
|
ESM::CellId localCell = Main::get().getLocalPlayer()->cell.getCellId();
|
||||||
|
ESM::CellId soundCell = ptrFound.getCell()->getCell()->getCellId();
|
||||||
|
playAtPosition = localCell == soundCell;
|
||||||
|
}
|
||||||
|
|
||||||
MWBase::Environment::get().getSoundManager()->playSound3D(ptrFound, baseObject.soundId,
|
if (playAtPosition) {
|
||||||
baseObject.volume, baseObject.pitch, MWSound::Type::Sfx, MWSound::PlayMode::Normal, 0);
|
MWBase::Environment::get().getSoundManager()->playSound3D(ptrFound.getRefData().getPosition().asVec3(),
|
||||||
|
baseObject.soundId, baseObject.volume, baseObject.pitch, MWSound::Type::Sfx, MWSound::PlayMode::Normal, 0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MWBase::Environment::get().getSoundManager()->playSound3D(ptrFound,
|
||||||
|
baseObject.soundId, baseObject.volume, baseObject.pitch, MWSound::Type::Sfx, MWSound::PlayMode::Normal, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue