//
// LevelEditorLayer::createObjectsFromSetup from 0x370e08 to 0x371068 (608 bytes)
//
// 1 xrefs:
// > LevelEditorLayer::init @ 0x376a52
//
// 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
//
void **__fastcall LevelEditorLayer::createObjectsFromSetup(LevelEditorLayer *a1, _DWORD *a2)
{
_BOOL4 v4; // r5
void **result; // r0
LevelSettingsObject *v6; // r0
GJGameLevel *m_level; // r3
GameManager *v8; // r0
unsigned int v9; // r7
int v10; // r9
int i; // r3
int v12; // r0
int v13; // r5
int v14; // r3
GameObject *v15; // r0
StartPosObject *v16; // r6
int v17; // [sp+0h] [bp-3Ch]
int v18; // [sp+4h] [bp-38h]
int v19; // [sp+8h] [bp-34h]
std::string *v20; // [sp+10h] [bp-2Ch]
int v21; // [sp+10h] [bp-2Ch]
void *v22; // [sp+1Ch] [bp-20h] BYREF
_DWORD *v23; // [sp+20h] [bp-1Ch] BYREF
char *v24; // [sp+24h] [bp-18h] BYREF
char v25[4]; // [sp+28h] [bp-14h] BYREF
char v26[4]; // [sp+2Ch] [bp-10h] BYREF
std::vector v27; // [sp+30h] [bp-Ch] BYREF
std::vector v28; // [sp+3Ch] [bp+0h] BYREF
char **v29; // [sp+48h] [bp+Ch] BYREF
int v30; // [sp+4Ch] [bp+10h]
int v31; // [sp+50h] [bp+14h]
sub_776584((int)&v28, " ");
if ( sub_774DBC(a2, &v28) )
{
sub_776584((int)&v29, (char *)&unk_939830);
v4 = sub_774DBC(a2, &v29) == 0;
sub_774008(&v29);
}
else
{
v4 = 1;
}
result = (void **)sub_774008(&v28);
if ( !v4 )
{
memset(&v27, 0, sizeof(v27));
std::vector::_M_default_append((char **)&v27, 0x259u);
memset(&v28, 0, sizeof(v28));
std::vector::_M_default_append((int)&v28, 0x259u);
v22 = &unk_ACDDA8;
v23 = &unk_ACDDA8;
v29 = nullptr;
v30 = 0;
v31 = 0;
sub_36F6EC(a2, ";", (int)&v29);
sub_7751A8(a2);
v6 = LevelSettingsObject::objectFromString(v29);
m_level = a1->m_level;
a1->m_levelSettings = v6;
v6->m_level = m_level;
cocos2d::CCObject::retain(a1->m_levelSettings);
GJBaseGameLayer::loadLevelSettings(a1);
v8 = GameManager::sharedState();
GameManager::loadFont(v8, a1->m_levelSettings->m_fontIndex);
v9 = 1;
v10 = 0;
while ( v9 < (v30 - (int)v29) >> 2 )
{
sub_775D40(&v23, &v29[v9]);
for ( i = 0; i != 601; ++i )
v28.m_start[i] = nullptr;
v12 = sub_774910(&v23, 44, 0);
v19 = *(v23 - 3);
v13 = v12;
if ( v12 != -1 )
{
v17 = 1;
v18 = 0;
v14 = 0;
while ( 1 )
{
if ( v14 != v19 )
{
if ( v17 )
{
sub_776158(&v24, &v23, v14, v13 - v14);
v10 = atoi(v24);
sub_774008(&v24);
}
else if ( (unsigned int)(v10 - 1) < 0x258 )
{
v20 = &v27.m_start[v10];
sub_776158(v25, &v23, v14, v13 - v14);
sub_774794(v20, v25);
sub_774008(v25);
v28.m_start[v10] = a1;
}
v17 ^= 1u;
}
if ( v18 )
break;
v21 = v13 + 1;
v13 = sub_774910(&v23, 44, v13 + 1);
v14 = v21;
if ( v13 == -1 )
{
v13 = v19;
v18 = 1;
}
}
}
v15 = LevelEditorLayer::addObjectFromVector(a1, &v27, &v28);
v16 = (StartPosObject *)v15;
if ( v15 && v15->m_objectID == 31 )
{
sub_775C20(v26, &v23);
StartPosObject::loadSettingsFromString(v16, (std::string)v26);
sub_774008(v26);
}
++v9;
}
std::vector::~vector((void **)&v29);
sub_774008(&v23);
sub_774008(&v22);
std::_Vector_base::~_Vector_base((void **)&v28.m_start);
return std::vector::~vector((void **)&v27.m_start);
}
return result;
}