animate idle creatures

This commit is contained in:
Eduardo Bart 2012-02-02 21:23:51 -02:00
parent 30330d1d2e
commit fa915e088c
2 changed files with 5 additions and 0 deletions

View File

@ -96,6 +96,10 @@ void Creature::draw(const Point& dest, float scaleFactor, bool animate)
// outfit is a real creature
if(m_outfit.getCategory() == ThingsType::Creature) {
int animationPhase = animate ? m_walkAnimationPhase : 0;
if(isAnimateAlways()) {
int ticksPerFrame = 1000 / getAnimationPhases();
animationPhase = (g_clock.ticks() % (ticksPerFrame * getAnimationPhases())) / ticksPerFrame;
}
// xPattern => creature direction
if(m_direction == Otc::NorthEast || m_direction == Otc::SouthEast)

View File

@ -83,6 +83,7 @@ public:
bool isHookSouth() { return m_type->properties[ThingType::HookSouth]; }
bool isHookEast() { return m_type->properties[ThingType::HookEast]; }
bool isStackable() { return m_type->properties[ThingType::IsStackable]; }
bool isAnimateAlways() { return m_type->properties[ThingType::AnimateAlways]; }
bool isLyingCorpse() { return m_type->properties[ThingType::IsLyingCorpse]; }
bool blocksProjectile() { return m_type->properties[ThingType::BlockProjectile]; }
bool isFluid() { return m_type->properties[ThingType::IsFluid]; }