//
// GJBaseGameLayer::triggerGradientCommand from 0x1001167d0 to 0x100116bc6 (1014 bytes)
//
// 6 xrefs:
// > PlayLayer::loadFromCheckpoint @ 0x10008b271
// > LevelEditorLayer::activateTriggerEffect @ 0x1000c2f76
// > GJBaseGameLayer::controlTriggersInGroup @ 0x100113962
// > GJBaseGameLayer::controlGradientTrigger @ 0x1001146b3
// > GJBaseGameLayer::controlTriggersWithControlID @ 0x100114b46
// > EffectGameObject::triggerObject @ 0x10019a3dc
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:24:34 +0000
//
__int64 __fastcall GJBaseGameLayer::triggerGradientCommand(__int64 a1, __int64 a2, double a3)
{
__int64 result; // rax
__int64 i; // r14
__int64 v6; // rbx
int v8; // ecx
__int64 v9; // rdi
__int64 v10; // r12
__int64 v11; // rsi
__int64 v12; // rbx
int v13; // ecx
unsigned int v14; // ecx
unsigned int v15; // r12d
__int64 v16; // rsi
int v17; // ecx
int v18; // r13d
__int64 v19; // r15
__int64 v20; // rdi
int ObjectZOrder; // eax
int v22; // ecx
int v23; // r12d
unsigned int v24; // eax
int v25; // ecx
unsigned int v26; // r12d
__int64 (__fastcall *v27)(__int64, __int64, _QWORD); // rax
if ( *(_BYTE *)(a2 + 1870) == 1 )
{
result = *(_QWORD *)(a1 + 12400);
if ( result )
{
for ( i = *(_QWORD *)(result + 56);
i;
result = (*(__int64 (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v6 + 344LL))(v6, 0) )
{
v6 = *(_QWORD *)(i + 264);
i = *(_QWORD *)(i + 288);
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v6 + 528LL))(v6, 0);
*(_QWORD *)(v6 + 584) = 0;
*(_BYTE *)(v6 + 592) = 0;
}
}
return result;
}
v8 = 999;
if ( *(int *)(a2 + 1848) < 999 )
v8 = *(_DWORD *)(a2 + 1848);
v9 = *(_QWORD *)(a1 + 12400);
v10 = v8;
v11 = v8;
v12 = cocos2d::CCDictionary::objectForKey_1(v9);
if ( v12 )
{
if ( *(_BYTE *)(a2 + 1869) == 1 )
{
LABEL_10:
result = (*(__int64 (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v12 + 528LL))(v12, 0);
*(_QWORD *)(v12 + 584) = 0;
return result;
}
}
else
{
v12 = GJGradientLayer::create(v9, v11);
*(_DWORD *)(v12 + 604) = v10;
cocos2d::CCDictionary::setObject_1(*(_QWORD *)(a1 + 12400), v12, v10);
if ( *(_BYTE *)(a2 + 1869) == 1 )
goto LABEL_10;
}
*(_QWORD *)(v12 + 584) = a2;
*(_DWORD *)(v12 + 564) = GameObject::getMainColorMode(a2);
*(_DWORD *)(v12 + 568) = GameObject::getSecondaryColorMode(a2, a3);
v13 = *(_DWORD *)(a2 + 1844);
*(_DWORD *)(v12 + 596) = v13;
v14 = v13 - 1;
if ( v14 > 2 )
{
v16 = 0x30300000302LL;
LOBYTE(v15) = 0;
}
else
{
v15 = 0x10100u >> (8 * v14);
v16 = qword_100A05068[v14] | qword_100A05080[v14];
}
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v12 + 1288LL))(v12, v16);
*(_BYTE *)(v12 + 561) = v15;
v17 = *(_DWORD *)(a2 + 1840);
*(_DWORD *)(v12 + 600) = v17;
switch ( v17 )
{
case 1:
case 2:
v18 = -1600;
goto LABEL_23;
case 3:
case 4:
case 5:
case 6:
case 7:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
v18 = 1399;
switch ( v17 )
{
case 3:
v19 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3168) + 512LL))(*(_QWORD *)(a1 + 3168));
v18 = -1201;
break;
case 4:
v19 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 3056) + 512LL))(*(_QWORD *)(a1 + 3056));
v18 = -901;
break;
case 5:
v19 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 2944) + 512LL))(*(_QWORD *)(a1 + 2944));
v18 = -601;
break;
case 6:
v19 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 2832) + 512LL))(*(_QWORD *)(a1 + 2832));
v18 = -301;
break;
case 7:
v19 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 2720) + 512LL))(*(_QWORD *)(a1 + 2720));
v18 = 38;
break;
case 8:
v18 = 99;
goto LABEL_40;
case 9:
v18 = 399;
LABEL_33:
v20 = *(_QWORD *)(a1 + 2560);
goto LABEL_41;
case 10:
v18 = 699;
LABEL_38:
v20 = *(_QWORD *)(a1 + 2448);
goto LABEL_41;
case 11:
v18 = 999;
LABEL_30:
v20 = *(_QWORD *)(a1 + 2336);
goto LABEL_41;
case 12:
LABEL_27:
v20 = *(_QWORD *)(a1 + 2224);
goto LABEL_41;
case 13:
LABEL_28:
v20 = *(_QWORD *)(a1 + 3960);
goto LABEL_41;
case 14:
LABEL_26:
v20 = *(_QWORD *)(a1 + 13312);
goto LABEL_41;
}
goto LABEL_42;
case 8:
v18 = 61;
LABEL_40:
v20 = *(_QWORD *)(a1 + 3256);
goto LABEL_41;
case 15:
v18 = 1400;
LABEL_25:
v19 = *(_QWORD *)(a1 + 3912);
goto LABEL_42;
default:
v18 = 0;
LABEL_23:
switch ( v17 )
{
case 2:
v20 = *(_QWORD *)(a1 + 3976);
if ( v20 )
goto LABEL_41;
break;
case 8:
goto LABEL_40;
case 9:
goto LABEL_33;
case 10:
goto LABEL_38;
case 11:
goto LABEL_30;
case 12:
goto LABEL_27;
case 13:
goto LABEL_28;
case 14:
goto LABEL_26;
case 15:
goto LABEL_25;
default:
break;
}
v20 = *(_QWORD *)(a1 + 3944);
LABEL_41:
v19 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v20 + 512LL))(v20);
LABEL_42:
switch ( *(_DWORD *)(a2 + 1840) )
{
case 1:
v18 = -54;
break;
case 2:
v18 = -14;
break;
case 0xD:
v18 = 46;
break;
case 0xE:
v18 = 56;
break;
default:
break;
}
ObjectZOrder = GameObject::getObjectZOrder(a2);
v22 = -5;
if ( ObjectZOrder >= -4 )
v22 = ObjectZOrder;
v23 = 5;
if ( v22 < 5 )
v23 = v22;
*(_BYTE *)(v12 + 592) = 1;
v24 = *(_DWORD *)(a2 + 1840);
if ( v24 <= 0xF )
{
v25 = 57350;
if ( _bittest(&v25, v24) )
*(_BYTE *)(v12 + 592) = 0;
}
v26 = v18 + v23;
if ( (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v12 + 512LL))(v12) == v19 )
{
v27 = *(__int64 (__fastcall **)(__int64, __int64, _QWORD))(*(_QWORD *)v19 + 592LL);
}
else
{
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v12 + 528LL))(v12, 0);
v27 = *(__int64 (__fastcall **)(__int64, __int64, _QWORD))(*(_QWORD *)v19 + 464LL);
}
result = v27(v19, v12, v26);
break;
}
return result;
}