Page MenuHomeWildfire Games

Immediately use new variant when only the variant changes in an animation
ClosedPublic

Authored by bb on Feb 23 2018, 12:19 AM.

Details

Summary

As noticed in D1239 units can slide a bit when changing the variant without changing the animation, the issue was tracked down a bit by temple:

The issue is that if the animation names are the same (which they are here, both walk), then it doesn't update the animation id right away (in SetAnimationState of UnitAnimation.cpp). E.g. carry_food doesn't have an id for walk but base_hoplite has walk1 and walk2. So then switching from walking & fighting (which uses hoplite) to walking (which uses carry) tries to find the old walk1 or walk2 id which doesn't exist, so it uses the idle animation by default, hence the gliding for a second or two before the animation id's finally updated. However, if there's no id then it takes all possible animations (in GetAnimations of ObjectEntry.cpp) so going from walking (using carry) to attacking (using hoplite) is okay. Women's walk doesn't have an id so there's no problem switching between walking & fighting and walking.

So we probably need some way to update the animation id earlier.

But beside the ID, we need to reload the animation also.

Test Plan

apply D1239 and follow:

gather something with a male
ctrl+click him away (so resources are shown)
while he is still walking, order him back to gather

and see it is gone

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

bb created this revision.Feb 23 2018, 12:19 AM
Owners added subscribers: Restricted Owners Package, Restricted Owners Package.Feb 23 2018, 12:19 AM
temple accepted this revision.Feb 23 2018, 12:35 AM

Looks good, thanks bb.

source/graphics/UnitAnimation.h
1 ↗(On Diff #5885)

bump years

This revision is now accepted and ready to land.Feb 23 2018, 12:35 AM

"Looks good" as in I think it reads correct, and I applied the patch and verified that animations are now correct, e.g. walking shows resources while walking & fighting doesn't, and both are walking animations. (On the other hand, I still don't 100% understand all the animation stuff.)

Vulcan added a subscriber: Vulcan.Feb 23 2018, 4:36 AM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/differential/74/display/redirect

bb added a comment.Feb 23 2018, 9:00 PM

Well I think you are just as much understanding it as I do :P
thx for the review

This revision was automatically updated to reflect the committed changes.
elexis added a subscriber: elexis.Feb 23 2018, 9:14 PM

(famous last words)