1
0
forked from 0ad/0ad

Switch to the running animation only above a certain ratio of the walk speed.

Following D3221/38c3827d3b, units switch to the 'run' animation when
moving faster than their walkspeed.
This makes formations 'flickery' because units often move slightly
faster than their walkspeed when the formation rotate slightly, which
happens often. It looks fairly bad.

This switches to the running animation halfway through, though a more
general system would be more desirable.


Approved By: Angen
Reviewed By: bb
Differential Revision: https://code.wildfiregames.com/D3224
This was SVN commit r24456.
This commit is contained in:
wraitii 2020-12-27 08:07:10 +00:00
parent 1e8299dcdb
commit d7caa91420

View File

@ -1068,11 +1068,11 @@ void CCmpUnitMotion::UpdateMovementState(entity_pos_t speed)
if (cmpObstruction)
cmpObstruction->SetMovingFlag(true);
if (cmpVisual)
cmpVisual->SelectMovementAnimation(speed > m_WalkSpeed ? "run" : "walk", speed);
cmpVisual->SelectMovementAnimation(speed > (m_WalkSpeed / 2).Multiply(m_RunMultiplier + fixed::FromInt(1)) ? "run" : "walk", speed);
}
// Speed change, update the visual actor if necessary.
else if (speed != m_CurSpeed && cmpVisual)
cmpVisual->SelectMovementAnimation(speed > m_WalkSpeed ? "run" : "walk", speed);
cmpVisual->SelectMovementAnimation(speed > (m_WalkSpeed / 2).Multiply(m_RunMultiplier + fixed::FromInt(1)) ? "run" : "walk", speed);
m_CurSpeed = speed;
}