//
// CCAnimatedSprite::initWithType from 0x10033b600 to 0x10033b7bb (443 bytes)
//
// 4 xrefs:
// > AnimatedShopKeeper::create @ 0x10030fea2
// > AnimatedShopKeeper::init @ 0x100313e54
// > CCAnimatedSprite::createWithType @ 0x10033b5ba
// > GJRobotSprite::init @ 0x1006ad77e
//
// 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 12:28:41 +0000
//
__int64 __fastcall CCAnimatedSprite::initWithType(std::string *a1, __int64 a2, __int64 a3, int a4)
{
unsigned __int8 v4; // r13
__int64 v5; // r12
__int64 v6; // r14
__int64 v7; // rax
__int64 Definition; // rax
void *v9; // rax
const char *CString; // r12
size_t v11; // rax
std::string::size_type v12; // r13
char *data; // r14
__int64 v14; // rax
std::string::pointer v15; // rsi
size_t v16; // rbx
__int64 result; // rax
unsigned int v18; // ebx
char v19; // [rsp+10h] [rbp-60h] BYREF
void *v20[3]; // [rsp+11h] [rbp-5Fh] BYREF
int v21; // [rsp+2Ch] [rbp-44h]
std::string __dst; // [rsp+30h] [rbp-40h] BYREF
v4 = a4;
v5 = a3;
v6 = a2;
if ( a3 )
goto LABEL_17;
v21 = a4;
v7 = ObjectManager::instance();
Definition = ObjectManager::getDefinition(v7, a2);
v19 = 22;
strcpy((char *)v20, "spriteSheet");
v9 = cocos2d::CCDictionary::valueForKey(Definition, (__int64)&v19);
CString = (const char *)cocos2d::CCString::getCString(v9);
v11 = strlen(CString);
if ( v11 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v12 = v11;
if ( v11 >= 0x17 )
{
v16 = 26;
if ( (v11 | 7) != 0x17 )
v16 = (v11 | 7) + 1;
data = (char *)operator new(v16);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)data;
__dst.__r_.__value_.__r.__words[0] = v16 | 1;
__dst.__r_.__value_.__l.__size_ = v12;
}
else
{
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v11);
data = __dst.__r_.__value_.__s.__data_;
if ( !v11 )
{
__dst.__r_.__value_.__s.__data_[0] = 0;
if ( (v19 & 1) == 0 )
goto LABEL_7;
goto LABEL_6;
}
}
memmove(data, CString, v12);
data[v12] = 0;
if ( (v19 & 1) != 0 )
LABEL_6:
operator delete(*(void **)((char *)&v20[1] + 7));
LABEL_7:
std::string::append(&__dst, ".png");
v6 = a2;
v4 = v21;
v14 = cocos2d::CCTextureCache::sharedTextureCache(&__dst);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
v15 = __dst.__r_.__value_.__l.__data_;
else
v15 = __dst.__r_.__value_.__s.__data_;
v5 = cocos2d::CCTextureCache::addImage(v14, v15, 0);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
LABEL_17:
sub_100278270((__int64)&__dst, 0.0, 0.0, (__m128)0LL, (__m128)0LL);
result = cocos2d::CCSprite::initWithTexture_1((__int64)a1, v5, (__int64)&__dst);
if ( (_BYTE)result )
{
a1[23].__r_.__value_.__s.__data_[6] = 1;
v18 = result;
std::string::assign(a1 + 25, "");
CCAnimatedSprite::loadType(a1, v6, v5, v4);
return v18;
}
return result;
}