mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 22:06:45 +00:00
Make last cell a field of SoundManager and initialize
This commit is contained in:
parent
3fa1e7ebaf
commit
6ab1a1f907
2 changed files with 6 additions and 4 deletions
|
@ -887,7 +887,6 @@ namespace MWSound
|
||||||
|
|
||||||
void SoundManager::updateWaterSound(float /*duration*/)
|
void SoundManager::updateWaterSound(float /*duration*/)
|
||||||
{
|
{
|
||||||
static const ESM::Cell *LastCell;
|
|
||||||
MWBase::World* world = MWBase::Environment::get().getWorld();
|
MWBase::World* world = MWBase::Environment::get().getWorld();
|
||||||
const MWWorld::ConstPtr player = world->getPlayerPtr();
|
const MWWorld::ConstPtr player = world->getPlayerPtr();
|
||||||
const ESM::Cell *curcell = player.getCell()->getCell();
|
const ESM::Cell *curcell = player.getCell()->getCell();
|
||||||
|
@ -905,9 +904,9 @@ namespace MWSound
|
||||||
bool soundIdChanged = false;
|
bool soundIdChanged = false;
|
||||||
|
|
||||||
Sound_Buffer *sfx = lookupSound(update.mId);
|
Sound_Buffer *sfx = lookupSound(update.mId);
|
||||||
if(LastCell != curcell)
|
if (mLastCell != curcell)
|
||||||
{
|
{
|
||||||
LastCell = curcell;
|
mLastCell = curcell;
|
||||||
SoundMap::const_iterator snditer = mActiveSounds.find(MWWorld::Ptr());
|
SoundMap::const_iterator snditer = mActiveSounds.find(MWWorld::Ptr());
|
||||||
if(snditer != mActiveSounds.end())
|
if(snditer != mActiveSounds.end())
|
||||||
{
|
{
|
||||||
|
@ -932,7 +931,7 @@ namespace MWSound
|
||||||
}
|
}
|
||||||
else if (update.mVolume > 0.0f)
|
else if (update.mVolume > 0.0f)
|
||||||
{
|
{
|
||||||
LastCell = curcell;
|
mLastCell = curcell;
|
||||||
mNearWaterSound = playSound(update.mId, update.mVolume, 1.0f, Type::Sfx, PlayMode::Loop);
|
mNearWaterSound = playSound(update.mId, update.mVolume, 1.0f, Type::Sfx, PlayMode::Loop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ namespace VFS
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
struct Sound;
|
struct Sound;
|
||||||
|
struct Cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MWSound
|
namespace MWSound
|
||||||
|
@ -116,6 +117,8 @@ namespace MWSound
|
||||||
|
|
||||||
float mTimePassed = 0;
|
float mTimePassed = 0;
|
||||||
|
|
||||||
|
const ESM::Cell *mLastCell = nullptr;
|
||||||
|
|
||||||
Sound_Buffer *insertSound(const std::string &soundId, const ESM::Sound *sound);
|
Sound_Buffer *insertSound(const std::string &soundId, const ESM::Sound *sound);
|
||||||
|
|
||||||
Sound_Buffer *lookupSound(const std::string &soundId) const;
|
Sound_Buffer *lookupSound(const std::string &soundId) const;
|
||||||
|
|
Loading…
Reference in a new issue