//
// CreateStartPosPopup::init from 0x1404dc3c0 to 0x1404dc936 (1398 bytes)
//
// 5 xrefs:
// > PauseLayer::onCreateStartpos @ 0x1404d90d1
// > PauseLayer::onCreateStartpos @ 0x1404d90d8
// > PauseLayer::onCreateStartpos @ 0x1404d90c2
// > ??> @ 0x1407d2a80
// > ??> @ 0x140929a98
//
// 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 11:33:05 +0000
//
// Hidden C++ exception states: #wind=4
char __fastcall CreateStartPosPopup::init(__int64 a1, __int64 a2, __int64 a3, int a4)
{
char result; // al
__int64 v6; // rcx
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rcx
cocos2d::CCArray *v10; // rdi
cocos2d::CCObject *v11; // rbx
struct cocos2d::CCObject *v12; // rbx
cocos2d::CCObject *v13; // rbx
struct cocos2d::CCObject *v14; // rbx
__int64 v15; // rbx
__int64 v16; // rax
__int64 v17; // rax
char *v18; // rsi
__int64 v19; // rdi
__int64 v20; // rbx
__int64 v21; // rax
__int64 v22; // rax
float v23; // [rsp+58h] [rbp-B0h] BYREF
float v24; // [rsp+5Ch] [rbp-ACh]
void *v25; // [rsp+60h] [rbp-A8h] BYREF
__int128 v26; // [rsp+68h] [rbp-A0h] BYREF
__int64 v27; // [rsp+78h] [rbp-90h]
__int64 v28; // [rsp+80h] [rbp-88h]
__int128 *v29; // [rsp+88h] [rbp-80h] BYREF
__int128 v30; // [rsp+90h] [rbp-78h] BYREF
__int64 v31; // [rsp+A0h] [rbp-68h]
__int64 v32; // [rsp+A8h] [rbp-60h]
int v33; // [rsp+B8h] [rbp-50h] BYREF
void *v34[4]; // [rsp+C0h] [rbp-48h] BYREF
_BYTE v35[8]; // [rsp+E0h] [rbp-28h] BYREF
int v36; // [rsp+E8h] [rbp-20h]
char v37; // [rsp+ECh] [rbp-1Ch]
int v38; // [rsp+F0h] [rbp-18h]
int v39; // [rsp+F4h] [rbp-14h]
char v40; // [rsp+F8h] [rbp-10h]
char v41; // [rsp+115h] [rbp+Dh]
int v42; // [rsp+118h] [rbp+10h]
_BYTE v43[32]; // [rsp+120h] [rbp+18h] BYREF
int v44; // [rsp+140h] [rbp+38h]
void *v45[4]; // [rsp+148h] [rbp+40h] BYREF
result = SetupTriggerPopup::init(a1, 0, 0, a4, 1127481344, 1, 0);
if ( result )
{
*(_BYTE *)(a1 + 744) = 1;
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1096LL))(a1);
v27 = 15;
v28 = 15;
strcpy((char *)&v26, "Create StartPos");
SetupTriggerPopup::addTitle(a1, &v26);
v7 = cocos2d::CCDirector::sharedDirector(v6);
cocos2d::CCDirector::getWinSize(v7, &v23);
sub_14009BE60((__int64)&v33);
v33 = -1;
sub_1400405A0(v34, "Name:", 5u);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v25, v23 * 0.5, (float)(v24 * 0.5) + 15.0);
cocos2d::CCPoint::operator=(v35, v8);
v36 = 1061997773;
v37 = 1;
v40 = 0;
v41 = 1;
v44 = 1060320051;
v38 = 4;
v39 = 20;
v42 = 1127481344;
sub_1400405A0(v45, "StartPos Name", 0xDu);
SetupTriggerPopup::createValueControlAdvanced_1(a1, &v33);
v10 = (cocos2d::CCArray *)cocos2d::CCArray::create(v9);
v25 = operator new(0x2C8u);
v11 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v25);
if ( v11 )
{
if ( ButtonSprite::init_1(
(__int64)v11,
(__int64)"Cancel",
80,
0,
1058642330,
1,
"goldFont.fnt",
(__int64)"GJ_button_04.png",
1105199104) )
{
cocos2d::CCObject::autorelease(v11);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v11 + 8LL))(v11, 1);
LODWORD(v11) = 0;
}
}
v12 = CCMenuItemSpriteExtra::create((int)v11, 0, a1, (__int64)sub_14009D628);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v12);
cocos2d::CCArray::addObject(v10, v12);
v25 = operator new(0x2C8u);
v13 = (cocos2d::CCObject *)ButtonSprite::ButtonSprite((__int64)v25);
if ( v13 )
{
if ( ButtonSprite::init_1(
(__int64)v13,
(__int64)&dword_14072428C,
80,
0,
1058642330,
1,
"goldFont.fnt",
(__int64)"GJ_button_01.png",
1105199104) )
{
cocos2d::CCObject::autorelease(v13);
}
else
{
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v13 + 8LL))(v13, 1);
LODWORD(v13) = 0;
}
}
v14 = CCMenuItemSpriteExtra::create((int)v13, 0, a1, (__int64)CreateStartPosPopup::onCreate);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCObject *))(**(_QWORD **)(a1 + 552) + 464LL))(
*(_QWORD *)(a1 + 552),
v14);
cocos2d::CCArray::addObject(v10, v14);
v15 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v25,
v23 * 0.5,
(float)((float)(v24 * 0.5) - (float)(*(float *)(a1 + 736) * 0.5)) + 30.0);
cocos2d::CCNode::convertToNodeSpace(v15, &v29, v16);
GameToolbox::alignItemsHorisontally((__int64)v10, 15.0, v17, 0);
v29 = &v26;
v26 = 0;
v27 = 0;
v28 = 0;
*(_QWORD *)&v26 = sub_14003D460(0x80u);
v27 = 112;
v28 = 127;
strcpy(
(char *)v26,
"Creates a start position here with the current settings.\n"
"Dual mode and camera settings may not be exact.");
v30 = 0;
v31 = 0;
v32 = 0;
*(_QWORD *)&v30 = sub_14003D460(0x20u);
v31 = 16;
v32 = 31;
strcpy((char *)v30, "Create Start Pos");
v18 = InfoAlertButton::create((__int64)&v30, (__int64)&v26);
(*(void (__fastcall **)(_QWORD, char *))(**(_QWORD **)(a1 + 552) + 464LL))(*(_QWORD *)(a1 + 552), v18);
v19 = *(_QWORD *)v18;
v20 = *(_QWORD *)(a1 + 552);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v29,
(float)((float)(*(float *)(a1 + 732) * 0.5) + (float)(v23 * 0.5)) - 15.0,
(float)((float)(v24 * 0.5) + (float)(*(float *)(a1 + 736) * 0.5)) - 15.0);
cocos2d::CCNode::convertToNodeSpace(v20, &v25, v21);
(*(void (__fastcall **)(char *, __int64))(v19 + 184))(v18, v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1136LL))(a1);
*(_BYTE *)(a1 + 744) = 0;
sub_14003D310((__int64)v45);
sub_14003D310((__int64)v43);
sub_14003D310((__int64)v34);
return 1;
}
return result;
}