//
// LevelEditorLayer::createObject from 0x10035a0ac to 0x10035a294 (488 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::addSpecial @ 0x100359d68
// > LevelEditorLayer::breakApartTextObject @ 0x10036257c
// > EditorUI::createObject @ 0x1003ec71c
//
// 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
//
// local variable allocation has failed, the output may be wrong!
GameObject *__fastcall LevelEditorLayer::createObject(LevelEditorLayer *a1, int a2, cocos2d::CCPoint a3, bool a4)
{
char v4; // w3
char v5; // w21
_BOOL8 v6; // x22
GameObject *v9; // x19
ObjectToolbox *v10; // x0
char *v11; // x0
int m_objectID; // w8
int m_currentLayer; // w8
float v15; // s0
UndoObject *v16; // x0
__int64 v18; // [xsp+8h] [xbp-88h] BYREF
void *__dst[2]; // [xsp+10h] [xbp-80h] BYREF
__int64 v20; // [xsp+20h] [xbp-70h]
void *__p[2]; // [xsp+30h] [xbp-60h] BYREF
__int64 v22; // [xsp+40h] [xbp-50h]
void *v23[2]; // [xsp+48h] [xbp-48h] BYREF
__int64 v24; // [xsp+58h] [xbp-38h]
v5 = v4;
v6 = a4;
v9 = GameObject::createWithKey(a2);
if ( v9 )
{
v10 = ObjectToolbox::sharedState();
v11 = (char *)ObjectToolbox::intKeyToFrame(v10, a2);
sub_100009900(v23, v11);
((void (__fastcall *)(GameObject *, _QWORD))v9->setVisible)(v9, 0);
m_objectID = v9->m_objectID;
if ( m_objectID == 1715 || m_objectID == 9 )
v9->m_defaultZOrder = 2;
((void (__fastcall *)(GameObject *))v9->firstSetup)(v9);
((void (__fastcall *)(GameObject *))v9->customSetup)(v9);
if ( SHIBYTE(v24) < 0 )
{
sub_1000097D0(__p, v23[0], (unsigned __int64)v23[1]);
}
else
{
*(_OWORD *)__p = *(_OWORD *)v23;
v22 = v24;
}
GameObject::addColorSprite(v9, (char *)__p);
if ( SHIBYTE(v22) < 0 )
operator delete(__p[0]);
if ( SHIBYTE(v24) < 0 )
{
sub_1000097D0(__dst, v23[0], (unsigned __int64)v23[1]);
}
else
{
*(_OWORD *)__dst = *(_OWORD *)v23;
v20 = v24;
}
((void (__fastcall *)(GameObject *, void **))v9->setupCustomSprites)(v9, __dst);
if ( SHIBYTE(v20) < 0 )
operator delete(__dst[0]);
((void (__fastcall *)(GameObject *))v9->saveActiveColors)(v9);
m_currentLayer = (unsigned __int16)a1->m_currentLayer;
if ( m_currentLayer != 0xFFFF )
v9->m_editorLayer = m_currentLayer;
v15 = sub_1000229B8(&v18, (__int64 *)v6);
((void (__fastcall *)(GameObject *, __int64 *, float))v9->setStartPos)(v9, &v18, v15);
((void (__fastcall *)(LevelEditorLayer *, GameObject *))a1->addToSection)(a1, v9);
LevelEditorLayer::addSpecial(a1, v9);
if ( (v5 & 1) == 0 )
{
sub_10024A45C((__int64)a1->m_redoObjects);
v16 = UndoObject::create(v9, New);
LevelEditorLayer::addToUndoList(a1, v16, 0);
}
if ( SHIBYTE(v24) < 0 )
operator delete(v23[0]);
}
return v9;
}