//
// EditorUI::onCreateObject from 0x48724c to 0x4877c2 (1398 bytes)
//
// 1 xrefs:
// > EditorUI::onCreate @ 0x487886
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:49:26 +0000
//
GameObject *__fastcall EditorUI::onCreateObject(EditorUI *this, char *a2)
{
float v4; // s13
float v5; // s15
float v6; // s14
int v7; // r3
_DWORD *v8; // r0
int v9; // r10
unsigned __int8 v10; // r9
float v11; // r11
cocos2d::CCArray *v12; // r0
GameObject *Object; // r0
int v14; // r3
GameObject *v15; // r5
int NewKeyframeAnim; // r0
int v17; // r0
cocos2d::CCArray *v19; // r0
cocos2d::CCObject *v20; // r1
GameManager *v21; // r0
int v22; // r0
int v23; // r3
char *v24; // r6
size_t v25; // r0
cocos2d::CCArray *v26; // r6
unsigned int i; // r11
_BYTE *v28; // r7
int v29; // r0
int v30; // r5
unsigned int j; // r5
int v32; // r7
unsigned int k; // r5
int v34; // r0
int v35; // r8
float v36; // s16
float v37; // s16
int v38; // s16
unsigned int m; // r5
GameObject *v40; // r0
cocos2d::CCArray *v41; // [sp+8h] [bp-Ch]
cocos2d::CCArray *v42; // [sp+8h] [bp-Ch]
float v43; // [sp+14h] [bp+0h] BYREF
float v44; // [sp+18h] [bp+4h]
_BYTE v45[8]; // [sp+1Ch] [bp+8h] BYREF
_BYTE v46[8]; // [sp+24h] [bp+10h] BYREF
_BYTE v47[8]; // [sp+2Ch] [bp+18h] BYREF
_BYTE v48[8]; // [sp+34h] [bp+20h] BYREF
_BYTE v49[8]; // [sp+3Ch] [bp+28h] BYREF
float v50[2]; // [sp+44h] [bp+30h] BYREF
float v51[2]; // [sp+4Ch] [bp+38h] BYREF
char v52; // [sp+54h] [bp+40h] BYREF
char v53; // [sp+55h] [bp+41h] BYREF
char *v54; // [sp+5Ch] [bp+48h]
int v55; // [sp+60h] [bp+4Ch] BYREF
int v56; // [sp+64h] [bp+50h]
int v57; // [sp+68h] [bp+54h]
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v51, (EditorUI *)((char *)this + 988));
EditorUI::getGridSnappedPos((int)&v43, (int)this, v51);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v45, (const cocos2d::CCPoint *)&v43);
v4 = *((float *)this + 118) * 0.5;
v5 = v4 - 3000.0;
if ( v43 >= (float)(v4 - 3000.0) )
v5 = v43;
v6 = v44;
if ( v44 < -3000.0 )
v6 = -3000.0;
if ( (float)(240000.0 - v4) <= v5 )
v5 = 240000.0 - v4;
if ( *(_BYTE *)(*(_DWORD *)(*((_DWORD *)this + 236) + 2084) + 373) )
v7 = 1000;
else
v7 = 80;
v43 = v5;
if ( (float)((float)((float)((float)v7 * 30.0) + 90.0) - v4) <= v6 )
v6 = (float)((float)((float)v7 * 30.0) + 90.0) - v4;
v44 = v6;
offsetForKey((cocos2d::CCPoint *)v46);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v47);
v8 = *((_DWORD **)this + 249);
if ( v8 && (char *)v8[223] == a2 )
{
v9 = (*(int (__fastcall **)(_DWORD *))(*v8 + 712))(v8);
v10 = (*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 249) + 716))(*((_DWORD *)this + 249));
v11 = COERCE_FLOAT((*(int (__fastcall **)(_DWORD))(**((_DWORD **)this + 249) + 184))(*((_DWORD *)this + 249)));
EditorUI::getRelativeOffset((EditorUI *)v50, this);
cocos2d::CCPoint::operator+(v51, &v43, v50);
cocos2d::CCPoint::operator=(v47, v51);
}
else
{
v10 = 0;
cocos2d::CCPoint::operator+(v51, &v43, v46);
v11 = 0.0;
cocos2d::CCPoint::operator=(v47, v51);
v9 = 0;
}
cocos2d::CCPoint::operator+(v51, &v43, v46);
cocos2d::CCPoint::operator=(&v43, v51);
v41 = *((cocos2d::CCArray **)this + 236);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v50, (const cocos2d::CCPoint *)v47);
if ( LevelEditorLayer::typeExistsAtPosition((int)v41, (int)a2, v50, v9, v10, v11)
|| (int)a2 < 0
&& (cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v51, (const cocos2d::CCPoint *)v45),
EditorUI::positionIsInSnapped((int)this, v51)) )
{
cocos2d::CCPoint::operator=((char *)this + 648, &flt_D2B938);
return nullptr;
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v51, (const cocos2d::CCPoint *)v45);
v12 = (cocos2d::CCArray *)EditorUI::addSnapPosition((cocos2d::CCArray **)this, (int)v51);
if ( (int)a2 <= 0 )
{
v19 = (cocos2d::CCArray *)cocos2d::CCArray::create(v12);
v20 = *((cocos2d::CCObject **)this + 249);
v42 = v19;
if ( v20 )
v21 = (GameManager *)cocos2d::CCArray::addObject(v19, v20);
else
v21 = (GameManager *)cocos2d::CCArray::addObjectsFromArray(v19, *((cocos2d::CCArray **)this + 167));
v22 = GameManager::sharedState(v21);
GameManager::stringForCustomObject((GameManager *)&v52, v22, a2, v23);
if ( !*((_BYTE *)this + 528) )
EditorBuildStats::noteAction((EditorBuildStats *)(*((_DWORD *)this + 236) + 12104));
*((_BYTE *)this + 528) = 1;
if ( (v52 & 1) != 0 )
v24 = v54;
else
v24 = &v53;
v55 = 0;
v56 = 0;
v57 = 0;
v25 = strlen(v24);
std::string::__init(&v55, v24, v25);
v26 = (cocos2d::CCArray *)EditorUI::pasteObjects((int)this, (int)&v55);
std::string::~string((int)&v55);
if ( v26 && cocos2d::CCArray::count(v26) )
{
for ( i = 0; i < cocos2d::CCArray::count(v26); ++i )
{
v28 = (_BYTE *)cocos2d::CCArray::objectAtIndex(v26, i);
if ( v28[1006] )
goto LABEL_49;
}
v28 = nullptr;
LABEL_49:
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v48, (const cocos2d::CCPoint *)v45);
if ( v28 )
{
EditorUI::getGroupCenter((EditorUI *)v49, this, v26);
v29 = (*(int (__fastcall **)(_BYTE *))(*(_DWORD *)v28 + 96))(v28);
cocos2d::CCPoint::operator-(v50, v49, v29);
cocos2d::CCPoint::operator+(v51, v48, v50);
cocos2d::CCPoint::operator=(v48, v51);
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v51, (const cocos2d::CCPoint *)v48);
EditorUI::repositionObjectsToCenter(this, v26, v51, 0);
v30 = cocos2d::CCArray::count(v26);
if ( v30 == cocos2d::CCArray::count(v42) )
{
for ( j = 0; j < cocos2d::CCArray::count(v42); ++j )
{
v32 = cocos2d::CCArray::objectAtIndex(v42, j);
if ( *(_BYTE *)(v32 + 1006) )
goto LABEL_57;
}
v32 = 0;
LABEL_57:
for ( k = 0; k < cocos2d::CCArray::count(v26); ++k )
{
v34 = cocos2d::CCArray::objectAtIndex(v26, k);
v35 = v34;
if ( *(_BYTE *)(v34 + 1006) )
{
if ( v32 )
{
if ( *(_DWORD *)(v32 + 892) == *(_DWORD *)(v34 + 892) )
{
v36 = COERCE_FLOAT((*(int (__fastcall **)(int))(*(_DWORD *)v32 + 184))(v32));
if ( v36 != (*(float (__fastcall **)(int))(*(_DWORD *)v35 + 184))(v35) )
{
v37 = COERCE_FLOAT((*(int (__fastcall **)(int))(*(_DWORD *)v32 + 184))(v32));
v38 = (int)(float)(v37 - (*(float (__fastcall **)(int))(*(_DWORD *)v35 + 184))(v35));
if ( v38 % 90 )
{
for ( m = 0; m < cocos2d::CCArray::count(v26); ++m )
{
v40 = (GameObject *)cocos2d::CCArray::objectAtIndex(v26, m);
if ( !GameObject::canRotateFree(v40) )
goto LABEL_65;
}
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v51, (const cocos2d::CCPoint *)&flt_D2B938);
((void (__fastcall *)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD))EditorUI::rotateObjects)(
this,
v26,
(float)v38,
v51,
0);
}
}
}
break;
}
}
}
}
LABEL_65:
std::string::~string((int)&v52);
return nullptr;
}
if ( !*((_BYTE *)this + 528) )
EditorBuildStats::noteAction((EditorBuildStats *)(*((_DWORD *)this + 236) + 12104));
*((_BYTE *)this + 528) = 1;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v51, (const cocos2d::CCPoint *)&v43);
Object = EditorUI::createObject((int)this, (GameObject *)a2, (const cocos2d::CCPoint *)v51);
v14 = *((_DWORD *)this + 249);
v15 = Object;
if ( v14 && *((_DWORD *)Object + 223) == *(_DWORD *)(v14 + 892) )
{
EditorUI::removeOffset(this, Object);
GameObject::duplicateValues(v15, *((GameObject **)this + 249));
EditorUI::applyOffset(this, v15);
}
if ( a2 == (_BYTE *)&stru_38C.st_value + 2 )
{
v55 = 0;
v56 = 0;
v57 = 0;
std::string::__init(&v55, "A", 1u);
TextGameObject::updateTextObject(v15, (unsigned __int8 *)&v55, 0);
std::string::~string((int)&v55);
}
else if ( a2 == (char *)&stru_BCC.st_info )
{
LevelEditorLayer::removeSpecial(*((LevelEditorLayer **)this + 236), v15);
NewKeyframeAnim = GJBaseGameLayer::createNewKeyframeAnim(*((GJBaseGameLayer **)this + 236));
v17 = (*(int (__fastcall **)(int))(*(_DWORD *)NewKeyframeAnim + 32))(NewKeyframeAnim);
*((_DWORD *)v15 + 415) = 0;
*((_DWORD *)v15 + 414) = v17;
LevelEditorLayer::addSpecial(*((LevelEditorLayer **)this + 236), v15);
}
EditorUI::selectObject(this, v15, 0);
if ( v15
&& *((_DWORD *)v15 + 271) == 1
&& (GameObject::isSpeedObject(v15)
|| (*(int (__fastcall **)(GameObject *))(*(_DWORD *)v15 + 840))(v15) && *((_BYTE *)v15 + 1596)) )
{
*((_BYTE *)v15 + 1584) = 1;
DrawGridLayer::addToSpeedObjects(*(cocos2d::CCArray ***)(*((_DWORD *)this + 236) + 11880), v15);
}
EditorUI::updateSlider(this);
return v15;
}