forked from teamnwah/openmw-tes3coop
Task 339 - Moving all sounds to actions
This commit is contained in:
parent
82e7c04c0a
commit
5cbb08fee1
4 changed files with 19 additions and 17 deletions
|
@ -6,8 +6,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"
|
|
||||||
|
|
||||||
|
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
@ -108,13 +106,9 @@ namespace MWClass
|
||||||
/// \todo remove this if clause once ActionTeleport can also support other actors
|
/// \todo remove this if clause once ActionTeleport can also support other actors
|
||||||
if (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()==actor)
|
if (MWBase::Environment::get().getWorld()->getPlayer().getPlayer()==actor)
|
||||||
{
|
{
|
||||||
// the player is using the door
|
|
||||||
// The reason this is not 3D is that it would get interrupted when you teleport
|
|
||||||
//MWBase::Environment::get().getSoundManager()->playSound3D(ptr,openSound, 1.0, 1.0);
|
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ref->ref.destCell, ref->ref.doorDest));
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ref->ref.destCell, ref->ref.doorDest));
|
||||||
|
|
||||||
action->setSound(openSound, true);
|
action->setSound(openSound);
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,13 @@
|
||||||
#include "action.hpp"
|
#include "action.hpp"
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
#include "../mwbase/soundmanager.hpp"
|
#include "../mwbase/soundmanager.hpp"
|
||||||
|
|
||||||
MWWorld::Action::Action() {}
|
MWWorld::Action::Action() {
|
||||||
|
teleport = false;
|
||||||
|
}
|
||||||
|
|
||||||
MWWorld::Action::~Action() {}
|
MWWorld::Action::~Action() {}
|
||||||
|
|
||||||
|
@ -12,15 +16,14 @@ void MWWorld::Action::execute (const Ptr& actor)
|
||||||
{
|
{
|
||||||
if (!mSoundId.empty())
|
if (!mSoundId.empty())
|
||||||
{
|
{
|
||||||
if (onActor)
|
if (teleport == true)
|
||||||
{
|
{
|
||||||
std::cout << "Douglas - Som Normal" << std::endl;
|
//this is a teleport action, so we need to call playSound
|
||||||
MWBase::Environment::get().getSoundManager()->playSound(mSoundId, 1.0, 1.0,
|
MWBase::Environment::get().getSoundManager()->playSound(mSoundId, 1.0, 1.0,
|
||||||
MWBase::SoundManager::Play_NoTrack);
|
MWBase::SoundManager::Play_NoTrack);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Douglas - Som 3D" << std::endl;
|
|
||||||
MWBase::Environment::get().getSoundManager()->playSound3D (actor, mSoundId, 1.0, 1.0,
|
MWBase::Environment::get().getSoundManager()->playSound3D (actor, mSoundId, 1.0, 1.0,
|
||||||
MWBase::SoundManager::Play_NoTrack);
|
MWBase::SoundManager::Play_NoTrack);
|
||||||
}
|
}
|
||||||
|
@ -29,8 +32,7 @@ void MWWorld::Action::execute (const Ptr& actor)
|
||||||
executeImp (actor);
|
executeImp (actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MWWorld::Action::setSound (const std::string& id, const bool onActorValue)
|
void MWWorld::Action::setSound (const std::string& id)
|
||||||
{
|
{
|
||||||
mSoundId = id;
|
mSoundId = id;
|
||||||
onActor = onActorValue;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ namespace MWWorld
|
||||||
class Action
|
class Action
|
||||||
{
|
{
|
||||||
std::string mSoundId;
|
std::string mSoundId;
|
||||||
bool onActor;
|
|
||||||
|
|
||||||
// not implemented
|
// not implemented
|
||||||
Action (const Action& action);
|
Action (const Action& action);
|
||||||
|
@ -19,6 +18,9 @@ namespace MWWorld
|
||||||
|
|
||||||
virtual void executeImp (const Ptr& actor) = 0;
|
virtual void executeImp (const Ptr& actor) = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool teleport; //True if the action will teleport the actor
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Action();
|
Action();
|
||||||
|
@ -27,7 +29,7 @@ namespace MWWorld
|
||||||
|
|
||||||
void execute (const Ptr& actor);
|
void execute (const Ptr& actor);
|
||||||
|
|
||||||
void setSound (const std::string& id, const bool onActor = false);
|
void setSound (const std::string& id);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,14 @@ namespace MWWorld
|
||||||
ActionTeleport::ActionTeleport (const std::string& cellName,
|
ActionTeleport::ActionTeleport (const std::string& cellName,
|
||||||
const ESM::Position& position)
|
const ESM::Position& position)
|
||||||
: mCellName (cellName), mPosition (position)
|
: mCellName (cellName), mPosition (position)
|
||||||
{}
|
{
|
||||||
|
teleport = true;
|
||||||
|
}
|
||||||
|
|
||||||
void ActionTeleport::executeImp (const Ptr& actor)
|
void ActionTeleport::executeImp (const Ptr& actor)
|
||||||
{
|
{
|
||||||
|
teleport = true;
|
||||||
|
|
||||||
if (mCellName.empty())
|
if (mCellName.empty())
|
||||||
MWBase::Environment::get().getWorld()->changeToExteriorCell (mPosition);
|
MWBase::Environment::get().getWorld()->changeToExteriorCell (mPosition);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue