//
// SpawnTriggerGameObject::changeRemap from 0x1001d3450 to 0x1001d3629 (473 bytes)
//
// 2 xrefs:
// > EditorUI::replaceGroupID @ 0x100045236
// > EditorUI::replaceGroupID @ 0x100045256
//
// 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 SpawnTriggerGameObject::changeRemap(SpawnTriggerGameObject *a1, int a2, int a3, bool a4)
{
unsigned int *begin; // r14
std::__vector_base::pointer end; // r8
std::__vector_base::pointer v6; // rax
__int64 v7; // rbx
__int64 v8; // r13
__int128 *v9; // r15
__int64 **v10; // r14
__int64 *v11; // rax
int v12; // ecx
int v13; // ecx
size_t v14; // r8
size_t v15; // rbx
__int64 v16; // rax
int v17; // eax
int v18; // eax
__int64 *v19; // rax
__int128 *v20; // [rsp+8h] [rbp-48h] BYREF
__int128 v21; // [rsp+10h] [rbp-40h] BYREF
void *__dst; // [rsp+20h] [rbp-30h]
begin = (unsigned int *)a1->m_remapObjects.__begin_;
end = a1->m_remapObjects.__end_;
if ( begin != (unsigned int *)end )
{
v6 = a1->m_remapObjects.__begin_;
if ( a4 )
{
do
{
if ( v6->m_groupID == a2 && v6->m_chance != a3 )
v6->m_groupID = a3;
++v6;
}
while ( v6 != end );
}
else
{
do
{
if ( v6->m_chance == a2 && v6->m_groupID != a3 )
v6->m_chance = a3;
++v6;
}
while ( v6 != end );
}
v21 = 0;
v20 = &v21;
while ( 1 )
{
while ( 1 )
{
v7 = *begin;
__dst = begin;
v8 = begin[2];
v9 = &v21;
v10 = (__int64 **)&v21;
if ( (_QWORD)v21 )
break;
LABEL_33:
v19 = (__int64 *)operator new(0x28u);
*(__int64 *)((char *)v19 + 28) = v7 | (v8 << 32);
*(_OWORD *)v19 = 0;
v19[2] = (__int64)v9;
*v10 = v19;
if ( *(_QWORD *)v20 )
v20 = *(__int128 **)v20;
sub_100054DD0((__int64 *)v21, v19);
++*((_QWORD *)&v21 + 1);
end = a1->m_remapObjects.__end_;
LABEL_36:
begin = (unsigned int *)((char *)__dst + 16);
if ( (char *)__dst + 16 == (char *)end )
{
LABEL_37:
sub_100054D90((__int64)&v20, (_QWORD *)v21);
return;
}
}
v11 = (__int64 *)v21;
while ( 1 )
{
v12 = *((_DWORD *)v11 + 7);
if ( (int)v7 < v12 )
goto LABEL_16;
if ( (int)v7 <= v12 )
{
v13 = *((_DWORD *)v11 + 8);
if ( (int)v8 < v13 )
goto LABEL_16;
if ( (int)v8 <= v13 )
break;
}
++v11;
LABEL_16:
v11 = (__int64 *)*v11;
if ( !v11 )
{
v16 = v21;
while ( 1 )
{
v9 = (__int128 *)v16;
v17 = *(_DWORD *)(v16 + 28);
if ( (int)v7 < v17 )
goto LABEL_26;
if ( (int)v7 > v17 )
{
LABEL_31:
v16 = *((_QWORD *)v9 + 1);
if ( !v16 )
{
v10 = (__int64 **)v9 + 1;
goto LABEL_33;
}
}
else
{
v18 = *((_DWORD *)v9 + 8);
if ( (int)v8 >= v18 )
{
if ( (int)v8 <= v18 )
goto LABEL_36;
goto LABEL_31;
}
LABEL_26:
v16 = *(_QWORD *)v9;
v10 = (__int64 **)v9;
if ( !*(_QWORD *)v9 )
goto LABEL_33;
}
}
}
}
begin = (unsigned int *)__dst;
v14 = (char *)end - ((_BYTE *)__dst + 16);
if ( v14 )
{
v15 = v14;
memmove(__dst, (char *)__dst + 16, v14);
v14 = v15;
}
end = (std::__vector_base::pointer)((char *)begin + v14);
a1->m_remapObjects.__end_ = end;
if ( begin == (unsigned int *)end )
goto LABEL_37;
}
}
}