//
// LevelEditorLayer::createObject from 0x1000afac0 to 0x1000afd70 (688 bytes)
//
// 13 xrefs:
// > EditorUI::onCreateObject @ 0x100011157
// > EditorUI::createObject @ 0x100011ccc
// > EditorUI::addObjectsToSmartTemplate @ 0x100013761
// > EditorUI::createPrefab @ 0x1000149a2
// > EditorUI::createPrefab @ 0x100014b5f
// > EditorUI::processSmartObjectsFromType @ 0x100015488
// > EditorUI::processSmartObjectsFromType @ 0x1000155c2
// > EditorUI::createNewKeyframeAnim @ 0x1000167e7
// > EditorUI::createLoop @ 0x100016c13
// > EditorUI::createLoop @ 0x100016fea
// > EditorUI::createGradientFromSelection @ 0x1000176b7
// > LevelEditorLayer::addSpecial @ 0x1000af68a
// > LevelEditorLayer::breakApartTextObject @ 0x1000c50ee
//
// 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 12:20:19 +0000
//
__int64 __fastcall LevelEditorLayer::createObject(__int64 a1, unsigned int a2, __int64 a3, int a4, double a5)
{
__int64 v7; // rbx
__int64 v8; // rax
const char *v9; // r12
size_t v10; // rax
size_t v11; // r13
char *v12; // r15
size_t v13; // r14
__int64 v14; // r13
int v15; // eax
char v16; // r14
__int16 v17; // ax
char *v18; // r15
char v19; // r12
unsigned int v20; // eax
unsigned int v21; // edx
char v23[8]; // [rsp+8h] [rbp-98h] BYREF
__int64 v24; // [rsp+10h] [rbp-90h]
__int64 v25; // [rsp+18h] [rbp-88h]
__int128 v26; // [rsp+20h] [rbp-80h] BYREF
void *__p; // [rsp+30h] [rbp-70h]
__int128 v28; // [rsp+40h] [rbp-60h] BYREF
void *v29; // [rsp+50h] [rbp-50h]
int v30; // [rsp+5Ch] [rbp-44h]
__int128 __dst; // [rsp+60h] [rbp-40h] BYREF
void *v32; // [rsp+70h] [rbp-30h]
v7 = GameObject::createWithKey(a2);
if ( !v7 )
return v7;
v25 = a3;
v30 = a4;
if ( !(_BYTE)a4 )
++*(_DWORD *)(a1 + 14704);
v24 = a1;
v8 = ObjectToolbox::sharedState(a5);
v9 = (const char *)ObjectToolbox::intKeyToFrame(v8, a2);
v10 = strlen(v9);
if ( v10 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v11 = v10;
if ( v10 >= 0x17 )
{
v13 = 26;
if ( (v10 | 7) != 0x17 )
v13 = (v10 | 7) + 1;
v12 = (char *)operator new(v13);
v32 = v12;
*(_QWORD *)&__dst = v13 + 1;
*((_QWORD *)&__dst + 1) = v11;
goto LABEL_11;
}
LOBYTE(__dst) = 2 * v10;
v12 = (char *)&__dst + 1;
if ( v10 )
LABEL_11:
memmove(v12, v9, v11);
v12[v11] = 0;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v7 + 344LL))(v7, 0);
v14 = v24;
v15 = *(_DWORD *)(v7 + 1028);
if ( v15 == 1715 || v15 == 9 )
*(_DWORD *)(v7 + 1048) = 2;
(*(void (__fastcall **)(__int64))(*(_QWORD *)v7 + 1256LL))(v7);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v7 + 1264LL))(v7);
v16 = __dst & 1;
if ( (__dst & 1) != 0 )
{
sub_10001AD30(&v26, v32, *((unsigned __int64 *)&__dst + 1));
}
else
{
__p = v32;
v26 = __dst;
}
GameObject::addColorSprite(v7, &v26);
if ( (v26 & 1) != 0 )
operator delete(__p);
if ( v16 )
{
sub_10001AD30(&v28, v32, *((unsigned __int64 *)&__dst + 1));
}
else
{
v29 = v32;
v28 = __dst;
}
(*(void (__fastcall **)(__int64, __int128 *))(*(_QWORD *)v7 + 1272LL))(v7, &v28);
if ( (v28 & 1) != 0 )
operator delete(v29);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v7 + 1616LL))(v7);
v17 = *(_WORD *)(v14 + 14210);
if ( v17 != -1 )
*(_WORD *)(v7 + 1202) = v17;
sub_1002782D0(v23, v25);
(*(void (__fastcall **)(__int64, char *))(*(_QWORD *)v7 + 1368LL))(v7, v23);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v14 + 1344LL))(v14, v7);
LevelEditorLayer::addSpecial(v14, v7);
if ( !(_BYTE)v30 )
{
sub_1007FF190(*(_QWORD *)(v14 + 14264));
v18 = UndoObject::create(v7, 2);
sub_1007FF190(*(_QWORD *)(v14 + 14264));
v19 = *(_BYTE *)(v14 + 14007);
v20 = sub_1007FEF90(*(_QWORD *)(v14 + 14256));
v21 = 200;
if ( v19 )
v21 = 1000;
if ( v20 >= v21 )
sub_1007FF150(*(_QWORD *)(v14 + 14256), 0, 1);
sub_1007FEBF0(*(_QWORD *)(v14 + 14256), v18);
}
if ( v16 )
operator delete(v32);
return v7;
}