forked from mirror/openmw-tes3mp
implemented npc/creature activation (enters dialog gui mode for now)
This commit is contained in:
parent
8e6a765603
commit
09c42589cc
7 changed files with 61 additions and 0 deletions
|
@ -81,6 +81,7 @@ set(GAMEWORLD
|
|||
mwworld/globals.cpp
|
||||
mwworld/class.cpp
|
||||
mwworld/actionteleport.cpp
|
||||
mwworld/actiontalk.cpp
|
||||
)
|
||||
set(GAMEWORLD_HEADER
|
||||
mwworld/refdata.hpp
|
||||
|
@ -92,6 +93,7 @@ set(GAMEWORLD_HEADER
|
|||
mwworld/action.hpp
|
||||
mwworld/nullaction.hpp
|
||||
mwworld/actionteleport.hpp
|
||||
mwworld/actiontalk.hpp
|
||||
)
|
||||
source_group(apps\\openmw\\mwworld FILES ${GAMEWORLD} ${GAMEWORLD_HEADER})
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../mwmechanics/creaturestats.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontalk.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
|
@ -44,6 +45,12 @@ namespace MWClass
|
|||
return *ptr.getRefData().getCreatureStats();
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Creature::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||
{
|
||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::ActionTalk (ptr));
|
||||
}
|
||||
|
||||
std::string Creature::getScript (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
|
||||
|
|
|
@ -16,6 +16,10 @@ namespace MWClass
|
|||
virtual MWMechanics::CreatureStats& getCreatureStats (const MWWorld::Ptr& ptr) const;
|
||||
///< Return creature stats
|
||||
|
||||
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
||||
///< Generate action for activation
|
||||
|
||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||
///< Return name of the script attached to ptr
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../mwmechanics/creaturestats.hpp"
|
||||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontalk.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
|
@ -44,6 +45,12 @@ namespace MWClass
|
|||
return *ptr.getRefData().getCreatureStats();
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Npc::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||
{
|
||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::ActionTalk (ptr));
|
||||
}
|
||||
|
||||
std::string Npc::getScript (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
|
||||
|
|
|
@ -16,6 +16,10 @@ namespace MWClass
|
|||
virtual MWMechanics::CreatureStats& getCreatureStats (const MWWorld::Ptr& ptr) const;
|
||||
///< Return creature stats
|
||||
|
||||
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const;
|
||||
///< Generate action for activation
|
||||
|
||||
virtual std::string getScript (const MWWorld::Ptr& ptr) const;
|
||||
///< Return name of the script attached to ptr
|
||||
|
||||
|
|
16
apps/openmw/mwworld/actiontalk.cpp
Normal file
16
apps/openmw/mwworld/actiontalk.cpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
|
||||
#include "actiontalk.hpp"
|
||||
|
||||
#include "environment.hpp"
|
||||
|
||||
#include "../mwgui/window_manager.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
ActionTalk::ActionTalk (const Ptr& actor) : mActor (actor) {}
|
||||
|
||||
void ActionTalk::execute (Environment& environment)
|
||||
{
|
||||
environment.mWindowManager->setMode (MWGui::GM_Dialogue);
|
||||
}
|
||||
}
|
21
apps/openmw/mwworld/actiontalk.hpp
Normal file
21
apps/openmw/mwworld/actiontalk.hpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef GAME_MWWORLD_ACTIONTALK_H
|
||||
#define GAME_MWWORLD_ACTIONTALK_H
|
||||
|
||||
#include "ptr.hpp"
|
||||
#include "action.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class ActionTalk : public Action
|
||||
{
|
||||
Ptr mActor;
|
||||
|
||||
public:
|
||||
|
||||
ActionTalk (const Ptr& actor);
|
||||
|
||||
virtual void execute (Environment& environment);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue