1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 13:23:53 +00:00

added a 'backend' for NPC/Player draw state

This commit is contained in:
Aleksandar Jovanov 2012-04-08 12:25:33 +02:00
parent d5b8d4ef49
commit b1259ca15c
4 changed files with 26 additions and 5 deletions

View file

@ -0,0 +1,11 @@
#ifndef GAME_MWMECHANICS_DRAWSTATE_H
#define GAME_MWMECHANICS_DRAWSTATE_H
enum DrawState
{
DrawState_Weapon,
DrawState_Spell,
DrawState_Nothing
}
#endif

View file

@ -4,13 +4,13 @@
#include <map>
#include "stat.hpp"
#include "drawstate.hpp"
namespace MWMechanics
{
/// \brief Additional stats for NPCs
///
/// For non-NPC-specific stats, see the CreatureStats struct.
struct NpcStats
{
// 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 mSneak;
bool mCombat;
DrawState mDrawState;
NpcStats() : mForceRun (false), mForceSneak (false), mRun (false), mSneak (false),
mCombat (false) {}
mCombat (false) , mDrawState(DrawState::DrawState_Nothing) {}
};
}

View file

@ -12,7 +12,7 @@ namespace MWWorld
{
Player::Player (MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world) :
mCellStore (0), mRenderer (renderer), mWorld (world), mClass (0),
mAutoMove (false), mForwardBackward (0)
mAutoMove (false), mForwardBackward (0) , mDrawState(DrawState_Nothing)
{
mPlayer.base = player;
mPlayer.ref.refID = "player";
@ -47,7 +47,10 @@ namespace MWWorld
delete mClass;
mClass = new_class;
}
void Player::setDrawState(const DrawState& value)
{
mDrawState = value;
}
void Player::setAutoMove (bool enable)
{
MWWorld::Ptr ptr = getPlayer();

View file

@ -8,6 +8,8 @@
#include "../mwworld/refdata.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwmechanics/drawstate.hpp"
namespace MWRender
{
class Player;
@ -31,7 +33,7 @@ namespace MWWorld
ESM::Class *mClass;
bool mAutoMove;
int mForwardBackward;
DrawState mDrawState;
public:
Player(MWRender::Player *renderer, const ESM::NPC *player, MWWorld::World& world);
@ -76,6 +78,8 @@ namespace MWWorld
void setClass (const ESM::Class& class_);
void setDrawState(const DrawState& state);
std::string getName() const
{
return mName;
@ -106,6 +110,8 @@ namespace MWWorld
return mAutoMove;
}
DrawState getDrawState() { return mDrawState; }
void setAutoMove (bool enable);
void setLeftRight (int value);