//
// GJBaseGameLayer::controlTriggersInGroup from 0x14021e190 to 0x14021e711 (1409 bytes)
//
// 2 xrefs:
// > TriggerControlGameObject::triggerObject @ 0x1404c3340
// > ??> @ 0x1406cd3f8
//
// 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=2
void GJBaseGameLayer::controlTriggersInGroup(GJBaseGameLayer *a1, int a2, GJActionCommand a3)
{
cocos2d::CCArray *Group; // rax
cocos2d::ccArray *data; // rax
__int64 num; // rdx
EnterEffectObject **arr; // rsi
EnterEffectObject **v9; // rbp
EnterEffectObject *v10; // rdi
int m_objectID; // ecx
int v12; // edi
std::_List_val>>::_Nodeptr Myhead; // rax
__int64 *v14; // rdx
int m_lengthVariance; // eax
struct cocos2d::CCObject *v16; // rax
struct cocos2d::CCObject *v17; // rdi
GJBaseGameLayer *v18; // rcx
std::_Vector_val>::pointer Mylast; // rcx
std::_Vector_val>::pointer Myfirst; // rax
__int64 v21; // rax
int *v22; // r14
int *v23; // r15
FMODAudioEngine *v24; // rsi
__int64 v25; // rax
__int64 v26; // rax
__int64 v27; // rcx
__int64 v28; // rax
std::_Vector_val>::pointer v29; // rcx
std::_Vector_val>::pointer i; // rax
std::_Vector_val>::pointer v31; // rcx
std::_Vector_val>::pointer j; // rax
int v33; // [rsp+20h] [rbp-88h] BYREF
_DWORD v34[2]; // [rsp+28h] [rbp-80h] BYREF
EnterEffectObject **v35; // [rsp+30h] [rbp-78h]
EnterEffectObject **v36; // [rsp+38h] [rbp-70h]
char v37[8]; // [rsp+40h] [rbp-68h] BYREF
FMODAudioEngine *v38; // [rsp+48h] [rbp-60h]
char v39[16]; // [rsp+50h] [rbp-58h] BYREF
char v40[16]; // [rsp+60h] [rbp-48h] BYREF
char v41[16]; // [rsp+70h] [rbp-38h] BYREF
int m_uniqueID; // [rsp+C8h] [rbp+20h] BYREF
Group = GJBaseGameLayer::getGroup(a1, a2);
if ( Group )
{
data = Group->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (EnterEffectObject **)data->arr;
v35 = arr;
v9 = &arr[num - 1];
v36 = v9;
while ( arr <= v9 )
{
v10 = *arr;
if ( !*arr )
return;
if ( v10->m_canBeControlled )
{
m_objectID = v10->m_objectID;
if ( m_objectID > 2903 )
{
if ( m_objectID <= 3602 )
{
if ( m_objectID == 3602 )
{
m_uniqueID = v10->m_uniqueID;
v21 = sub_140250040(&a1->m_gameState.m_unkUMap8, v39, &m_uniqueID);
v22 = *(int **)(*(_QWORD *)v21 + 24LL);
v23 = *(int **)(*(_QWORD *)v21 + 32LL);
if ( v22 != v23 )
{
v34[1] = 0;
do
{
v24 = (FMODAudioEngine *)qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v38 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v38);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v24 = (FMODAudioEngine *)qword_1406C2E88;
}
v33 = *v22;
v25 = sub_140060FD0((__int64)&v24->m_channelIDToChannel, (__int64)v40, (unsigned __int8 *)&v33);
FMODAudioEngine::stopChannel_1(v24, *(FMOD::Channel **)(*(_QWORD *)v25 + 24LL), 0, 0.0);
v34[0] = *v22;
sub_140249E30(&a1->m_gameState.m_proximityVolumeRelated, v34);
++v22;
}
while ( v22 != v23 );
arr = v35;
v9 = v36;
}
m_uniqueID = v10->m_uniqueID;
v26 = sub_140250040(&a1->m_gameState.m_unkUMap8, v41, &m_uniqueID);
v27 = *(_QWORD *)v26;
v28 = *(_QWORD *)(*(_QWORD *)v26 + 24LL);
if ( v28 != *(_QWORD *)(v27 + 32) )
*(_QWORD *)(v27 + 32) = v28;
goto LABEL_82;
}
v18 = (GJBaseGameLayer *)(unsigned int)(m_objectID - 2904);
switch ( (int)v18 )
{
case 0:
case 1:
case 3:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 15:
case 16:
case 17:
case 18:
case 19:
case 20:
goto LABEL_82;
case 95:
goto LABEL_12;
case 102:
GJBaseGameLayer::controlAreaEffect(v18, *arr, &a1->m_gameState.m_moveEffectInstances, a3);
goto LABEL_82;
case 103:
GJBaseGameLayer::controlAreaEffect(v18, *arr, &a1->m_gameState.m_rotateEffectInstances, a3);
goto LABEL_82;
case 104:
GJBaseGameLayer::controlAreaEffect(v18, *arr, &a1->m_gameState.m_scaleEffectInstances, a3);
goto LABEL_82;
case 105:
GJBaseGameLayer::controlAreaEffect(v18, *arr, &a1->m_gameState.m_fadeEffectInstances, a3);
goto LABEL_82;
case 106:
GJBaseGameLayer::controlAreaEffect(v18, *arr, &a1->m_gameState.m_tintEffectInstances, a3);
goto LABEL_82;
case 112:
Mylast = a1->m_gameState.m_advanceFollowInstances._Mypair._Myval2._Mylast;
Myfirst = a1->m_gameState.m_advanceFollowInstances._Mypair._Myval2._Myfirst;
if ( Myfirst == Mylast )
goto LABEL_82;
break;
default:
goto LABEL_80;
}
while ( 2 )
{
if ( (EnterEffectObject *)Myfirst->m_gameObject == v10 )
{
switch ( a3 )
{
case Stop:
Myfirst->m_started = 1;
goto LABEL_38;
case Pause:
*(_WORD *)&Myfirst->m_finished = 257;
break;
case Resume:
LABEL_38:
*(_WORD *)&Myfirst->m_finished = 0;
break;
}
}
if ( ++Myfirst == Mylast )
goto LABEL_82;
continue;
}
}
if ( m_objectID != 3604 )
goto LABEL_57;
GJBaseGameLayer::controlEventLink(a1, v10->m_uniqueID, -1, a3);
}
else
{
switch ( m_objectID )
{
case 2903:
if ( a3 == Resume )
{
GJBaseGameLayer::triggerGradientCommand(a1, (GradientTriggerObject *)*arr);
}
else
{
m_lengthVariance = v10->m_lengthVariance;
if ( m_lengthVariance > 999 )
m_lengthVariance = 999;
v16 = cocos2d::CCDictionary::objectForKey(a1->m_gradientLayers, m_lengthVariance);
v17 = v16;
if ( v16 )
{
v16->__vftable[7].copyWithZone(v16, nullptr);
*(_QWORD *)&v17[10].m_uAutoReleaseCount = 0;
}
}
break;
case 1615:
v10->m_relative = a3 != Resume;
break;
case 1913:
case 1916:
case 2015:
LABEL_12:
v12 = v10->m_uniqueID;
Myhead = a1->m_gameState.m_tweenActions._List._Mypair._Myval2._Myhead;
v14 = *(__int64 **)Myhead;
if ( *(std::_List_val>>::_Nodeptr *)Myhead != Myhead )
{
while ( 1 )
{
if ( *((_DWORD *)v14 + 13) != v12 )
goto LABEL_45;
if ( a3 )
break;
v14 = *(__int64 **)sub_14024D170(&a1->m_gameState.m_tweenActions, v37, v14);
LABEL_46:
if ( v14 == (__int64 *)a1->m_gameState.m_tweenActions._List._Mypair._Myval2._Myhead )
goto LABEL_82;
}
if ( a3 == Pause )
{
*((_BYTE *)v14 + 49) = 1;
}
else if ( a3 == Resume )
{
*((_BYTE *)v14 + 49) = 0;
}
LABEL_45:
v14 = (__int64 *)*v14;
goto LABEL_46;
}
break;
default:
LABEL_57:
if ( m_objectID == 1346 )
{
if ( v10->m_isDynamicMode )
{
v29 = a1->m_gameState.m_dynamicRotateActions._Mypair._Myval2._Mylast;
for ( i = a1->m_gameState.m_dynamicRotateActions._Mypair._Myval2._Myfirst; i != v29; ++i )
{
if ( i->m_gameObject1 == v10 )
{
if ( a3 )
{
if ( a3 == Pause )
{
*(_WORD *)&i->m_unkBool3 = 257;
}
else if ( a3 == Resume )
{
*(_WORD *)&i->m_unkBool3 = 0;
}
}
else
{
i->m_unkBool2 = 1;
}
}
}
}
}
else if ( m_objectID == 901 && v10->m_isDynamicMode )
{
v31 = a1->m_gameState.m_dynamicMoveActions._Mypair._Myval2._Mylast;
for ( j = a1->m_gameState.m_dynamicMoveActions._Mypair._Myval2._Myfirst; j != v31; ++j )
{
if ( j->m_gameObject1 == v10 )
{
if ( a3 )
{
if ( a3 == Pause )
{
*(_WORD *)&j->m_unkBool3 = 257;
}
else if ( a3 == Resume )
{
*(_WORD *)&j->m_unkBool3 = 0;
}
}
else
{
j->m_unkBool2 = 1;
}
}
}
}
LABEL_80:
GJEffectManager::controlActionsForTrigger(a1->m_effectManager, v10, a3);
break;
}
}
}
LABEL_82:
v35 = ++arr;
}
}
}
}