//
// SpriteAnimationManager::executeAnimation from 0x2f36d4 to 0x2f385e (394 bytes)
//
// 2 xrefs:
// > SpriteAnimationManager::runAnimation @ 0x2f38ee
// > SpriteAnimationManager::runQueuedAnimation @ 0x2f3982
//
// 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
//
cocos2d::CCAction *__fastcall SpriteAnimationManager::executeAnimation(
int a1,
const std::string *a2,
stl::StringData::Internal *a3,
stl::StringData::Internal *a4)
{
int v4; // r4
cocos2d::CCAction *result; // r0
int v8; // r8
int v9; // r9
spriteMode v10; // r10
cocos2d::CCDictionary *v11; // r10
cocos2d::CCString *v12; // r0
char *CString; // r0
int v14; // r6
int v15; // r10
spriteMode AnimType; // r6
std::string v17[2]; // [sp+8h] [bp-8h] BYREF
v17[0].m_data.m_data = a3;
v17[1].m_data.m_data = a4;
v4 = a1 + 296;
result = (cocos2d::CCAction *)sub_774DBC(a1 + 296, a2);
if ( result )
{
cocos2d::CCNode::stopAllActions(*(cocos2d::CCNode **)(*(_DWORD *)(a1 + 264) + 520));
sub_775D40(v4, a2);
sub_775C20(v17, a2);
SpriteAnimationManager::playSoundForAnimation(a1, v17);
sub_774008(v17);
v8 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 292), a2);
if ( *(_DWORD *)(v8 + 24) )
{
sub_775C20(v17, a2);
AnimType = SpriteAnimationManager::getAnimType(a1, v17);
sub_774008(v17);
CCAnimatedSprite::willPlayAnimation(*(CCAnimatedSprite **)(a1 + 264));
CCAnimatedSprite::switchToMode(*(CCAnimatedSprite **)(a1 + 264), AnimType);
return (cocos2d::CCAction *)(*(int (__fastcall **)(_DWORD, int))(**(_DWORD **)(*(_DWORD *)(a1 + 264) + 520) + 572))(
*(_DWORD *)(*(_DWORD *)(a1 + 264) + 520),
v8);
}
else
{
v9 = *(_DWORD *)(*(_DWORD *)(a1 + 264) + 532);
sub_775C20(v17, a2);
v10 = SpriteAnimationManager::getAnimType(a1, v17);
sub_774008(v17);
CCAnimatedSprite::willPlayAnimation(*(CCAnimatedSprite **)(a1 + 264));
CCAnimatedSprite::switchToMode(*(CCAnimatedSprite **)(a1 + 264), v10);
if ( v9 != *(_DWORD *)(*(_DWORD *)(a1 + 264) + 532)
|| (sub_776584((int)v17, "spawn"), v15 = sub_774DBC(a2, v17), sub_774008(v17), !v15) )
{
v11 = *(cocos2d::CCDictionary **)(a1 + 292);
v12 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%s_first",
(const char *)a2->m_data.m_data);
CString = (char *)cocos2d::CCString::getCString(v12);
sub_776584((int)v17, CString);
v14 = cocos2d::CCDictionary::objectForKey(v11, v17);
sub_774008(v17);
if ( (unsigned int)(*(_DWORD *)(v14 + 24) - 1) <= 1 )
(*(void (__fastcall **)(_DWORD, int))(**(_DWORD **)(*(_DWORD *)(a1 + 264) + 520) + 572))(
*(_DWORD *)(*(_DWORD *)(a1 + 264) + 520),
v14);
}
(*(void (__fastcall **)(int, int))(*(_DWORD *)v8 + 36))(v8, 1);
return cocos2d::CCNode::runAction(*(cocos2d::CCNode **)(*(_DWORD *)(a1 + 264) + 520), (cocos2d::CCAction *)v8);
}
}
return result;
}