MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / zEntAnimEvent_AutoAnim

Function zEntAnimEvent_AutoAnim

src/SB/Game/zEnt.cpp:596–725  ·  view source on GitHub ↗

This function needs the floats to be replaced with literals and the jumptable to be generated in the right spot.

Source from the content-addressed store, hash-verified

594// This function needs the floats to be replaced with literals
595// and the jumptable to be generated in the right spot.
596void zEntAnimEvent_AutoAnim(zEnt* ent, U32 animEvent, const F32* animParam)
597{
598 xAnimPlay* play = ent->model->Anim;
599 xAnimSingle* single = play->Single;
600
601 switch (animEvent)
602 {
603 case 0xc3:
604 case 0xc4:
605 if (animParam == NULL)
606 {
607 break;
608 }
609
610 S32 anum = (int)*animParam + -1;
611 if (anum < 0 || anum >= 5)
612 {
613 break;
614 }
615
616 xAnimTable* tab1 = ent->model->Anim->Table;
617 if (tab1 == NULL)
618 {
619 break;
620 }
621
622 xAnimState* ast = xAnimTableGetStateID(tab1, g_hash_xentanim[anum]);
623 if (ast == NULL)
624 {
625 break;
626 }
627
628 if (anum != 0)
629 {
630 if (animEvent == 0xc4)
631 {
632 ast->Flags = ast->Flags & 0xffffffdf;
633 ast->Flags = ast->Flags | 0x10;
634 }
635 else
636 {
637 ast->Flags = ast->Flags | 0x20;
638 ast->Flags = ast->Flags & 0xffffffef;
639 }
640 }
641 xAnimPlaySetState(single, ast, 0.0f);
642 single->CurrentSpeed = 1.0f;
643 xAnimPlayUpdate(play, 0.0f);
644 xAnimPlayEval(play);
645 break;
646 case 0xc5:
647 xAnimTable* tab2 = ent->model->Anim->Table;
648 if (tab2 == NULL)
649 {
650 break;
651 }
652
653 xAnimState* ast2 = xAnimTableGetStateID(tab2, g_hash_xentanim[0]);

Callers 1

zEntAnimEventFunction · 0.70

Calls 6

xAnimPlaySetStateFunction · 0.85
xrandFunction · 0.85
xUtil_yesnoFunction · 0.85
xAnimTableGetStateIDFunction · 0.50
xAnimPlayUpdateFunction · 0.50
xAnimPlayEvalFunction · 0.50

Tested by

no test coverage detected