//
// AnimatedGameObject::init from 0x1404a2a40 to 0x1404a2fcf (1423 bytes)
//
// 2 xrefs:
// > GameObject::createWithKey @ 0x14018bee6
// > ??> @ 0x1406dc7a0
//
// 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
//
// Hidden C++ exception states: #wind=4
bool AnimatedGameObject::init(AnimatedGameObject *a1, int a2)
{
double v2; // xmm0_8
const char *v5; // r15
CCAnimatedSprite *v6; // r14
ObjectManager *v7; // rax
cocos2d::CCDictionary *Definition; // rax
cocos2d::CCString *v9; // rax
const char *CString; // rax
size_t v11; // r8
void *v12; // rcx
void **v13; // rbx
cocos2d::CCTextureCache *v14; // rax
cocos2d::CCTexture2D *v15; // rbx
void *v16; // rcx
const struct cocos2d::CCRect *v17; // rax
SpriteAnimationManager *m_animationManager; // rbx
cocos2d::CCNode *m_paSprite; // rcx
cocos2d::CCNode *m_fbfSprite; // rcx
struct cocos2d::CCTexture2D *v21; // rax
float v22; // xmm6_4
float v23; // xmm7_4
int v24; // esi
int v25; // esi
float v26; // xmm1_4
__int64 v27; // rax
__int64 v28; // rax
AnimatedGameObject_vtbl *v29; // rbx
const cocos2d::CCSize *v30; // rax
const struct cocos2d::CCSize *v31; // rax
double v32; // xmm0_8
CCAnimatedSprite_vtbl *v33; // rbx
const cocos2d::CCPoint *v34; // rax
cocos2d::CCRect v36; // [rsp+38h] [rbp-49h] BYREF
cocos2d::CCSize v37; // [rsp+48h] [rbp-39h] BYREF
void *Block[2]; // [rsp+50h] [rbp-31h] BYREF
__int64 v39; // [rsp+60h] [rbp-21h]
unsigned __int64 v40; // [rsp+68h] [rbp-19h]
void *Src[2]; // [rsp+70h] [rbp-11h] BYREF
__int64 v42; // [rsp+80h] [rbp-1h]
unsigned __int64 v43; // [rsp+88h] [rbp+7h]
a1->m_classType = Animated;
a1->m_objectID = a2;
if ( a2 > 1328 )
{
if ( a2 == 1584 )
{
v5 = "GJBeast04";
}
else
{
if ( a2 != 2012 )
return 0;
v5 = "GJBeast05";
}
a1->m_notGrounded = 1;
}
else
{
switch ( a2 )
{
case 1328:
v5 = "GJBeast03";
break;
case 918:
v5 = "GJBeast01";
a1->m_notGrounded = 1;
break;
case 919:
v5 = "BlackSludge";
break;
case 1327:
v5 = "GJBeast02";
break;
default:
return 0;
}
}
v36.origin = (cocos2d::CCPoint)operator new(0x2E8u);
v6 = CCAnimatedSprite::CCAnimatedSprite(*(CCAnimatedSprite **)&v36.origin);
if ( v6 )
{
v7 = ObjectManager::instance();
Definition = ObjectManager::getDefinition(v7, v5);
v39 = 11;
v40 = 15;
Block[0] = (void *)0x6853657469727073LL;
Block[1] = (void *)7628133;
v9 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(Definition, Block);
CString = cocos2d::CCString::getCString(v9);
*(_OWORD *)Src = 0;
v42 = 0;
v43 = 0;
v11 = -1;
do
++v11;
while ( CString[v11] );
sub_14003A930(Src, CString, v11);
if ( v40 > 0xF )
{
v12 = Block[0];
if ( v40 + 1 >= 0x1000 )
{
v12 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v12 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v12);
}
v39 = 0;
v40 = 15;
LOBYTE(Block[0]) = 0;
sub_140041270(Src, ".png", 4u);
v13 = Src;
if ( v43 > 0xF )
v13 = (void **)Src[0];
v14 = (cocos2d::CCTextureCache *)cocos2d::CCTextureCache::sharedTextureCache();
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 )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v16);
}
v42 = 0;
v43 = 15;
LOBYTE(Src[0]) = 0;
v2 = cocos2d::CCRect::CCRect(&v36, 0.0, 0.0, 0.0, 0.0);
if ( cocos2d::CCSprite::initWithTexture(v6, v15, v17) )
{
v6->m_bDontDraw = 1;
sub_14003CCE0((void **)&v6->m_unkString1, byte_140518980, 0);
CCAnimatedSprite::loadType(v6, v5, v15, 0);
cocos2d::CCObject::autorelease(v6);
goto LABEL_34;
}
((void (__fastcall *)(CCAnimatedSprite *, __int64))v6->~CCAnimatedSprite)(v6, 1);
}
v6 = nullptr;
LABEL_34:
a1->m_animatedSprite = v6;
m_animationManager = v6->m_animationManager;
SpriteAnimationManager::overridePrio(m_animationManager);
m_paSprite = m_animationManager->m_sprite->m_paSprite;
if ( m_paSprite )
cocos2d::CCNode::stopAllActions(m_paSprite);
m_fbfSprite = m_animationManager->m_sprite->m_fbfSprite;
if ( m_fbfSprite )
cocos2d::CCNode::stopAllActions(m_fbfSprite);
a1->m_animatedSprite->m_delegate = &a1->AnimatedSpriteDelegate;
v21 = a1->m_animatedSprite->getTexture(&a1->m_animatedSprite->cocos2d::CCTextureProtocol);
a1->m_eObjType = GameObjectObjectType;
if ( cocos2d::CCSprite::initWithTexture(a1, v21, &stru_1406C13D0) )
{
GameObject::commonSetup(a1);
v22 = 10.0;
v23 = 10.0;
if ( a2 <= 1328 )
{
if ( a2 == 1328 )
{
v22 = 8.0;
v23 = 15.0;
v26 = 35.0;
LABEL_54:
a1->m_hasContentSize = 1;
cocos2d::CCPoint::CCPoint(*(float *)&v2, v26);
cocos2d::CCSize::operator=(&a1->m_lastSize, v28);
goto LABEL_55;
}
v24 = a2 - 918;
if ( !v24 )
{
a1->m_objectRadius = 24.0;
v22 = 48.0;
v26 = 80.0;
LABEL_53:
v23 = v22;
goto LABEL_54;
}
v25 = v24 - 1;
if ( v25 )
{
if ( v25 == 408 )
{
v26 = 35.0;
LABEL_52:
v22 = 8.0;
goto LABEL_53;
}
}
else
{
v22 = 25.0;
v23 = 6.0;
}
LABEL_55:
a1->m_width = v22 * a1->m_scaleX;
a1->m_height = v23 * a1->m_scaleY;
v29 = a1->EnhancedGameObject::GameObject::CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v36, v22, v23);
v29->setContentSize(a1, v30);
a1->addChild_1(a1, a1->m_animatedSprite);
v31 = a1->getContentSize(a1);
v32 = cocos2d::CCSize::CCSize(&v37, v31);
v33 = a1->m_animatedSprite->__vftable;
cocos2d::CCPoint::CCPoint(*(float *)&v32, v37.width * 0.5);
v33->setPosition_0(a1->m_animatedSprite, v34);
a1->m_unk367 = 1;
a1->m_bUnkBool2 = 0;
AnimatedGameObject::setupChildSprites(a1);
return 1;
}
if ( a2 != 1584 )
{
if ( a2 == 2012 )
{
v22 = 8.0;
v23 = 8.0;
a1->m_hasContentSize = 1;
cocos2d::CCPoint::CCPoint(*(float *)&v2, 45.0);
cocos2d::CCSize::operator=(&a1->m_lastSize, v27);
a1->m_objectRadius = 15.0;
}
goto LABEL_55;
}
v26 = 60.0;
goto LABEL_52;
}
return 0;
}