mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-29 09:32:45 +00:00
Merge pull request #1223 from MiroslavR/rifle_sounds
Fix for incorrect gun sounds with the Clean Hunter Rifles mod
This commit is contained in:
commit
a6429a2518
@ -12,6 +12,9 @@
|
|||||||
#include "../mwbase/soundmanager.hpp"
|
#include "../mwbase/soundmanager.hpp"
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
|
||||||
|
#include "../mwworld/inventorystore.hpp"
|
||||||
|
#include "../mwworld/class.hpp"
|
||||||
|
|
||||||
#include "interpretercontext.hpp"
|
#include "interpretercontext.hpp"
|
||||||
#include "ref.hpp"
|
#include "ref.hpp"
|
||||||
|
|
||||||
@ -183,8 +186,22 @@ namespace MWScript
|
|||||||
int index = runtime[0].mInteger;
|
int index = runtime[0].mInteger;
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
|
|
||||||
runtime.push (MWBase::Environment::get().getSoundManager()->getSoundPlaying (
|
bool ret = MWBase::Environment::get().getSoundManager()->getSoundPlaying (
|
||||||
ptr, runtime.getStringLiteral (index)));
|
ptr, runtime.getStringLiteral (index));
|
||||||
|
|
||||||
|
// GetSoundPlaying called on an equipped item should also look for sounds played by the equipping actor.
|
||||||
|
if (!ret && ptr.getContainerStore())
|
||||||
|
{
|
||||||
|
MWWorld::Ptr cont = MWBase::Environment::get().getWorld()->findContainer(ptr);
|
||||||
|
|
||||||
|
if (!cont.isEmpty() && cont.getClass().hasInventoryStore(cont) && cont.getClass().getInventoryStore(cont).isEquipped(ptr))
|
||||||
|
{
|
||||||
|
ret = MWBase::Environment::get().getSoundManager()->getSoundPlaying (
|
||||||
|
cont, runtime.getStringLiteral (index));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
runtime.push(ret);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user