//
// GJBaseGameLayer::playerTouchedTrigger from 0x140217f50 to 0x140218153 (515 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::collisionCheckObjects @ 0x140215a5e
// > ??> @ 0x1406cd200
//
// 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
//
// Hidden C++ exception states: #wind=1
void GJBaseGameLayer::playerTouchedTrigger(GJBaseGameLayer *a1, PlayerObject *a2, EffectGameObject *a3)
{
int m_uniqueID; // r9d
int v7; // edx
std::_Tree_val, int>>>::_Nodeptr Myhead; // r8
std::_Tree_node, int>, void *>::_Nodeptr Parent; // rax
bool v10; // al
std::_Tree_val>>::_Nodeptr v11; // r8
std::_Tree_simple_types>::_Node *v12; // rax
std::_Vector_val>::pointer Myfirst; // rcx
std::vector Block; // [rsp+20h] [rbp-28h] BYREF
int v15; // [rsp+60h] [rbp+18h] BYREF
int v16; // [rsp+64h] [rbp+1Ch]
if ( a3->m_objectID == 3640 )
a3->powerOnObject(a3, a1->m_gameState.m_commandIndex);
if ( a3->m_isTouchTriggered )
{
if ( a3->m_isSinglePTouch )
m_uniqueID = 0;
else
m_uniqueID = a2->m_uniqueID;
v7 = a3->m_uniqueID;
v15 = v7;
v16 = m_uniqueID;
Myhead = a1->m_gameState.m_activatedObjectIDs._Mypair._Myval2._Myval2._Myhead;
Parent = Myhead->_Parent;
while ( !Parent->_Isnil )
{
if ( Parent->_Myval.first.first < v7
|| Parent->_Myval.first.first <= v7 && Parent->_Myval.first.second < m_uniqueID )
{
Parent = Parent->_Right;
}
else
{
Myhead = Parent;
Parent = Parent->_Left;
}
}
v10 = !Myhead->_Isnil
&& v7 >= Myhead->_Myval.first.first
&& (v7 > Myhead->_Myval.first.first || m_uniqueID >= Myhead->_Myval.first.second);
if ( a3->m_isMultiTriggered )
{
if ( !v10 )
GJEffectManager::removeTriggeredID(a1->m_effectManager, v7, m_uniqueID);
*(_DWORD *)sub_1401D0800((unsigned __int64)&a1->m_gameState.m_activatedObjectIDs, &v15) = a1->m_gameState.m_commandIndex;
m_uniqueID = v16;
v7 = v15;
}
v11 = a1->m_effectManager->m_unkMap498._Mypair._Myval2._Myval2._Myhead;
v12 = *((std::_Tree_simple_types>::_Node **)v11 + 1);
while ( !*((_BYTE *)v12 + 25) )
{
if ( *((_DWORD *)v12 + 7) < v7 || *((_DWORD *)v12 + 7) <= v7 && *((_DWORD *)v12 + 8) < m_uniqueID )
{
v12 = *((std::_Tree_simple_types>::_Node **)v12 + 2);
}
else
{
v11 = v12;
v12 = *(std::_Tree_simple_types>::_Node **)v12;
}
}
if ( *((_BYTE *)v11 + 25)
|| v7 < *((_DWORD *)v11 + 7)
|| v7 <= *((_DWORD *)v11 + 7) && m_uniqueID < *((_DWORD *)v11 + 8) )
{
GJEffectManager::storeTriggeredID(a1->m_effectManager, v7, m_uniqueID);
if ( a3->m_objectID == 1268 )
{
memset(&Block, 0, sizeof(Block));
SpawnTriggerGameObject::updateRemapKeys((SpawnTriggerGameObject *)a3, &Block);
Myfirst = Block._Mypair._Myval2._Myfirst;
if ( Block._Mypair._Myval2._Myfirst )
{
if ( (((char *)Block._Mypair._Myval2._Myend - (char *)Block._Mypair._Myval2._Myfirst) & 0xFFFFFFFFFFFFFFFCuLL) >= 0x1000 )
{
Myfirst = *((std::_Vector_val>::pointer *)Block._Mypair._Myval2._Myfirst - 1);
if ( (unsigned __int64)((char *)Block._Mypair._Myval2._Myfirst - (char *)Myfirst - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(Myfirst);
}
}
a3->triggerObject(a3, a1, a2->m_uniqueID, nullptr);
}
((void (__fastcall *)(EffectGameObject *))a3->triggerActivated)(a3);
}
}