//
// SetupArtSwitchPopup::init from 0x57de80 to 0x57e0f8 (632 bytes)
//
// 1 xrefs:
// > SetupArtSwitchPopup::create @ 0x57e1d0
//
// 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 SetupArtSwitchPopup::init(SetupArtSwitchPopup *a1, ArtTriggerGameObject *a2, cocos2d::CCArray *a3, int a4)
{
_BOOL4 v6; // r11
const char *v7; // s16
char *v8; // r1
cocos2d::CCDirector *v9; // r0
cocos2d::CCLabelBMFont *v10; // r9
cocos2d::CCSprite *m_artSprite; // r0
CCMenuItemSpriteExtra *v12; // r8
void (__fastcall *v13)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r9
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // [sp+8h] [bp-4Ch]
void *v16; // [sp+14h] [bp-40h] BYREF
cocos2d::CCLabelBMFont *v17; // [sp+18h] [bp-3Ch] BYREF
_BYTE v18[4]; // [sp+1Ch] [bp-38h] BYREF
ButtonSprite *v19; // [sp+20h] [bp-34h] BYREF
_BYTE v20[4]; // [sp+24h] [bp-30h] BYREF
_BYTE v21[4]; // [sp+28h] [bp-2Ch] BYREF
cocos2d::CCSize v22; // [sp+2Ch] [bp-28h] BYREF
cocos2d::CCPoint v23; // [sp+34h] [bp-20h] BYREF
cocos2d::CCPoint v24; // [sp+3Ch] [bp-18h] BYREF
_DWORD v25[2]; // [sp+44h] [bp-10h] BYREF
v6 = SetupTriggerPopup::init(a1, a2, a3, 300.0, 200.0, 1);
if ( v6 )
{
v16 = &unk_ACDDA8;
v17 = (cocos2d::CCLabelBMFont *)&unk_ACDDA8;
v7 = (const char *)(int)a1->getValue(a1, 533);
if ( a4 == 3030 )
{
a1->m_artType = Ground;
sub_7753D4((int)&v16, "Change Ground");
v8 = "G:";
}
else if ( a4 == 3031 )
{
a1->m_artType = Middleground;
sub_7753D4((int)&v16, "Change Middleground");
v8 = "MG:";
}
else
{
a1->m_artType = Background;
if ( a4 == 3029 )
{
sub_7753D4((int)&v16, "Change Background");
v8 = "BG:";
}
else
{
sub_7753D4((int)&v16, "NA");
v8 = "NA:";
}
}
sub_7753D4((int)&v17, v8);
SetupTriggerPopup::preSetup(a1);
sub_775C20(v18);
SetupTriggerPopup::addTitle((int)a1);
sub_774008(v18);
sub_776584((int)&v19, "OK");
SetupTriggerPopup::addCloseButton((unsigned int)a1, &v19);
sub_774008(&v19);
sub_776584((int)v20, "Help");
sub_776584((int)v21, "Seems pretty obvious what this does.\nWhy are you here?");
SetupTriggerPopup::addHelpButton((int)a1, (int)v20, (int)v21, 1065353216);
sub_774008(v21);
sub_774008(v20);
SetupTriggerPopup::createMultiTriggerItemsDefault(a1);
v9 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v22, v9);
cocos2d::CCPoint::CCPoint(&v23, v22.width * 0.5, v22.height * 0.5);
v10 = cocos2d::CCLabelBMFont::create();
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v10->setScale)(v10, 1058642330);
a1->m_mainLayer->addChild(a1->m_mainLayer, v10);
setPosition = v10->setPosition;
cocos2d::CCPoint::CCPoint(&v24, 0.0, 40.0);
cocos2d::CCPoint::operator+(v25, &v23, &v24);
setPosition(v10, (const cocos2d::CCPoint *)v25);
artIconForKey((int)&v24, v7, a1->m_artType);
a1->m_artSprite = cocos2d::CCSprite::createWithSpriteFrameName((const char *)LODWORD(v24.x));
sub_774008(&v24);
m_artSprite = a1->m_artSprite;
v25[0] = SetupArtSwitchPopup::onArt;
v25[1] = 0;
v12 = CCMenuItemSpriteExtra::create(
m_artSprite,
nullptr,
(cocos2d::SEL_MenuHandler)__PAIR64__(SetupArtSwitchPopup::onArt, (unsigned int)a1));
a1->m_buttonMenu->addChild(a1->m_buttonMenu, v12);
v13 = v12->setPosition;
cocos2d::CCNode::convertToNodeSpace(&v24, a1->m_buttonMenu, &v23);
v13(v12, &v24);
SetupTriggerPopup::postSetup(a1);
sub_774008(&v17);
sub_774008(&v16);
}
return v6;
}