//
// EditorUI::onCreateObject from 0x7c9fa0 to 0x7ca780 (2016 bytes)
//
// 2 xrefs:
// > EditorUI::onCreate @ 0x7ca848
// > ??> @ 0xa3ca8
//
// This function is hookable on this platform (idp: arm, 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 12:54:11 +0000
//
float *__fastcall EditorUI::onCreateObject(EditorUI *this, int a2)
{
float v4; // s1
float v5; // s0
float v6; // s2
__int64 v7; // x0
float v8; // s0
float v9; // s1
_DWORD *v10; // x0
float v11; // s8
unsigned __int8 v12; // w28
__int64 v13; // x25
cocos2d::CCArray *v15; // x0
float *Object; // x20
__int64 v17; // x0
cocos2d::CCArray *v18; // x0
cocos2d::CCArray *v19; // x24
cocos2d::CCObject *v20; // x1
GameManager *v21; // x0
GameManager *v22; // x0
char v23; // w0
const char *v24; // x1
size_t v25; // x0
cocos2d::CCArray *v26; // x21
unsigned int i; // w22
_BYTE *v28; // x25
__int64 v29; // x0
long double v30; // q0
int v31; // w22
bool v32; // zf
unsigned int v33; // w22
__int64 v34; // x23
unsigned int j; // w22
__int64 v36; // x24
__int64 NewKeyframeAnim; // x0
int v38; // w0
float v39; // s8
float v40; // s8
int v41; // w22
unsigned int k; // w24
GameObject *v43; // x0
unsigned __int8 v44; // [xsp+78h] [xbp+78h]
char *v45; // [xsp+78h] [xbp+78h]
float v46; // [xsp+88h] [xbp+88h] BYREF
float v47; // [xsp+8Ch] [xbp+8Ch]
_BYTE v48[8]; // [xsp+90h] [xbp+90h] BYREF
__int64 v49; // [xsp+98h] [xbp+98h] BYREF
_BYTE v50[8]; // [xsp+A0h] [xbp+A0h] BYREF
_BYTE v51[8]; // [xsp+A8h] [xbp+A8h] BYREF
__int64 v52; // [xsp+B0h] [xbp+B0h] BYREF
__int64 v53; // [xsp+B8h] [xbp+B8h] BYREF
__int64 v54; // [xsp+C0h] [xbp+C0h] BYREF
__int64 v55[2]; // [xsp+C8h] [xbp+C8h] BYREF
void *v56; // [xsp+D8h] [xbp+D8h]
__int64 v57; // [xsp+E0h] [xbp+E0h] BYREF
__int64 v58; // [xsp+E8h] [xbp+E8h]
void *v59; // [xsp+F0h] [xbp+F0h]
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v54, (EditorUI *)((char *)this + 1488));
EditorUI::getGridSnappedPos((__int64)this, (float *)&v54, (__int64)&v46);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v48, (const cocos2d::CCPoint *)&v46);
v4 = *((float *)this + 162) * 0.5;
v5 = v4 - 3000.0;
if ( v46 >= (float)(v4 - 3000.0) )
v5 = v46;
v6 = v47;
if ( v47 < -3000.0 )
v6 = -3000.0;
if ( v5 >= (float)(240000.0 - v4) )
v5 = 240000.0 - v4;
v7 = *((_QWORD *)this + 180);
v46 = v5;
if ( *(_BYTE *)(*(_QWORD *)(v7 + 3272) + 453LL) )
v8 = 30090.0;
else
v8 = 2490.0;
v9 = v8 - v4;
if ( v6 >= v9 )
v6 = v9;
v47 = v6;
offsetForKey(&v49, a2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50);
v10 = *((_DWORD **)this + 187);
if ( v10 && v10[257] == a2 )
{
v44 = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)v10 + 1424LL))(v10);
v12 = (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 187) + 1432LL))(*((_QWORD *)this + 187));
v11 = (*(float (__fastcall **)(_QWORD))(**((_QWORD **)this + 187) + 368LL))(*((_QWORD *)this + 187));
EditorUI::getRelativeOffset(this, *((GameObject **)this + 187));
cocos2d::CCPoint::operator+(&v54, &v46);
cocos2d::CCPoint::operator=(v50, &v54);
}
else
{
v11 = 0.0;
v44 = 0;
v12 = 0;
cocos2d::CCPoint::operator+(&v54, &v46);
cocos2d::CCPoint::operator=(v50, &v54);
}
cocos2d::CCPoint::operator+(&v54, &v46);
cocos2d::CCPoint::operator=(&v46, &v54);
v13 = *((_QWORD *)this + 180);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v53, (const cocos2d::CCPoint *)v50);
if ( (unsigned __int8)LevelEditorLayer::typeExistsAtPosition(v13, a2, (float *)&v53, v44, v12, v11)
|| a2 < 0
&& (cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v54, (const cocos2d::CCPoint *)v48),
(unsigned __int8)EditorUI::positionIsInSnapped((__int64)this, (float *)&v54)) )
{
cocos2d::CCPoint::operator=((char *)this + 872, &dword_155C778);
return nullptr;
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v54, (const cocos2d::CCPoint *)v48);
v15 = (cocos2d::CCArray *)EditorUI::addSnapPosition((cocos2d::CCArray **)this, (__int64)&v54);
if ( a2 > 0 )
{
if ( !*((_BYTE *)this + 708) )
EditorBuildStats::noteAction((EditorBuildStats *)(*((_QWORD *)this + 180) + 14704LL));
*((_BYTE *)this + 708) = 1;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v54, (const cocos2d::CCPoint *)&v46);
Object = EditorUI::createObject((__int64)this, a2, (const cocos2d::CCPoint *)&v54);
v17 = *((_QWORD *)this + 187);
if ( v17 && *((_DWORD *)Object + 257) == *(_DWORD *)(v17 + 1028) )
{
EditorUI::removeOffset(this, (GameObject *)Object);
GameObject::duplicateValues((GameObject *)Object, *((GameObject **)this + 187));
EditorUI::applyOffset(this, (GameObject *)Object);
if ( a2 != 914 )
{
LABEL_24:
if ( a2 == 3032 )
{
LevelEditorLayer::removeSpecial(*((LevelEditorLayer **)this + 180), (GameObject *)Object);
NewKeyframeAnim = GJBaseGameLayer::createNewKeyframeAnim(*((GJBaseGameLayer **)this + 180));
v38 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)NewKeyframeAnim + 64LL))(NewKeyframeAnim);
Object[465] = 0.0;
*((_DWORD *)Object + 464) = v38;
LevelEditorLayer::addSpecial(*((LevelEditorLayer **)this + 180), (GameObject *)Object);
EditorUI::selectObject(this, (GameObject *)Object, 0);
LABEL_26:
if ( *((_DWORD *)Object + 312) == 1
&& (GameObject::isSpeedObject((GameObject *)Object)
|| (*(unsigned __int8 (__fastcall **)(float *))(*(_QWORD *)Object + 1680LL))(Object)
&& *((_BYTE *)Object + 1780)) )
{
*((_BYTE *)Object + 1768) = 1;
DrawGridLayer::addToSpeedObjects(
*(cocos2d::CCArray ***)(*((_QWORD *)this + 180) + 14288LL),
(EffectGameObject *)Object);
EditorUI::updateSlider(this);
return Object;
}
LABEL_27:
EditorUI::updateSlider(this);
return Object;
}
LABEL_25:
EditorUI::selectObject(this, (GameObject *)Object, 0);
if ( !Object )
goto LABEL_27;
goto LABEL_26;
}
}
else if ( a2 != 914 )
{
goto LABEL_24;
}
v57 = 0;
v58 = 0;
v59 = nullptr;
std::string::__init(&v57, "A", 1u);
TextGameObject::updateTextObject(Object, (unsigned __int8 *)&v57, 0);
if ( (v57 & 1) != 0 )
operator delete(v59);
goto LABEL_25;
}
v18 = (cocos2d::CCArray *)cocos2d::CCArray::create(v15);
v19 = v18;
v20 = *((cocos2d::CCObject **)this + 187);
if ( v20 )
v21 = (GameManager *)cocos2d::CCArray::addObject(v18, v20);
else
v21 = (GameManager *)cocos2d::CCArray::addObjectsFromArray(v18, *((cocos2d::CCArray **)this + 112));
v22 = (GameManager *)GameManager::sharedState(v21);
GameManager::stringForCustomObject(v22, (const char *)(unsigned int)a2, v55);
if ( !*((_BYTE *)this + 708) )
EditorBuildStats::noteAction((EditorBuildStats *)(*((_QWORD *)this + 180) + 14704LL));
v23 = v55[0];
*((_BYTE *)this + 708) = 1;
v24 = (char *)v55 + 1;
if ( (v23 & 1) != 0 )
v24 = (const char *)v56;
v45 = (char *)v24;
v57 = 0;
v58 = 0;
v59 = nullptr;
v25 = strlen(v24);
std::string::__init(&v57, v45, v25);
v26 = (cocos2d::CCArray *)EditorUI::pasteObjects((int)this, (int)&v57);
if ( (v57 & 1) != 0 )
operator delete(v59);
if ( v26 && (unsigned int)cocos2d::CCArray::count(v26) )
{
for ( i = 0; i < (unsigned int)cocos2d::CCArray::count(v26); ++i )
{
v28 = (_BYTE *)cocos2d::CCArray::objectAtIndex(v26, i);
if ( v28[1150] )
goto LABEL_51;
}
v28 = nullptr;
LABEL_51:
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v51, (const cocos2d::CCPoint *)v48);
if ( v28 )
{
EditorUI::getGroupCenter(&v52, this, v26, 0);
v29 = (*(__int64 (__fastcall **)(_BYTE *))(*(_QWORD *)v28 + 192LL))(v28);
cocos2d::CCPoint::operator-(&v53, &v52, v29, v30);
cocos2d::CCPoint::operator+(&v54, v51);
cocos2d::CCPoint::operator=(v51, &v54);
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v54, (const cocos2d::CCPoint *)v51);
EditorUI::repositionObjectsToCenter(this, v26, &v54, 0);
v31 = cocos2d::CCArray::count(v26);
v32 = v31 == (unsigned int)cocos2d::CCArray::count(v19);
v33 = 0;
if ( v32 )
{
while ( v33 < (unsigned int)cocos2d::CCArray::count(v19) )
{
v34 = cocos2d::CCArray::objectAtIndex(v19, v33);
if ( *(_BYTE *)(v34 + 1150) )
goto LABEL_59;
++v33;
}
v34 = 0;
LABEL_59:
for ( j = 0; j < (unsigned int)cocos2d::CCArray::count(v26); ++j )
{
v36 = cocos2d::CCArray::objectAtIndex(v26, j);
if ( *(_BYTE *)(v36 + 1150) )
{
if ( v34 )
{
if ( *(_DWORD *)(v34 + 1028) == *(_DWORD *)(v36 + 1028) )
{
v39 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v34 + 368LL))(v34);
if ( v39 != (*(float (__fastcall **)(__int64))(*(_QWORD *)v36 + 368LL))(v36) )
{
v40 = (*(float (__fastcall **)(__int64))(*(_QWORD *)v34 + 368LL))(v34);
v41 = (int)(float)(v40 - (*(float (__fastcall **)(__int64))(*(_QWORD *)v36 + 368LL))(v36));
if ( v41 % 90 )
{
for ( k = 0; k < (unsigned int)cocos2d::CCArray::count(v26); ++k )
{
v43 = (GameObject *)cocos2d::CCArray::objectAtIndex(v26, k);
if ( !(unsigned __int8)GameObject::canRotateFree(v43) )
goto LABEL_63;
}
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v54, (const cocos2d::CCPoint *)&dword_155C778);
EditorUI::rotateObjects(this, v26, &v54, 0, (float)v41);
}
}
}
break;
}
}
}
}
LABEL_63:
if ( (v55[0] & 1) != 0 )
operator delete(v56);
return nullptr;
}