//
// GJBaseGameLayer::controlTriggersWithControlID from 0x100136f40 to 0x100137226 (742 bytes)
//
// 1 xrefs:
// > TriggerControlGameObject::triggerObject @ 0x1001efbf0
//
// 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::controlTriggersWithControlID(GJBaseGameLayer *a1, int a2, GJActionCommand a3)
{
std::__hash_node_base>, void *> *>::__next_pointer i; // rax
std::__hash_node_base>, void *> *>::__next_pointer next; // rdx
std::__hash_node_base>, void *> *>::__next_pointer v7; // rsi
cocos2d::CCDictionary *m_gradientLayers; // rax
cocos2d::CCDictElement *m_pElements; // r15
unsigned __int64 v10; // rdi
char *v11; // r14
char *v12; // r13
cocos2d::CCObject *m_pObject; // rbx
__int64 v14; // r8
char *v15; // rdx
__int64 v16; // r13
unsigned __int64 v17; // rcx
__int64 v18; // rdi
unsigned __int64 v19; // r14
char *v20; // rax
__int64 v21; // rbx
GradientTriggerObject **v22; // rbx
char *v23; // r15
char *v24; // rbx
int v25; // eax
cocos2d::CCObject *v26; // r14
__int64 __n; // [rsp+0h] [rbp-50h]
char *v28; // [rsp+8h] [rbp-48h]
GJActionCommand v30; // [rsp+1Ch] [rbp-34h]
char *__src; // [rsp+20h] [rbp-30h]
GJEffectManager::controlActionsForControlID(a1->m_effectManager, a2, a3);
GJBaseGameLayer::controlAreaEffectWithID(a1, -1, a2, a3);
GJBaseGameLayer::controlAdvancedFollowCommand(a1, nullptr, a2, a3);
GJBaseGameLayer::controlEventLink(a1, -1, a2, a3);
GJBaseGameLayer::controlDynamicMoveCommand(a1, nullptr, a2, a3);
GJBaseGameLayer::controlDynamicRotateCommand(a1, nullptr, a2, a3);
GJGameState::controlTweenAction(&a1->m_gameState, -1, a2, a3);
for ( i = a1->m_labelObjects.__table_.__p1_.__value_.__next_; i; i = i->__next_ )
{
next = i[3].__next_;
v7 = i[4].__next_;
while ( next != v7 )
{
if ( LODWORD(next->__next_[209].__next_) == a2 )
LOBYTE(next->__next_[238].__next_) = a3 != Resume;
++next;
}
}
m_gradientLayers = a1->m_gradientLayers;
if ( m_gradientLayers )
{
m_pElements = m_gradientLayers->m_pElements;
if ( m_pElements )
{
v30 = a3;
v10 = 0;
v11 = nullptr;
v12 = nullptr;
do
{
m_pObject = m_pElements->m_pObject;
m_pElements = (cocos2d::CCDictElement *)m_pElements->hh.next;
v14 = *(_QWORD *)&m_pObject[10].m_uAutoReleaseCount;
if ( v14 && *(_DWORD *)(v14 + 1672) == a2 )
{
if ( (unsigned __int64)v11 < v10 )
{
*(_QWORD *)v11 = v14;
v11 += 8;
}
else
{
v15 = v12;
__n = v11 - v12;
v16 = __n >> 3;
v17 = (__n >> 3) + 1;
__src = v15;
if ( v17 > 0x1FFFFFFFFFFFFFFFLL )
sub_100168CE0(v10, 0x1FFFFFFFFFFFFFFFLL);
v18 = v10 - (_QWORD)v15;
v19 = v18 >> 2;
if ( v18 >> 2 <= v17 )
v19 = (__n >> 3) + 1;
if ( (unsigned __int64)v18 >= 0x7FFFFFFFFFFFFFF8LL )
v19 = 0x1FFFFFFFFFFFFFFFLL;
if ( v19 )
{
if ( v19 > 0x1FFFFFFFFFFFFFFFLL )
sub_100054850();
v20 = (char *)operator new(8 * v19);
v14 = *(_QWORD *)&m_pObject[10].m_uAutoReleaseCount;
}
else
{
v20 = nullptr;
}
v28 = &v20[8 * v19];
*(_QWORD *)&v20[8 * v16] = v14;
v21 = (__int64)&v20[8 * v16 + 8];
v12 = v20;
memcpy(v20, __src, __n);
if ( __src )
operator delete(__src);
v11 = (char *)v21;
v10 = (unsigned __int64)v28;
}
}
}
while ( m_pElements );
if ( v12 != v11 )
{
if ( v30 == Resume )
{
v22 = (GradientTriggerObject **)v12;
do
GJBaseGameLayer::triggerGradientCommand(a1, *v22++);
while ( v22 != (GradientTriggerObject **)v11 );
}
else
{
v23 = v12;
do
{
v24 = v11;
v25 = *(_DWORD *)(*(_QWORD *)v23 + 1844LL);
if ( v25 >= 999 )
v25 = 999;
v26 = cocos2d::CCDictionary::objectForKey(a1->m_gradientLayers, v25);
if ( v26 )
{
((void (__fastcall *)(cocos2d::CCObject *, _QWORD))v26->__vftable[6].acceptVisitor)(v26, 0);
*(_QWORD *)&v26[10].m_uAutoReleaseCount = 0;
}
v23 += 8;
v11 = v24;
}
while ( v23 != v24 );
}
}
if ( v12 )
operator delete(v12);
}
}
}