TFS 1.3 compiled for Windows x64 today +
OTClient - OTLands' Fork compiled for Windows x32 today +
OTClient - OTLand's Fork compiled for Windows x32 today with @Ninja commit, take your own conclusions:
http://www.mediafire.com/file/n2ahhrfd4a38dz9/tfs1.3+++otclient+(animation+fixed).zip
Original OTClient - OTLands' Fork without changes - Streamable (https://streamable.com/95l7x) (walking on Original OTClient - OTLands' Fork)
OTClient - OTLands' Fork with NinjaLulz changes - Streamable (https://streamable.com/j89lw) (walking on OTClient - OTLands' Fork with
@Ninja changes)
I think my screen recorder has bad fps :/
Tested with a level 1 and a level 120, for me its working so much better.
Edit:
Tested with a Tibia 10.98, then with the changed OTClient. The
@Ninja fix is changing sprites a little more fast than normal Tibia.
I'm working on fix that trying different values for footdelay.
My fix, on creature.cpp use this formula to footDelay:
Code:
int footDelay = (getStepDuration(true) / footAnimPhases) * 2;
and
Code:
footDelay = (getStepDuration(true) / footAnimPhases) * 2;
I know this is not the right solution, not all sprites are being used.
Also I think
Code:
if(totalPixelsWalked == 32 && !m_walkFinishAnimEvent) {
should be
Code:
if(totalPixelsWalked >= 32 && !m_walkFinishAnimEvent) {
Shouldnt footDelay be float?
getAnimationPhases() is returning 9, so why do you removed the -1?
shouldnt footSteps be reset?
Edit:
Did 1 sqm walk on client, printed that on terminal, I think its reaaaally smooth now reseting footSteps count.
Code:
ERROR: m_footStep = 1
ERROR: m_walkAnimationPhase = 2
ERROR: m_footStep = 2
ERROR: m_walkAnimationPhase = 3
ERROR: m_footStep = 3
ERROR: m_walkAnimationPhase = 4
ERROR: m_footStep = 4
ERROR: m_walkAnimationPhase = 5
ERROR: m_footStep = 5
ERROR: m_walkAnimationPhase = 6
ERROR: m_footStep = 6
ERROR: m_walkAnimationPhase = 7
ERROR: m_footStep = 7
ERROR: m_walkAnimationPhase = 8
ERROR: m_footStep = 8
ERROR: m_walkAnimationPhase = 1
Code:
void Creature::updateWalkAnimation(int totalPixelsWalked)
{
// update outfit animation
if(m_outfit.getCategory() != ThingCategoryCreature)
return;
int footAnimPhases = getAnimationPhases() - 1;
float footDelay = getStepDuration(true) / footAnimPhases;
// since mount is a different outfit we need to get the mount animation phases
if(m_outfit.getMount() != 0) {
ThingType *type = g_things.rawGetThingType(m_outfit.getMount(), m_outfit.getCategory());
footAnimPhases = type->getAnimationPhases() - 1;
footDelay = getStepDuration(true) / footAnimPhases;
}
if(totalPixelsWalked >= 32 && !m_walkFinishAnimEvent) {
m_footStep = 0;
auto self = static_self_cast<Creature>();
m_walkFinishAnimEvent = g_dispatcher.scheduleEvent([self] {
if(!self->m_walking || self->m_walkTimer.ticksElapsed() >= self->getStepDuration(true))
self->m_walkAnimationPhase = 0;
self->m_walkFinishAnimEvent = nullptr;
}, std::min<int>(footDelay, 200));
}
if(footAnimPhases == 0) {
m_walkAnimationPhase = 0;
}
else if(m_footStepDrawn && m_footTimer.ticksElapsed() >= footDelay && totalPixelsWalked < 32) {
m_footStep++;
m_walkAnimationPhase = m_footStep % footAnimPhases;
m_footStepDrawn = false;
m_footTimer.restart();
}
else if(m_walkAnimationPhase == 0 && totalPixelsWalked < 32) {
m_walkAnimationPhase = m_footStep % footAnimPhases;
}
}
With this function I think its veery near real tibia animation
But it looks like the last frame walking left (when left foot is out of the ground) is skipping a little faster than normal, dont know how to fix. But thats the only issue i guess.