mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 07:23:54 +00:00
Prevent overlapping for journal and books scrolling
This commit is contained in:
parent
839196e4fa
commit
e0aa5e8e79
5 changed files with 13 additions and 8 deletions
|
@ -337,7 +337,7 @@ namespace MWBase
|
|||
/// Cycle to next or previous weapon
|
||||
virtual void cycleWeapon(bool next) = 0;
|
||||
|
||||
virtual void playSound(const std::string& soundId, float volume = 1.f, float pitch = 1.f) = 0;
|
||||
virtual void playSound(const std::string& soundId, bool preventOverlapping = false, float volume = 1.f, float pitch = 1.f) = 0;
|
||||
|
||||
// In WindowManager for now since there isn't a VFS singleton
|
||||
virtual std::string correctIconPath(const std::string& path) = 0;
|
||||
|
|
|
@ -200,7 +200,7 @@ namespace MWGui
|
|||
{
|
||||
if ((mCurrentPage+1)*2 < mPages.size())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->playSound("book page2");
|
||||
MWBase::Environment::get().getWindowManager()->playSound("book page2", true);
|
||||
|
||||
++mCurrentPage;
|
||||
|
||||
|
@ -211,7 +211,7 @@ namespace MWGui
|
|||
{
|
||||
if (mCurrentPage > 0)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->playSound("book page");
|
||||
MWBase::Environment::get().getWindowManager()->playSound("book page", true);
|
||||
|
||||
--mCurrentPage;
|
||||
|
||||
|
|
|
@ -616,7 +616,7 @@ namespace
|
|||
|
||||
if (page+2 < book->pageCount())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->playSound("book page");
|
||||
MWBase::Environment::get().getWindowManager()->playSound("book page", true);
|
||||
|
||||
page += 2;
|
||||
updateShowingPages ();
|
||||
|
@ -634,7 +634,7 @@ namespace
|
|||
|
||||
if(page >= 2)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->playSound("book page");
|
||||
MWBase::Environment::get().getWindowManager()->playSound("book page", true);
|
||||
|
||||
page -= 2;
|
||||
updateShowingPages ();
|
||||
|
|
|
@ -1916,11 +1916,16 @@ namespace MWGui
|
|||
mInventoryWindow->cycle(next);
|
||||
}
|
||||
|
||||
void WindowManager::playSound(const std::string& soundId, float volume, float pitch)
|
||||
void WindowManager::playSound(const std::string& soundId, bool preventOverlapping, float volume, float pitch)
|
||||
{
|
||||
if (soundId.empty())
|
||||
return;
|
||||
MWBase::Environment::get().getSoundManager()->playSound(soundId, volume, pitch, MWSound::Type::Sfx, MWSound::PlayMode::NoEnv);
|
||||
|
||||
MWBase::SoundManager *sndmgr = MWBase::Environment::get().getSoundManager();
|
||||
if (preventOverlapping && sndmgr->getSoundPlaying(MWWorld::Ptr(), soundId))
|
||||
return;
|
||||
|
||||
sndmgr->playSound(soundId, volume, pitch, MWSound::Type::Sfx, MWSound::PlayMode::NoEnv);
|
||||
}
|
||||
|
||||
void WindowManager::updateSpellWindow()
|
||||
|
|
|
@ -366,7 +366,7 @@ namespace MWGui
|
|||
/// Cycle to next or previous weapon
|
||||
virtual void cycleWeapon(bool next);
|
||||
|
||||
virtual void playSound(const std::string& soundId, float volume = 1.f, float pitch = 1.f);
|
||||
virtual void playSound(const std::string& soundId, bool preventOverlapping = false, float volume = 1.f, float pitch = 1.f);
|
||||
|
||||
// In WindowManager for now since there isn't a VFS singleton
|
||||
virtual std::string correctIconPath(const std::string& path);
|
||||
|
|
Loading…
Reference in a new issue