forked from teamnwah/openmw-tes3coop
Merge remote-tracking branch 'trombonecot/master'
Conflicts: apps/openmw/mwclass/light.cpp
This commit is contained in:
commit
5d45bcd03a
6 changed files with 52 additions and 10 deletions
|
@ -50,7 +50,7 @@ add_openmw_dir (mwsound
|
||||||
|
|
||||||
add_openmw_dir (mwworld
|
add_openmw_dir (mwworld
|
||||||
refdata worldimp physicssystem scene globals class action nullaction actionteleport
|
refdata worldimp physicssystem scene globals class action nullaction actionteleport
|
||||||
containerstore actiontalk actiontake manualref player cellfunctors
|
containerstore actiontalk actiontake manualref player cellfunctors failedaction
|
||||||
cells localscripts customdata weather inventorystore ptr actionopen actionread
|
cells localscripts customdata weather inventorystore ptr actionopen actionread
|
||||||
actionequip timestamp actionalchemy cellstore actionapply actioneat
|
actionequip timestamp actionalchemy cellstore actionapply actioneat
|
||||||
esmstore store recordcmp
|
esmstore store recordcmp
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#include "../mwbase/windowmanager.hpp"
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/nullaction.hpp"
|
#include "../mwworld/failedaction.hpp"
|
||||||
#include "../mwworld/containerstore.hpp"
|
#include "../mwworld/containerstore.hpp"
|
||||||
#include "../mwworld/customdata.hpp"
|
#include "../mwworld/customdata.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
|
@ -129,7 +129,7 @@ namespace MWClass
|
||||||
{
|
{
|
||||||
// Trap activation goes here
|
// Trap activation goes here
|
||||||
std::cout << "Activated trap: " << ptr.getCellRef().mTrap << std::endl;
|
std::cout << "Activated trap: " << ptr.getCellRef().mTrap << std::endl;
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction);
|
||||||
action->setSound(trapActivationSound);
|
action->setSound(trapActivationSound);
|
||||||
ptr.getCellRef().mTrap = "";
|
ptr.getCellRef().mTrap = "";
|
||||||
return action;
|
return action;
|
||||||
|
@ -137,7 +137,7 @@ namespace MWClass
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction);
|
||||||
action->setSound(lockedSound);
|
action->setSound(lockedSound);
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
#include "../mwworld/nullaction.hpp"
|
#include "../mwworld/nullaction.hpp"
|
||||||
|
#include "../mwworld/failedaction.hpp"
|
||||||
#include "../mwworld/actionteleport.hpp"
|
#include "../mwworld/actionteleport.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/physicssystem.hpp"
|
#include "../mwworld/physicssystem.hpp"
|
||||||
|
@ -110,8 +111,7 @@ namespace MWClass
|
||||||
// Trap activation
|
// Trap activation
|
||||||
std::cout << "Activated trap: " << ptr.getCellRef().mTrap << std::endl;
|
std::cout << "Activated trap: " << ptr.getCellRef().mTrap << std::endl;
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction);
|
||||||
|
|
||||||
action->setSound(trapActivationSound);
|
action->setSound(trapActivationSound);
|
||||||
ptr.getCellRef().mTrap = "";
|
ptr.getCellRef().mTrap = "";
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ namespace MWClass
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// another NPC or a creature is using the door
|
// another NPC or a creature is using the door
|
||||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::FailedAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -152,7 +152,7 @@ namespace MWClass
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// locked, and we can't open.
|
// locked, and we can't open.
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::NullAction);
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction);
|
||||||
action->setSound(lockedSound);
|
action->setSound(lockedSound);
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "../mwworld/actiontake.hpp"
|
#include "../mwworld/actiontake.hpp"
|
||||||
#include "../mwworld/actionequip.hpp"
|
#include "../mwworld/actionequip.hpp"
|
||||||
#include "../mwworld/nullaction.hpp"
|
#include "../mwworld/nullaction.hpp"
|
||||||
|
#include "../mwworld/failedaction.hpp"
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/cellstore.hpp"
|
#include "../mwworld/cellstore.hpp"
|
||||||
#include "../mwworld/physicssystem.hpp"
|
#include "../mwworld/physicssystem.hpp"
|
||||||
|
@ -55,7 +56,7 @@ namespace MWClass
|
||||||
|
|
||||||
if(!model.empty())
|
if(!model.empty())
|
||||||
physics.addObject(ptr);
|
physics.addObject(ptr);
|
||||||
|
|
||||||
if (!ref->mBase->mSound.empty())
|
if (!ref->mBase->mSound.empty())
|
||||||
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->mBase->mSound, 1.0, 1.0, MWBase::SoundManager::Play_Loop);
|
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->mBase->mSound, 1.0, 1.0, MWBase::SoundManager::Play_Loop);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +92,7 @@ namespace MWClass
|
||||||
ptr.get<ESM::Light>();
|
ptr.get<ESM::Light>();
|
||||||
|
|
||||||
if (!(ref->mBase->mData.mFlags & ESM::Light::Carry))
|
if (!(ref->mBase->mData.mFlags & ESM::Light::Carry))
|
||||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
return boost::shared_ptr<MWWorld::Action> (new MWWorld::FailedAction);
|
||||||
|
|
||||||
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTake (ptr));
|
||||||
|
|
||||||
|
|
21
apps/openmw/mwworld/failedaction.cpp
Normal file
21
apps/openmw/mwworld/failedaction.cpp
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#include "failedaction.hpp"
|
||||||
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
#include "../mwbase/windowmanager.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
namespace MWWorld
|
||||||
|
{
|
||||||
|
FailedAction::FailedAction (const std::string& msg) : Action (false), message(msg)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
|
||||||
|
void FailedAction::executeImp (const Ptr& actor)
|
||||||
|
{
|
||||||
|
if ( actor.getRefData().getHandle()=="player" and !(message.empty()))
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWindowManager() ->messageBox(message, std::vector<std::string>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
20
apps/openmw/mwworld/failedaction.hpp
Normal file
20
apps/openmw/mwworld/failedaction.hpp
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#ifndef GAME_MWWORLD_FAILEDACTION_H
|
||||||
|
#define GAME_MWWORLD_FAILEDACTION_H
|
||||||
|
|
||||||
|
#include "action.hpp"
|
||||||
|
#include "ptr.hpp"
|
||||||
|
|
||||||
|
namespace MWWorld
|
||||||
|
{
|
||||||
|
class FailedAction : public Action
|
||||||
|
{
|
||||||
|
std::string message;
|
||||||
|
|
||||||
|
virtual void executeImp (const Ptr& actor);
|
||||||
|
|
||||||
|
public:
|
||||||
|
FailedAction (const std::string& message = std::string());
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in a new issue