//
// SelectArtLayer::init from 0xa358e4 to 0xa362b8 (2516 bytes)
//
// 2 xrefs:
// > SelectArtLayer::create @ 0xa363e0
// > ??> @ 0xaa100
//
// 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 SelectArtLayer::init(SelectArtLayer *a1, SelectArtType a2, int a3)
{
bool v7; // zf
cocos2d::CCDirector *v8; // x0
cocos2d::CCLayer *v9; // x0
cocos2d::CCNode *v10; // x22
SelectArtType m_type; // w0
float v12; // s8
void (__fastcall *setContentSize)(cocos2d::CCNode *__hidden, const cocos2d::CCSize *); // x20
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x20
cocos2d::CCLabelBMFont *v15; // x20
void (__fastcall *v16)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x22
cocos2d::CCArray *v17; // x0
float v18; // s13
cocos2d::CCArray *v19; // x0
cocos2d::CCArray *v20; // x0
cocos2d::CCArray *v21; // x25
cocos2d::CCMenu *v22; // x0
SelectArtType v23; // w0
float v24; // s14
float v25; // s12
int v26; // w27
float v27; // s8
int v28; // w23
float v29; // s1
SelectArtType v30; // w20
float v31; // s10
ObjectToolbox *v32; // x27
int v33; // w0
const char *CString; // x0
cocos2d::CCSprite *v35; // x27
CCMenuItemSpriteExtra *v36; // x27
__int32 v37; // w1
__int32 v38; // w2
void (__fastcall *v39)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x28
SelectArtType v40; // w0
cocos2d::CCString *v41; // x0
cocos2d::CCString *v42; // x0
const char *v43; // x6
cocos2d::CCNode *v44; // x0
CCMenuItemSpriteExtra *v45; // x20
cocos2d::CCMenu *v46; // x25
void (__fastcall *v47)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCArray *v48; // x0
cocos2d::CCString *v49; // x0
cocos2d::CCArray *v50; // x0
cocos2d::CCLabelBMFont *v51; // x24
void (__fastcall *v52)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x27
const char *v53; // x6
CCMenuItemSpriteExtra *v54; // x28
const char *v55; // x6
CCMenuItemSpriteExtra *v56; // x28
const char *v57; // x6
cocos2d::CCNode *v58; // x25
CCMenuItemSpriteExtra *v59; // x20
cocos2d::CCLabelBMFont_vtbl *v60; // x1
cocos2d::CCLabelBMFont *v61; // x0
cocos2d::CCMenu *v62; // x24
void (__fastcall *v63)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
__int64 v64; // x25
double v65; // d0
double v66; // d1
float v67; // [xsp+B0h] [xbp+B0h]
cocos2d::CCMenu *v68; // [xsp+B0h] [xbp+B0h]
cocos2d::CCMenu *v69; // [xsp+B0h] [xbp+B0h]
cocos2d::CCMenu *m_buttonMenu; // [xsp+B8h] [xbp+B8h]
cocos2d::CCNode *v71; // [xsp+B8h] [xbp+B8h]
cocos2d::CCNode *v72; // [xsp+B8h] [xbp+B8h]
char v73; // [xsp+C7h] [xbp+C7h]
int v74; // [xsp+C8h] [xbp+C8h]
cocos2d::CCNode *v75; // [xsp+C8h] [xbp+C8h]
cocos2d::CCObject *v76; // [xsp+C8h] [xbp+C8h]
cocos2d::CCNode *v77; // [xsp+C8h] [xbp+C8h]
cocos2d::CCObject *v78; // [xsp+C8h] [xbp+C8h]
float v79; // [xsp+D8h] [xbp+D8h]
float v80; // [xsp+DCh] [xbp+DCh]
char v81[8]; // [xsp+E0h] [xbp+E0h] BYREF
char v82[8]; // [xsp+E8h] [xbp+E8h] BYREF
cocos2d::CCPoint v83; // [xsp+F0h] [xbp+F0h] BYREF
cocos2d::CCRect v84; // [xsp+F8h] [xbp+F8h] BYREF
cocos2d::CCPoint v85; // 0:kr08_8.8
cocos2d::CCPoint v86; // 0:kr10_8.8
cocos2d::CCPoint v87; // 0:kr18_8.8
cocos2d::CCPoint v88; // 0:kr20_8.8
cocos2d::CCPoint v89; // 0:kr28_8.8
cocos2d::SEL_MenuHandler v90; // 0:x2.16
cocos2d::SEL_MenuHandler v91; // 0:x2.16
cocos2d::SEL_MenuHandler v92; // 0:x2.16
cocos2d::SEL_MenuHandler v93; // 0:x2.16
cocos2d::SEL_MenuHandler v94; // 0:x2.16
cocos2d::CCRect v95; // 0:s0.4,4:s1.4,8:s2.4,12:s3.4
v84.origin.x = -1.034e-25;
v73 = cocos2d::CCLayerColor::initWithColor(a1, (const cocos2d::_ccColor4B *)&v84);
if ( v73 )
{
FLAlertLayer::incrementForcePrio(a1);
a1->m_type = a2;
if ( a3 != -1 )
a1->m_art = a3;
if ( a2 )
{
if ( a2 == Ground )
{
if ( a1->m_art <= 0 )
a1->m_art = 1;
v74 = 22;
}
else
{
v7 = a2 == Middleground;
a2 = Background;
if ( v7 )
v74 = 3;
else
v74 = 11;
}
}
else
{
a2 = Ground;
if ( a1->m_art <= 0 )
a1->m_art = 1;
v74 = 59;
}
a1->setTouchEnabled(a1, 1);
a1->setKeypadEnabled(a1, 1);
v8 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v8);
v9 = cocos2d::CCLayer::create();
a1->m_mainLayer = v9;
a1->addChild(a1, v9);
cocos2d::CCRect::CCRect(&v84, 0.0, 0.0, 80.0, 80.0);
v10 = (cocos2d::CCNode *)cocos2d::extension::CCScale9Sprite::create(
(cocos2d::extension::CCScale9Sprite *)"GJ_square01.png",
(const char *)&v84,
v95);
m_type = a1->m_type;
if ( m_type )
{
if ( m_type == Ground )
v12 = 260.0;
else
v12 = 240.0;
}
else
{
v12 = 300.0;
}
setContentSize = v10->setContentSize;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v84, 360.0, v12);
setContentSize(v10, (const cocos2d::CCSize *)&v84);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v10, -1);
setPosition = v10->setPosition;
cocos2d::CCPoint::CCPoint(&v84.origin, v79 * 0.5, v80 * 0.5);
setPosition(v10, &v84.origin);
v15 = cocos2d::CCLabelBMFont::create();
v67 = v12 * 0.5;
v16 = v15->setPosition;
cocos2d::CCPoint::CCPoint(&v84.origin, v79 * 0.5, (float)((float)(v12 * 0.5) + (float)(v80 * 0.5)) - 20.0);
v16(v15, &v84.origin);
a1->m_mainLayer->addChild(a1->m_mainLayer, v15);
v15->setScale(v15, 0.8);
v17 = (cocos2d::CCArray *)(unsigned int)a1->m_type;
if ( (_DWORD)v17 )
{
v18 = 0.8;
if ( (_DWORD)v17 == 1 )
v18 = 0.7;
}
else
{
v18 = 0.6;
}
v19 = (cocos2d::CCArray *)cocos2d::CCArray::create(v17);
a1->m_artSprites = v19;
cocos2d::CCObject::retain(v19);
v21 = (cocos2d::CCArray *)cocos2d::CCArray::create(v20);
v22 = cocos2d::CCMenu::create();
a1->m_buttonMenu = v22;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v22, 10);
v23 = a1->m_type;
if ( v23 )
{
if ( v23 == Ground )
{
v29 = 40.0;
v26 = -8;
v28 = 8;
v24 = -40.0;
v25 = 20.0;
v27 = 40.0;
}
else
{
v24 = -45.0;
v25 = 22.5;
v26 = -7;
v27 = 45.0;
v28 = 7;
v29 = 25.0;
}
}
else
{
v28 = 10;
v24 = -35.0;
v26 = -10;
v25 = 17.5;
v29 = 75.0;
v27 = 35.0;
}
m_buttonMenu = a1->m_buttonMenu;
v30 = a2;
cocos2d::CCPoint::CCPoint(&v84.origin, v79 * 0.5, (float)(v25 + (float)(v80 * 0.5)) + v29);
v85 = cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v84.origin);
*(float *)&v65 = v85.x;
*(float *)&v66 = v85.y;
v31 = (float)v26;
do
{
v40 = a1->m_type;
if ( v40 )
{
if ( v40 == Ground )
{
v49 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"gIcon_%02d_001.png",
(const char *)(unsigned int)v30,
v65,
v66);
CString = cocos2d::CCString::getCString(v49);
}
else if ( v40 == Middleground )
{
v42 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"mgIcon_%02d_001.png",
(const char *)(unsigned int)v30,
v65,
v66);
CString = cocos2d::CCString::getCString(v42);
}
else
{
v32 = ObjectToolbox::sharedState();
v33 = EditorUI::smartTypeForKey(v30);
CString = ObjectToolbox::intKeyToFrame(v32, v33);
}
}
else
{
v41 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"bgIcon_%02d_001.png",
(const char *)(unsigned int)v30,
v65,
v66);
CString = cocos2d::CCString::getCString(v41);
}
v35 = cocos2d::CCSprite::createWithSpriteFrameName(CString);
cocos2d::CCArray::addObject(a1->m_artSprites, v35);
v35->setScale(v35, v18);
v90.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v90.adj = (size_t)SelectArtLayer::selectArt;
v36 = CCMenuItemSpriteExtra::create(v35, nullptr, v90);
v36->setTag(v36, v30);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v36);
cocos2d::CCArray::addObject(v21, v36);
v37 = v30 - a2;
v38 = (v30 - a2) / v28;
++v30;
v39 = v36->setPosition;
cocos2d::CCPoint::CCPoint(
&v84.origin,
(float)((float)(v27 * (float)(v37 - v38 * v28)) + (float)(v27 * (float)(v31 * 0.5))) + v25,
floorf((float)v38) * v24);
cocos2d::CCPoint::operator+(&v83, v81, &v84);
v39(v36, &v83);
}
while ( v30 <= v74 );
a1->m_joystickConnected = -1;
cocos2d::CCArray::removeAllObjects(v21);
v44 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"OK",
(const char *)&qword_28,
0,
1,
0.8,
"goldFont.fnt",
"GJ_button_01.png",
v43,
30.0);
v91.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v91.adj = (size_t)SelectArtLayer::onClose;
v45 = CCMenuItemSpriteExtra::create(v44, nullptr, v91);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v45);
v46 = a1->m_buttonMenu;
v47 = v45->setPosition;
cocos2d::CCPoint::CCPoint(&v84.origin, v79 * 0.5, 25.0 - (float)(v67 - (float)(v80 * 0.5)));
v86 = cocos2d::CCNode::convertToNodeSpace(v46, &v84.origin);
((void (__fastcall *)(CCMenuItemSpriteExtra *, cocos2d::CCPoint *, float, float))v47)(v45, &v83, v86.x, v86.y);
SelectArtLayer::selectArt(a1, nullptr);
if ( a1->m_type == Ground )
{
v50 = (cocos2d::CCArray *)cocos2d::CCArray::create(v48);
a1->m_lineSprites = v50;
cocos2d::CCObject::retain(v50);
v51 = cocos2d::CCLabelBMFont::create();
v51->setScale(v51, 0.7);
a1->m_mainLayer->addChild(a1->m_mainLayer, v51);
v52 = v51->setPosition;
cocos2d::CCPoint::CCPoint(&v84.origin, (float)(v79 * 0.5) + 130.0, (float)(v80 * 0.5) + -45.0);
v52(v51, &v84.origin);
v75 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"1",
(const char *)&dword_14,
0,
1,
0.4,
"bigFont.fnt",
"GJ_button_04.png",
v53,
20.0);
v92.adj = (size_t)SelectArtLayer::onSelectCustom;
v92.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v54 = CCMenuItemSpriteExtra::create(v75, nullptr, v92);
v54->setTag(v54, 1);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v54);
cocos2d::CCArray::addObject(a1->m_lineSprites, v75);
v71 = (cocos2d::CCNode *)v54->setPosition;
v68 = a1->m_buttonMenu;
v76 = (cocos2d::CCObject *)v51->getPosition(v51);
cocos2d::CCPoint::CCPoint(&v84.origin, -23.0, -25.0);
cocos2d::CCPoint::operator+(&v83, v76, &v84);
v87 = cocos2d::CCNode::convertToNodeSpace(v68, &v83);
((void (__fastcall *)(CCMenuItemSpriteExtra *, char *, float, float))v71)(v54, v82, v87.x, v87.y);
v77 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)&byte_F78BA8,
(const char *)&dword_14,
0,
1,
0.4,
"bigFont.fnt",
"GJ_button_04.png",
v55,
20.0);
v93.adj = (size_t)SelectArtLayer::onSelectCustom;
v93.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v56 = CCMenuItemSpriteExtra::create(v77, nullptr, v93);
v56->setTag(v56, 2);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v56);
cocos2d::CCArray::addObject(a1->m_lineSprites, v77);
v72 = (cocos2d::CCNode *)v56->setPosition;
v69 = a1->m_buttonMenu;
v78 = (cocos2d::CCObject *)v51->getPosition(v51);
cocos2d::CCPoint::CCPoint(&v84.origin, 23.0, -25.0);
cocos2d::CCPoint::operator+(&v83, v78, &v84);
v88 = cocos2d::CCNode::convertToNodeSpace(v69, &v83);
((void (__fastcall *)(CCMenuItemSpriteExtra *, char *, float, float))v72)(v56, v82, v88.x, v88.y);
v58 = (cocos2d::CCNode *)ButtonSprite::create(
(ButtonSprite *)"3",
(const char *)&dword_14,
0,
1,
0.4,
"bigFont.fnt",
"GJ_button_04.png",
v57,
20.0);
v94.adj = (size_t)SelectArtLayer::onSelectCustom;
v94.ptr = (void (__cdecl *)(cocos2d::CCObject *))a1;
v59 = CCMenuItemSpriteExtra::create(v58, nullptr, v94);
v59->setTag(v59, 3);
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v59);
cocos2d::CCArray::addObject(a1->m_lineSprites, v58);
v60 = v51->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v61 = v51;
v62 = a1->m_buttonMenu;
v63 = v59->setPosition;
v64 = (__int64)v60->getPosition(v61);
cocos2d::CCPoint::CCPoint(&v84.origin, -23.0, -50.0);
cocos2d::CCPoint::operator+(&v83, v64, &v84);
v89 = cocos2d::CCNode::convertToNodeSpace(v62, &v83);
((void (__fastcall *)(CCMenuItemSpriteExtra *, char *, float, float))v63)(v59, v82, v89.x, v89.y);
}
a1->m_noElasticity = 1;
}
return v73;
}