mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-22 03:53:54 +00:00
added a 'backend' for NPC/Player draw state
This commit is contained in:
parent
d5b8d4ef49
commit
b1259ca15c
4 changed files with 26 additions and 5 deletions
11
apps/openmw/mwmechanics/drawstate.hpp
Normal file
11
apps/openmw/mwmechanics/drawstate.hpp
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#ifndef GAME_MWMECHANICS_DRAWSTATE_H
|
||||||
|
#define GAME_MWMECHANICS_DRAWSTATE_H
|
||||||
|
|
||||||
|
enum DrawState
|
||||||
|
{
|
||||||
|
DrawState_Weapon,
|
||||||
|
DrawState_Spell,
|
||||||
|
DrawState_Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -4,13 +4,13 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "stat.hpp"
|
#include "stat.hpp"
|
||||||
|
#include "drawstate.hpp"
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
/// \brief Additional stats for NPCs
|
/// \brief Additional stats for NPCs
|
||||||
///
|
///
|
||||||
/// For non-NPC-specific stats, see the CreatureStats struct.
|
/// For non-NPC-specific stats, see the CreatureStats struct.
|
||||||
|
|
||||||
struct NpcStats
|
struct NpcStats
|
||||||
{
|
{
|
||||||
// NPCs other than the player can only have one faction. But for the sake of consistency
|
// NPCs other than the player can only have one faction. But for the sake of consistency
|
||||||
|
@ -24,9 +24,10 @@ namespace MWMechanics
|
||||||
bool mRun;
|
bool mRun;
|
||||||
bool mSneak;
|
bool mSneak;
|
||||||
bool mCombat;
|
bool mCombat;
|
||||||
|
DrawState mDrawState;
|
||||||
|
|
||||||
NpcStats() : mForceRun (false), mForceSneak (false), mRun (false), mSneak (false),
|
NpcStats() : mForceRun (false), mForceSneak (false), mRun (false), mSneak (false),
|
||||||
mCombat (false) {}
|
mCombat (false) , mDrawState(DrawState::DrawState_Nothing) {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
Player::Player (MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world) :
|
Player::Player (MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world) :
|
||||||
mCellStore (0), mRenderer (renderer), mWorld (world), mClass (0),
|
mCellStore (0), mRenderer (renderer), mWorld (world), mClass (0),
|
||||||
mAutoMove (false), mForwardBackward (0)
|
mAutoMove (false), mForwardBackward (0) , mDrawState(DrawState_Nothing)
|
||||||
{
|
{
|
||||||
mPlayer.base = player;
|
mPlayer.base = player;
|
||||||
mPlayer.ref.refID = "player";
|
mPlayer.ref.refID = "player";
|
||||||
|
@ -47,7 +47,10 @@ namespace MWWorld
|
||||||
delete mClass;
|
delete mClass;
|
||||||
mClass = new_class;
|
mClass = new_class;
|
||||||
}
|
}
|
||||||
|
void Player::setDrawState(const DrawState& value)
|
||||||
|
{
|
||||||
|
mDrawState = value;
|
||||||
|
}
|
||||||
void Player::setAutoMove (bool enable)
|
void Player::setAutoMove (bool enable)
|
||||||
{
|
{
|
||||||
MWWorld::Ptr ptr = getPlayer();
|
MWWorld::Ptr ptr = getPlayer();
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include "../mwworld/refdata.hpp"
|
#include "../mwworld/refdata.hpp"
|
||||||
#include "../mwworld/ptr.hpp"
|
#include "../mwworld/ptr.hpp"
|
||||||
|
|
||||||
|
#include "../mwmechanics/drawstate.hpp"
|
||||||
|
|
||||||
namespace MWRender
|
namespace MWRender
|
||||||
{
|
{
|
||||||
class Player;
|
class Player;
|
||||||
|
@ -31,7 +33,7 @@ namespace MWWorld
|
||||||
ESM::Class *mClass;
|
ESM::Class *mClass;
|
||||||
bool mAutoMove;
|
bool mAutoMove;
|
||||||
int mForwardBackward;
|
int mForwardBackward;
|
||||||
|
DrawState mDrawState;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Player(MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world);
|
Player(MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world);
|
||||||
|
@ -76,6 +78,8 @@ namespace MWWorld
|
||||||
|
|
||||||
void setClass (const ESM::Class& class_);
|
void setClass (const ESM::Class& class_);
|
||||||
|
|
||||||
|
void setDrawState(const DrawState& state);
|
||||||
|
|
||||||
std::string getName() const
|
std::string getName() const
|
||||||
{
|
{
|
||||||
return mName;
|
return mName;
|
||||||
|
@ -106,6 +110,8 @@ namespace MWWorld
|
||||||
return mAutoMove;
|
return mAutoMove;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DrawState getDrawState() { return mDrawState; }
|
||||||
|
|
||||||
void setAutoMove (bool enable);
|
void setAutoMove (bool enable);
|
||||||
|
|
||||||
void setLeftRight (int value);
|
void setLeftRight (int value);
|
||||||
|
|
Loading…
Reference in a new issue