From 8b08928dae542758bdf59eb423cedf8b31e1082f Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Fri, 27 Jul 2012 12:19:25 +0200 Subject: [PATCH] Issue #351: Added sound playing to Action --- apps/openmw/mwworld/action.cpp | 13 +++++++++++++ apps/openmw/mwworld/action.hpp | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/apps/openmw/mwworld/action.cpp b/apps/openmw/mwworld/action.cpp index 0fcbf4a6f..0a57d5f67 100644 --- a/apps/openmw/mwworld/action.cpp +++ b/apps/openmw/mwworld/action.cpp @@ -1,11 +1,24 @@ #include "action.hpp" +#include "../mwbase/environment.hpp" + +#include "../mwsound/soundmanager.hpp" + MWWorld::Action::Action() {} MWWorld::Action::~Action() {} void MWWorld::Action::execute (const Ptr& actor) { + if (!mSoundId.empty()) + MWBase::Environment::get().getSoundManager()->playSound3D (actor, mSoundId, 1.0, 1.0, + MWSound::Play_NoTrack); + executeImp (actor); } + +void MWWorld::Action::setSound (const std::string& id) +{ + mSoundId = id; +} diff --git a/apps/openmw/mwworld/action.hpp b/apps/openmw/mwworld/action.hpp index c95648135..a00f67951 100644 --- a/apps/openmw/mwworld/action.hpp +++ b/apps/openmw/mwworld/action.hpp @@ -1,6 +1,8 @@ #ifndef GAME_MWWORLD_ACTION_H #define GAME_MWWORLD_ACTION_H +#include + namespace MWWorld { class Ptr; @@ -8,6 +10,8 @@ namespace MWWorld /// \brief Abstract base for actions class Action { + std::string mSoundId; + // not implemented Action (const Action& action); Action& operator= (const Action& action); @@ -21,6 +25,8 @@ namespace MWWorld virtual ~Action(); void execute (const Ptr& actor); + + void setSound (const std::string& id); }; }