//
// GJBaseGameLayer::updateLevelColors from 0x140312620 to 0x140312d0c (1772 bytes)
//
// 13 xrefs:
// > GameManager::finishedLoadingBGAsync @ 0x14027de08
// > GameManager::finishedLoadingMGAsync @ 0x14027e032
// > GameManager::finishedLoadingGAsync @ 0x14027e295
// > LevelEditorLayer::updateGameObjects @ 0x1403fb651
// > LevelEditorLayer::onPlaytest @ 0x1403ff0ea
// > LevelEditorLayer::postUpdate @ 0x1404009b4
// > PlayLayer::setupHasCompleted @ 0x140505736
// > PlayLayer::setupHasCompleted @ 0x140505af5
// > PlayLayer::postUpdate @ 0x140513ce3
// > PlayLayer::resetLevel @ 0x140519617
// > ArtTriggerGameObject::triggerObject @ 0x1406630df
// > ArtTriggerGameObject::triggerObject @ 0x14066335f
// > ??> @ 0x14091e848
//
// 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:16 +0000
//
__int64 __fastcall GJBaseGameLayer::updateLevelColors(_QWORD *a1)
{
__int64 ColorSprite; // rax
char v3; // al
void (__fastcall ***v4)(_QWORD, __int16 *); // rcx
__int64 v5; // rax
__int16 v6; // r15
char v7; // r12
__int64 v8; // rax
cocos2d::CCArray *v9; // rax
unsigned int v10; // esi
cocos2d::CCArray *v11; // r14
unsigned int v12; // ebx
struct cocos2d::CCObject *v13; // rax
__int64 v14; // rax
cocos2d::CCArray *v15; // rax
cocos2d::CCArray *v16; // r14
unsigned int v17; // ebx
struct cocos2d::CCObject *v18; // rax
__int64 v19; // rax
__int16 v20; // r15
char v21; // r12
__int64 v22; // rax
__int64 v23; // rcx
cocos2d::CCArray *v24; // rax
cocos2d::CCArray *v25; // r14
unsigned int v26; // ebx
struct cocos2d::CCObject *v27; // rax
__int64 v28; // rax
__int64 v29; // rcx
cocos2d::CCArray *v30; // rax
cocos2d::CCArray *v31; // r14
unsigned int v32; // ebx
struct cocos2d::CCObject *v33; // rax
__int64 v34; // rax
char v35; // al
__int64 v36; // rcx
__int64 v37; // rax
float v38; // xmm6_4
float v39; // xmm7_4
void (__fastcall ***v40)(_QWORD, __int16 *); // rcx
void (__fastcall ***v41)(_QWORD, __int16 *); // rcx
int v42; // ebx
__int64 v43; // rcx
__int64 v44; // rcx
__int64 v45; // rax
__int64 v46; // rcx
void (__fastcall ***v47)(_QWORD, __int64); // rcx
bool v48; // zf
void (__fastcall **v49)(_QWORD, __int64); // rax
__int64 result; // rax
__int64 v51; // rcx
__int64 (__fastcall ***v52)(_QWORD, __int64); // rcx
__int64 (__fastcall **v53)(_QWORD, __int64); // rax
__int64 v54; // rax
__int16 v55; // cx
char v56; // dl
__int64 v57; // rax
__int64 v58; // rcx
cocos2d::CCArray *v59; // r14
unsigned int i; // ebx
struct cocos2d::CCObject *v61; // rax
__int64 v62; // rax
__int16 v63; // cx
char v64; // dl
__int64 v65; // rax
__int64 v66; // rcx
cocos2d::CCArray *v67; // rbx
struct cocos2d::CCObject *v68; // rax
__int64 v69; // rax
__int64 v70; // r8
float v71; // xmm0_4
__int64 v72; // rax
__int64 v73; // rdx
__int64 v74; // r8
__int64 v75; // rcx
__int64 v76; // rbx
__int64 v77; // rdx
void (__fastcall ***v78)(_QWORD, __int64); // rcx
__int64 v79; // rdx
__int64 (__fastcall ***v80)(_QWORD, __int64); // rcx
__int16 v81; // [rsp+20h] [rbp-40h] BYREF
char v82; // [rsp+22h] [rbp-3Eh]
__int16 v83; // [rsp+A0h] [rbp+40h] BYREF
char v84; // [rsp+A2h] [rbp+42h]
__int16 v85; // [rsp+A8h] [rbp+48h] BYREF
char v86; // [rsp+AAh] [rbp+4Ah]
__int64 v87; // [rsp+B0h] [rbp+50h] BYREF
ColorSprite = GJEffectManager::getColorSprite(a1[301], 1000);
if ( ColorSprite )
{
v85 = *(_WORD *)(ColorSprite + 327);
v3 = *(_BYTE *)(ColorSprite + 329);
}
else
{
v85 = -1;
v3 = -1;
}
v4 = (void (__fastcall ***)(_QWORD, __int16 *))(a1[540] + 320LL);
v86 = v3;
(**v4)(v4, &v85);
v5 = GJEffectManager::getColorSprite(a1[301], 1001);
if ( v5 )
{
v6 = *(_WORD *)(v5 + 327);
v7 = *(_BYTE *)(v5 + 329);
}
else
{
v6 = -1;
v7 = -1;
}
v8 = a1[542];
LOWORD(v87) = v6;
BYTE2(v87) = v7;
v9 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(v8 + 408) + 480LL))(*(_QWORD *)(v8 + 408));
v10 = 0;
v11 = v9;
if ( v9 )
{
v12 = 0;
if ( cocos2d::CCArray::count(v9) )
{
do
{
v13 = cocos2d::CCArray::objectAtIndex(v11, v12);
(**((void (__fastcall ***)(__int64, __int64 *))v13 + 40))((__int64)v13 + 320, &v87);
++v12;
}
while ( v12 < cocos2d::CCArray::count(v11) );
}
}
v14 = a1[543];
v81 = v6;
v82 = v7;
v15 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(_QWORD))(**(_QWORD **)(v14 + 408) + 480LL))(*(_QWORD *)(v14 + 408));
v16 = v15;
if ( v15 )
{
v17 = 0;
if ( cocos2d::CCArray::count(v15) )
{
do
{
v18 = cocos2d::CCArray::objectAtIndex(v16, v17);
(**((void (__fastcall ***)(__int64, __int16 *))v18 + 40))((__int64)v18 + 320, &v81);
++v17;
}
while ( v17 < cocos2d::CCArray::count(v16) );
}
}
if ( *(_QWORD *)(a1[542] + 416LL) )
{
v19 = GJEffectManager::getColorSprite(a1[301], 1009);
if ( v19 )
{
v20 = *(_WORD *)(v19 + 327);
v21 = *(_BYTE *)(v19 + 329);
}
else
{
v20 = -1;
v21 = -1;
}
v22 = a1[542];
LOWORD(v87) = v20;
BYTE2(v87) = v21;
v23 = *(_QWORD *)(v22 + 416);
if ( v23 )
{
v24 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v23 + 480LL))(v23);
v25 = v24;
if ( v24 )
{
v26 = 0;
if ( cocos2d::CCArray::count(v24) )
{
do
{
v27 = cocos2d::CCArray::objectAtIndex(v25, v26);
(**((void (__fastcall ***)(__int64, __int64 *))v27 + 40))((__int64)v27 + 320, &v87);
++v26;
}
while ( v26 < cocos2d::CCArray::count(v25) );
}
}
}
v28 = a1[543];
v81 = v20;
v82 = v21;
v29 = *(_QWORD *)(v28 + 416);
if ( v29 )
{
v30 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v29 + 480LL))(v29);
v31 = v30;
if ( v30 )
{
v32 = 0;
if ( cocos2d::CCArray::count(v30) )
{
do
{
v33 = cocos2d::CCArray::objectAtIndex(v31, v32);
(**((void (__fastcall ***)(__int64, __int16 *))v33 + 40))((__int64)v33 + 320, &v81);
++v32;
}
while ( v32 < cocos2d::CCArray::count(v31) );
}
}
}
}
v34 = GJEffectManager::getColorSprite(a1[301], 1002);
if ( v34 )
{
v83 = *(_WORD *)(v34 + 327);
v35 = *(_BYTE *)(v34 + 329);
}
else
{
v83 = -1;
v35 = -1;
}
v36 = a1[301];
v84 = v35;
v37 = GJEffectManager::getColorSprite(v36, 1002);
v38 = 1.0;
if ( v37 )
v39 = *(float *)(v37 + 320) / 255.0;
else
v39 = 1.0;
v40 = (void (__fastcall ***)(_QWORD, __int16 *))(*(_QWORD *)(a1[542] + 432LL) + 320LL);
(**v40)(v40, &v83);
v41 = (void (__fastcall ***)(_QWORD, __int16 *))(*(_QWORD *)(a1[543] + 432LL) + 320LL);
(**v41)(v41, &v83);
v42 = (int)(float)(v39 * 255.0);
v43 = *(_QWORD *)(a1[542] + 432LL) + 320LL;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v43 + 40LL))(v43, (unsigned __int8)v42);
v44 = *(_QWORD *)(a1[543] + 432LL) + 320LL;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v44 + 40LL))(v44, (unsigned __int8)v42);
v45 = *(_QWORD *)(*(_QWORD *)(a1[301] + 736LL) + 8016LL);
if ( v45 )
LOBYTE(v45) = *(_BYTE *)(v45 + 84);
v46 = a1[542];
if ( *(_BYTE *)(v46 + 441) != (_BYTE)v45 )
{
*(_BYTE *)(v46 + 441) = v45;
v47 = (void (__fastcall ***)(_QWORD, __int64))(*(_QWORD *)(v46 + 432) + 344LL);
v48 = (_BYTE)v45 == 0;
v49 = *v47;
if ( v48 )
v87 = 0x30300000001LL;
else
v87 = 0x100000302LL;
(*v49)(v47, v87);
}
result = *(_QWORD *)(*(_QWORD *)(a1[301] + 736LL) + 8016LL);
if ( result )
result = *(unsigned __int8 *)(result + 84);
v51 = a1[543];
if ( *(_BYTE *)(v51 + 441) != (_BYTE)result )
{
*(_BYTE *)(v51 + 441) = result;
v52 = (__int64 (__fastcall ***)(_QWORD, __int64))(*(_QWORD *)(v51 + 432) + 344LL);
v48 = (_BYTE)result == 0;
v53 = *v52;
if ( v48 )
v87 = 0x30300000001LL;
else
v87 = 0x100000302LL;
result = (*v53)(v52, v87);
}
if ( a1[544] )
{
v54 = GJEffectManager::getColorSprite(a1[301], 1013);
if ( v54 )
{
v55 = *(_WORD *)(v54 + 327);
v56 = *(_BYTE *)(v54 + 329);
}
else
{
v55 = -1;
v56 = -1;
}
v57 = a1[544];
LOWORD(v87) = v55;
BYTE2(v87) = v56;
v58 = *(_QWORD *)(v57 + 408);
if ( v58 )
{
v59 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v58 + 480LL))(v58);
for ( i = 0; i < cocos2d::CCArray::count(v59); ++i )
{
v61 = cocos2d::CCArray::objectAtIndex(v59, i);
(**((void (__fastcall ***)(__int64, __int64 *))v61 + 40))((__int64)v61 + 320, &v87);
}
}
v62 = GJEffectManager::getColorSprite(a1[301], 1014);
if ( v62 )
{
v63 = *(_WORD *)(v62 + 327);
v64 = *(_BYTE *)(v62 + 329);
}
else
{
v63 = -1;
v64 = -1;
}
v65 = a1[544];
v81 = v63;
v82 = v64;
v66 = *(_QWORD *)(v65 + 416);
if ( v66 )
{
v67 = (cocos2d::CCArray *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v66 + 480LL))(v66);
if ( cocos2d::CCArray::count(v67) )
{
do
{
v68 = cocos2d::CCArray::objectAtIndex(v67, v10);
(**((void (__fastcall ***)(__int64, __int16 *))v68 + 40))((__int64)v68 + 320, &v81);
++v10;
}
while ( v10 < cocos2d::CCArray::count(v67) );
}
}
v69 = GJEffectManager::getColorSprite(a1[301], 1013);
if ( v69 )
v71 = *(float *)(v69 + 320) / 255.0;
else
v71 = 1.0;
LOBYTE(v70) = 1;
GJMGLayer::updateGroundOpacity(a1[544], (unsigned int)(int)(float)(v71 * 255.0), v70);
v72 = GJEffectManager::getColorSprite(a1[301], 1014);
if ( v72 )
v38 = *(float *)(v72 + 320) / 255.0;
GJMGLayer::updateGroundOpacity(a1[544], (unsigned int)(int)(float)(v38 * 255.0), 0);
v73 = a1[301];
v74 = *(_QWORD *)(*(_QWORD *)(v73 + 736) + 8104LL);
if ( v74 )
LOBYTE(v74) = *(_BYTE *)(v74 + 84);
v75 = a1[544];
v76 = 0x100000302LL;
if ( *(_BYTE *)(v75 + 457) != (_BYTE)v74 )
{
*(_BYTE *)(v75 + 457) = v74;
v77 = 0x100000302LL;
v78 = (void (__fastcall ***)(_QWORD, __int64))(*(_QWORD *)(v75 + 464) + 320LL);
if ( !(_BYTE)v74 )
v77 = 0x30300000001LL;
(**v78)(v78, v77);
v75 = a1[544];
v73 = a1[301];
}
result = *(_QWORD *)(v73 + 736);
v79 = *(_QWORD *)(result + 8112);
if ( v79 )
LOBYTE(v79) = *(_BYTE *)(v79 + 84);
if ( *(_BYTE *)(v75 + 458) != (_BYTE)v79 )
{
*(_BYTE *)(v75 + 458) = v79;
v80 = (__int64 (__fastcall ***)(_QWORD, __int64))(*(_QWORD *)(v75 + 472) + 320LL);
if ( !(_BYTE)v79 )
v76 = 0x30300000001LL;
return (**v80)(v80, v76);
}
}
return result;
}