//
// AnimatedGameObject::init from 0x140644710 to 0x140644cbf (1455 bytes)
//
// 2 xrefs:
// > GameObject::createWithKey @ 0x140289046
// > ??> @ 0x140931334
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:35:36 +0000
//
// Hidden C++ exception states: #wind=4
char __fastcall AnimatedGameObject::init(cocos2d::CCSprite *a1, int a2)
{
char *v4; // r15
__int64 v5; // r14
__int64 v6; // rax
__int64 Definition; // rax
cocos2d::CCString *v8; // rax
const char *CString; // rax
size_t v10; // r8
void *v11; // rcx
__int64 v12; // rcx
void **v13; // rbx
cocos2d::CCTextureCache *v14; // rax
struct cocos2d::CCTexture2D *v15; // rbx
void *v16; // r8
const struct cocos2d::CCRect *v17; // rax
__int64 v18; // rbx
cocos2d::CCNode *v19; // rcx
cocos2d::CCNode *v20; // rcx
struct cocos2d::CCTexture2D *v21; // rax
float v22; // xmm6_4
float v23; // xmm7_4
int v24; // edi
int v25; // edi
float v26; // xmm2_4
float v27; // xmm1_4
__int64 v28; // rax
__int64 v29; // rax
__int64 v30; // rbx
__int64 v31; // rax
const struct cocos2d::CCSize *v32; // rax
__int64 v33; // rdi
__int64 v34; // rbx
__int64 v35; // rax
float v37[2]; // [rsp+38h] [rbp-39h] BYREF
void *Block[2]; // [rsp+40h] [rbp-31h] BYREF
__int64 v39; // [rsp+50h] [rbp-21h]
unsigned __int64 v40; // [rsp+58h] [rbp-19h]
void *Src[2]; // [rsp+60h] [rbp-11h] BYREF
__int64 v42; // [rsp+70h] [rbp-1h]
unsigned __int64 v43; // [rsp+78h] [rbp+7h]
*((_DWORD *)a1 + 314) = 2;
*((_DWORD *)a1 + 259) = a2;
if ( a2 > 1328 )
{
if ( a2 == 1584 )
{
v4 = "GJBeast04";
}
else
{
if ( a2 != 2012 )
return 0;
v4 = "GJBeast05";
}
*((_BYTE *)a1 + 1544) = 1;
}
else
{
switch ( a2 )
{
case 1328:
v4 = "GJBeast03";
break;
case 918:
v4 = "GJBeast01";
*((_BYTE *)a1 + 1544) = 1;
break;
case 919:
v4 = "BlackSludge";
break;
case 1327:
v4 = "GJBeast02";
break;
default:
return 0;
}
}
Block[0] = operator new(0x2E8u);
v5 = CCAnimatedSprite::CCAnimatedSprite((__int64)Block[0]);
if ( v5 )
{
v6 = ObjectManager::instance();
Definition = ObjectManager::getDefinition(v6, v4);
v39 = 11;
v40 = 15;
Block[0] = (void *)0x6853657469727073LL;
Block[1] = (void *)7628133;
v8 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(Definition, Block);
CString = cocos2d::CCString::getCString(v8);
*(_OWORD *)Src = 0;
v42 = 0;
v43 = 0;
v10 = -1;
do
++v10;
while ( CString[v10] );
sub_14003D230(Src, CString, v10);
if ( v40 > 0xF )
{
v11 = Block[0];
if ( v40 + 1 >= 0x1000 )
{
v11 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v11 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v11);
}
v39 = 0;
v40 = 15;
LOBYTE(Block[0]) = 0;
sub_140044D80(Src, ".png", 4u);
v13 = Src;
if ( v43 > 0xF )
v13 = (void **)Src[0];
v14 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache(v12);
v15 = cocos2d::CCTextureCache::addImage(v14, (const char *)v13, 0);
if ( v43 > 0xF )
{
v16 = Src[0];
if ( v43 + 1 >= 0x1000 )
{
v16 = *((void **)Src[0] - 1);
if ( (unsigned __int64)((char *)Src[0] - (char *)v16 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v16);
}
v42 = 0;
v43 = 15;
LOBYTE(Src[0]) = 0;
cocos2d::CCRect::CCRect((cocos2d::CCRect *)Block, 0.0, 0.0, 0.0, 0.0);
if ( cocos2d::CCSprite::initWithTexture((cocos2d::CCSprite *)v5, v15, v17) )
{
*(_BYTE *)(v5 + 559) = 1;
sub_1400405A0((void **)(v5 + 600), &byte_1406ED6E0, 0);
CCAnimatedSprite::loadType((_QWORD *)v5, v4, v15, 0);
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v5);
goto LABEL_34;
}
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v5 + 8LL))(v5, 1);
}
v5 = 0;
LABEL_34:
*((_QWORD *)a1 + 185) = v5;
v18 = *(_QWORD *)(v5 + 664);
SpriteAnimationManager::overridePrio(v18);
v19 = *(cocos2d::CCNode **)(*(_QWORD *)(v18 + 320) + 688LL);
if ( v19 )
cocos2d::CCNode::stopAllActions(v19);
v20 = *(cocos2d::CCNode **)(*(_QWORD *)(v18 + 320) + 680LL);
if ( v20 )
cocos2d::CCNode::stopAllActions(v20);
*(_QWORD *)(*((_QWORD *)a1 + 185) + 736LL) = (char *)a1 + 1464;
v21 = (struct cocos2d::CCTexture2D *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(*((_QWORD *)a1 + 185) + 344LL)
+ 16LL))(*((_QWORD *)a1 + 185) + 344LL);
*((_DWORD *)a1 + 7) = 13;
if ( cocos2d::CCSprite::initWithTexture(a1, v21, (const struct cocos2d::CCRect *)&unk_140909B08) )
{
GameObject::commonSetup((__int64)a1);
v22 = 10.0;
v23 = 10.0;
if ( a2 <= 1328 )
{
if ( a2 == 1328 )
{
v22 = 8.0;
v23 = 15.0;
v26 = 40.0;
v27 = 35.0;
LABEL_54:
*((_BYTE *)a1 + 1221) = 1;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)Block, v27, v26);
cocos2d::CCSize::operator=((char *)a1 + 1224, v29);
goto LABEL_55;
}
v24 = a2 - 918;
if ( !v24 )
{
*((_DWORD *)a1 + 227) = 1103101952;
v22 = 48.0;
v27 = 80.0;
v26 = 80.0;
LABEL_53:
v23 = v22;
goto LABEL_54;
}
v25 = v24 - 1;
if ( v25 )
{
if ( v25 == 408 )
{
v26 = 30.0;
v27 = 35.0;
LABEL_52:
v22 = 8.0;
goto LABEL_53;
}
}
else
{
v22 = 25.0;
v23 = 6.0;
}
LABEL_55:
*((float *)a1 + 191) = v22 * *((float *)a1 + 290);
*((float *)a1 + 192) = v23 * *((float *)a1 + 291);
v30 = *(_QWORD *)a1;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)Block, v22, v23);
(*(void (__fastcall **)(cocos2d::CCSprite *, __int64))(v30 + 312))(a1, v31);
(*(void (__fastcall **)(cocos2d::CCSprite *, _QWORD))(*(_QWORD *)a1 + 464LL))(a1, *((_QWORD *)a1 + 185));
v32 = (const struct cocos2d::CCSize *)(*(__int64 (__fastcall **)(cocos2d::CCSprite *))(*(_QWORD *)a1 + 320LL))(a1);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v37, v32);
v33 = **((_QWORD **)a1 + 185);
v34 = *((_QWORD *)a1 + 185);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)Block, v37[0] * 0.5, v37[1] * 0.5);
(*(void (__fastcall **)(__int64, __int64))(v33 + 184))(v34, v35);
*((_BYTE *)a1 + 895) = 1;
*((_BYTE *)a1 + 313) = 0;
AnimatedGameObject::setupChildSprites(a1);
return 1;
}
if ( a2 != 1584 )
{
if ( a2 == 2012 )
{
v22 = 8.0;
v23 = 8.0;
*((_BYTE *)a1 + 1221) = 1;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)Block, 45.0, 45.0);
cocos2d::CCSize::operator=((char *)a1 + 1224, v28);
*((_DWORD *)a1 + 227) = 1097859072;
}
goto LABEL_55;
}
v26 = 80.0;
v27 = 60.0;
goto LABEL_52;
}
return 0;
}