mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-20 22:23:52 +00:00
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/mechanicsmanager.hpp"
|
||||
#include "../mwbase/dialoguemanager.hpp"
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
|
||||
#include "creaturestats.hpp"
|
||||
#include <OgreVector3.h>
|
||||
|
||||
namespace
|
||||
|
@ -66,8 +65,7 @@ namespace MWMechanics
|
|||
|
||||
bool AiWander::execute (const MWWorld::Ptr& actor,float duration)
|
||||
{
|
||||
if (actor.getClass().isNpc())
|
||||
actor.getClass().getNpcStats(actor).setDrawState(DrawState_Nothing);
|
||||
actor.getClass().getCreatureStats(actor).setDrawState(DrawState_Nothing);
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
if(mDuration)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace MWMechanics
|
|||
mAttackingOrSpell(false), mAttackType(AT_Chop),
|
||||
mIsWerewolf(false),
|
||||
mFallHeight(0), mRecalcDynamicStats(false), mKnockdown(false), mHitRecovery(false),
|
||||
mMovementFlags(0)
|
||||
mMovementFlags(0), mDrawState (DrawState_Nothing)
|
||||
{
|
||||
for (int i=0; i<4; ++i)
|
||||
mAiSettings[i] = 0;
|
||||
|
@ -452,4 +452,14 @@ namespace MWMechanics
|
|||
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 "activespells.hpp"
|
||||
#include "aisequence.hpp"
|
||||
#include "drawstate.hpp"
|
||||
|
||||
namespace MWMechanics
|
||||
{
|
||||
|
@ -18,6 +19,7 @@ namespace MWMechanics
|
|||
///
|
||||
class CreatureStats
|
||||
{
|
||||
DrawState_ mDrawState;
|
||||
AttributeValue mAttributes[8];
|
||||
DynamicStat<float> mDynamic[3]; // health, magicka, fatigue
|
||||
int mLevel;
|
||||
|
@ -57,6 +59,9 @@ namespace MWMechanics
|
|||
public:
|
||||
CreatureStats();
|
||||
|
||||
DrawState_ getDrawState() const;
|
||||
void setDrawState(DrawState_ state);
|
||||
|
||||
bool needToRecalcDynamicStats();
|
||||
|
||||
void addToFallHeight(float height);
|
||||
|
|
|
@ -22,8 +22,7 @@
|
|||
#include "../mwbase/soundmanager.hpp"
|
||||
|
||||
MWMechanics::NpcStats::NpcStats()
|
||||
: mDrawState (DrawState_Nothing)
|
||||
, mBounty (0)
|
||||
: mBounty (0)
|
||||
, mLevelProgress(0)
|
||||
, mDisposition(0)
|
||||
, mReputation(0)
|
||||
|
@ -36,16 +35,6 @@ MWMechanics::NpcStats::NpcStats()
|
|||
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
|
||||
{
|
||||
return mAttackStrength;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <vector>
|
||||
|
||||
#include "stat.hpp"
|
||||
#include "drawstate.hpp"
|
||||
|
||||
#include "creaturestats.hpp"
|
||||
|
||||
|
@ -30,7 +29,6 @@ namespace MWMechanics
|
|||
/// \note the faction key must be in lowercase
|
||||
std::map<std::string, int> mFactionRank;
|
||||
|
||||
DrawState_ mDrawState;
|
||||
int mDisposition;
|
||||
SkillValue mSkill[27];
|
||||
SkillValue mWerewolfSkill[27];
|
||||
|
@ -61,9 +59,6 @@ namespace MWMechanics
|
|||
int getProfit() const;
|
||||
void modifyProfit(int diff);
|
||||
|
||||
DrawState_ getDrawState() const;
|
||||
void setDrawState (DrawState_ state);
|
||||
|
||||
/// When attacking, stores how strong the attack should be (0 = weakest, 1 = strongest)
|
||||
float getAttackStrength() const;
|
||||
void setAttackStrength(float value);
|
||||
|
|
Loading…
Reference in a new issue