//
// CollisionBlockPopup::init from 0x1400a4cf0 to 0x1400a516c (1148 bytes)
//
// 3 xrefs:
// > CollisionBlockPopup::create @ 0x1400a4cae
// > ??> @ 0x140913190
// > ??> @ 0x14091319c
//
// 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:26:08 +0000
//
// Hidden C++ exception states: #wind=2
char __fastcall CollisionBlockPopup::init(__int64 a1, int a2, int a3, int a4)
{
char result; // al
__int64 v6; // rcx
__int64 v7; // rax
_WORD *v8; // rax
__int64 v9; // rax
int v10; // edx
void *v11; // rcx
cocos2d::CCDictionary *v12; // rbx
struct cocos2d::CCObject *v13; // rax
cocos2d::CCDictionary *v14; // rbx
struct cocos2d::CCObject *v15; // rax
int v16; // eax
__int128 *v17; // [rsp+68h] [rbp-59h] BYREF
__int128 v18; // [rsp+70h] [rbp-51h] BYREF
__int64 v19; // [rsp+80h] [rbp-41h]
__int64 v20; // [rsp+88h] [rbp-39h]
float v21; // [rsp+90h] [rbp-31h] BYREF
float v22; // [rsp+94h] [rbp-2Dh]
_BYTE v23[8]; // [rsp+98h] [rbp-29h] BYREF
_BYTE v24[8]; // [rsp+A0h] [rbp-21h] BYREF
_BYTE v25[8]; // [rsp+A8h] [rbp-19h] BYREF
void *Block[2]; // [rsp+B0h] [rbp-11h] BYREF
__m128i si128; // [rsp+C0h] [rbp-1h]
result = SetupTriggerPopup::init(a1, a2, a3, a4, 1128792064, 1, 0);
if ( result )
{
*(_BYTE *)(a1 + 744) = 1;
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1096LL))(a1);
v7 = cocos2d::CCDirector::sharedDirector(v6);
cocos2d::CCDirector::getWinSize(v7, &v21);
v18 = 0;
*(_QWORD *)&v18 = sub_14003D460(0x20u);
v19 = 21;
v20 = 31;
strcpy((char *)v18, "Collision Block Setup");
SetupTriggerPopup::addTitle(a1, &v18);
v18 = 0;
v19 = 2;
v20 = 15;
strcpy((char *)&v18, "OK");
SetupTriggerPopup::addCloseButton(a1, &v18);
v17 = &v18;
v18 = 0;
v19 = 0;
v20 = 0;
v8 = sub_14003D460(0xC0u);
*(_QWORD *)&v18 = v8;
v19 = 191;
v20 = 191;
qmemcpy(
v8,
"Used for Collision and Instant Collision triggers.\n"
"Enable Dynamic Block if you want it to collide with another. Dynamic Blocks check for collisions with othe"
"r nearby collision blocks",
190);
v8[95] = (unsigned __int8)aUsedForCollisi[190];
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 4;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "Help");
SetupTriggerPopup::addHelpButton(a1, Block, &v18);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v23, v21 * 0.5, (float)(v22 * 0.5) + 10.0);
si128 = _mm_load_si128((const __m128i *)&xmmword_140836590);
Block[0] = (void *)0x4449206B636F6C42LL;
Block[1] = nullptr;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v17, (const struct cocos2d::CCPoint *)v23);
v10 = a1 + 544;
if ( !a1 )
v10 = 0;
IDNameInput::create(a1, v10, 3, 80, (__int64)Block, v9, 1065353216, 6, 0, 0, 0);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v11 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v11 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v11 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v11);
}
v12 = *(cocos2d::CCDictionary **)(a1 + 840);
v13 = cocos2d::CCFloat::create(0.0);
cocos2d::CCDictionary::setObject(v12, v13, 80);
v14 = *(cocos2d::CCDictionary **)(a1 + 848);
v15 = cocos2d::CCFloat::create(9999.0);
cocos2d::CCDictionary::setObject(v14, v15, 80);
LODWORD(v17) = 80;
*(_BYTE *)sub_14016EE40(a1 + 856, &v17) = 1;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v24,
(float)((float)(v21 * 0.5) - (float)(*(float *)(a1 + 732) * 0.5)) + 20.0,
(float)((float)(v22 * 0.5) - (float)(*(float *)(a1 + 736) * 0.5)) + 25.0);
v17 = &v18;
v19 = 13;
v20 = 15;
strcpy((char *)&v18, "Dynamic\nBlock");
HIWORD(v18) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v25, (const struct cocos2d::CCPoint *)v24);
SetupTriggerPopup::createToggleValueControl(a1, 94, (unsigned int)&v18, v16, 0, 0, 0, 1065353216);
(*(void (__fastcall **)(__int64))(*(_QWORD *)a1 + 1136LL))(a1);
*(_BYTE *)(a1 + 744) = 0;
return 1;
}
return result;
}