Page MenuHomeWildfire Games

VisualActor GetAnimationName
ClosedPublic

Authored by elexis on Mar 13 2017, 5:27 AM.

Details

Summary

While the code to select an arbitrary animation of an entity exists, the code to read the currently played animation doesn't.

Reading the animation state can be useful if we want to set the animation only if the animation isn't already played.

Used in D204 for example:
If a mischief disrupts the celebration, the unit will chase and kill him, return to the campfire, become idle and play the idle animation.
A timer can select the animation of all idle units, but it shouldn't restart the animation if it is already being played.

Test Plan

Use D204 to verify the validity, potentially print the name with a warn().
Notice we can't mark that function as const because we got some instant crash otherwise (trying to free null pointer or something).

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

elexis created this revision.Mar 13 2017, 5:27 AM
Vulcan added a subscriber: Vulcan.Mar 13 2017, 6:48 AM

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/514/ for more details.

bb accepted this revision.Mar 15 2017, 2:48 PM
bb added a subscriber: bb.

Note that the same code is used in #2577, only naming is changed a bit, but I am fine with these too.

This revision is now accepted and ready to land.Mar 15 2017, 2:48 PM
elexis updated this revision to Diff 799.Mar 15 2017, 3:09 PM

Move GetAnimationName right above SelectAnimation.

elexis requested review of this revision.Mar 15 2017, 3:09 PM
elexis edited edge metadata.
bb accepted this revision.Mar 15 2017, 3:23 PM
This revision is now accepted and ready to land.Mar 15 2017, 3:23 PM
This revision was automatically updated to reflect the committed changes.

So my weird map isn't the sole use case. That point is even more relevant than the review of the code, thanks :-)

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/520/ for more details.