//
// SpawnTriggerGameObject::changeRemap from 0x10038ee48 to 0x10038ef88 (320 bytes)
//
// 2 xrefs:
// > EditorUI::replaceGroupID @ 0x1003f32d4
// > EditorUI::replaceGroupID @ 0x1003f32fc
//
// 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)
{
std::__vector_base::pointer end; // x8
std::__vector_base::pointer begin; // x20
std::__vector_base::pointer v7; // x9
_DWORD *p_m_groupID; // x10
__int64 m_groupID; // x9
__int64 m_chance; // x10
_QWORD *v12; // x11
int v13; // w12
int v14; // w12
signed __int64 v15; // x21
__int64 v16; // [xsp+0h] [xbp-40h] BYREF
__int64 *v17; // [xsp+8h] [xbp-38h] BYREF
_QWORD *v18[2]; // [xsp+10h] [xbp-30h] BYREF
end = a1->m_remapObjects.__end_;
begin = a1->m_remapObjects.__begin_;
if ( begin != end )
{
v7 = a1->m_remapObjects.__begin_;
while ( 1 )
{
if ( a4 )
{
if ( v7->m_groupID != a2 )
goto LABEL_12;
p_m_groupID = &v7->m_groupID;
if ( v7->m_chance == a3 )
goto LABEL_12;
}
else
{
p_m_groupID = &v7->m_chance;
if ( v7->m_chance != a2 || v7->m_groupID == a3 )
goto LABEL_12;
}
*p_m_groupID = a3;
LABEL_12:
if ( ++v7 == end )
{
v18[0] = nullptr;
v18[1] = nullptr;
v17 = (__int64 *)v18;
while ( 1 )
{
m_groupID = (unsigned int)begin->m_groupID;
m_chance = (unsigned int)begin->m_chance;
v16 = m_groupID | (m_chance << 32);
v12 = v18[0];
if ( !v18[0] )
{
LABEL_21:
sub_10001BC04(&v17, (__int64)&v16, &v16);
++begin;
end = a1->m_remapObjects.__end_;
goto LABEL_22;
}
while ( 1 )
{
v13 = *((_DWORD *)v12 + 7);
if ( (int)m_groupID >= v13 )
{
if ( v13 < (int)m_groupID )
goto LABEL_19;
v14 = *((_DWORD *)v12 + 8);
if ( (int)m_chance >= v14 )
break;
}
LABEL_20:
v12 = (_QWORD *)*v12;
if ( !v12 )
goto LABEL_21;
}
if ( v14 < (int)m_chance )
{
LABEL_19:
++v12;
goto LABEL_20;
}
v15 = (char *)end - (char *)&begin[1];
if ( end != &begin[1] )
memmove(begin, &begin[1], (char *)end - (char *)&begin[1]);
end = (std::__vector_base::pointer)((char *)begin + v15);
a1->m_remapObjects.__end_ = (std::__vector_base::pointer)((char *)begin + v15);
LABEL_22:
if ( begin == end )
{
sub_100017D70((__int64)&v17, v18[0]);
return;
}
}
}
}
}
}