//
// CollisionBlockPopup::init from 0x14008aa40 to 0x14008b59d (2909 bytes)
//
// 2 xrefs:
// > CollisionBlockPopup::create @ 0x14008a9fb
// > ??> @ 0x1406c6d68
//
// 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
//
// Hidden C++ exception states: #wind=2
bool CollisionBlockPopup::init(CollisionBlockPopup *a1, EffectGameObject *a2, cocos2d::CCArray *a3)
{
bool result; // al
__int64 v7; // rdx
cocos2d::CCObject *v8; // rcx
EffectGameObject *m_gameObject; // rcx
cocos2d::CCArray *m_gameObjects; // rcx
unsigned int i; // ebx
struct cocos2d::CCObject *v12; // rax
int m_blockID; // ecx
int m_nTag; // eax
__int64 v15; // rcx
cocos2d::CCDirector *v16; // rax
struct cocos2d::CCRect *v17; // rax
struct cocos2d::extension::CCScale9Sprite *v18; // rdi
cocos2d::extension::CCScale9Sprite_vtbl *v19; // rbx
const cocos2d::CCSize *v20; // rax
cocos2d::extension::CCScale9Sprite_vtbl *v21; // rbx
const cocos2d::CCPoint *v22; // rax
struct cocos2d::CCLabelBMFont *v23; // rdi
cocos2d::CCLabelBMFont_vtbl *v24; // rbx
const cocos2d::CCPoint *v25; // rax
ButtonSprite *v26; // rbx
CCMenuItemSpriteExtra *v27; // rax
cocos2d::CCMenu *v28; // rax
cocos2d::CCMenu_vtbl *v29; // rbx
const cocos2d::CCPoint *v30; // rax
cocos2d::CCNode *v31; // rdi
cocos2d::CCNode_vtbl *v32; // rbx
struct cocos2d::CCPoint v33; // rax
struct cocos2d::CCLabelBMFont *v34; // rbx
struct cocos2d::CCRect *v35; // rax
struct cocos2d::extension::CCScale9Sprite *v36; // rdi
__int64 v37; // rdx
const char *v38; // r9
CCTextInputNode *v39; // rax
CCTextInputNode *m_blockIDInput; // rcx
CCTextInputNode *v41; // rcx
std::string *p_m_allowedChars; // rcx
CCTextInputNode *v43; // rcx
CCTextInputNode *v44; // rcx
struct cocos2d::CCSprite *v45; // rax
CCMenuItemSpriteExtra *v46; // rdi
CCMenuItemSpriteExtra_vtbl *v47; // rbx
struct cocos2d::CCPoint v48; // rax
struct cocos2d::CCSprite *v49; // rbx
cocos2d::CCNode *v50; // rbx
struct cocos2d::CCSprite *v51; // rbx
cocos2d::CCNode *v52; // rbx
float *v53; // rax
float *v54; // rbx
struct cocos2d::CCPoint v55; // rax
int v56; // [rsp+20h] [rbp-E0h]
float v57; // [rsp+80h] [rbp-80h]
float v58; // [rsp+84h] [rbp-7Ch]
cocos2d::CCPoint v59; // [rsp+88h] [rbp-78h] BYREF
__int128 v60; // [rsp+90h] [rbp-70h] BYREF
__int64 v61; // [rsp+A0h] [rbp-60h]
__int64 v62; // [rsp+A8h] [rbp-58h]
cocos2d::CCPoint v63; // [rsp+B0h] [rbp-50h] BYREF
cocos2d::CCRect v64; // [rsp+B8h] [rbp-48h] BYREF
__int64 v65; // [rsp+C8h] [rbp-38h]
__int64 v66; // [rsp+D0h] [rbp-30h]
struct cocos2d::CCPoint v67; // [rsp+D8h] [rbp-28h] BYREF
_QWORD Src[4]; // [rsp+E0h] [rbp-20h] BYREF
cocos2d::CCSize v69; // [rsp+100h] [rbp+0h] BYREF
cocos2d::CCPoint v70; // [rsp+108h] [rbp+8h] BYREF
cocos2d::CCRect v71[6]; // [rsp+110h] [rbp+10h] BYREF
ButtonSprite *v72; // [rsp+1B8h] [rbp+B8h] BYREF
result = FLAlertLayer::init_1(a1, 150);
if ( !result )
return result;
a1->m_disableDelegate = 1;
if ( a2 )
{
a1->m_gameObject = a2;
v8 = a2;
LABEL_6:
cocos2d::CCObject::retain(v8);
goto LABEL_7;
}
if ( a3 )
{
a1->m_gameObjects = a3;
v8 = a3;
goto LABEL_6;
}
LABEL_7:
m_gameObject = a1->m_gameObject;
if ( m_gameObject )
{
a1->m_blockID = m_gameObject->m_itemID;
a1->m_dynamicBlock = m_gameObject->m_isDynamicBlock;
}
else
{
m_gameObjects = a1->m_gameObjects;
if ( m_gameObjects )
{
if ( cocos2d::CCArray::count(m_gameObjects) )
{
a1->m_blockID = -1;
a1->m_dynamicBlock = 1;
for ( i = 0; i < cocos2d::CCArray::count(a1->m_gameObjects); ++i )
{
v12 = cocos2d::CCArray::objectAtIndex(a1->m_gameObjects, i);
if ( !BYTE1(v12[30].m_nLuaID) )
a1->m_dynamicBlock = 0;
m_blockID = a1->m_blockID;
m_nTag = v12[30].m_nTag;
if ( m_blockID == -1 )
{
a1->m_blockID = m_nTag;
}
else if ( m_blockID != m_nTag )
{
a1->m_blockID = 0;
}
}
}
}
}
LOBYTE(v7) = -106;
a1->setOpacity(&a1->cocos2d::CCRGBAProtocol, v7);
a1->m_noElasticity = 1;
v16 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v15);
cocos2d::CCDirector::getWinSize(v16);
v17 = (struct cocos2d::CCRect *)cocos2d::CCRect::CCRect(&v64, 0.0, 0.0, 80.0, 80.0);
v18 = cocos2d::extension::CCScale9Sprite::create("GJ_square01.png", v17);
v19 = v18->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v72, 300.0, 200.0);
v19->setContentSize(v18, v20);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v18, -2);
v21 = v18->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v72, v57 * 0.5, v58 * 0.5);
v21->setPosition_0(v18, v22);
v23 = cocos2d::CCLabelBMFont::create("Collision Block Setup", "goldFont.fnt");
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v23);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v23->setScale_0)(v23);
v24 = v23->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v72, v57 * 0.5, (float)((float)(v58 * 0.5) + 100.0) - 18.0);
v24->setPosition_0(v23, v25);
v72 = (ButtonSprite *)operator new(0x2C0u);
v26 = ButtonSprite::ButtonSprite(v72);
if ( v26 )
{
if ( ButtonSprite::init_1(v26, "OK", 40, 0, 0.80000001, 1, "goldFont.fnt", "GJ_button_01.png", 30.0) )
{
cocos2d::CCObject::autorelease(v26);
}
else
{
((void (__fastcall *)(ButtonSprite *, __int64))v26->~ButtonSprite)(v26, 1);
v26 = nullptr;
}
}
v27 = CCMenuItemSpriteExtra::create(v26, nullptr, a1, (cocos2d::SEL_MenuHandler *)CollisionBlockPopup::onClose);
v28 = cocos2d::CCMenu::create(v27, 0);
a1->m_buttonMenu = v28;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v28, 10);
v29 = a1->m_buttonMenu->FLAlertLayer::__vftable;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v72, v57 * 0.5, (float)((float)(v58 * 0.5) - 100.0) + 24.0);
v29->setPosition_0(a1->m_buttonMenu, v30);
v72 = (ButtonSprite *)&v60;
v60 = 0;
v61 = 0;
v62 = 15;
*(_QWORD *)&v60 = sub_14003AA10(0xC0u);
v61 = 191;
v62 = 191;
strcpy(
(char *)v60,
"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 other "
"nearby collision blocks.");
v64 = 0;
v65 = 4;
v66 = 15;
strcpy((char *)&v64, "Help");
v31 = (cocos2d::CCNode *)InfoAlertButton::create(&v64, &v60);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v31);
v32 = v31->__vftable;
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v72,
(float)((float)(v57 * 0.5) - 150.0) + 18.0,
(float)((float)(v58 * 0.5) + 100.0) - 18.0);
v33 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v63);
((void (__fastcall *)(cocos2d::CCNode *, struct cocos2d::CCPoint))v32->setPosition_0)(v31, v33);
a1->m_joystickConnected = -1;
cocos2d::CCPoint::CCPoint(&v59, v57 * 0.5, (float)(v58 * 0.5) + 10.0);
v34 = cocos2d::CCLabelBMFont::create("Block ID", "goldFont.fnt");
a1->m_mainLayer->addChild_1(a1->m_mainLayer, v34);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v34->setScale_0)(v34);
cocos2d::CCPoint::CCPoint(&v63, 0.0, 34.0);
cocos2d::CCPoint::operator+(&v59, &v72);
v34->setPosition_0(v34, (const cocos2d::CCPoint *)&v72);
cocos2d::CCRect::CCRect(v71, 0.0, 0.0, 40.0, 40.0);
v35 = (struct cocos2d::CCRect *)cocos2d::CCRect::CCRect(&v64, v71);
v36 = cocos2d::extension::CCScale9Sprite::create("square02b_small.png", v35);
LOBYTE(v37) = 100;
v36->setOpacity(&v36->cocos2d::CCRGBAProtocol, v37);
LOWORD(v72) = 0;
BYTE2(v72) = 0;
v36->setColor(&v36->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v72);
cocos2d::CCSize::CCSize(&v69, 50.0, 30.0);
v36->setContentSize(v36, &v69);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v36, -1);
v36->setPosition_0(v36, &v59);
v39 = CCTextInputNode::create(50.0, 40.0, "Num", v38, v56, (const char *)&qword_14052A4D8);
a1->m_blockIDInput = v39;
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v39, 20);
a1->m_blockIDInput->setPosition_0(a1->m_blockIDInput, &v59);
m_blockIDInput = a1->m_blockIDInput;
m_blockIDInput->m_maxLabelScale = 0.60000002;
CCTextInputNode::refreshLabel(m_blockIDInput);
v41 = a1->m_blockIDInput;
v41->m_maxLabelWidth = 200.0;
CCTextInputNode::refreshLabel(v41);
a1->m_blockIDInput->m_textField->setVisible(a1->m_blockIDInput->m_textField, 0);
a1->m_blockIDInput->m_maxLabelLength = 6;
Src[1] = 14648;
Src[2] = 10;
Src[3] = 15;
Src[0] = 0x3736353433323130LL;
v72 = (ButtonSprite *)Src;
p_m_allowedChars = &a1->m_blockIDInput->m_allowedChars;
if ( p_m_allowedChars != (std::string *)Src )
sub_14003CCE0((void **)p_m_allowedChars, Src, 0xAu);
sub_14003A830((__int64)Src);
LOWORD(v72) = -21896;
v43 = a1->m_blockIDInput;
*(_WORD *)&v43->m_placeholderColor.r = -21896;
v43->m_placeholderColor.b = -16;
CCTextInputNode::refreshLabel(v43);
v44 = a1->m_blockIDInput;
v44->m_placeholderScale = 0.5;
CCTextInputNode::refreshLabel(v44);
a1->m_blockIDInput->m_delegate = &a1->TextInputDelegate;
a1->m_blockIDInput->m_numberInput = 1;
v45 = cocos2d::CCSprite::createWithSpriteFrameName("GJ_plus2Btn_001.png");
v46 = CCMenuItemSpriteExtra::create(v45, nullptr, a1, (cocos2d::SEL_MenuHandler *)CollisionBlockPopup::onNextItemID);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v46);
cocos2d::CCPoint::CCPoint(&v63, 54.0, 32.0);
cocos2d::CCPoint::operator+(&v59, &v72);
v47 = v46->cocos2d::CCMenuItemSprite::cocos2d::CCMenuItem::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v48 = cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v64.origin);
((void (__fastcall *)(CCMenuItemSpriteExtra *, struct cocos2d::CCPoint))v47->setPosition_0)(v46, v48);
cocos2d::CCNode::convertToNodeSpace(a1->m_buttonMenu, &v67);
v49 = cocos2d::CCSprite::createWithSpriteFrameName("edit_leftBtn_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v49->setScale_0)(v49);
v50 = CCMenuItemSpriteExtra::create(v49, nullptr, a1, (cocos2d::SEL_MenuHandler *)CollisionBlockPopup::onItemIDArrow);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v50);
v50->setTag(v50, 1);
cocos2d::CCPoint::CCPoint(&v64.origin, -50.0, 0.0);
cocos2d::CCPoint::operator+(&v67, &v72);
v50->setPosition_0(v50, (const cocos2d::CCPoint *)&v72);
v50[1].m_unknown5 = 0x40000000;
v51 = cocos2d::CCSprite::createWithSpriteFrameName("edit_rightBtn_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v51->setScale_0)(v51);
v52 = CCMenuItemSpriteExtra::create(v51, nullptr, a1, (cocos2d::SEL_MenuHandler *)CollisionBlockPopup::onItemIDArrow);
a1->m_buttonMenu->addChild_1(a1->m_buttonMenu, v52);
v52->setTag(v52, 2);
cocos2d::CCPoint::CCPoint(&v64.origin, 50.0, 0.0);
cocos2d::CCPoint::operator+(&v67, &v72);
v52->setPosition_0(v52, (const cocos2d::CCPoint *)&v72);
v52[1].m_unknown5 = 0x40000000;
CollisionBlockPopup::updateTextInputLabel(a1);
cocos2d::CCPoint::CCPoint(
&v70,
(float)((float)(v57 * 0.5) - 150.0) + 20.0,
(float)((float)(v58 * 0.5) - 100.0) + 25.0);
v72 = (ButtonSprite *)&v60;
v61 = 13;
v62 = 15;
strcpy((char *)&v60, "Dynamic\nBlock");
HIWORD(v60) = 0;
cocos2d::CCPoint::CCPoint(&v64.origin, 8.0, 0.0);
v54 = v53;
cocos2d::CCPoint::CCPoint(&v63, &v70);
GameToolbox::createToggleButton(
(const char *)&v60,
(cocos2d::SEL_MenuHandler *)CollisionBlockPopup::onDynamicBlock,
a1->m_dynamicBlock,
a1->m_buttonMenu,
v55,
a1,
a1->m_mainLayer,
0.60000002,
0.34999999,
0.0,
v54,
(const char *)&qword_14052A4D8,
0,
0,
nullptr);
a1->m_disableDelegate = 0;
return 1;
}