forked from teamnwah/openmw-tes3coop
Issue #777: Move DrawState to CreatureStats. All creatures can cast spells, and some creatures have weapons.
This commit is contained in:
parent
947b6c9645
commit
69ca03c308
5 changed files with 19 additions and 22 deletions
|
@ -7,8 +7,7 @@
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/mechanicsmanager.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
#include "../mwbase/dialoguemanager.hpp"
|
#include "../mwbase/dialoguemanager.hpp"
|
||||||
#include "../mwmechanics/npcstats.hpp"
|
#include "creaturestats.hpp"
|
||||||
|
|
||||||
#include <OgreVector3.h>
|
#include <OgreVector3.h>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
@ -66,8 +65,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
bool AiWander::execute (const MWWorld::Ptr& actor,float duration)
|
bool AiWander::execute (const MWWorld::Ptr& actor,float duration)
|
||||||
{
|
{
|
||||||
if (actor.getClass().isNpc())
|
actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Nothing);
|
||||||
actor.getClass().getNpcStats(actor).setDrawState(DrawState_Nothing);
|
|
||||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
if(mDuration)
|
if(mDuration)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace MWMechanics
|
||||||
mAttackingOrSpell(false), mAttackType(AT_Chop),
|
mAttackingOrSpell(false), mAttackType(AT_Chop),
|
||||||
mIsWerewolf(false),
|
mIsWerewolf(false),
|
||||||
mFallHeight(0), mRecalcDynamicStats(false), mKnockdown(false), mHitRecovery(false),
|
mFallHeight(0), mRecalcDynamicStats(false), mKnockdown(false), mHitRecovery(false),
|
||||||
mMovementFlags(0)
|
mMovementFlags(0), mDrawState (DrawState_Nothing)
|
||||||
{
|
{
|
||||||
for (int i=0; i<4; ++i)
|
for (int i=0; i<4; ++i)
|
||||||
mAiSettings[i] = 0;
|
mAiSettings[i] = 0;
|
||||||
|
@ -452,4 +452,14 @@ namespace MWMechanics
|
||||||
return false; // shut up, compiler
|
return false; // shut up, compiler
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DrawState_ CreatureStats::getDrawState() const
|
||||||
|
{
|
||||||
|
return mDrawState;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreatureStats::setDrawState(DrawState_ state)
|
||||||
|
{
|
||||||
|
mDrawState = state;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "spells.hpp"
|
#include "spells.hpp"
|
||||||
#include "activespells.hpp"
|
#include "activespells.hpp"
|
||||||
#include "aisequence.hpp"
|
#include "aisequence.hpp"
|
||||||
|
#include "drawstate.hpp"
|
||||||
|
|
||||||
namespace MWMechanics
|
namespace MWMechanics
|
||||||
{
|
{
|
||||||
|
@ -18,6 +19,7 @@ namespace MWMechanics
|
||||||
///
|
///
|
||||||
class CreatureStats
|
class CreatureStats
|
||||||
{
|
{
|
||||||
|
DrawState_ mDrawState;
|
||||||
AttributeValue mAttributes[8];
|
AttributeValue mAttributes[8];
|
||||||
DynamicStat<float> mDynamic[3]; // health, magicka, fatigue
|
DynamicStat<float> mDynamic[3]; // health, magicka, fatigue
|
||||||
int mLevel;
|
int mLevel;
|
||||||
|
@ -57,6 +59,9 @@ namespace MWMechanics
|
||||||
public:
|
public:
|
||||||
CreatureStats();
|
CreatureStats();
|
||||||
|
|
||||||
|
DrawState_ getDrawState() const;
|
||||||
|
void setDrawState(DrawState_ state);
|
||||||
|
|
||||||
bool needToRecalcDynamicStats();
|
bool needToRecalcDynamicStats();
|
||||||
|
|
||||||
void addToFallHeight(float height);
|
void addToFallHeight(float height);
|
||||||
|
|
|
@ -22,8 +22,7 @@
|
||||||
#include "../mwbase/soundmanager.hpp"
|
#include "../mwbase/soundmanager.hpp"
|
||||||
|
|
||||||
MWMechanics::NpcStats::NpcStats()
|
MWMechanics::NpcStats::NpcStats()
|
||||||
: mDrawState (DrawState_Nothing)
|
: mBounty (0)
|
||||||
, mBounty (0)
|
|
||||||
, mLevelProgress(0)
|
, mLevelProgress(0)
|
||||||
, mDisposition(0)
|
, mDisposition(0)
|
||||||
, mReputation(0)
|
, mReputation(0)
|
||||||
|
@ -36,16 +35,6 @@ MWMechanics::NpcStats::NpcStats()
|
||||||
mSkillIncreases.resize (ESM::Attribute::Length, 0);
|
mSkillIncreases.resize (ESM::Attribute::Length, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
MWMechanics::DrawState_ MWMechanics::NpcStats::getDrawState() const
|
|
||||||
{
|
|
||||||
return mDrawState;
|
|
||||||
}
|
|
||||||
|
|
||||||
void MWMechanics::NpcStats::setDrawState (DrawState_ state)
|
|
||||||
{
|
|
||||||
mDrawState = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
float MWMechanics::NpcStats::getAttackStrength() const
|
float MWMechanics::NpcStats::getAttackStrength() const
|
||||||
{
|
{
|
||||||
return mAttackStrength;
|
return mAttackStrength;
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "stat.hpp"
|
#include "stat.hpp"
|
||||||
#include "drawstate.hpp"
|
|
||||||
|
|
||||||
#include "creaturestats.hpp"
|
#include "creaturestats.hpp"
|
||||||
|
|
||||||
|
@ -30,7 +29,6 @@ namespace MWMechanics
|
||||||
/// \note the faction key must be in lowercase
|
/// \note the faction key must be in lowercase
|
||||||
std::map<std::string, int> mFactionRank;
|
std::map<std::string, int> mFactionRank;
|
||||||
|
|
||||||
DrawState_ mDrawState;
|
|
||||||
int mDisposition;
|
int mDisposition;
|
||||||
SkillValue mSkill[27];
|
SkillValue mSkill[27];
|
||||||
SkillValue mWerewolfSkill[27];
|
SkillValue mWerewolfSkill[27];
|
||||||
|
@ -61,9 +59,6 @@ namespace MWMechanics
|
||||||
int getProfit() const;
|
int getProfit() const;
|
||||||
void modifyProfit(int diff);
|
void modifyProfit(int diff);
|
||||||
|
|
||||||
DrawState_ getDrawState() const;
|
|
||||||
void setDrawState (DrawState_ state);
|
|
||||||
|
|
||||||
/// When attacking, stores how strong the attack should be (0 = weakest, 1 = strongest)
|
/// When attacking, stores how strong the attack should be (0 = weakest, 1 = strongest)
|
||||||
float getAttackStrength() const;
|
float getAttackStrength() const;
|
||||||
void setAttackStrength(float value);
|
void setAttackStrength(float value);
|
||||||
|
|
Loading…
Reference in a new issue