//
// AnimatedGameObject::animationFinished from 0x751ed0 to 0x752d68 (3736 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'AnimatedGameObject::animationFinished @ 0x752d78
// > ??> @ 0x60ba0
// > ??> @ 0x1168538
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void AnimatedGameObject::animationFinished(AnimatedGameObject *a1, const char *a2)
{
char *v4; // x0
_BOOL4 v5; // w21
int m_objectID; // w0
int m_animationID; // w24
char *v8; // x28
unsigned __int64 v9; // x26
unsigned __int64 v10; // x21
size_t v11; // x2
int v12; // w22
__int64 v13; // x21
int v14; // w0
CCAnimatedSprite *v15; // x22
float v16; // s0
int v17; // w0
unsigned int *v18; // x2
int v19; // w1
char *v20; // x27
char *v21; // x28
unsigned __int64 v22; // x21
unsigned __int64 v23; // x26
size_t v24; // x2
int v25; // w22
__int64 v26; // x21
CCAnimatedSprite *v27; // x22
int v28; // w0
char *v29; // x28
unsigned __int64 v30; // x26
unsigned __int64 v31; // x21
size_t v32; // x2
int v33; // w22
__int64 v34; // x21
int v35; // w0
float v36; // s0
size_t v37; // x21
size_t v38; // x5
size_t v39; // x2
int v40; // w26
char *v41; // x3
__int64 v42; // x21
size_t v43; // x5
size_t v44; // x6
size_t v45; // x2
int v46; // w26
char *v47; // x3
CCAnimatedSprite *v48; // x22
int v49; // w26
CCAnimatedSprite *m_animatedSprite; // x22
CCAnimatedSprite *v51; // x22
CCAnimatedSprite *v52; // x22
char *v53; // x26
char *v54; // x3
char *v55; // x4
size_t v56; // x2
_BOOL8 v57; // x2
CCAnimatedSprite *v58; // x22
int v59; // w22
CCAnimatedSprite *v60; // x22
int v61; // w22
CCAnimatedSprite *v62; // x22
int v63; // w0
float v64; // s0
int v65; // w0
int v66; // w0
CCAnimatedSprite *v67; // x22
_QWORD v68[2]; // [xsp+0h] [xbp+0h] BYREF
size_t v69; // [xsp+60h] [xbp+60h]
size_t v70; // [xsp+68h] [xbp+68h]
char *v71; // [xsp+70h] [xbp+70h]
_BYTE *v72; // [xsp+78h] [xbp+78h]
void *v73; // [xsp+B8h] [xbp+B8h] BYREF
void *v74; // [xsp+C0h] [xbp+C0h] BYREF
__int64 v75; // [xsp+C8h] [xbp+C8h] BYREF
__int64 v76; // [xsp+D0h] [xbp+D0h] BYREF
void *v77; // [xsp+D8h] [xbp+D8h] BYREF
void *v78; // [xsp+E0h] [xbp+E0h] BYREF
if ( !a1->m_finishedAnimating )
{
if ( !a1->m_animatedSprite )
goto LABEL_5;
sub_D18D28(&v78);
v4 = (char *)v78 - 24;
v5 = *((_QWORD *)v78 - 3) != 0;
if ( (char *)v78 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)((char *)v78 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *((_DWORD *)v78 - 2);
*((_DWORD *)v78 - 2) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v4);
}
if ( !v5 )
{
LABEL_5:
m_objectID = a1->m_objectID;
m_animationID = a1->m_animationID;
if ( m_objectID != 918 )
{
if ( m_objectID != 1327 )
{
if ( m_objectID != 1328 )
{
if ( m_objectID != 1584 )
{
if ( m_objectID != 2012 )
{
a1->m_animationID = 0;
return;
}
sub_D153B8((int)&v77, (char *)a2);
sub_D153B8((int)&v78, "toAttack03");
v49 = sub_D17014(&v77, &v78);
if ( (char *)v78 - 24 != (char *)&qword_124B6B0 )
sub_74B3A8((char *)v78 - 24);
if ( (char *)v77 - 24 != (char *)&qword_124B6B0 )
sub_74B3A8((char *)v77 - 24);
if ( !v49 )
{
m_animatedSprite = a1->m_animatedSprite;
sub_D153B8((int)&v78, "attack03");
CCAnimatedSprite::runAnimationForced((__int64)m_animatedSprite, (__int64)&v78);
if ( (char *)v78 - 24 != (char *)&qword_124B6B0 )
sub_74B3A8((char *)v78 - 24);
v28 = 6;
a1->m_animationID = 6;
LABEL_93:
if ( m_animationID == v28 )
a1->m_animationID = 0;
return;
}
sub_D153B8((int)&v73, (char *)a2);
sub_D153B8((int)&v74, "fromAttack03");
v53 = (char *)v74;
v54 = *((char **)v73 - 3);
v55 = *((char **)v74 - 3);
v71 = v54;
v72 = v55;
if ( v55 > v54 )
v56 = (size_t)v54;
else
v56 = (size_t)v55;
if ( memcmp(v73, v74, v56)
|| (unsigned __int64)(v71 - v72 + 0x80000000LL) > 0xFFFFFFFF
|| (v57 = 1, (_DWORD)v71 != (_DWORD)v72) )
{
sub_D153B8((int)&v75, (char *)a2);
sub_D153B8((int)&v76, "attack02");
v72 = (_BYTE *)(&dword_0 + 1);
v65 = sub_D17014(&v75, &v76);
v57 = 1;
if ( v65 )
{
sub_D153B8((int)&v77, (char *)a2);
sub_D153B8((int)&v78, "toAttack01");
v57 = (unsigned int)sub_D17014(&v77, &v78) == 0;
if ( (char *)v78 - 24 != (char *)&qword_124B6B0 )
{
v72 = (_BYTE *)v57;
sub_74B3A8((char *)v78 - 24);
v57 = (_BOOL8)v72;
}
if ( (char *)v77 - 24 != (char *)&qword_124B6B0 )
{
v72 = (_BYTE *)v57;
sub_74B3A8((char *)v77 - 24);
v57 = (_BOOL8)v72;
}
}
if ( (__int64 *)(v76 - 24) != &qword_124B6B0 )
{
v72 = (_BYTE *)v57;
sub_74B3A8((void *)(v76 - 24));
v57 = (_BOOL8)v72;
}
if ( (__int64 *)(v75 - 24) == &qword_124B6B0 )
{
v53 = (char *)v74;
}
else
{
v72 = (_BYTE *)v57;
sub_74B3A8((void *)(v75 - 24));
v53 = (char *)v74;
v57 = (_BOOL8)v72;
}
}
if ( v53 - 24 != (char *)&qword_124B6B0 )
{
v72 = (_BYTE *)v57;
sub_74B3A8(v53 - 24);
v57 = (_BOOL8)v72;
}
if ( (char *)v73 - 24 != (char *)&qword_124B6B0 )
{
v72 = (_BYTE *)v57;
sub_74B3A8((char *)v73 - 24);
LODWORD(v57) = (_DWORD)v72;
}
if ( v57 )
{
v58 = a1->m_animatedSprite;
sub_D153B8((int)&v78, "attack01");
CCAnimatedSprite::runAnimationForced((__int64)v58, (__int64)&v78);
if ( (char *)v78 - 24 != (char *)&qword_124B6B0 )
sub_74B3A8((char *)v78 - 24);
v28 = 3;
a1->m_animationID = 3;
goto LABEL_93;
}
sub_D153B8((int)&v77, (char *)a2);
sub_D153B8((int)&v78, "idle01");
v61 = sub_D17014(&v77, &v78);
if ( (char *)v78 - 24 != (char *)&qword_124B6B0 )
sub_74B3A8((char *)v78 - 24);
if ( (char *)v77 - 24 != (char *)&qword_124B6B0 )
sub_74B3A8((char *)v77 - 24);
if ( v61 )
{
v62 = a1->m_animatedSprite;
sub_D153B8((int)&v78, "idle01");
CCAnimatedSprite::runAnimationForced((__int64)v62, (__int64)&v78);
}
else
{
v66 = rand();
v67 = a1->m_animatedSprite;
if ( (float)((float)v66 * 4.6566e-10) <= 0.75 )
sub_D153B8((int)&v78, "idle01");
else
sub_D153B8((int)&v78, "idle02");
CCAnimatedSprite::runAnimationForced((__int64)v67, (__int64)&v78);
}
LABEL_96:
if ( (char *)v78 - 24 != (char *)&qword_124B6B0 )
sub_74B3A8((char *)v78 - 24);
v28 = a1->m_animationID;
goto LABEL_93;
}
sub_D153B8((int)&v77, (char *)a2);
sub_D153B8((unsigned int)v68 + 224, "attack02");
v71 = (char *)v77;
v37 = *((_QWORD *)v77 - 3);
v38 = *((_QWORD *)v78 - 3);
v72 = v78;
v70 = v38;
if ( v38 > v37 )
v39 = v37;
else
v39 = v38;
v40 = memcmp(v77, v78, v39);
v41 = v71;
if ( !v40 )
{
v40 = 0x7FFFFFFF;
v42 = v37 - v70;
if ( v42 <= 0x7FFFFFFF )
{
if ( v42 >= (__int64)0xFFFFFFFF80000000LL )
v40 = v42;
else
v40 = 0x80000000;
}
}
if ( v72 - 24 != (_BYTE *)&qword_124B6B0 )
{
sub_74B3A8(v72 - 24);
v41 = (char *)v77;
}
if ( v41 - 24 == (char *)&qword_124B6B0 )
{
if ( v40 )
goto LABEL_69;
}
else
{
sub_74B3A8(v41 - 24);
if ( v40 )
{
LABEL_69:
sub_D153B8((unsigned int)v68 + 216, (char *)a2);
sub_D153B8((unsigned int)v68 + 224, "sleep");
v71 = (char *)v77;
v43 = *((_QWORD *)v77 - 3);
v44 = *((_QWORD *)v78 - 3);
v72 = v78;
v69 = v43;
if ( v44 > v43 )
v45 = v43;
else
v45 = v44;
v70 = v44;
v46 = memcmp(v77, v78, v45);
v47 = v71;
if ( !v46 )
{
v46 = 0x7FFFFFFF;
if ( (__int64)(v69 - v70) <= 0x7FFFFFFF )
{
if ( (__int64)(v69 - v70) >= (__int64)0xFFFFFFFF80000000LL )
v46 = v69 - v70;
else
v46 = 0x80000000;
}
}
if ( v72 - 24 != (_BYTE *)&qword_124B6B0 )
{
sub_74B3A8(v72 - 24);
v47 = (char *)v77;
}
if ( v47 - 24 != (char *)&qword_124B6B0 )
sub_74B3A8(v47 - 24);
if ( !v46 )
{
v48 = a1->m_animatedSprite;
sub_D153B8((int)&v78, "sleep_loop");
CCAnimatedSprite::runAnimationForced((__int64)v48, (__int64)&v78);
if ( (char *)v78 - 24 != (char *)&qword_124B6B0 )
sub_74B3A8((char *)v78 - 24);
v28 = 7;
a1->m_animationID = 7;
goto LABEL_93;
}
sub_D153B8((unsigned int)v68 + 216, (char *)a2);
sub_D153B8((unsigned int)v68 + 224, "idle01");
v59 = sub_D17014(&v77, &v78);
if ( (char *)v78 - 24 != (char *)&qword_124B6B0 )
sub_74B3A8((char *)v78 - 24);
if ( (char *)v77 - 24 != (char *)&qword_124B6B0 )
sub_74B3A8((char *)v77 - 24);
if ( v59 )
goto LABEL_137;
v63 = rand();
v15 = a1->m_animatedSprite;
v64 = (float)v63;
v17 = (unsigned int)v68 + 224;
if ( (float)(v64 * 4.6566e-10) > 0.8 )
goto LABEL_145;
LABEL_155:
sub_D153B8(v17, "idle01");
goto LABEL_146;
}
}
v52 = a1->m_animatedSprite;
sub_D153B8((int)&v78, "attack02_loop");
CCAnimatedSprite::runAnimationForced((__int64)v52, (__int64)&v78);
if ( (char *)v78 - 24 != (char *)&qword_124B6B0 )
sub_74B3A8((char *)v78 - 24);
v28 = 9;
a1->m_animationID = 9;
goto LABEL_93;
}
sub_D153B8((int)&v77, (char *)a2);
sub_D153B8((int)&v78, "idle01");
v29 = (char *)v77;
v72 = v78;
v30 = *((_QWORD *)v78 - 3);
v31 = *((_QWORD *)v77 - 3);
if ( v30 > v31 )
v32 = *((_QWORD *)v77 - 3);
else
v32 = *((_QWORD *)v78 - 3);
v33 = memcmp(v77, v78, v32);
if ( !v33 )
{
v33 = 0x7FFFFFFF;
v34 = v31 - v30;
if ( v34 <= 0x7FFFFFFF )
{
if ( v34 >= (__int64)0xFFFFFFFF80000000LL )
v33 = v34;
else
v33 = 0x80000000;
}
}
if ( v72 - 24 != (_BYTE *)&qword_124B6B0 )
{
sub_74B3A8(v72 - 24);
v29 = (char *)v77;
}
if ( v29 - 24 == (char *)&qword_124B6B0 )
{
if ( !v33 )
goto LABEL_55;
}
else
{
sub_74B3A8(v29 - 24);
if ( !v33 )
{
LABEL_55:
v35 = rand();
v15 = a1->m_animatedSprite;
v36 = (float)v35;
v17 = (unsigned int)v68 + 224;
if ( (float)(v36 * 4.6566e-10) <= 0.9 )
goto LABEL_155;
goto LABEL_145;
}
}
LABEL_137:
v60 = a1->m_animatedSprite;
sub_D153B8((unsigned int)v68 + 224, "idle01");
CCAnimatedSprite::runAnimationForced((__int64)v60, (__int64)&v78);
goto LABEL_96;
}
sub_D153B8((int)&v77, (char *)a2);
sub_D153B8((int)&v78, "idle01");
v8 = (char *)v77;
v72 = v78;
v9 = *((_QWORD *)v78 - 3);
v10 = *((_QWORD *)v77 - 3);
if ( v9 > v10 )
v11 = *((_QWORD *)v77 - 3);
else
v11 = *((_QWORD *)v78 - 3);
v12 = memcmp(v77, v78, v11);
if ( !v12 )
{
v12 = 0x7FFFFFFF;
v13 = v10 - v9;
if ( v13 <= 0x7FFFFFFF )
{
if ( v13 >= (__int64)0xFFFFFFFF80000000LL )
v12 = v13;
else
v12 = 0x80000000;
}
}
if ( v72 - 24 != (_BYTE *)&qword_124B6B0 )
{
sub_74B3A8(v72 - 24);
v8 = (char *)v77;
}
if ( v8 - 24 == (char *)&qword_124B6B0 )
{
if ( v12 )
goto LABEL_137;
}
else
{
sub_74B3A8(v8 - 24);
if ( v12 )
goto LABEL_137;
}
v14 = rand();
v15 = a1->m_animatedSprite;
v16 = (float)v14;
v17 = (unsigned int)v68 + 224;
if ( (float)(v16 * 4.6566e-10) <= 0.75 )
goto LABEL_155;
LABEL_145:
sub_D153B8(v17, "idle02");
LABEL_146:
CCAnimatedSprite::runAnimationForced((__int64)v15, (__int64)&v78);
goto LABEL_96;
}
sub_D153B8((int)&v77, (char *)a2);
sub_D153B8((int)&v78, "attack01");
v20 = (char *)v77;
v21 = (char *)v78;
v22 = *((_QWORD *)v77 - 3);
v23 = *((_QWORD *)v78 - 3);
if ( v23 > v22 )
v24 = *((_QWORD *)v77 - 3);
else
v24 = *((_QWORD *)v78 - 3);
v25 = memcmp(v77, v78, v24);
if ( !v25 )
{
v25 = 0x7FFFFFFF;
v26 = v22 - v23;
if ( v26 <= 0x7FFFFFFF )
{
if ( v26 >= (__int64)0xFFFFFFFF80000000LL )
v25 = v26;
else
v25 = 0x80000000;
}
}
if ( v21 - 24 != (char *)&qword_124B6B0 )
{
sub_74B3A8(v21 - 24);
v20 = (char *)v77;
}
if ( v20 - 24 == (char *)&qword_124B6B0 )
{
if ( !v25 )
{
LABEL_40:
v27 = a1->m_animatedSprite;
sub_D153B8((unsigned int)v68 + 224, "attack01_loop");
CCAnimatedSprite::runAnimationForced((__int64)v27, (__int64)&v78);
if ( (char *)v78 - 24 != (char *)&qword_124B6B0 )
sub_74B3A8((char *)v78 - 24);
v28 = 1;
a1->m_animationID = 1;
goto LABEL_93;
}
}
else
{
sub_74B3A8(v20 - 24);
if ( !v25 )
goto LABEL_40;
}
v51 = a1->m_animatedSprite;
sub_D153B8((unsigned int)v68 + 224, "bite");
CCAnimatedSprite::runAnimationForced((__int64)v51, (__int64)&v78);
goto LABEL_96;
}
}
}