Commit 09c42589 authored by Marc Zinnschlag's avatar Marc Zinnschlag

implemented npc/creature activation (enters dialog gui mode for now)

parent 8e6a7656
......@@ -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
......
#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);
}
}
#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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment