From 608e5a03318290661f1730238a484b8d73181ffc Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Mon, 29 Aug 2011 21:40:52 -0300 Subject: [PATCH] alternate walk animation --- src/otclient/core/creature.cpp | 6 ++++-- src/otclient/core/creature.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/otclient/core/creature.cpp b/src/otclient/core/creature.cpp index ca342b68..0e247ee1 100644 --- a/src/otclient/core/creature.cpp +++ b/src/otclient/core/creature.cpp @@ -36,6 +36,7 @@ Creature::Creature() : Thing(Otc::Creature) m_walking = false; m_walkOffsetX = 0; m_walkOffsetY = 0; + m_walkCount = 0; m_informationFont = g_fonts.getFont("tibia-12px-rounded"); } @@ -124,8 +125,7 @@ void Creature::draw(int x, int y) else if(m_direction == Otc::West || m_direction == Otc::NorthWest || m_direction == Otc::SouthWest) m_walkOffsetX = std::max(m_walkOffsetX - pixelsWalked, 0); - int walkOffset = std::max(fabs(m_walkOffsetX), fabs(m_walkOffsetY)); - + int walkOffset = std::max(std::abs(m_walkOffsetX), std::abs(m_walkOffsetY)); if(walkOffset % 8 == 0) { if(m_animation+1 == attributes.animcount) m_animation = 1; @@ -251,6 +251,8 @@ void Creature::walk(const Position& position) m_walkTimePerPixel = walkTime / 32.0; m_lastTicks = g_platform.getTicks(); + m_walkCount++; + m_animation = (m_walkCount % 2) + 1; } void Creature::setHealthPercent(uint8 healthPercent) diff --git a/src/otclient/core/creature.h b/src/otclient/core/creature.h index 272c0214..95c7a316 100644 --- a/src/otclient/core/creature.h +++ b/src/otclient/core/creature.h @@ -92,6 +92,7 @@ private: Color m_informationColor; int m_lastTicks; + int m_walkCount; bool m_walking; float m_walkTimePerPixel; Position m_walkingFromPosition;