//
// GJBaseGameLayer::triggerGradientCommand from 0x9ad440 to 0x9ad784 (836 bytes)
//
// 5 xrefs:
// > PlayLayer::loadFromCheckpoint @ 0x70f814
// > LevelEditorLayer::activateTriggerEffect @ 0x795a24
// > EffectGameObject::triggerObject @ 0x897f04
// > GJBaseGameLayer::controlGradientTrigger @ 0x9ad7e4
// > ??> @ 0x41800
//
// This function is hookable on this platform (idp: arm, 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:58:13 +0000
//
_QWORD *__fastcall GJBaseGameLayer::triggerGradientCommand(cocos2d::CCDictionary **this, GradientTriggerObject *a2)
{
int v4; // w1
cocos2d::CCDictionary *v5; // x0
int v6; // w20
__int64 v7; // x21
_QWORD *result; // x0
int v9; // w0
char v10; // w20
__int64 v11; // x1
int v12; // w20
__int64 v13; // x1
__int64 v14; // x22
int ObjectZOrder; // w0
int v16; // w1
unsigned int v17; // w19
__int64 v18; // x0
cocos2d::CCObject *v19; // x0
if ( *((_BYTE *)a2 + 1870) )
return GJBaseGameLayer::resetGradientLayers((GJBaseGameLayer *)this);
v4 = *((_DWORD *)a2 + 462);
v5 = *(this + 1550);
if ( v4 > 999 )
v6 = 999;
else
v6 = v4;
v7 = cocos2d::CCDictionary::objectForKey(v5, v6);
if ( !v7 )
{
v19 = (cocos2d::CCObject *)GJGradientLayer::create(nullptr);
*((_DWORD *)v19 + 151) = v6;
v7 = (__int64)v19;
cocos2d::CCDictionary::setObject(*(this + 1550), v19, v6);
}
if ( *((_BYTE *)a2 + 1869) )
{
result = (_QWORD *)(*(__int64 (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v7 + 528LL))(v7, 0);
*(_QWORD *)(v7 + 584) = 0;
}
else
{
*(_QWORD *)(v7 + 584) = a2;
*(_DWORD *)(v7 + 564) = GameObject::getMainColorMode(a2);
*(_DWORD *)(v7 + 568) = GameObject::getSecondaryColorMode(a2);
v9 = *((_DWORD *)a2 + 461);
*(_DWORD *)(v7 + 596) = v9;
if ( v9 == 2 )
{
v10 = 1;
v11 = 0x30300000306LL;
}
else if ( v9 == 3 )
{
v10 = 1;
v11 = 0x30100000307LL;
}
else
{
v10 = 0;
if ( v9 == 1 )
v11 = 0x100000302LL;
else
v11 = 0x30300000302LL;
}
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v7 + 1288LL))(v7, v11);
*(_BYTE *)(v7 + 561) = v10;
*(_DWORD *)(v7 + 600) = *((_DWORD *)a2 + 460);
v12 = GJBaseGameLayer::maxZOrderForShaderZ((GJBaseGameLayer *)this, *((_DWORD *)a2 + 460));
switch ( *((_DWORD *)a2 + 460) )
{
case 2:
v18 = (__int64)*(this + 497);
if ( !v18 )
goto LABEL_14;
v14 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v18 + 512LL))(v18);
goto LABEL_16;
case 3:
v13 = (__int64)*(this + 396);
goto LABEL_15;
case 4:
v13 = (__int64)*(this + 382);
goto LABEL_15;
case 5:
v13 = (__int64)*(this + 368);
goto LABEL_15;
case 6:
v13 = (__int64)*(this + 354);
goto LABEL_15;
case 7:
v13 = (__int64)*(this + 340);
goto LABEL_15;
case 8:
v13 = (__int64)*(this + 407);
goto LABEL_15;
case 9:
v13 = (__int64)*(this + 320);
goto LABEL_15;
case 0xA:
v13 = (__int64)*(this + 306);
goto LABEL_15;
case 0xB:
v13 = (__int64)*(this + 292);
goto LABEL_15;
case 0xC:
v13 = (__int64)*(this + 278);
goto LABEL_15;
case 0xD:
v13 = (__int64)*(this + 495);
goto LABEL_15;
case 0xE:
v13 = (__int64)*(this + 1664);
goto LABEL_15;
case 0xF:
v14 = (__int64)*(this + 489);
goto LABEL_23;
default:
LABEL_14:
v13 = (__int64)*(this + 493);
LABEL_15:
v14 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v13 + 512LL))(v13);
LABEL_16:
switch ( *((_DWORD *)a2 + 460) )
{
case 1:
v12 = -54;
break;
case 2:
v12 = -14;
break;
case 0xD:
v12 = 46;
break;
case 0xE:
v12 = 56;
break;
default:
break;
}
LABEL_23:
ObjectZOrder = GameObject::getObjectZOrder(a2);
*(_BYTE *)(v7 + 592) = 1;
if ( ObjectZOrder < -5 )
ObjectZOrder = -5;
v16 = *((_DWORD *)a2 + 460) - 1;
if ( ObjectZOrder > 5 )
ObjectZOrder = 5;
v17 = v12 + ObjectZOrder;
switch ( v16 )
{
case 0:
case 1:
case 12:
case 13:
case 14:
*(_BYTE *)(v7 + 592) = 0;
break;
default:
break;
}
if ( v14 == (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v7 + 512LL))(v7) )
{
result = (_QWORD *)(*(__int64 (**)(void))(*(_QWORD *)v14 + 592LL))();
}
else
{
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v7 + 528LL))(v7, 0);
result = (_QWORD *)(*(__int64 (__fastcall **)(__int64, __int64, _QWORD))(*(_QWORD *)v14 + 464LL))(
v14,
v7,
v17);
}
break;
}
}
return result;
}