//
// LevelEditorLayer::createObject from 0x3713ac to 0x3714f4 (328 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::addSpecial @ 0x370b44
// > LevelEditorLayer::breakApartTextObject @ 0x371600
// > EditorUI::createObject @ 0x37d72a
//
// 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
//
GameObject *LevelEditorLayer::createObject(LevelEditorLayer *a1, int a2, cocos2d::CCPoint a3, bool a4)
{
float y; // r11
float x; // r10
GameObject *v8; // r4
ObjectToolbox *v9; // r0
char *v10; // r0
int m_objectID; // r3
void (__fastcall *setupCustomSprites)(GameObject *__hidden, std::string); // r8
__int16 m_currentLayer; // r3
void (__fastcall *setStartPos)(GameObject *__hidden, cocos2d::CCPoint); // r8
UndoObject *v15; // r0
_BYTE v17[4]; // [sp+4h] [bp-18h] BYREF
char *v18; // [sp+8h] [bp-14h] BYREF
cocos2d::CCPoint v19; // [sp+Ch] [bp-10h] BYREF
y = a3.y;
x = a3.x;
v8 = GameObject::createWithKey(a2);
if ( v8 )
{
v9 = ObjectToolbox::sharedState();
v10 = (char *)ObjectToolbox::intKeyToFrame(v9, a2);
sub_776584((int)v17, v10);
v8->setVisible(v8, 0);
m_objectID = v8->m_objectID;
if ( m_objectID == 9 || m_objectID == 1715 )
v8->m_defaultZOrder = 2;
v8->firstSetup(v8);
v8->customSetup(v8);
sub_775C20(&v18, v17);
GameObject::addColorSprite(v8, &v18);
sub_774008(&v18);
setupCustomSprites = v8->setupCustomSprites;
sub_775C20(&v19, v17);
((void (__fastcall *)(GameObject *, cocos2d::CCPoint *))setupCustomSprites)(v8, &v19);
sub_774008(&v19);
v8->saveActiveColors(v8);
m_currentLayer = a1->m_currentLayer;
if ( m_currentLayer != -1 )
v8->m_editorLayer = m_currentLayer;
setStartPos = v8->setStartPos;
cocos2d::CCPoint::CCPoint(&v19, (const cocos2d::CCPoint *)LODWORD(x));
((void (__fastcall *)(GameObject *, cocos2d::CCPoint *))setStartPos)(v8, &v19);
a1->addToSection(a1, v8);
LevelEditorLayer::addSpecial(a1, v8);
if ( y == 0.0 )
{
cocos2d::CCArray::removeAllObjects(a1->m_redoObjects);
v15 = UndoObject::create(v8, New);
LevelEditorLayer::addToUndoList(a1, v15, 0);
}
sub_774008(v17);
}
return v8;
}