//
// GJBaseGameLayer::controlEventLink from 0x140232380 to 0x14023255c (476 bytes)
//
// 6 xrefs:
// > GJBaseGameLayer::controlTriggersInGroup @ 0x14021e636
// > GJBaseGameLayer::controlTriggersWithControlID @ 0x14021e7c1
// > ??> @ 0x140681090
// > ??> @ 0x1406810a0
// > ??> @ 0x1406cdf38
// > ??> @ 0x1406cdf44
//
// 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)
{
int v6; // r9d
std::_Tree_node, std::vector>, void *>::_Nodeptr Left; // rbx
std::_Vector_val>::pointer Mylast; // rbp
std::_Vector_val>::pointer Myfirst; // r8
int v10; // r14d
__int64 v11; // r15
__int64 v12; // rcx
_DWORD *p_m_targetID; // rsi
int *p_m_controlID; // rcx
int *v15; // rdi
std::_Tree_node, std::vector>, void *>::_Nodeptr Right; // rax
std::_Tree_node, std::vector>, void *>::_Nodeptr i; // rax
std::_Tree_node, std::vector>, void *> *v18; // rcx
v6 = a2;
Left = a1->m_gameState.m_unkMapPairGJGameEventIntVectorEventTriggerInstance._Mypair._Myval2._Myval2._Myhead->_Left;
if ( !Left->_Isnil )
{
while ( 1 )
{
Mylast = Left->_Myval.second._Mypair._Myval2._Mylast;
Myfirst = Left->_Myval.second._Mypair._Myval2._Myfirst;
v10 = 0;
if ( Mylast - Myfirst )
break;
LABEL_19:
Right = Left->_Right;
if ( Right->_Isnil )
{
for ( i = Left->_Parent; !i->_Isnil; i = i->_Parent )
{
if ( Left != i->_Right )
break;
Left = i;
}
Left = i;
}
else
{
v18 = Right->_Left;
for ( Left = Left->_Right; !v18->_Isnil; v18 = v18->_Left )
Left = v18;
}
if ( Left->_Isnil )
return;
}
v11 = 0;
while ( 1 )
{
if ( a3 == -1 )
{
if ( Myfirst[v11].m_uniqueID != v6 )
goto LABEL_17;
}
else if ( Myfirst[v11].m_controlID != a3 )
{
goto LABEL_17;
}
switch ( a4 )
{
case Stop:
v12 = v10;
p_m_targetID = &Myfirst[v12 + 1].m_targetID;
if ( p_m_targetID != (_DWORD *)Mylast )
{
p_m_controlID = &Myfirst[v12].m_controlID;
do
{
v15 = p_m_controlID + 10;
*(p_m_controlID - 2) = *p_m_targetID;
*(p_m_controlID - 1) = p_m_controlID[9];
*p_m_controlID = p_m_controlID[10];
*((_BYTE *)p_m_controlID + 4) = *((_BYTE *)p_m_controlID + 44);
sub_14024B1D0(p_m_controlID + 2, p_m_controlID + 12);
p_m_targetID += 10;
p_m_controlID = v15;
}
while ( p_m_targetID != (_DWORD *)Mylast );
}
sub_14005E430((__int64)&Left->_Myval.second._Mypair._Myval2._Mylast[-1].m_remapKeys);
--Left->_Myval.second._Mypair._Myval2._Mylast;
v6 = a2;
goto LABEL_18;
case Pause:
Myfirst[v11].m_inactive = 1;
break;
case Resume:
Myfirst[v11].m_inactive = 0;
break;
}
LABEL_17:
++v10;
++v11;
LABEL_18:
Mylast = Left->_Myval.second._Mypair._Myval2._Mylast;
Myfirst = Left->_Myval.second._Mypair._Myval2._Myfirst;
if ( v10 >= (unsigned __int64)(Mylast - Myfirst) )
goto LABEL_19;
}
}
}