//
// EditorUI::onCreate from 0x1401b2460 to 0x1401b26c0 (608 bytes)
//
// 2 xrefs:
// > EditorUI::clickOnPosition @ 0x1401ada8e
// > ??> @ 0x140919fac
//
// 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:27:56 +0000
//
// Hidden C++ exception states: #wind=1
char __fastcall EditorUI::onCreate(__int64 a1, __int64 a2)
{
int v3; // r11d
__int64 v5; // r10
int v6; // eax
int v7; // eax
int v8; // eax
cocos2d::CCString *v9; // rax
int v10; // edi
const char *CString; // rax
size_t v12; // r8
__int64 v13; // rax
cocos2d::CCObject *v14; // rbx
__int64 Object; // rax
__int64 v16; // rcx
__int128 v17; // [rsp+50h] [rbp-48h] BYREF
__int64 v18; // [rsp+60h] [rbp-38h]
__int64 v19; // [rsp+68h] [rbp-30h]
_BYTE v20[32]; // [rsp+70h] [rbp-28h] BYREF
v3 = *(_DWORD *)(a1 + 1392);
if ( !v3 )
return 0;
v5 = *(_QWORD *)(a1 + 1512);
if ( !*(_DWORD *)(v5 + 15240) )
goto LABEL_10;
v6 = *(__int16 *)(v5 + 14866);
a2 = 9999;
if ( v6 < 9999 )
a2 = (unsigned int)v6;
if ( (int)a2 < 0 )
a2 = 0;
v7 = *(_DWORD *)(*(_QWORD *)(v5 + 15208) + 4 * ((unsigned __int64)(unsigned int)a2 >> 5));
if ( !_bittest(&v7, a2 & 0x1F) )
{
LABEL_10:
v8 = *(_DWORD *)(v5 + 14928) - *(_DWORD *)(v5 + 14932);
if ( v8 < 80000 )
{
if ( v8 < 40000 )
{
LABEL_18:
if ( v3 == 1329 && *(_DWORD *)(v5 + 14812) - *(_DWORD *)(v5 + 14816) >= 3 )
{
if ( !*(_BYTE *)(a1 + 680) )
{
*(_BYTE *)(a1 + 680) = 1;
v9 = cocos2d::CCString::createWithFormat("You cannot add more than 3 coins in a single level.");
v10 = a1 + 408;
if ( !a1 )
v10 = 0;
CString = cocos2d::CCString::getCString(v9);
v17 = 0;
v18 = 0;
v19 = 0;
v12 = -1;
do
++v12;
while ( CString[v12] );
sub_14003D230(&v17, CString, v12);
v13 = sub_14003F4F0((__int64)v20, (__int64)&v17);
v14 = FLAlertLayer::create(v10, (int)"Max Coins", v13, (__int64)"OK", 0, 1133903872, 0, 0, 1065353216);
sub_14003D310((__int64)&v17);
(*(void (__fastcall **)(cocos2d::CCObject *, __int64))(*(_QWORD *)v14 + 64LL))(v14, 122);
(*(void (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v14 + 1064LL))(v14);
}
return 1;
}
LABEL_26:
if ( *(_QWORD *)(a1 + 1568) || cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 944)) )
{
LOBYTE(a2) = 1;
EditorUI::createUndoSelectObject(a1, a2);
}
Object = EditorUI::onCreateObject(a1, *(unsigned int *)(a1 + 1392));
if ( Object )
EditorUI::playSoundForCreatedObject(v16, Object);
return 1;
}
if ( v3 == 31 )
goto LABEL_26;
}
else
{
if ( v3 == 31 )
goto LABEL_26;
if ( !*(_BYTE *)(*(_QWORD *)(v5 + 2168) + 1297LL) )
{
EditorUI::showMaxError(a1);
return 1;
}
}
if ( !*(_BYTE *)(*(_QWORD *)(v5 + 2168) + 1296LL) )
{
EditorUI::showMaxBasicError(a1);
return 1;
}
goto LABEL_18;
}
EditorUI::showLockedLayerAlert(a1);
return 1;
}