//
// GJBaseGameLayer::triggerGradientCommand from 0x1403274b0 to 0x140327938 (1160 bytes)
//
// 6 xrefs:
// > GJBaseGameLayer::controlTriggersInGroup @ 0x140325c01
// > GJBaseGameLayer::controlTriggersWithControlID @ 0x140326426
// > LevelEditorLayer::activateTriggerEffect @ 0x1403fbf30
// > PlayLayer::loadFromCheckpoint @ 0x140516c11
// > EffectGameObject::triggerObject @ 0x140649077
// > ??> @ 0x14091f01c
//
// 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 11:30:27 +0000
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall GJBaseGameLayer::triggerGradientCommand(__int64 a1, __int64 a2)
{
__int64 result; // rax
int v5; // r14d
struct cocos2d::CCObject *v6; // rbx
int v7; // ebp
__int64 (__fastcall *v8)(struct cocos2d::CCObject *); // rdx
char v9; // al
int *v10; // rax
int v11; // ecx
int v12; // eax
int *v13; // rax
int v14; // ecx
char v15; // bp
int v16; // ecx
int v17; // ecx
__int64 v18; // rcx
int v19; // ebp
int v20; // r9d
__int64 v21; // rax
__int64 v22; // rcx
__int64 v23; // rdi
int v24; // eax
unsigned int v25; // ebp
__int64 v26; // [rsp+48h] [rbp+10h]
if ( *(_BYTE *)(a2 + 1886) )
return GJBaseGameLayer::resetGradientLayers();
v5 = *(_DWORD *)(a2 + 1864);
if ( v5 > 999 )
v5 = 999;
v6 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 12880), v5);
v7 = 0;
if ( !v6 )
{
v6 = (struct cocos2d::CCObject *)operator new(0x260u);
cocos2d::CCLayerGradient::CCLayerGradient(v6);
*(_QWORD *)v6 = &GJGradientLayer::`vftable';
*((_QWORD *)v6 + 40) = &GJGradientLayer::`vftable';
*((_QWORD *)v6 + 41) = &GJGradientLayer::`vftable';
*((_QWORD *)v6 + 42) = &GJGradientLayer::`vftable';
*((_QWORD *)v6 + 43) = &GJGradientLayer::`vftable';
*((_QWORD *)v6 + 44) = &GJGradientLayer::`vftable';
*((_QWORD *)v6 + 51) = &GJGradientLayer::`vftable';
*((_QWORD *)v6 + 54) = &GJGradientLayer::`vftable';
*((_QWORD *)v6 + 71) = 0;
cocos2d::CCPoint::CCPoint((struct cocos2d::CCObject *)((char *)v6 + 576));
*((_QWORD *)v6 + 73) = 0;
*((_BYTE *)v6 + 592) = 0;
*(_QWORD *)((char *)v6 + 596) = 0;
*((_DWORD *)v6 + 151) = 0;
v8 = *(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v6 + 72LL);
if ( (char *)v8 == (char *)GJGradientLayer::init )
v9 = GJGradientLayer::init(v6);
else
v9 = v8(v6);
if ( v9 )
{
cocos2d::CCObject::autorelease(v6);
}
else
{
(*(void (__fastcall **)(struct cocos2d::CCObject *, __int64))(*(_QWORD *)v6 + 8LL))(v6, 1);
v6 = nullptr;
}
*((_DWORD *)v6 + 151) = v5;
cocos2d::CCDictionary::setObject(*(cocos2d::CCDictionary **)(a1 + 12880), v6, v5);
}
if ( *(_BYTE *)(a2 + 1885) )
{
result = (*(__int64 (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v6 + 520LL))(v6, 0);
*((_QWORD *)v6 + 73) = 0;
return result;
}
*((_QWORD *)v6 + 73) = a2;
v10 = *(int **)(a2 + 1104);
if ( v10 )
{
v11 = v10[1];
v12 = *v10;
if ( v11 == v12 || !v12 )
v12 = v11;
}
else
{
v12 = 0;
}
*((_DWORD *)v6 + 142) = v12;
v13 = *(int **)(a2 + 1112);
if ( v13 )
{
v7 = *v13;
if ( v13[1] == *v13 || !v7 )
v7 = v13[1];
}
*((_DWORD *)v6 + 143) = v7;
v14 = *(_DWORD *)(a2 + 1860);
*((_DWORD *)v6 + 149) = v14;
v15 = 0;
v16 = v14 - 1;
if ( v16 )
{
v17 = v16 - 1;
if ( !v17 )
{
v26 = 0x30300000306LL;
v15 = 1;
goto LABEL_32;
}
if ( v17 == 1 )
{
v26 = 0x30100000307LL;
v15 = 1;
goto LABEL_32;
}
HIDWORD(v26) = 771;
}
else
{
HIDWORD(v26) = 1;
}
LODWORD(v26) = 770;
LABEL_32:
(**((void (__fastcall ***)(__int64, __int64))v6 + 54))((__int64)v6 + 432, v26);
*((_BYTE *)v6 + 561) = v15;
*((_DWORD *)v6 + 150) = *(_DWORD *)(a2 + 1856);
v19 = GJBaseGameLayer::maxZOrderForShaderZ(v18, *(unsigned int *)(a2 + 1856));
switch ( v20 )
{
case 1:
v21 = (*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(a1 + 4320) + 504LL))(*(_QWORD *)(a1 + 4320));
goto LABEL_37;
case 2:
v22 = *(_QWORD *)(a1 + 4352);
if ( !v22 )
goto LABEL_35;
goto LABEL_36;
case 3:
v22 = *(_QWORD *)(a1 + 3424);
goto LABEL_36;
case 4:
v22 = *(_QWORD *)(a1 + 3312);
goto LABEL_36;
case 5:
v22 = *(_QWORD *)(a1 + 3200);
goto LABEL_36;
case 6:
v22 = *(_QWORD *)(a1 + 3088);
goto LABEL_36;
case 7:
v22 = *(_QWORD *)(a1 + 2976);
goto LABEL_36;
case 8:
v22 = *(_QWORD *)(a1 + 3512);
goto LABEL_36;
case 9:
v22 = *(_QWORD *)(a1 + 2816);
goto LABEL_36;
case 10:
v22 = *(_QWORD *)(a1 + 2704);
goto LABEL_36;
case 11:
v22 = *(_QWORD *)(a1 + 2592);
goto LABEL_36;
case 12:
v22 = *(_QWORD *)(a1 + 2480);
goto LABEL_36;
case 13:
v22 = *(_QWORD *)(a1 + 4336);
goto LABEL_36;
case 14:
v22 = *(_QWORD *)(a1 + 13912);
goto LABEL_36;
case 15:
v23 = *(_QWORD *)(a1 + 4288);
goto LABEL_38;
default:
LABEL_35:
v22 = *(_QWORD *)(a1 + 4320);
LABEL_36:
v21 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v22 + 504LL))(v22);
LABEL_37:
v23 = v21;
LABEL_38:
switch ( *(_DWORD *)(a2 + 1856) )
{
case 1:
v19 = -54;
break;
case 2:
v19 = -14;
break;
case 0xD:
v19 = 46;
break;
case 0xE:
v19 = 56;
break;
}
v24 = *(_DWORD *)(a2 + 1136);
if ( !v24 )
v24 = *(_DWORD *)(a2 + 1056);
if ( v24 <= 5 )
{
if ( v24 < -5 )
v24 = -5;
}
else
{
v24 = 5;
}
v25 = v24 + v19;
*((_BYTE *)v6 + 592) = 1;
if ( *(_DWORD *)(a2 + 1856) == 1
|| *(_DWORD *)(a2 + 1856) == 2
|| *(_DWORD *)(a2 + 1856) == 13
|| (unsigned int)(*(_DWORD *)(a2 + 1856) - 14) <= 1 )
{
*((_BYTE *)v6 + 592) = 0;
}
if ( (*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v6 + 504LL))(v6) == v23 )
{
result = (*(__int64 (__fastcall **)(__int64, struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v23 + 584LL))(
v23,
v6,
v25);
}
else
{
(*(void (__fastcall **)(struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v6 + 520LL))(v6, 0);
result = (*(__int64 (__fastcall **)(__int64, struct cocos2d::CCObject *, _QWORD))(*(_QWORD *)v23 + 456LL))(
v23,
v6,
v25);
}
break;
}
return result;
}