This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: [SOLVED] Playable Animations Lookup ?  (Read 1486 times)

spik96

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 275
    • View Profile
[SOLVED] Playable Animations Lookup ?
« on: June 12, 2015, 03:12:43 pm »
Hi !
Back in the BC days, there was a table in M2 where information about which animation the game should play and some flags. Wiki : http://www.wowdev.wiki/index.php ... ion_Lookup

For example, for models who did not have a sprint animation, you could say just use the run animation with this table.

Now, in 3.3.5a LK m2, I don't know where this is stored or how to do that.
Do you ?
« Last Edit: June 13, 2015, 01:18:41 pm by Admin »
Github ]https://github.com/Koward[/url]    Skype : koward723 =)

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [QUESTION] Playable Animations Lookup ?
« Reply #1 on: June 12, 2015, 06:07:46 pm »
I'm sorry, but I don't think they exist anymore. I wouldn't know of it at least.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

spik96

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 275
    • View Profile
Re: [QUESTION] Playable Animations Lookup ?
« Reply #2 on: June 12, 2015, 06:26:19 pm »
But how does that work for the client ? How can know which animation to play ?

This block had a purpose. Its functions are still needed, there must be something equal.
How does the Loot animation work ? There is only one of them, yet it was used by three animations (1 was hold, and the other was a looped back). It's still in the game, so something must say it to the client.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Github ]https://github.com/Koward[/url]    Skype : koward723 =)

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [QUESTION] Playable Animations Lookup ?
« Reply #3 on: June 12, 2015, 07:45:41 pm »
Is there really only one animation that is exactly played in reverse? My guess would have been that they just duplicated the animations when that block was reusing one.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

spik96

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 275
    • View Profile
Re: [QUESTION] Playable Animations Lookup ?
« Reply #4 on: June 12, 2015, 08:43:36 pm »
Quote from: "schlumpf"
Is there really only one animation that is exactly played in reverse? My guess would have been that they just duplicated the animations when that block was reusing one.
There is only one animation, at least for HumanMale.M2. The animation Loot at index 19 is the only one and it's used for the 3 loot anims in game.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Github ]https://github.com/Koward[/url]    Skype : koward723 =)

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [QUESTION] Playable Animations Lookup ?
« Reply #5 on: June 13, 2015, 12:29:06 am »
animkits, it seems. I have no idea how they work though and didn't understand for four hours.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

spik96

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 275
    • View Profile
Re: [QUESTION] Playable Animations Lookup ?
« Reply #6 on: June 13, 2015, 09:40:13 am »
Thanks anyway Schlumpf.
Hmm AnimKits, where did you get that name from ?

If there is absolutely no way I'll just make a function where it assigns the "most suitable" animation for an action.

I think the playable lookup doesn't map directly from the global animation list like the wiki says but from the animation lookup, which still exists today and is used as a link between "physical" positions in the global animation list and Animation List and their ID. The Playable lookup then link between IDs and real actions, there are always 203 of them.

Sometimes I see the model don't even have the AnimLookup anymore (it's just a 0..) but it's easy to create it (its length is max{AnimIDs}+1 and then you go through the Animations and then AnimLookup[AnimID]=current "for" Index.
When it's done I could make the mapping..
Example for Drowned (AnimID 132 in AnimationData.DBC) :
Code: [Select]
//First I make an int array with valid (Not == -1 in Anim lookup) AnimIDs in it
//then I start to map
if(131 in AnimIDs){
    ID=131;//131 is Drown
} else {
    ID=0;
}
Flag=3;//3 means Freeze which is what happens with Drowned as you don't move after

It would be a bit artificial as it was originally done by hand but it would works...
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Github ]https://github.com/Koward[/url]    Skype : koward723 =)

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [QUESTION] Playable Animations Lookup ?
« Reply #7 on: June 13, 2015, 10:37:54 am »
I got that from the client. The animations/animkits are hardcoded in looting.

Code: [Select]
void CGUnit_C::UpdateLootAnimKit (int desired)
{
  uint current_state = this->current_anim_kit ? this->current_anim_kit->GetID() : 0;
  uint new_state;
  if ( this->IsLooting() && this->ShouldKneelForLoot() )
  {
    new_state = (desired == 0 && current_state > 203) ? 204 : 202;
  }
  else
  {
    new_state = current_state == 202 ? 204 : 0;
  }
  if ( current_state != new_state )
  {
    if ( this->current_anim_kit )
    {
      this->current_anim_kit->SetStopCallback (0LL, 0LL);
      this->current_anim_kit->Stop (1, 0LL);
      this->current_anim_kit->Release();
    }
    if ( new_state )
    {
      this->current_anim_kit = this->animKitManager->PlayAndMaintain
        (new_state, (ANIMATIONDATAENUM)-1, 0LL);
      if ( this->current_anim_kit )
      {
        this->current_anim_kit->SetStopCallback
          (&UnitCallbacks::LootAnimKitStopCallback, this->field_2050);
      }
    }
    else
    {
      this->current_anim_kit = 0LL;
    }
  }
}
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

spik96

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 275
    • View Profile
Re: [QUESTION] Playable Animations Lookup ?
« Reply #8 on: June 13, 2015, 11:41:46 am »
A decompiled client... you're cheating x). I wonder how they haven't leaked on the Web somewhere.

Okay so they probably hardcoded it in LK as they realized the logic was always the same for each model.
There is also probably a "death" function too handling death and drowning (they are the same but with different flags, like for loot) and other actions with similar mechanics.
I should have no difficulty to reproduce this logic with the method I described a bit above.

Thanks a lot.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Github ]https://github.com/Koward[/url]    Skype : koward723 =)

schlumpf

  • Administrator
  • Creator of Worlds
  • *****
  • Posts: 2967
    • View Profile
Re: [QUESTION] Playable Animations Lookup ?
« Reply #9 on: June 13, 2015, 11:54:44 am »
Seeing as I spent about 5 hours to get to the point of being able to show you that code with confidence, I don't think it qualifies as cheating too much.

In addition to hardcoded animkits, there is also fallbacks for some in dbcs: flystand, flyhover, flyshuffleleft/right, flymount, flyfly, flydrown, flydrowned, open, close, opened, closed.

Other hardcoded kits contain mountride, some on charselection, looking at something, something for spell effects (81 and 125), wheels (139Fh, 13A1h, 13A2h, 13A3h, 13A4h, 13A5h, 13A6h, 13A7h), movement (29h, 29h, 2Ah, 2Ch, 2Bh, 2Dh, 12Dh), combatReady (56h, 8Dh, 8Eh), standState (0B5h, 0B6h, 0B7h, 0B8h, 0B9h, 0BAh), emotes (4B7h, 4B6h, 0CDh, 0CEh, 550h, 54Fh, 54Dh, 54Eh), raid markers, … and really a shitload more.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

spik96

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 275
    • View Profile
Re: [QUESTION] Playable Animations Lookup ?
« Reply #10 on: June 13, 2015, 12:39:29 pm »
Quote from: "schlumpf"
Seeing as I spent about 5 hours to get to the point of being able to show you that code with confidence, I don't think it qualifies as cheating too much.
I'm sorry, that was friendly humor on the spot. I never meant to undermine your work. The source you have, while it is probably massively useful, I understand it still requires a lot of time studying it to extract useful information.
I'm eternally grateful for it, for all of your work on the Wiki and all the knowledge you brought for the modding scene in general.
Given the amount of times I see your name on the documentation pages and on the thanks lists of Modding programs, this community owes you everything.


Quote from: "schlumpf"
In addition to hardcoded animkits, there is also fallbacks for some in dbcs: flystand, flyhover, flyshuffleleft/right, flymount, flyfly, flydrown, flydrowned, open, close, opened, closed.
Now that you say, the PlayableAnimationLookup was previously (years ago) named FallbackLookup so I guess it's a mix of both hardcoded kits and fallbacks. I will have to look which one were recognized by TBC (for example, wheels did not exist).
So far I have :
Code: [Select]
Note : This apply only when there is no real animation for the action.
Flag | Name | AnimID | From
3 Dead 6 Death
0 CombatCritical 10 CombatWound
1 Walkbackwards 13 Walk
1 SwimBackwards 45 Swim
3 SitGround 97 Sit
3 Sleep 100 SleepDown
1 SleepUp 101 SleepDown
3 KneelLoop 115 Kneel
3 UseStandingLoop 123 Stand
3 Drowned 132 Drown
0 JumpLandRun 187 Run
3 LootHold 188 Loot
1 LootUp 189 Loot

For the others, the flag is always 0 and the default ID is 0 (Stand).

It will take time to find all of them, but it will works.
EDIT : In fact even Loot&others are in AnimationData.dbc in the fallback column, so it's really just about it.
A little recursive function should be able to give me the ID I can use in no time, the end being a ping pong between Open/148 and Close/146 which I'll have to break.
Code: [Select]
short Fallback[226];
//*Extract Fallback IDs from the DBC or put them by hand in the Fallback array*
short getTrueID(short ID){
    if(ID in AnimIDs){
        return ID;
    } return getTrueID(Fallback[ID]);
}
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
Github ]https://github.com/Koward[/url]    Skype : koward723 =)