//
// CCAnimatedSprite::loadType from 0x2e3d9c to 0x2e406a (718 bytes)
//
// 1 xrefs:
// > CCAnimatedSprite::initWithType @ 0x2e4130
//
// 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 CCAnimatedSprite::loadType(CCAnimatedSprite *a1, const char *a2, cocos2d::CCTexture2D *a3, bool a4)
{
int v7; // r7
ObjectManager *v8; // r0
cocos2d::CCDictionary *Definition; // r9
cocos2d::CCString *v10; // r6
char *CString; // r0
cocos2d::CCTextureCache *v12; // r0
cocos2d::CCString *v13; // r7
cocos2d::CCString *v14; // r6
cocos2d::CCString *v15; // r0
char *v16; // r0
cocos2d::CCSprite *v17; // r0
cocos2d::CCSprite_vtbl *v18; // r3
cocos2d::CCSprite *v19; // r8
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r7
float width; // s16
const cocos2d::CCSize *v22; // r0
cocos2d::CCString *v23; // r0
const char *v24; // r6
CCPartAnimSprite *v25; // r0
CCPartAnimSprite_vtbl *v26; // r3
CCPartAnimSprite *v27; // r6
void (__fastcall *v28)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r9
float v29; // s16
const cocos2d::CCSize *v30; // r0
std::string v31; // r2
CCPartAnimSprite *m_paSprite; // r0
cocos2d::CCSprite *m_fbfSprite; // r0
SpriteAnimationManager *m_animationManager; // r5
cocos2d::CCRect v36; // [sp+1Ch] [bp-18h] BYREF
sub_776584((int)&v36, (char *)a2);
v7 = sub_774DBC(&a1->m_unkString1, &v36);
sub_774008(&v36);
if ( v7 )
{
CCAnimatedSprite::cleanupSprite(a1);
v8 = ObjectManager::instance();
Definition = ObjectManager::getDefinition(v8, a2);
if ( !a3 )
{
sub_776584((int)&v36, "spriteSheet");
v10 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(Definition, (const std::string *)&v36);
sub_774008(&v36);
CString = (char *)cocos2d::CCString::getCString(v10);
sub_776584((int)&v36, CString);
sub_774544((int)&v36, ".png");
v12 = cocos2d::CCTextureCache::sharedTextureCache();
a3 = cocos2d::CCTextureCache::addImage(v12, (const char *)LODWORD(v36.origin.x), 0);
sub_774008(&v36);
}
sub_776584((int)&v36, "useFBF");
v13 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(Definition, (const std::string *)&v36);
sub_774008(&v36);
sub_776584((int)&v36, "usePA");
v14 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(Definition, (const std::string *)&v36);
sub_774008(&v36);
if ( v13 )
v13 = (cocos2d::CCString *)cocos2d::CCString::boolValue(v13);
if ( v14 )
v14 = (cocos2d::CCString *)cocos2d::CCString::boolValue(v14);
sub_776584((int)&v36, "defaultAnimation");
v15 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(Definition, (const std::string *)&v36);
v16 = (char *)cocos2d::CCString::getCString(v15);
sub_7753D4((int)&a1->m_currentAnim, v16);
sub_774008(&v36);
if ( v13 )
{
cocos2d::CCRect::CCRect(&v36, 0.0, 0.0, 0.0, 0.0);
v17 = cocos2d::CCSprite::createWithTexture(a3);
v18 = v17->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v19 = v17;
a1->m_fbfSprite = v17;
setPosition = v18->setPosition;
width = a1->getContentSize(a1)->width;
v22 = a1->getContentSize(a1);
cocos2d::CCPoint::CCPoint(&v36.origin, width * 0.5, v22->height * 0.5);
setPosition(v19, &v36.origin);
a1->addChild(a1, a1->m_fbfSprite);
a1->m_sprite = a1->m_fbfSprite;
}
if ( v14 )
{
sub_776584((int)&v36, "animDesc");
v23 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(Definition, (const std::string *)&v36);
v24 = cocos2d::CCString::getCString(v23);
sub_774008(&v36);
v25 = CCPartAnimSprite::createWithAnimDesc(v24, a3, a4);
v26 = v25->cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v27 = v25;
a1->m_paSprite = v25;
v28 = v26->setPosition;
v29 = a1->getContentSize(a1)->width;
v30 = a1->getContentSize(a1);
cocos2d::CCPoint::CCPoint(&v36.origin, v29 * 0.5, v30->height * 0.5);
v28(v27, &v36.origin);
a1->addChild(a1, a1->m_paSprite);
a1->m_sprite = a1->m_paSprite;
}
a1->m_spriteMode = 0;
sub_776584((int)&v36, (char *)a2);
a1->m_animationManager = (SpriteAnimationManager *)SpriteAnimationManager::createWithOwner(
(SpriteAnimationManager *)a1,
(CCAnimatedSprite *)&v36,
v31);
sub_774008(&v36);
cocos2d::CCObject::retain(a1->m_animationManager);
m_paSprite = a1->m_paSprite;
if ( m_paSprite )
m_paSprite->setVisible(m_paSprite, 0);
m_fbfSprite = a1->m_fbfSprite;
if ( m_fbfSprite )
m_fbfSprite->setVisible(m_fbfSprite, 0);
a1->setVisible(a1, 1);
m_animationManager = a1->m_animationManager;
sub_776584((int)&v36, (char *)a1->m_currentAnim.m_data.m_data);
SpriteAnimationManager::runAnimation(m_animationManager, (std::string)&v36);
sub_774008(&v36);
}
}