Merge pull request #1331 from akortunov/guidistortionfix

Prevent GUI sounds distortion
0.6.1
scrawl 8 years ago committed by GitHub
commit ada85aa1ee

@ -351,6 +351,8 @@ namespace MWBase
/// Cycle to next or previous weapon /// Cycle to next or previous weapon
virtual void cycleWeapon(bool next) = 0; virtual void cycleWeapon(bool next) = 0;
virtual void playSound(const std::string& soundId, float volume = 1.f, float pitch = 1.f) = 0;
// In WindowManager for now since there isn't a VFS singleton // In WindowManager for now since there isn't a VFS singleton
virtual std::string correctIconPath(const std::string& path) = 0; virtual std::string correctIconPath(const std::string& path) = 0;
virtual std::string correctBookartPath(const std::string& path, int width, int height) = 0; virtual std::string correctBookartPath(const std::string& path, int width, int height) = 0;

@ -4,7 +4,6 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwmechanics/magiceffects.hpp" #include "../mwmechanics/magiceffects.hpp"
@ -66,26 +65,27 @@ namespace MWGui
void AlchemyWindow::onCreateButtonClicked(MyGUI::Widget* _sender) void AlchemyWindow::onCreateButtonClicked(MyGUI::Widget* _sender)
{ {
MWMechanics::Alchemy::Result result = mAlchemy->create (mNameEdit->getCaption ()); MWMechanics::Alchemy::Result result = mAlchemy->create (mNameEdit->getCaption ());
MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager();
switch (result) switch (result)
{ {
case MWMechanics::Alchemy::Result_NoName: case MWMechanics::Alchemy::Result_NoName:
MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage37}"); winMgr->messageBox("#{sNotifyMessage37}");
break; break;
case MWMechanics::Alchemy::Result_NoMortarAndPestle: case MWMechanics::Alchemy::Result_NoMortarAndPestle:
MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage45}"); winMgr->messageBox("#{sNotifyMessage45}");
break; break;
case MWMechanics::Alchemy::Result_LessThanTwoIngredients: case MWMechanics::Alchemy::Result_LessThanTwoIngredients:
MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage6a}"); winMgr->messageBox("#{sNotifyMessage6a}");
break; break;
case MWMechanics::Alchemy::Result_Success: case MWMechanics::Alchemy::Result_Success:
MWBase::Environment::get().getWindowManager()->messageBox("#{sPotionSuccess}"); winMgr->messageBox("#{sPotionSuccess}");
MWBase::Environment::get().getSoundManager()->playSound("potion success", 1.f, 1.f); winMgr->playSound("potion success");
break; break;
case MWMechanics::Alchemy::Result_NoEffects: case MWMechanics::Alchemy::Result_NoEffects:
case MWMechanics::Alchemy::Result_RandomFailure: case MWMechanics::Alchemy::Result_RandomFailure:
MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage8}"); winMgr->messageBox("#{sNotifyMessage8}");
MWBase::Environment::get().getSoundManager()->playSound("potion fail", 1.f, 1.f); winMgr->playSound("potion fail");
break; break;
} }
@ -151,7 +151,7 @@ namespace MWGui
update(); update();
std::string sound = item.getClass().getUpSoundId(item); std::string sound = item.getClass().getUpSoundId(item);
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound(sound);
} }
} }

@ -6,7 +6,6 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwmechanics/actorutil.hpp" #include "../mwmechanics/actorutil.hpp"
@ -82,7 +81,7 @@ namespace MWGui
clearPages(); clearPages();
mCurrentPage = 0; mCurrentPage = 0;
MWBase::Environment::get().getSoundManager()->playSound ("book open", 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound("book open");
MWWorld::LiveCellRef<ESM::Book> *ref = mBook.get<ESM::Book>(); MWWorld::LiveCellRef<ESM::Book> *ref = mBook.get<ESM::Book>();
@ -98,7 +97,7 @@ namespace MWGui
void BookWindow::exit() void BookWindow::exit()
{ {
// no 3d sounds because the object could be in a container. // no 3d sounds because the object could be in a container.
MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound("book close");
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Book); MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Book);
} }
@ -122,7 +121,7 @@ namespace MWGui
void BookWindow::onTakeButtonClicked (MyGUI::Widget* sender) void BookWindow::onTakeButtonClicked (MyGUI::Widget* sender)
{ {
MWBase::Environment::get().getSoundManager()->playSound("Item Book Up", 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound("Item Book Up");
MWWorld::ActionTake take(mBook); MWWorld::ActionTake take(mBook);
take.execute (MWMechanics::getPlayer()); take.execute (MWMechanics::getPlayer());
@ -195,7 +194,7 @@ namespace MWGui
{ {
if ((mCurrentPage+1)*2 < mPages.size()) if ((mCurrentPage+1)*2 < mPages.size())
{ {
MWBase::Environment::get().getSoundManager()->playSound ("book page2", 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound("book page2");
++mCurrentPage; ++mCurrentPage;
@ -206,7 +205,7 @@ namespace MWGui
{ {
if (mCurrentPage > 0) if (mCurrentPage > 0)
{ {
MWBase::Environment::get().getSoundManager()->playSound ("book page", 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound("book page");
--mCurrentPage; --mCurrentPage;

@ -5,7 +5,6 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/dialoguemanager.hpp" #include "../mwbase/dialoguemanager.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
@ -224,7 +223,7 @@ namespace MWGui
// play the sound of the first object // play the sound of the first object
MWWorld::Ptr item = mModel->getItem(i).mBase; MWWorld::Ptr item = mModel->getItem(i).mBase;
std::string sound = item.getClass().getUpSoundId(item); std::string sound = item.getClass().getUpSoundId(item);
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound(sound);
} }
const ItemStack& item = mModel->getItem(i); const ItemStack& item = mModel->getItem(i);

@ -11,7 +11,6 @@
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/dialoguemanager.hpp" #include "../mwbase/dialoguemanager.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
@ -228,21 +227,21 @@ namespace MWGui
void Choice::activated() void Choice::activated()
{ {
MWBase::Environment::get().getSoundManager()->playSound("Menu Click", 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound("Menu Click");
MWBase::Environment::get().getDialogueManager()->questionAnswered(mChoiceId); MWBase::Environment::get().getDialogueManager()->questionAnswered(mChoiceId);
} }
void Topic::activated() void Topic::activated()
{ {
MWBase::Environment::get().getSoundManager()->playSound("Menu Click", 1.f, 1.f); MWBase::Environment::get().getWindowManager()->playSound("Menu Click");
MWBase::Environment::get().getDialogueManager()->keywordSelected(Misc::StringUtils::lowerCase(mTopicId)); MWBase::Environment::get().getDialogueManager()->keywordSelected(Misc::StringUtils::lowerCase(mTopicId));
} }
void Goodbye::activated() void Goodbye::activated()
{ {
MWBase::Environment::get().getSoundManager()->playSound("Menu Click", 1.f, 1.f); MWBase::Environment::get().getWindowManager()->playSound("Menu Click");
MWBase::Environment::get().getDialogueManager()->goodbyeSelected(); MWBase::Environment::get().getDialogueManager()->goodbyeSelected();
} }

@ -5,7 +5,6 @@
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
@ -64,7 +63,7 @@ void DragAndDrop::startDrag (int index, SortFilterItemModel* sortModel, ItemMode
} }
std::string sound = mItem.mBase.getClass().getUpSoundId(mItem.mBase); std::string sound = mItem.mBase.getClass().getUpSoundId(mItem.mBase);
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound (sound);
if (mSourceSortModel) if (mSourceSortModel)
{ {
@ -94,7 +93,7 @@ void DragAndDrop::startDrag (int index, SortFilterItemModel* sortModel, ItemMode
void DragAndDrop::drop(ItemModel *targetModel, ItemView *targetView) void DragAndDrop::drop(ItemModel *targetModel, ItemView *targetView)
{ {
std::string sound = mItem.mBase.getClass().getDownSoundId(mItem.mBase); std::string sound = mItem.mBase.getClass().getDownSoundId(mItem.mBase);
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound(sound);
// We can't drop a conjured item to the ground; the target container should always be the source container // We can't drop a conjured item to the ground; the target container should always be the source container
if (mItem.mFlags & ItemStack::Flag_Bound && targetModel != mSourceModel) if (mItem.mFlags & ItemStack::Flag_Bound && targetModel != mSourceModel)

@ -8,7 +8,6 @@
#include <components/widgets/list.hpp> #include <components/widgets/list.hpp>
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/dialoguemanager.hpp" #include "../mwbase/dialoguemanager.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
@ -237,7 +236,7 @@ namespace MWGui
mItemSelectionDialog->setVisible(false); mItemSelectionDialog->setVisible(false);
setItem(item); setItem(item);
MWBase::Environment::get().getSoundManager()->playSound(item.getClass().getDownSoundId(item), 1, 1); MWBase::Environment::get().getWindowManager()->playSound(item.getClass().getDownSoundId(item));
mEnchanting.nextCastStyle(); mEnchanting.nextCastStyle();
updateLabels(); updateLabels();
} }
@ -259,7 +258,7 @@ namespace MWGui
} }
setSoulGem(item); setSoulGem(item);
MWBase::Environment::get().getSoundManager()->playSound(item.getClass().getDownSoundId(item), 1, 1); MWBase::Environment::get().getWindowManager()->playSound(item.getClass().getDownSoundId(item));
updateLabels(); updateLabels();
} }
@ -374,12 +373,12 @@ namespace MWGui
if(result==1) if(result==1)
{ {
MWBase::Environment::get().getSoundManager()->playSound("enchant success", 1.f, 1.f); MWBase::Environment::get().getWindowManager()->playSound("enchant success");
MWBase::Environment::get().getWindowManager()->messageBox ("#{sEnchantmentMenu12}"); MWBase::Environment::get().getWindowManager()->messageBox ("#{sEnchantmentMenu12}");
} }
else else
{ {
MWBase::Environment::get().getSoundManager()->playSound("enchant fail", 1.f, 1.f); MWBase::Environment::get().getWindowManager()->playSound("enchant fail");
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage34}"); MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage34}");
} }

@ -18,7 +18,6 @@
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/scriptmanager.hpp" #include "../mwbase/scriptmanager.hpp"
@ -239,7 +238,7 @@ namespace MWGui
// Can't give conjured items to a merchant // Can't give conjured items to a merchant
if (item.mFlags & ItemStack::Flag_Bound) if (item.mFlags & ItemStack::Flag_Bound)
{ {
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound(sound);
MWBase::Environment::get().getWindowManager()->messageBox("#{sBarterDialog9}"); MWBase::Environment::get().getWindowManager()->messageBox("#{sBarterDialog9}");
return; return;
} }
@ -248,7 +247,7 @@ namespace MWGui
int services = MWBase::Environment::get().getWindowManager()->getTradeWindow()->getMerchantServices(); int services = MWBase::Environment::get().getWindowManager()->getTradeWindow()->getMerchantServices();
if (!object.getClass().canSell(object, services)) if (!object.getClass().canSell(object, services))
{ {
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound(sound);
MWBase::Environment::get().getWindowManager()-> MWBase::Environment::get().getWindowManager()->
messageBox("#{sBarterDialog4}"); messageBox("#{sBarterDialog4}");
return; return;
@ -322,7 +321,7 @@ namespace MWGui
ensureSelectedItemUnequipped(count); ensureSelectedItemUnequipped(count);
const ItemStack& item = mTradeModel->getItem(mSelectedItem); const ItemStack& item = mTradeModel->getItem(mSelectedItem);
std::string sound = item.mBase.getClass().getDownSoundId(item.mBase); std::string sound = item.mBase.getClass().getDownSoundId(item.mBase);
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound(sound);
if (item.mType == ItemStack::Type_Barter) if (item.mType == ItemStack::Type_Barter)
{ {

@ -14,7 +14,6 @@
#include <components/widgets/list.hpp> #include <components/widgets/list.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/journal.hpp" #include "../mwbase/journal.hpp"
@ -516,8 +515,9 @@ namespace
void notifyClose(MyGUI::Widget* _sender) void notifyClose(MyGUI::Widget* _sender)
{ {
MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0); MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager();
MWBase::Environment::get().getWindowManager ()->popGuiMode (); winMgr->playSound("book close");
winMgr->popGuiMode();
} }
void notifyMouseWheel(MyGUI::Widget* sender, int rel) void notifyMouseWheel(MyGUI::Widget* sender, int rel)

@ -10,7 +10,6 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/statemanager.hpp" #include "../mwbase/statemanager.hpp"
@ -76,23 +75,25 @@ namespace MWGui
void MainMenu::onButtonClicked(MyGUI::Widget *sender) void MainMenu::onButtonClicked(MyGUI::Widget *sender)
{ {
MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager();
std::string name = *sender->getUserData<std::string>(); std::string name = *sender->getUserData<std::string>();
MWBase::Environment::get().getSoundManager()->playSound("Menu Click", 1.f, 1.f); winMgr->playSound("Menu Click");
if (name == "return") if (name == "return")
{ {
MWBase::Environment::get().getWindowManager ()->removeGuiMode (GM_MainMenu); winMgr->removeGuiMode (GM_MainMenu);
} }
else if (name == "options") else if (name == "options")
MWBase::Environment::get().getWindowManager ()->pushGuiMode (GM_Settings); winMgr->pushGuiMode (GM_Settings);
else if (name == "credits") else if (name == "credits")
MWBase::Environment::get().getWindowManager()->playVideo("mw_credits.bik", true); winMgr->playVideo("mw_credits.bik", true);
else if (name == "exitgame") else if (name == "exitgame")
{ {
if (MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_NoGame) if (MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_NoGame)
onExitConfirmed(); onExitConfirmed();
else else
{ {
ConfirmationDialog* dialog = MWBase::Environment::get().getWindowManager()->getConfirmationDialog(); ConfirmationDialog* dialog = winMgr->getConfirmationDialog();
dialog->askForConfirmation("#{sMessage2}"); dialog->askForConfirmation("#{sMessage2}");
dialog->eventOkClicked.clear(); dialog->eventOkClicked.clear();
dialog->eventOkClicked += MyGUI::newDelegate(this, &MainMenu::onExitConfirmed); dialog->eventOkClicked += MyGUI::newDelegate(this, &MainMenu::onExitConfirmed);
@ -105,7 +106,7 @@ namespace MWGui
onNewGameConfirmed(); onNewGameConfirmed();
else else
{ {
ConfirmationDialog* dialog = MWBase::Environment::get().getWindowManager()->getConfirmationDialog(); ConfirmationDialog* dialog = winMgr->getConfirmationDialog();
dialog->askForConfirmation("#{sNotifyMessage54}"); dialog->askForConfirmation("#{sNotifyMessage54}");
dialog->eventOkClicked.clear(); dialog->eventOkClicked.clear();
dialog->eventOkClicked += MyGUI::newDelegate(this, &MainMenu::onNewGameConfirmed); dialog->eventOkClicked += MyGUI::newDelegate(this, &MainMenu::onNewGameConfirmed);

@ -10,7 +10,6 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/creaturestats.hpp"
#include "../mwmechanics/actorutil.hpp" #include "../mwmechanics/actorutil.hpp"
@ -138,8 +137,7 @@ void MerchantRepair::onRepairButtonClick(MyGUI::Widget *sender)
player.getClass().getContainerStore(player).restack(item); player.getClass().getContainerStore(player).restack(item);
MWBase::Environment::get().getSoundManager()->playSound("Repair",1,1); MWBase::Environment::get().getWindowManager()->playSound("Repair");
player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player); player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player);

@ -12,7 +12,6 @@
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwworld/containerstore.hpp" #include "../mwworld/containerstore.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
@ -130,7 +129,7 @@ void Recharge::onItemSelected(MWWorld::Ptr item)
mGemIcon->setUserString ("ToolTipType", "ItemPtr"); mGemIcon->setUserString ("ToolTipType", "ItemPtr");
mGemIcon->setUserData(item); mGemIcon->setUserData(item);
MWBase::Environment::get().getSoundManager()->playSound(item.getClass().getDownSoundId(item), 1, 1); MWBase::Environment::get().getWindowManager()->playSound(item.getClass().getDownSoundId(item));
updateView(); updateView();
} }
@ -175,7 +174,7 @@ void Recharge::onItemClicked(MyGUI::Widget *sender, const MWWorld::Ptr& item)
item.getCellRef().setEnchantmentCharge( item.getCellRef().setEnchantmentCharge(
std::min(item.getCellRef().getEnchantmentCharge() + restored, static_cast<float>(enchantment->mData.mCharge))); std::min(item.getCellRef().getEnchantmentCharge() + restored, static_cast<float>(enchantment->mData.mCharge)));
MWBase::Environment::get().getSoundManager()->playSound("Enchant Success",1,1); MWBase::Environment::get().getWindowManager()->playSound("Enchant Success");
player.getClass().getContainerStore(player).restack(item); player.getClass().getContainerStore(player).restack(item);
@ -183,7 +182,7 @@ void Recharge::onItemClicked(MyGUI::Widget *sender, const MWWorld::Ptr& item)
} }
else else
{ {
MWBase::Environment::get().getSoundManager()->playSound("Enchant Fail",1,1); MWBase::Environment::get().getWindowManager()->playSound("Enchant Fail");
} }
gem.getContainerStore()->remove(gem, 1, player); gem.getContainerStore()->remove(gem, 1, player);

@ -11,7 +11,6 @@
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwmechanics/actorutil.hpp" #include "../mwmechanics/actorutil.hpp"
@ -66,7 +65,7 @@ void Repair::exit()
void Repair::startRepairItem(const MWWorld::Ptr &item) void Repair::startRepairItem(const MWWorld::Ptr &item)
{ {
MWBase::Environment::get().getSoundManager()->playSound("Item Repair Up",1,1); MWBase::Environment::get().getWindowManager()->playSound("Item Repair Up");
mRepair.setTool(item); mRepair.setTool(item);
@ -135,7 +134,7 @@ void Repair::onItemSelected(MWWorld::Ptr item)
mRepair.setTool(item); mRepair.setTool(item);
MWBase::Environment::get().getSoundManager()->playSound(item.getClass().getDownSoundId(item), 1, 1); MWBase::Environment::get().getWindowManager()->playSound(item.getClass().getDownSoundId(item));
updateRepairView(); updateRepairView();
} }

@ -7,7 +7,6 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwmechanics/actorutil.hpp" #include "../mwmechanics/actorutil.hpp"
@ -53,7 +52,7 @@ namespace MWGui
void ScrollWindow::openScroll (MWWorld::Ptr scroll, bool showTakeButton) void ScrollWindow::openScroll (MWWorld::Ptr scroll, bool showTakeButton)
{ {
// no 3d sounds because the object could be in a container. // no 3d sounds because the object could be in a container.
MWBase::Environment::get().getSoundManager()->playSound ("scroll", 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound("scroll");
mScroll = scroll; mScroll = scroll;
@ -78,7 +77,7 @@ namespace MWGui
void ScrollWindow::exit() void ScrollWindow::exit()
{ {
MWBase::Environment::get().getSoundManager()->playSound ("scroll", 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound("scroll");
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Scroll); MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Scroll);
} }
@ -102,7 +101,7 @@ namespace MWGui
void ScrollWindow::onTakeButtonClicked (MyGUI::Widget* _sender) void ScrollWindow::onTakeButtonClicked (MyGUI::Widget* _sender)
{ {
MWBase::Environment::get().getSoundManager()->playSound("Item Book Up", 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound("Item Book Up");
MWWorld::ActionTake take(mScroll); MWWorld::ActionTake take(mScroll);
take.execute (MWMechanics::getPlayer()); take.execute (MWMechanics::getPlayer());

@ -6,7 +6,6 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
@ -146,7 +145,7 @@ namespace MWGui
startSpellBuying(mPtr); startSpellBuying(mPtr);
MWBase::Environment::get().getSoundManager()->playSound ("Item Gold Up", 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound("Item Gold Up");
} }
void SpellBuyingWindow::onCancelButtonClicked(MyGUI::Widget* _sender) void SpellBuyingWindow::onCancelButtonClicked(MyGUI::Widget* _sender)

@ -7,7 +7,6 @@
#include <components/widgets/list.hpp> #include <components/widgets/list.hpp>
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
@ -396,7 +395,7 @@ namespace MWGui
MWMechanics::CreatureStats& npcStats = mPtr.getClass().getCreatureStats(mPtr); MWMechanics::CreatureStats& npcStats = mPtr.getClass().getCreatureStats(mPtr);
npcStats.setGoldPool(npcStats.getGoldPool() + price); npcStats.setGoldPool(npcStats.getGoldPool() + price);
MWBase::Environment::get().getSoundManager()->playSound ("Mysticism Hit", 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound ("Mysticism Hit");
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->createRecord(mSpell); const ESM::Spell* spell = MWBase::Environment::get().getWorld()->createRecord(mSpell);

@ -10,7 +10,6 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/dialoguemanager.hpp" #include "../mwbase/dialoguemanager.hpp"
@ -211,7 +210,7 @@ namespace MWGui
{ {
const ItemStack& item = mTradeModel->getItem(mItemToSell); const ItemStack& item = mTradeModel->getItem(mItemToSell);
std::string sound = item.mBase.getClass().getDownSoundId(item.mBase); std::string sound = item.mBase.getClass().getDownSoundId(item.mBase);
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound(sound);
TradeItemModel* playerTradeModel = MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getTradeModel(); TradeItemModel* playerTradeModel = MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getTradeModel();
@ -356,9 +355,7 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->getDialogueWindow()->addResponse( MWBase::Environment::get().getWindowManager()->getDialogueWindow()->addResponse(
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sBarterDialog5")->getString()); MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sBarterDialog5")->getString());
std::string sound = "Item Gold Up"; MWBase::Environment::get().getWindowManager()->playSound("Item Gold Up");
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter); MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Barter);
} }

@ -8,7 +8,6 @@
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/dialoguemanager.hpp" #include "../mwbase/dialoguemanager.hpp"
#include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/creaturestats.hpp"
@ -158,7 +157,7 @@ namespace MWGui
if (!mPtr.getCell()->isExterior()) if (!mPtr.getCell()->isExterior())
// Interior cell -> mages guild transport // Interior cell -> mages guild transport
MWBase::Environment::get().getSoundManager()->playSound("mysticism cast", 1, 1); MWBase::Environment::get().getWindowManager()->playSound("mysticism cast");
player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player); player.getClass().getContainerStore(player).remove(MWWorld::ContainerStore::sGoldId, price, player);

@ -856,7 +856,7 @@ namespace MWGui
mRepair->exit(); mRepair->exit();
break; break;
case GM_Journal: case GM_Journal:
MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0); playSound("book close");
removeGuiMode(GM_Journal); //Simple way to remove it removeGuiMode(GM_Journal); //Simple way to remove it
break; break;
default: default:
@ -1976,6 +1976,11 @@ namespace MWGui
mInventoryWindow->cycle(next); mInventoryWindow->cycle(next);
} }
void WindowManager::playSound(const std::string& soundId, float volume, float pitch)
{
MWBase::Environment::get().getSoundManager()->playSound(soundId, volume, pitch, MWBase::SoundManager::Play_TypeSfx, MWBase::SoundManager::Play_NoEnv);
}
void WindowManager::setConsoleSelectedObject(const MWWorld::Ptr &object) void WindowManager::setConsoleSelectedObject(const MWWorld::Ptr &object)
{ {
mConsole->setSelectedObject(object); mConsole->setSelectedObject(object);

@ -380,6 +380,8 @@ namespace MWGui
/// Cycle to next or previous weapon /// Cycle to next or previous weapon
virtual void cycleWeapon(bool next); virtual void cycleWeapon(bool next);
virtual void playSound(const std::string& soundId, float volume = 1.f, float pitch = 1.f);
// In WindowManager for now since there isn't a VFS singleton // In WindowManager for now since there isn't a VFS singleton
virtual std::string correctIconPath(const std::string& path); virtual std::string correctIconPath(const std::string& path);
virtual std::string correctBookartPath(const std::string& path, int width, int height); virtual std::string correctBookartPath(const std::string& path, int width, int height);

@ -18,7 +18,6 @@
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/statemanager.hpp" #include "../mwbase/statemanager.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
@ -715,7 +714,7 @@ namespace MWInput
MyGUI::Button* b = MyGUI::InputManager::getInstance ().getMouseFocusWidget ()->castType<MyGUI::Button>(false); MyGUI::Button* b = MyGUI::InputManager::getInstance ().getMouseFocusWidget ()->castType<MyGUI::Button>(false);
if (b && b->getEnabled() && id == SDL_BUTTON_LEFT) if (b && b->getEnabled() && id == SDL_BUTTON_LEFT)
{ {
MWBase::Environment::get().getSoundManager ()->playSound ("Menu Click", 1.f, 1.f); MWBase::Environment::get().getWindowManager()->playSound("Menu Click");
} }
} }
} }
@ -810,7 +809,7 @@ namespace MWInput
MyGUI::Button* b = MyGUI::InputManager::getInstance ().getMouseFocusWidget ()->castType<MyGUI::Button>(false); MyGUI::Button* b = MyGUI::InputManager::getInstance ().getMouseFocusWidget ()->castType<MyGUI::Button>(false);
if (b && b->getEnabled()) if (b && b->getEnabled())
{ {
MWBase::Environment::get().getSoundManager ()->playSound ("Menu Click", 1.f, 1.f); MWBase::Environment::get().getWindowManager()->playSound("Menu Click");
} }
} }
} }
@ -1025,12 +1024,12 @@ namespace MWInput
if(MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_Journal if(MWBase::Environment::get().getWindowManager()->getMode() != MWGui::GM_Journal
&& MWBase::Environment::get().getWindowManager ()->getJournalAllowed()) && MWBase::Environment::get().getWindowManager ()->getJournalAllowed())
{ {
MWBase::Environment::get().getSoundManager()->playSound ("book open", 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound ("book open");
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Journal); MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Journal);
} }
else if(MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Journal)) else if(MWBase::Environment::get().getWindowManager()->containsMode(MWGui::GM_Journal))
{ {
MWBase::Environment::get().getSoundManager()->playSound ("book close", 1.0, 1.0); MWBase::Environment::get().getWindowManager()->playSound ("book close");
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Journal); MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Journal);
} }
} }

@ -15,7 +15,6 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/soundmanager.hpp"
MWMechanics::NpcStats::NpcStats() MWMechanics::NpcStats::NpcStats()
: mDisposition (0) : mDisposition (0)
@ -254,7 +253,7 @@ void MWMechanics::NpcStats::increaseSkill(int skillIndex, const ESM::Class &clas
// Play sound & skill progress notification // Play sound & skill progress notification
/// \todo check if character is the player, if levelling is ever implemented for NPCs /// \todo check if character is the player, if levelling is ever implemented for NPCs
MWBase::Environment::get().getSoundManager ()->playSound ("skillraise", 1, 1); MWBase::Environment::get().getWindowManager()->playSound("skillraise");
std::stringstream message; std::stringstream message;
message << boost::format(MWBase::Environment::get().getWindowManager ()->getGameSettingString ("sNotifyMessage39", "")) message << boost::format(MWBase::Environment::get().getWindowManager ()->getGameSettingString ("sNotifyMessage39", ""))

@ -8,7 +8,6 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/mechanicsmanager.hpp" #include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwworld/containerstore.hpp" #include "../mwworld/containerstore.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
@ -71,12 +70,12 @@ void Repair::repair(const MWWorld::Ptr &itemToRepair)
// increase skill // increase skill
player.getClass().skillUsageSucceeded(player, ESM::Skill::Armorer, 0); player.getClass().skillUsageSucceeded(player, ESM::Skill::Armorer, 0);
MWBase::Environment::get().getSoundManager()->playSound("Repair",1,1); MWBase::Environment::get().getWindowManager()->playSound("Repair");
MWBase::Environment::get().getWindowManager()->messageBox("#{sRepairSuccess}"); MWBase::Environment::get().getWindowManager()->messageBox("#{sRepairSuccess}");
} }
else else
{ {
MWBase::Environment::get().getSoundManager()->playSound("Repair Fail",1,1); MWBase::Environment::get().getWindowManager()->playSound("Repair Fail");
MWBase::Environment::get().getWindowManager()->messageBox("#{sRepairFailed}"); MWBase::Environment::get().getWindowManager()->messageBox("#{sRepairFailed}");
} }
@ -100,7 +99,7 @@ void Repair::repair(const MWWorld::Ptr &itemToRepair)
{ {
mTool = *iter; mTool = *iter;
MWBase::Environment::get().getSoundManager()->playSound("Item Repair Up",1,1); MWBase::Environment::get().getWindowManager()->playSound("Item Repair Up");
break; break;
} }

Loading…
Cancel
Save