forked from mirror/openmw-tes3mp
Issue #351: Added sound playing to Action
This commit is contained in:
parent
78fe6fdce5
commit
8b08928dae
2 changed files with 19 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef GAME_MWWORLD_ACTION_H
|
||||
#define GAME_MWWORLD_ACTION_H
|
||||
|
||||
#include <string>
|
||||
|
||||
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);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue