//
// AnimatedGameObject::animationFinished from 0x3e4a80 to 0x3e50be (1598 bytes)
//
// 1 xrefs:
// > `non-virtual thunk to'AnimatedGameObject::animationFinished @ 0x3e50cc
//
// 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)
{
_BOOL4 v4; // r4
int m_objectID; // r3
_BOOL4 v6; // r8
CCAnimatedSprite *m_animatedSprite; // r7
int v8; // r2
int v9; // r3
int v10; // r2
_BOOL4 v11; // r7
unsigned int v12; // r0
CCAnimatedSprite *v13; // r7
_BOOL4 v14; // r7
unsigned int v15; // r0
_BOOL4 v16; // r10
CCAnimatedSprite *v17; // r7
int v18; // r2
_BOOL4 v19; // r10
CCAnimatedSprite *v20; // r7
int v21; // r2
_BOOL4 v22; // r7
CCAnimatedSprite *v23; // r7
int v24; // r2
unsigned int v25; // r0
int v26; // r2
_BOOL4 v27; // r10
CCAnimatedSprite *v28; // r7
int v29; // r2
_BOOL4 v30; // r10
CCAnimatedSprite *v31; // r7
int v32; // r2
_BOOL4 v33; // r7
CCAnimatedSprite *v34; // r7
int v35; // r2
unsigned int v36; // r0
CCAnimatedSprite *v37; // r7
int v38; // r2
int m_animationID; // [sp+0h] [bp-44h]
_BYTE v40[4]; // [sp+24h] [bp-20h] BYREF
_BYTE v41[4]; // [sp+28h] [bp-1Ch] BYREF
_BYTE v42[4]; // [sp+2Ch] [bp-18h] BYREF
_BYTE v43[4]; // [sp+30h] [bp-14h] BYREF
_BYTE v44[4]; // [sp+34h] [bp-10h] BYREF
int v45; // [sp+38h] [bp-Ch] BYREF
if ( !a1->m_finishedAnimating )
{
if ( !a1->m_animatedSprite || (sub_775C20(&v45), v4 = *(_DWORD *)(v45 - 12) != 0, sub_774008(&v45), !v4) )
{
m_animationID = a1->m_animationID;
m_objectID = a1->m_objectID;
switch ( m_objectID )
{
case 918:
sub_776584((int)v44, (char *)a2);
sub_776584((int)&v45, "attack01");
v6 = sub_3E0DA2((int)v44, (int)&v45);
sub_774008(&v45);
sub_774008(v44);
m_animatedSprite = a1->m_animatedSprite;
if ( v6 )
{
sub_776584((int)&v45, "attack01_loop");
CCAnimatedSprite::runAnimationForced((int)m_animatedSprite, (int)&v45, v8);
sub_774008(&v45);
v9 = 1;
LABEL_20:
a1->m_animationID = v9;
goto LABEL_45;
}
sub_776584((int)&v45, "bite");
CCAnimatedSprite::runAnimationForced((int)m_animatedSprite, (int)&v45, v10);
goto LABEL_44;
case 1327:
sub_776584((int)v44, (char *)a2);
sub_776584((int)&v45, "idle01");
v11 = sub_3E0DA2((int)v44, (int)&v45);
sub_774008(&v45);
sub_774008(v44);
if ( !v11 )
goto LABEL_24;
v12 = rand();
v13 = a1->m_animatedSprite;
if ( vcvts_n_f32_s32(v12, 0x1Fu) <= 0.75 )
goto LABEL_28;
break;
case 1328:
sub_776584((int)v44, (char *)a2);
sub_776584((int)&v45, "idle01");
v14 = sub_3E0DA2((int)v44, (int)&v45);
sub_774008(&v45);
sub_774008(v44);
if ( !v14 )
goto LABEL_24;
v15 = rand();
v13 = a1->m_animatedSprite;
if ( vcvts_n_f32_s32(v15, 0x1Fu) <= 0.9 )
{
LABEL_28:
sub_776584((int)&v45, "idle01");
goto LABEL_27;
}
break;
case 1584:
sub_776584((int)v44, (char *)a2);
sub_776584((int)&v45, "attack02");
v16 = sub_3E0DA2((int)v44, (int)&v45);
sub_774008(&v45);
sub_774008(v44);
if ( v16 )
{
v17 = a1->m_animatedSprite;
sub_776584((int)&v45, "attack02_loop");
CCAnimatedSprite::runAnimationForced((int)v17, (int)&v45, v18);
sub_774008(&v45);
v9 = 9;
goto LABEL_20;
}
sub_776584((int)v44, (char *)a2);
sub_776584((int)&v45, "sleep");
v19 = sub_3E0DA2((int)v44, (int)&v45);
sub_774008(&v45);
sub_774008(v44);
if ( v19 )
{
v20 = a1->m_animatedSprite;
sub_776584((int)&v45, "sleep_loop");
CCAnimatedSprite::runAnimationForced((int)v20, (int)&v45, v21);
sub_774008(&v45);
v9 = 7;
goto LABEL_20;
}
sub_776584((int)v44, (char *)a2);
sub_776584((int)&v45, "idle01");
v22 = sub_3E0DA2((int)v44, (int)&v45);
sub_774008(&v45);
sub_774008(v44);
if ( !v22 )
{
LABEL_24:
v23 = a1->m_animatedSprite;
sub_776584((int)&v45, "idle01");
CCAnimatedSprite::runAnimationForced((int)v23, (int)&v45, v24);
goto LABEL_44;
}
v25 = rand();
v13 = a1->m_animatedSprite;
if ( vcvts_n_f32_s32(v25, 0x1Fu) <= 0.8 )
goto LABEL_28;
break;
case 2012:
sub_776584((int)v44, (char *)a2);
sub_776584((int)&v45, "toAttack03");
v27 = sub_3E0DA2((int)v44, (int)&v45);
sub_774008(&v45);
sub_774008(v44);
if ( v27 )
{
v28 = a1->m_animatedSprite;
sub_776584((int)&v45, "attack03");
CCAnimatedSprite::runAnimationForced((int)v28, (int)&v45, v29);
sub_774008(&v45);
v9 = 6;
goto LABEL_20;
}
sub_776584((int)v40, (char *)a2);
sub_776584((int)v41, "fromAttack03");
v30 = sub_3E0DA2((int)v40, (int)v41);
if ( !v30 )
{
sub_776584((int)v42, (char *)a2);
sub_776584((int)v43, "attack02");
v30 = sub_3E0DA2((int)v42, (int)v43);
if ( !v30 )
{
sub_776584((int)v44, (char *)a2);
sub_776584((int)&v45, "toAttack01");
v30 = sub_3E0DA2((int)v44, (int)&v45);
sub_774008(&v45);
sub_774008(v44);
}
sub_774008(v43);
sub_774008(v42);
}
sub_774008(v41);
sub_774008(v40);
if ( v30 )
{
v31 = a1->m_animatedSprite;
sub_776584((int)&v45, "attack01");
CCAnimatedSprite::runAnimationForced((int)v31, (int)&v45, v32);
sub_774008(&v45);
v9 = 3;
goto LABEL_20;
}
sub_776584((int)v44, (char *)a2);
sub_776584((int)&v45, "idle01");
v33 = sub_3E0DA2((int)v44, (int)&v45);
sub_774008(&v45);
sub_774008(v44);
if ( v33 )
{
v36 = rand();
v37 = a1->m_animatedSprite;
if ( vcvts_n_f32_s32(v36, 0x1Fu) <= 0.75 )
sub_776584((int)&v45, "idle01");
else
sub_776584((int)&v45, "idle02");
CCAnimatedSprite::runAnimationForced((int)v37, (int)&v45, v38);
}
else
{
v34 = a1->m_animatedSprite;
sub_776584((int)&v45, "idle01");
CCAnimatedSprite::runAnimationForced((int)v34, (int)&v45, v35);
}
LABEL_44:
sub_774008(&v45);
LABEL_45:
if ( a1->m_animationID == m_animationID )
a1->m_animationID = 0;
return;
default:
goto LABEL_45;
}
sub_776584((int)&v45, "idle02");
LABEL_27:
CCAnimatedSprite::runAnimationForced((int)v13, (int)&v45, v26);
goto LABEL_44;
}
}
}