Store an animation object in the character controller

actorid
Chris Robinson 12 years ago
parent 63e685ea39
commit b378bc92a0

@ -165,11 +165,12 @@ namespace MWMechanics
void Actors::addActor (const MWWorld::Ptr& ptr)
{
MWRender::Animation *anim = MWBase::Environment::get().getWorld()->getAnimation(ptr);
if(!MWWorld::Class::get(ptr).getCreatureStats(ptr).isDead())
mActors.insert(std::make_pair(ptr, CharacterController(ptr, CharState_Idle)));
mActors.insert(std::make_pair(ptr, CharacterController(ptr, anim, CharState_Idle)));
else
{
mActors.insert(std::make_pair(ptr, CharacterController(ptr, CharState_Dead)));
mActors.insert(std::make_pair(ptr, CharacterController(ptr, anim, CharState_Dead)));
MWBase::Environment::get().getWorld()->playAnimationGroup (ptr, "death1", 2);
}
}

@ -3,6 +3,11 @@
#include "../mwworld/ptr.hpp"
namespace MWRender
{
class Animation;
}
namespace MWMechanics
{
@ -14,12 +19,13 @@ enum CharacterState {
class CharacterController
{
MWWorld::Ptr mPtr;
MWRender::Animation *mAnimation;
CharacterState mState;
public:
CharacterController(const MWWorld::Ptr &ptr, CharacterState state)
: mPtr(ptr), mState(state)
CharacterController(const MWWorld::Ptr &ptr, MWRender::Animation *anim, CharacterState state)
: mPtr(ptr), mAnimation(anim), mState(state)
{ }
CharacterState getState() const

Loading…
Cancel
Save