//
// AnimatedGameObject::playAnimation from 0x75757c to 0x7577b0 (564 bytes)
//
// 3 xrefs:
// > PlayLayer::loadActiveSaveObjects @ 0x5d0614
// > GJBaseGameLayer::playAnimationCommand @ 0x85d488
// > ??> @ 0x7f6c8
//
// 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::playAnimation(AnimatedGameObject *a1, int a2)
{
__int64 v4; // x1
void *v5; // x0
_BOOL4 m_isActivated; // w0
CCAnimatedSprite *v7; // x21
char *v8; // x0
unsigned int *v9; // x1
int v10; // w2
float TweenTime; // s8
CCAnimatedSprite *m_animatedSprite; // x21
__int64 v13; // [xsp+50h] [xbp+50h] BYREF
std::string v14; // [xsp+58h] [xbp+58h] BYREF
__int64 v15; // [xsp+60h] [xbp+60h] BYREF
AnimatedGameObject::animationForID((AnimatedGameObject *)(unsigned int)a2, a1->m_objectID, (__int64)&v13);
v4 = v13;
if ( *(_QWORD *)(v13 - 24) )
{
a1->m_animationID = a2;
sub_D18EA8(&a1->m_currentAnimation, &v13);
m_isActivated = a1->m_isActivated;
a1->m_playingAnimation = 1;
if ( m_isActivated && (TweenTime = AnimatedGameObject::getTweenTime(a2, a1->m_objectID), TweenTime > 0.0) )
{
m_animatedSprite = a1->m_animatedSprite;
sub_D18D28(&v14);
CCAnimatedSprite::tweenToAnimation((__int64)m_animatedSprite, &v14, TweenTime);
v8 = (char *)v14.m_data.m_data - 24;
if ( (__int64 *)v14.m_data.m_data - 3 != &qword_124B6B0 )
{
LABEL_15:
sub_74B3A8(v8);
v4 = v13;
LABEL_7:
v5 = (void *)(v4 - 24);
if ( (__int64 *)(v4 - 24) == &qword_124B6B0 )
return;
goto LABEL_8;
}
}
else
{
v7 = a1->m_animatedSprite;
sub_D18D28(&v15);
CCAnimatedSprite::runAnimationForced((__int64)v7, (__int64)&v15);
v8 = (char *)(v15 - 24);
if ( (__int64 *)(v15 - 24) != &qword_124B6B0 )
goto LABEL_15;
}
v4 = v13;
goto LABEL_7;
}
v5 = (void *)(v13 - 24);
if ( (__int64 *)(v13 - 24) == &qword_124B6B0 )
return;
LABEL_8:
if ( &pthread_create )
{
v9 = (unsigned int *)(v4 - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *(_DWORD *)(v4 - 8);
*(_DWORD *)(v4 - 8) = v10 - 1;
}
if ( v10 <= 0 )
operator delete(v5);
}