//
// GJBaseGameLayer::controlEventLink from 0x8762cc to 0x8763e4 (280 bytes)
//
// 3 xrefs:
// > GJBaseGameLayer::controlTriggersWithControlID @ 0x898ecc
// > GJBaseGameLayer::controlTriggersInGroup @ 0x899268
// > ??> @ 0x41988
//
// 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 GJBaseGameLayer::controlEventLink(GJBaseGameLayer *a1, int a2, int a3, GJActionCommand a4)
{
std::_rb_tree_base *m_left; // x24
std::_rb_tree_base *i; // x20
std::_rb_tree_base *m_parent; // x2
int v10; // w21
unsigned __int64 v11; // x19
__int64 j; // x0
__int64 v13; // x1
m_left = a1->m_gameState.m_unkMapPairGJGameEventIntVectorEventTriggerInstance.m_header.m_left;
for ( i = &a1->m_gameState.m_unkMapPairGJGameEventIntVectorEventTriggerInstance.m_header;
i != m_left;
m_left = (std::_rb_tree_base *)sub_CFAB14(m_left) )
{
m_parent = m_left[1].m_parent;
v10 = 0;
v11 = 0;
for ( j = (char *)m_left[1].m_left - (char *)m_parent;
v11 < 0xCCCCCCCCCCCCCCCDLL * (j >> 3);
j = (char *)m_left[1].m_left - (char *)m_parent )
{
while ( 1 )
{
v13 = (__int64)m_parent + 40 * v11;
if ( a3 != -1 )
break;
if ( *(_DWORD *)(v13 + 4) == a2 )
goto LABEL_10;
LABEL_6:
v11 = ++v10;
if ( v10 >= 0xCCCCCCCCCCCCCCCDLL * (j >> 3) )
goto LABEL_7;
}
if ( *(_DWORD *)(v13 + 8) != a3 )
goto LABEL_6;
LABEL_10:
if ( a4 )
{
if ( a4 == Pause )
{
*(_BYTE *)(v13 + 12) = 1;
}
else if ( a4 == Resume )
{
*(_BYTE *)(v13 + 12) = 0;
}
goto LABEL_6;
}
std::vector::_M_erase((__int64)&m_left[1].m_parent, v13);
m_parent = m_left[1].m_parent;
}
LABEL_7:
;
}
}