//
// LevelEditorLayer::recreateGroups from 0x1000c4500 to 0x1000c47e8 (744 bytes)
//
// 3 xrefs:
// > EditorUI::dynamicGroupUpdate @ 0x100016008
// > LevelEditorLayer::onPlaytest @ 0x1000c5f42
// > LevelEditorLayer::onResumePlaytest @ 0x1000c6bba
//
// 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:35 +0000
//
__int64 __fastcall LevelEditorLayer::recreateGroups(_QWORD *a1)
{
_QWORD *v2; // r14
__int64 v3; // rsi
_QWORD *v4; // r14
__int64 v5; // rsi
__int64 i; // r14
__int64 v7; // rdi
__int64 v8; // rdi
__int64 v9; // rdi
_QWORD *v10; // r15
void *v11; // rdi
_QWORD *v12; // r15
void *v13; // rdi
__int64 v14; // rax
__int64 v15; // r14
__int64 v16; // rdi
__int64 v17; // r14
unsigned int v18; // r15d
__int64 v19; // r12
unsigned int v20; // r13d
unsigned int GroupID; // eax
int v22; // eax
__int64 result; // rax
GJBaseGameLayer::resetMoveOptimizedValue(a1);
if ( a1[503] )
{
v2 = (_QWORD *)a1[502];
if ( v2 )
{
do
{
v10 = (_QWORD *)*v2;
v11 = (void *)v2[3];
if ( v11 )
{
v2[4] = v11;
operator delete(v11);
}
operator delete(v2);
v2 = v10;
}
while ( v10 );
}
a1[502] = 0;
v3 = a1[501];
if ( v3 )
__bzero(a1[500], 8 * v3);
a1[503] = 0;
}
if ( a1[508] )
{
v4 = (_QWORD *)a1[507];
if ( v4 )
{
do
{
v12 = (_QWORD *)*v4;
v13 = (void *)v4[3];
if ( v13 )
{
v4[4] = v13;
operator delete(v13);
}
operator delete(v4);
v4 = v12;
}
while ( v12 );
}
a1[507] = 0;
v5 = a1[506];
if ( v5 )
__bzero(a1[505], 8 * v5);
a1[508] = 0;
}
sub_1007FF190(a1[411]);
sub_1007FEBF0(a1[411], a1[1530]);
sub_1007FEBF0(a1[411], a1[1531]);
for ( i = 0; i != 10000; ++i )
{
v7 = *(_QWORD *)(a1[452] + 8 * i);
if ( v7 )
sub_1007FF190(v7);
v8 = *(_QWORD *)(a1[455] + 8 * i);
if ( v8 )
sub_1007FF190(v8);
v9 = *(_QWORD *)(a1[458] + 8 * i);
if ( v9 )
sub_1007FF190(v9);
}
v14 = a1[1797];
if ( v14 )
{
v15 = *(_QWORD *)(v14 + 56);
while ( v15 )
{
v16 = *(_QWORD *)(v15 + 264);
v15 = *(_QWORD *)(v15 + 288);
sub_1007FF190(v16);
}
}
v17 = a1[410];
if ( (unsigned int)sub_1007FEF90(v17) )
{
v18 = 0;
do
{
v19 = sub_1007FEFE0(v17, v18);
if ( *(__int16 *)(v19 + 1168) > 0 )
{
v20 = 0;
do
{
GroupID = GameObject::getGroupID(v19, v20);
(*(void (__fastcall **)(_QWORD *, __int64, _QWORD, __int64))(*a1 + 1352LL))(a1, v19, GroupID, 1);
++v20;
}
while ( (int)v20 < *(__int16 *)(v19 + 1168) );
}
v22 = *(_DWORD *)(v19 + 1028);
if ( v22 == 1816 )
{
if ( *(_BYTE *)(v19 + 1677) == 1 )
sub_1007FEBF0(a1[411], v19);
}
else if ( v22 == 1615 )
{
GJBaseGameLayer::addObjectCounter(a1, v19);
}
++v18;
}
while ( v18 < (unsigned int)sub_1007FEF90(v17) );
}
result = a1[409];
if ( *(_BYTE *)(result + 454) )
return GJBaseGameLayer::sortAllGroupsX(a1);
return result;
}