//
// SimplePlayer::init from 0x100307008 to 0x100307428 (1056 bytes)
//
// 1 xrefs:
// > SimplePlayer::create @ 0x10030323c
//
// 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 SimplePlayer::init(SimplePlayer *a1, int a2)
{
GameManager *v4; // x0
int v5; // w8
__int64 v6; // x20
__int128 v7; // kr20_16
bool v8; // w21
GameManager *v9; // x0
std::string *p_dst; // x0
std::string *v11; // x0
cocos2d::CCSprite *m_secondLayer; // x22
std::string *v13; // x0
cocos2d::CCSprite *m_birdDome; // x22
std::string *v15; // x0
cocos2d::CCSprite *m_outlineSprite; // x22
std::string *v17; // x0
cocos2d::CCSprite *m_detailSprite; // x22
_BYTE v20[8]; // [xsp+8h] [xbp-2C8h] BYREF
std::string v21; // [xsp+10h] [xbp-2C0h] BYREF
std::string v22; // [xsp+30h] [xbp-2A0h] BYREF
std::string __dst; // [xsp+50h] [xbp-280h] BYREF
std::string __p; // [xsp+68h] [xbp-268h] BYREF
__int128 v25; // [xsp+80h] [xbp-250h] BYREF
char *__s; // [xsp+90h] [xbp-240h]
_BYTE v27[512]; // [xsp+98h] [xbp-238h] BYREF
cocos2d::CCPoint v28; // 0:kr00_8.8
cocos2d::CCPoint v29; // 0:kr08_8.8
cocos2d::CCPoint v30; // 0:kr10_8.8
cocos2d::CCPoint v31; // 0:kr18_8.8
v4 = GameManager::sharedState();
a1->m_iconRequestID = GameManager::getIconRequestID(v4);
if ( a2 >= 485 )
v5 = 485;
else
v5 = a2;
if ( v5 <= 1 )
v6 = 1;
else
v6 = (unsigned int)v5;
v25 = xmmword_1006350E0;
__s = v27;
sub_10000CB18((__int64 *)&v25, "player_", 0);
if ( a2 <= 9 )
sub_10000CB18((__int64 *)&v25, "0", 0);
LODWORD(__p.__r_.__value_.__l.__data_) = v6;
sub_100009A40((int)&v25, v6, (int)&__p);
v7 = v25;
if ( *((_QWORD *)&v25 + 1) < (unsigned __int64)(v25 + 1) )
sub_100009ED4((__int64)&v25, v25 + 1);
__s[v7] = 0;
sub_100009900(&__p, __s);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__dst, __p.__r_.__value_.__l.__data_, __p.__r_.__value_.__l.__size_);
else
__dst = __p;
std::string::append(&__dst, "_001.png");
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&v22, __p.__r_.__value_.__l.__data_, __p.__r_.__value_.__l.__size_);
else
v22 = __p;
std::string::append(&v22, "_2_001.png");
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&v21, __p.__r_.__value_.__l.__data_, __p.__r_.__value_.__l.__size_);
else
v21 = __p;
std::string::append(&v21, "_glow_001.png");
v8 = cocos2d::CCSprite::init(a1);
if ( v8 )
{
((void (__fastcall *)(SimplePlayer *, void *))a1->setTextureRect)(a1, &unk_10086DF50);
v9 = GameManager::sharedState();
GameManager::loadIcon(v9, v6, 0, a1->m_iconRequestID);
if ( (__dst.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
p_dst = &__dst;
else
p_dst = (std::string *)__dst.__r_.__value_.__r.__words[0];
a1->m_firstLayer = cocos2d::CCSprite::createWithSpriteFrameName((const char *)p_dst);
((void (__fastcall *)(SimplePlayer *))a1->addChild_0)(a1);
if ( (v22.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v11 = &v22;
else
v11 = (std::string *)v22.__r_.__value_.__r.__words[0];
a1->m_secondLayer = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v11);
((void (__fastcall *)(cocos2d::CCSprite *))a1->m_firstLayer->addChild_0)(a1->m_firstLayer);
m_secondLayer = a1->m_secondLayer;
v28 = cocos2d::CCNode::convertToNodeSpace(a1->m_firstLayer, &stru_10086DF40);
((void (__fastcall *)(cocos2d::CCSprite *, _BYTE *, float, float))m_secondLayer->setPosition)(
m_secondLayer,
v20,
v28.x,
v28.y);
if ( (v22.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v13 = &v22;
else
v13 = (std::string *)v22.__r_.__value_.__r.__words[0];
a1->m_birdDome = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v13);
((void (__fastcall *)(cocos2d::CCSprite *))a1->m_firstLayer->addChild_0)(a1->m_firstLayer);
m_birdDome = a1->m_birdDome;
v29 = cocos2d::CCNode::convertToNodeSpace(a1->m_firstLayer, &stru_10086DF40);
((void (__fastcall *)(cocos2d::CCSprite *, _BYTE *, float, float))m_birdDome->setPosition)(
m_birdDome,
v20,
v29.x,
v29.y);
if ( (v21.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v15 = &v21;
else
v15 = (std::string *)v21.__r_.__value_.__r.__words[0];
a1->m_outlineSprite = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v15);
((void (__fastcall *)(cocos2d::CCSprite *))a1->m_firstLayer->addChild_0)(a1->m_firstLayer);
m_outlineSprite = a1->m_outlineSprite;
v30 = cocos2d::CCNode::convertToNodeSpace(a1->m_firstLayer, &stru_10086DF40);
((void (__fastcall *)(cocos2d::CCSprite *, _BYTE *, float, float))m_outlineSprite->setPosition)(
m_outlineSprite,
v20,
v30.x,
v30.y);
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))a1->m_outlineSprite->setVisible)(a1->m_outlineSprite, 0);
if ( (v22.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v17 = &v22;
else
v17 = (std::string *)v22.__r_.__value_.__r.__words[0];
a1->m_detailSprite = cocos2d::CCSprite::createWithSpriteFrameName((const char *)v17);
((void (__fastcall *)(cocos2d::CCSprite *))a1->m_firstLayer->addChild_0)(a1->m_firstLayer);
m_detailSprite = a1->m_detailSprite;
v31 = cocos2d::CCNode::convertToNodeSpace(a1->m_firstLayer, &stru_10086DF40);
((void (__fastcall *)(cocos2d::CCSprite *, _BYTE *, float, float))m_detailSprite->setPosition)(
m_detailSprite,
v20,
v31.x,
v31.y);
SimplePlayer::updatePlayerFrame(a1, v6, Cube);
}
if ( SHIBYTE(v21.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v21.__r_.__value_.__l.__data_);
if ( SHIBYTE(v22.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v22.__r_.__value_.__l.__data_);
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
if ( SHIBYTE(__p.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__p.__r_.__value_.__l.__data_);
if ( __s != v27 && __s )
operator delete[](__s);
return v8;
}