//
// GJBaseGameLayer::playerTouchedTrigger from 0x1001286b0 to 0x10012891a (618 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::collisionCheckObjects @ 0x100127029
//
// 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 GJBaseGameLayer::playerTouchedTrigger(GJBaseGameLayer *a1, PlayerObject *a2, EffectGameObject *a3)
{
PlayerObject *v4; // r14
GJBaseGameLayer *v5; // r12
__int64 m_uniqueID; // rdx
__int64 v7; // r13
std::__tree_end_node *>::pointer left; // rax
std::__tree_end_node *>::pointer v9; // rcx
int v10; // esi
int v11; // esi
unsigned int m_commandIndex; // ecx
__int64 v13; // r15
std::__compressed_pair *>> *p_pair1; // r14
char *v15; // r15
int v16; // eax
int v17; // eax
__int64 v18; // r12
std::__tree_end_node *> *v19; // rax
int v20; // r15d
int v21; // [rsp+10h] [rbp-60h]
char *v22; // [rsp+18h] [rbp-58h]
std::vector __p; // [rsp+20h] [rbp-50h] BYREF
PlayerObject *v24; // [rsp+38h] [rbp-38h]
unsigned int v25; // [rsp+44h] [rbp-2Ch]
v4 = a2;
v5 = a1;
if ( a3->m_objectID == 3640 )
((void (__fastcall *)(EffectGameObject *, _QWORD))a3->powerOnObject)(a3, a1->m_gameState.m_commandIndex);
if ( !a3->m_isTouchTriggered )
return;
m_uniqueID = 0;
if ( !a3->m_isSinglePTouch )
m_uniqueID = (unsigned int)a2->m_uniqueID;
v7 = (unsigned int)a3->m_uniqueID;
left = a1->m_gameState.m_activatedObjectIDs.__tree_.__pair1_.__value_.__left_;
if ( left )
{
v9 = a1->m_gameState.m_activatedObjectIDs.__tree_.__pair1_.__value_.__left_;
do
{
v10 = *((_DWORD *)v9 + 7);
if ( (int)v7 >= v10 )
{
if ( (int)v7 <= v10 )
{
v11 = *((_DWORD *)v9 + 8);
if ( (int)m_uniqueID < v11 )
goto LABEL_9;
if ( (int)m_uniqueID <= v11 )
{
if ( a3->m_isMultiTriggered )
{
v24 = v4;
m_commandIndex = a1->m_gameState.m_commandIndex;
goto LABEL_20;
}
goto LABEL_30;
}
}
v9 = (std::__tree_end_node *>::pointer)((char *)v9 + 8);
}
LABEL_9:
v9 = *(std::__tree_end_node *>::pointer *)v9;
}
while ( v9 );
}
if ( !a3->m_isMultiTriggered )
goto LABEL_30;
v13 = m_uniqueID;
GJEffectManager::removeTriggeredID(a1->m_effectManager, v7, m_uniqueID);
m_uniqueID = v13;
left = a1->m_gameState.m_activatedObjectIDs.__tree_.__pair1_.__value_.__left_;
v24 = v4;
m_commandIndex = a1->m_gameState.m_commandIndex;
if ( left )
{
while ( 1 )
{
LABEL_20:
v15 = (char *)left;
v16 = *((_DWORD *)left + 7);
if ( (int)v7 < v16 )
goto LABEL_19;
if ( (int)v7 > v16 )
goto LABEL_24;
v17 = *((_DWORD *)v15 + 8);
if ( (int)m_uniqueID < v17 )
{
LABEL_19:
left = *(std::__tree_end_node *>::pointer *)v15;
p_pair1 = (std::__compressed_pair *>> *)v15;
if ( !*(_QWORD *)v15 )
goto LABEL_26;
}
else
{
if ( (int)m_uniqueID <= v17 )
{
v4 = v24;
goto LABEL_29;
}
LABEL_24:
left = *((std::__tree_end_node *>::pointer *)v15 + 1);
if ( !left )
{
p_pair1 = (std::__compressed_pair *>> *)(v15 + 8);
goto LABEL_26;
}
}
}
}
p_pair1 = &a1->m_gameState.m_activatedObjectIDs.__tree_.__pair1_;
v15 = (char *)&a1->m_gameState.m_activatedObjectIDs.__tree_.__pair1_;
LABEL_26:
v25 = m_commandIndex;
v22 = v15;
v21 = m_uniqueID;
v18 = m_uniqueID << 32;
v15 = (char *)operator new(0x28u);
*(_QWORD *)(v15 + 28) = v7 | v18;
v5 = a1;
*((_DWORD *)v15 + 9) = 0;
*(_OWORD *)v15 = 0;
*((_QWORD *)v15 + 2) = v22;
p_pair1->__value_.__left_ = (std::__tree_end_node *>::pointer)v15;
v19 = (std::__tree_end_node *> *)a1->m_gameState.m_activatedObjectIDs.__tree_.__begin_node_->__left_;
if ( v19 )
a1->m_gameState.m_activatedObjectIDs.__tree_.__begin_node_ = v19;
sub_100054DD0((__int64 *)a1->m_gameState.m_activatedObjectIDs.__tree_.__pair1_.__value_.__left_, (__int64 *)v15);
++a1->m_gameState.m_activatedObjectIDs.__tree_.__pair3_.__value_;
v4 = v24;
LODWORD(m_uniqueID) = v21;
m_commandIndex = v25;
LABEL_29:
*((_DWORD *)v15 + 9) = m_commandIndex;
LABEL_30:
v20 = m_uniqueID;
if ( !GJEffectManager::hasBeenTriggered(v5->m_effectManager, v7, m_uniqueID) )
{
GJEffectManager::storeTriggeredID(v5->m_effectManager, v7, v20);
if ( a3->m_objectID == 1268 )
{
memset(&__p, 0, sizeof(__p));
SpawnTriggerGameObject::updateRemapKeys((SpawnTriggerGameObject *)a3, &__p);
if ( __p.__begin_ )
{
__p.__end_ = __p.__begin_;
operator delete(__p.__begin_);
}
}
((void (__fastcall *)(EffectGameObject *, GJBaseGameLayer *, _QWORD, _QWORD))a3->triggerObject)(
a3,
v5,
(unsigned int)v4->m_uniqueID,
0);
}
((void (__fastcall *)(EffectGameObject *, double))a3->triggerActivated)(a3, 0.0);
}