//
// AnimatedGameObject::animationFinished from 0x100384028 to 0x100384858 (2096 bytes)
//
// 2 xrefs:
// > sub_100384A5C @ 0x100384a60
// > ??> @ 0x1007f5828
//
// 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 __fastcall AnimatedGameObject::animationFinished(AnimatedGameObject *a1, const char *a2)
{
CCAnimatedSprite *m_animatedSprite; // x8
std::string *p_m_activeTween; // x8
__int64 v6; // x21
int m_animationID; // w22
int m_objectID; // w8
_BOOL4 v9; // w21
CCAnimatedSprite *v10; // x20
int v11; // w8
bool v12; // w20
unsigned int v13; // w0
CCAnimatedSprite *v14; // x20
void *v15; // x0
bool v16; // w20
unsigned int v17; // w0
CCAnimatedSprite *v18; // x20
_BOOL4 v19; // w21
CCAnimatedSprite *v20; // x20
_BOOL4 v21; // w21
CCAnimatedSprite *v22; // x20
CCAnimatedSprite *v23; // x20
_BOOL4 v24; // w21
CCAnimatedSprite *v25; // x20
_BOOL4 v26; // w21
CCAnimatedSprite *v27; // x20
bool v28; // w20
unsigned int v29; // w0
CCAnimatedSprite *v30; // x20
CCAnimatedSprite *v31; // x20
CCAnimatedSprite *v32; // x20
bool v33; // w20
unsigned int v34; // w0
CCAnimatedSprite *v35; // x20
CCAnimatedSprite *v36; // x20
void *v37[2]; // [xsp+8h] [xbp-278h] BYREF
char v38; // [xsp+1Fh] [xbp-261h]
_QWORD v39[2]; // [xsp+20h] [xbp-260h] BYREF
char v40; // [xsp+37h] [xbp-249h]
_QWORD v41[2]; // [xsp+38h] [xbp-248h] BYREF
char v42; // [xsp+4Fh] [xbp-231h]
void *v43[2]; // [xsp+50h] [xbp-230h] BYREF
char v44; // [xsp+67h] [xbp-219h]
void *v45[2]; // [xsp+68h] [xbp-218h] BYREF
char v46; // [xsp+7Fh] [xbp-201h]
void *v47[2]; // [xsp+80h] [xbp-200h] BYREF
char v48; // [xsp+97h] [xbp-1E9h]
void *v49[2]; // [xsp+98h] [xbp-1E8h] BYREF
char v50; // [xsp+AFh] [xbp-1D1h]
void *v51[2]; // [xsp+B0h] [xbp-1D0h] BYREF
char v52; // [xsp+C7h] [xbp-1B9h]
void *__p[2]; // [xsp+C8h] [xbp-1B8h] BYREF
char v54; // [xsp+DFh] [xbp-1A1h]
_QWORD v55[2]; // [xsp+E0h] [xbp-1A0h] BYREF
char v56; // [xsp+F7h] [xbp-189h]
_QWORD v57[2]; // [xsp+F8h] [xbp-188h] BYREF
char v58; // [xsp+10Fh] [xbp-171h]
_QWORD v59[2]; // [xsp+110h] [xbp-170h] BYREF
char v60; // [xsp+127h] [xbp-159h]
void *v61[2]; // [xsp+128h] [xbp-158h] BYREF
char v62; // [xsp+13Fh] [xbp-141h]
void *v63[2]; // [xsp+140h] [xbp-140h] BYREF
char v64; // [xsp+157h] [xbp-129h]
_QWORD v65[2]; // [xsp+158h] [xbp-128h] BYREF
char v66; // [xsp+16Fh] [xbp-111h]
_QWORD v67[2]; // [xsp+170h] [xbp-110h] BYREF
char v68; // [xsp+187h] [xbp-F9h]
_QWORD v69[2]; // [xsp+188h] [xbp-F8h] BYREF
char v70; // [xsp+19Fh] [xbp-E1h]
_QWORD v71[2]; // [xsp+1A0h] [xbp-E0h] BYREF
char v72; // [xsp+1B7h] [xbp-C9h]
_QWORD v73[2]; // [xsp+1B8h] [xbp-C8h] BYREF
char v74; // [xsp+1CFh] [xbp-B1h]
_QWORD v75[2]; // [xsp+1D0h] [xbp-B0h] BYREF
char v76; // [xsp+1E7h] [xbp-99h]
_QWORD v77[2]; // [xsp+1E8h] [xbp-98h] BYREF
char v78; // [xsp+1FFh] [xbp-81h]
void *v79[2]; // [xsp+200h] [xbp-80h] BYREF
char v80; // [xsp+217h] [xbp-69h]
void *v81[2]; // [xsp+218h] [xbp-68h] BYREF
char v82; // [xsp+22Fh] [xbp-51h]
__int128 __dst; // [xsp+230h] [xbp-50h] BYREF
char *longStorage; // [xsp+240h] [xbp-40h]
if ( !a1->m_finishedAnimating )
{
m_animatedSprite = a1->m_animatedSprite;
if ( m_animatedSprite )
{
if ( m_animatedSprite->m_activeTween.m_data.m_short.shortStorage.__elems_[22] < 0 )
{
sub_1000097D0(
&__dst,
(void *)m_animatedSprite->m_activeTween.m_data.m_long.capacitym1,
m_animatedSprite->m_activeTween.m_data.m_long.size);
}
else
{
p_m_activeTween = &m_animatedSprite->m_activeTween;
__dst = *(_OWORD *)&p_m_activeTween->m_data.m_short.sizex2;
longStorage = p_m_activeTween->m_data.m_long.longStorage;
}
if ( SHIBYTE(longStorage) >= 0 )
v6 = SHIBYTE(longStorage);
else
v6 = *((_QWORD *)&__dst + 1);
if ( (SHIBYTE(longStorage) & 0x8000000000000000LL) != 0 )
{
operator delete((void *)__dst);
if ( v6 )
return;
}
else if ( v6 )
{
return;
}
}
m_animationID = a1->m_animationID;
m_objectID = a1->m_objectID;
if ( m_objectID <= 1327 )
{
if ( m_objectID == 918 )
{
sub_100009900(&__dst, (char *)a2);
sub_100009900(v81, "attack01");
v21 = sub_1000045BC(&__dst, v81);
if ( v82 < 0 )
operator delete(v81[0]);
if ( SHIBYTE(longStorage) < 0 )
operator delete((void *)__dst);
v22 = a1->m_animatedSprite;
if ( v21 )
{
sub_100009900(v79, "attack01_loop");
CCAnimatedSprite::runAnimationForced((__int64)v22, (__int64)v79);
if ( v80 < 0 )
operator delete(v79[0]);
v11 = 1;
goto LABEL_107;
}
sub_100009900(v77, "bite");
CCAnimatedSprite::runAnimationForced((__int64)v22, (__int64)v77);
if ( (v78 & 0x80000000) == 0 )
goto LABEL_123;
v15 = (void *)v77[0];
}
else
{
if ( m_objectID != 1327 )
goto LABEL_123;
sub_100009900(&__dst, (char *)a2);
sub_100009900(v81, "idle01");
v12 = sub_1000045BC(&__dst, v81);
if ( v82 < 0 )
operator delete(v81[0]);
if ( SHIBYTE(longStorage) < 0 )
operator delete((void *)__dst);
if ( v12 )
{
v13 = rand();
v14 = a1->m_animatedSprite;
if ( vcvts_n_f32_s32(v13, 0x1Fu) <= 0.75 )
{
sub_100009900(v71, "idle01");
CCAnimatedSprite::runAnimationForced((__int64)v14, (__int64)v71);
if ( (v72 & 0x80000000) == 0 )
goto LABEL_123;
v15 = (void *)v71[0];
}
else
{
sub_100009900(v73, "idle02");
CCAnimatedSprite::runAnimationForced((__int64)v14, (__int64)v73);
if ( (v74 & 0x80000000) == 0 )
goto LABEL_123;
v15 = (void *)v73[0];
}
}
else
{
v27 = a1->m_animatedSprite;
sub_100009900(v75, "idle01");
CCAnimatedSprite::runAnimationForced((__int64)v27, (__int64)v75);
if ( (v76 & 0x80000000) == 0 )
goto LABEL_123;
v15 = (void *)v75[0];
}
}
}
else
{
switch ( m_objectID )
{
case 1328:
sub_100009900(&__dst, (char *)a2);
sub_100009900(v81, "idle01");
v16 = sub_1000045BC(&__dst, v81);
if ( v82 < 0 )
operator delete(v81[0]);
if ( SHIBYTE(longStorage) < 0 )
operator delete((void *)__dst);
if ( v16 )
{
v17 = rand();
v18 = a1->m_animatedSprite;
if ( vcvts_n_f32_s32(v17, 0x1Fu) <= 0.9 )
{
sub_100009900(v65, "idle01");
CCAnimatedSprite::runAnimationForced((__int64)v18, (__int64)v65);
if ( (v66 & 0x80000000) == 0 )
goto LABEL_123;
v15 = (void *)v65[0];
}
else
{
sub_100009900(v67, "idle02");
CCAnimatedSprite::runAnimationForced((__int64)v18, (__int64)v67);
if ( (v68 & 0x80000000) == 0 )
goto LABEL_123;
v15 = (void *)v67[0];
}
}
else
{
v23 = a1->m_animatedSprite;
sub_100009900(v69, "idle01");
CCAnimatedSprite::runAnimationForced((__int64)v23, (__int64)v69);
if ( (v70 & 0x80000000) == 0 )
goto LABEL_123;
v15 = (void *)v69[0];
}
break;
case 1584:
sub_100009900(&__dst, (char *)a2);
sub_100009900(v81, "attack02");
v19 = sub_1000045BC(&__dst, v81);
if ( v82 < 0 )
operator delete(v81[0]);
if ( SHIBYTE(longStorage) < 0 )
operator delete((void *)__dst);
if ( v19 )
{
v20 = a1->m_animatedSprite;
sub_100009900(v63, "attack02_loop");
CCAnimatedSprite::runAnimationForced((__int64)v20, (__int64)v63);
if ( v64 < 0 )
operator delete(v63[0]);
v11 = 9;
goto LABEL_107;
}
sub_100009900(&__dst, (char *)a2);
sub_100009900(v81, "sleep");
v24 = sub_1000045BC(&__dst, v81);
if ( v82 < 0 )
operator delete(v81[0]);
if ( SHIBYTE(longStorage) < 0 )
operator delete((void *)__dst);
if ( v24 )
{
v25 = a1->m_animatedSprite;
sub_100009900(v61, "sleep_loop");
CCAnimatedSprite::runAnimationForced((__int64)v25, (__int64)v61);
if ( v62 < 0 )
operator delete(v61[0]);
v11 = 7;
goto LABEL_107;
}
sub_100009900(&__dst, (char *)a2);
sub_100009900(v81, "idle01");
v28 = sub_1000045BC(&__dst, v81);
if ( v82 < 0 )
operator delete(v81[0]);
if ( SHIBYTE(longStorage) < 0 )
operator delete((void *)__dst);
if ( v28 )
{
v29 = rand();
v30 = a1->m_animatedSprite;
if ( vcvts_n_f32_s32(v29, 0x1Fu) <= 0.8 )
{
sub_100009900(v55, "idle01");
CCAnimatedSprite::runAnimationForced((__int64)v30, (__int64)v55);
if ( (v56 & 0x80000000) == 0 )
goto LABEL_123;
v15 = (void *)v55[0];
}
else
{
sub_100009900(v57, "idle02");
CCAnimatedSprite::runAnimationForced((__int64)v30, (__int64)v57);
if ( (v58 & 0x80000000) == 0 )
goto LABEL_123;
v15 = (void *)v57[0];
}
}
else
{
v31 = a1->m_animatedSprite;
sub_100009900(v59, "idle01");
CCAnimatedSprite::runAnimationForced((__int64)v31, (__int64)v59);
if ( (v60 & 0x80000000) == 0 )
goto LABEL_123;
v15 = (void *)v59[0];
}
break;
case 2012:
sub_100009900(&__dst, (char *)a2);
sub_100009900(v81, "toAttack03");
v9 = sub_1000045BC(&__dst, v81);
if ( v82 < 0 )
operator delete(v81[0]);
if ( SHIBYTE(longStorage) < 0 )
operator delete((void *)__dst);
if ( v9 )
{
v10 = a1->m_animatedSprite;
sub_100009900(__p, "attack03");
CCAnimatedSprite::runAnimationForced((__int64)v10, (__int64)__p);
if ( v54 < 0 )
operator delete(__p[0]);
v11 = 6;
LABEL_107:
a1->m_animationID = v11;
goto LABEL_123;
}
sub_100009900(&__dst, (char *)a2);
sub_100009900(v81, "fromAttack03");
if ( sub_1000045BC(&__dst, v81) )
{
v26 = 1;
}
else
{
sub_100009900(v51, (char *)a2);
sub_100009900(v49, "attack02");
if ( sub_1000045BC(v51, v49) )
{
v26 = 1;
}
else
{
sub_100009900(v47, (char *)a2);
sub_100009900(v45, "toAttack01");
v26 = sub_1000045BC(v47, v45);
if ( v46 < 0 )
operator delete(v45[0]);
if ( v48 < 0 )
operator delete(v47[0]);
}
if ( v50 < 0 )
operator delete(v49[0]);
if ( v52 < 0 )
operator delete(v51[0]);
}
if ( v82 < 0 )
operator delete(v81[0]);
if ( SHIBYTE(longStorage) < 0 )
operator delete((void *)__dst);
if ( v26 )
{
v32 = a1->m_animatedSprite;
sub_100009900(v43, "attack01");
CCAnimatedSprite::runAnimationForced((__int64)v32, (__int64)v43);
if ( v44 < 0 )
operator delete(v43[0]);
v11 = 3;
goto LABEL_107;
}
sub_100009900(&__dst, (char *)a2);
sub_100009900(v81, "idle01");
v33 = sub_1000045BC(&__dst, v81);
if ( v82 < 0 )
operator delete(v81[0]);
if ( SHIBYTE(longStorage) < 0 )
operator delete((void *)__dst);
if ( v33 )
{
v34 = rand();
v35 = a1->m_animatedSprite;
if ( vcvts_n_f32_s32(v34, 0x1Fu) <= 0.75 )
{
sub_100009900(v37, "idle01");
CCAnimatedSprite::runAnimationForced((__int64)v35, (__int64)v37);
if ( (v38 & 0x80000000) == 0 )
goto LABEL_123;
v15 = v37[0];
}
else
{
sub_100009900(v39, "idle02");
CCAnimatedSprite::runAnimationForced((__int64)v35, (__int64)v39);
if ( (v40 & 0x80000000) == 0 )
goto LABEL_123;
v15 = (void *)v39[0];
}
}
else
{
v36 = a1->m_animatedSprite;
sub_100009900(v41, "idle01");
CCAnimatedSprite::runAnimationForced((__int64)v36, (__int64)v41);
if ( (v42 & 0x80000000) == 0 )
goto LABEL_123;
v15 = (void *)v41[0];
}
break;
default:
goto LABEL_123;
}
}
operator delete(v15);
LABEL_123:
if ( a1->m_animationID == m_animationID )
a1->m_animationID = 0;
}
}