//
// AnimatedGameObject::init from 0x100383214 to 0x1003833b0 (412 bytes)
//
// 1 xrefs:
// > AnimatedGameObject::create @ 0x1003831c8
//
// 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
//
bool __fastcall AnimatedGameObject::init(AnimatedGameObject *a1, int a2)
{
bool v4; // w21
const char *v5; // x0
CCAnimatedSprite *v6; // x0
CCAnimatedSprite *m_animatedSprite; // x0
cocos2d::CCTexture2D *v8; // x0
double *v9; // x0
__n128 v10; // q0
CCAnimatedSprite *v11; // x20
__n128 v12; // q1
int v14; // [xsp+0h] [xbp-30h] BYREF
__int64 v15; // [xsp+8h] [xbp-28h] BYREF
v4 = 0;
a1->m_classType = Animated;
a1->m_objectID = a2;
if ( a2 > 1327 )
{
switch ( a2 )
{
case 1328:
v5 = "GJBeast03";
break;
case 1584:
a1->m_notGrounded = 1;
v5 = "GJBeast04";
break;
case 2012:
a1->m_notGrounded = 1;
v5 = "GJBeast05";
break;
default:
return v4;
}
}
else
{
switch ( a2 )
{
case 918:
a1->m_notGrounded = 1;
v5 = "GJBeast01";
break;
case 919:
v5 = "BlackSludge";
break;
case 1327:
v5 = "GJBeast02";
break;
default:
return v4;
}
}
v6 = CCAnimatedSprite::createWithType(v5, nullptr, 0);
a1->m_animatedSprite = v6;
SpriteAnimationManager::stopAnimations(v6->m_animationManager);
m_animatedSprite = a1->m_animatedSprite;
m_animatedSprite->m_delegate = &a1->AnimatedSpriteDelegate;
v8 = (cocos2d::CCTexture2D *)((__int64 (__fastcall *)(CCAnimatedSprite *))m_animatedSprite->getTexture)(m_animatedSprite);
v4 = 0;
if ( GameObject::initWithTexture(a1, v8) )
{
AnimatedGameObject::setupAnimatedSize(a1, a2);
((void (__fastcall *)(AnimatedGameObject *, CCAnimatedSprite *))a1->addChild)(a1, a1->m_animatedSprite);
v9 = (double *)((__int64 (__fastcall *)(AnimatedGameObject *))a1->getContentSize)(a1);
v10.n128_f64[0] = sub_100022AFC(&v15, v9);
v11 = a1->m_animatedSprite;
v10.n128_f32[0] = *(float *)&v15 * 0.5;
v12.n128_f32[0] = *((float *)&v15 + 1) * 0.5;
sub_100022980(v10, v12, &v14);
((void (__fastcall *)(CCAnimatedSprite *, int *))v11->setPosition)(v11, &v14);
v4 = 1;
a1->m_unk367 = 1;
a1->m_bUnkBool2 = 0;
AnimatedGameObject::setupChildSprites(a1);
}
return v4;
}