//
// GJBaseGameLayer::updateLevelColors from 0x14020c490 to 0x14020cc14 (1924 bytes)
//
// 13 xrefs:
// > GameManager::finishedLoadingBGAsync @ 0x140182998
// > GameManager::finishedLoadingMGAsync @ 0x140182bc2
// > GameManager::finishedLoadingGAsync @ 0x140182e25
// > LevelEditorLayer::updateGameObjects @ 0x1402dcda0
// > LevelEditorLayer::onPlaytest @ 0x1402e0529
// > LevelEditorLayer::postUpdate @ 0x1402e0fd7
// > PlayLayer::setupHasCompleted @ 0x1403a73c8
// > PlayLayer::setupHasCompleted @ 0x1403a7779
// > PlayLayer::postUpdate @ 0x1403b4bdb
// > PlayLayer::resetLevel @ 0x1403b97bc
// > ArtTriggerGameObject::triggerObject @ 0x1404c24ab
// > ArtTriggerGameObject::triggerObject @ 0x1404c2729
// > ??> @ 0x1406ccd68
//
// 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
//
void GJBaseGameLayer::updateLevelColors(GJBaseGameLayer *a1)
{
ColorActionSprite *ColorSprite; // rax
char b; // al
cocos2d::CCRGBAProtocol *v4; // rcx
ColorActionSprite *v5; // rax
__int16 v6; // r15
char v7; // r12
GJGroundLayer *m_groundLayer; // rax
cocos2d::CCArray *v9; // rax
unsigned int v10; // esi
cocos2d::CCArray *v11; // r14
unsigned int v12; // ebx
struct cocos2d::CCObject *v13; // rax
GJGroundLayer *m_groundLayer2; // rax
cocos2d::CCArray *v15; // rax
cocos2d::CCArray *v16; // r14
unsigned int v17; // ebx
struct cocos2d::CCObject *v18; // rax
ColorActionSprite *v19; // rax
__int16 v20; // r15
char v21; // r12
GJGroundLayer *v22; // rax
cocos2d::CCSprite *m_ground2Sprite; // rcx
cocos2d::CCArray *v24; // rax
cocos2d::CCArray *v25; // r14
unsigned int v26; // ebx
struct cocos2d::CCObject *v27; // rax
GJGroundLayer *v28; // rax
cocos2d::CCSprite *v29; // rcx
cocos2d::CCArray *v30; // rax
cocos2d::CCArray *v31; // r14
unsigned int v32; // ebx
struct cocos2d::CCObject *v33; // rax
ColorActionSprite *v34; // rax
char v35; // al
GJEffectManager *m_effectManager; // rcx
ColorActionSprite *v37; // rax
float v38; // xmm7_4
float v39; // xmm6_4
cocos2d::CCRGBAProtocol *v40; // rcx
cocos2d::CCRGBAProtocol *v41; // rcx
int v42; // ebx
cocos2d::CCRGBAProtocol *v43; // rcx
cocos2d::CCRGBAProtocol *v44; // rcx
__int64 v45; // rax
GJGroundLayer *v46; // rcx
cocos2d::CCTextureProtocol *v47; // rcx
bool v48; // zf
cocos2d::CCTextureProtocol_vtbl *v49; // rax
__int64 v50; // rax
GJGroundLayer *v51; // rcx
cocos2d::CCTextureProtocol *v52; // rcx
cocos2d::CCTextureProtocol_vtbl *v53; // rax
ColorActionSprite *v54; // rax
__int16 v55; // cx
char v56; // dl
GJMGLayer *m_middleground; // rax
cocos2d::CCSprite *m_ground1Sprite; // rcx
cocos2d::CCArray *v59; // r14
unsigned int i; // ebx
struct cocos2d::CCObject *v61; // rax
ColorActionSprite *v62; // rax
__int16 v63; // cx
char v64; // dl
GJMGLayer *v65; // rax
cocos2d::CCSprite *v66; // rcx
cocos2d::CCArray *v67; // r14
unsigned int j; // ebx
struct cocos2d::CCObject *v69; // rax
ColorActionSprite *v70; // rax
float v71; // xmm6_4
cocos2d::CCSprite *v72; // rcx
cocos2d::CCArray *v73; // r14
unsigned int k; // ebx
struct cocos2d::CCObject *v75; // rax
ColorActionSprite *v76; // rax
cocos2d::CCSprite *v77; // rcx
cocos2d::CCArray *v78; // rbx
struct cocos2d::CCObject *v79; // rax
GJEffectManager *v80; // rdx
__int64 v81; // r8
GJMGLayer *v82; // rcx
__int64 v83; // rbx
__int64 v84; // rdx
cocos2d::CCTextureProtocol *v85; // rcx
__int64 v86; // rdx
cocos2d::CCTextureProtocol *v87; // rcx
__int16 v88; // [rsp+20h] [rbp-40h] BYREF
char v89; // [rsp+22h] [rbp-3Eh]
__int16 v90; // [rsp+A0h] [rbp+40h] BYREF
char v91; // [rsp+A2h] [rbp+42h]
__int16 v92; // [rsp+A8h] [rbp+48h] BYREF
char v93; // [rsp+AAh] [rbp+4Ah]
__int64 v94; // [rsp+B0h] [rbp+50h] BYREF
ColorSprite = GJEffectManager::getColorSprite(a1->m_effectManager, 1000);
if ( ColorSprite )
{
v92 = *(_WORD *)&ColorSprite->m_copyColor.r;
b = ColorSprite->m_copyColor.b;
}
else
{
v92 = -1;
b = -1;
}
v4 = &a1->m_background->cocos2d::CCRGBAProtocol;
v93 = b;
v4->setColor(v4, (const cocos2d::ccColor3B *)&v92);
v5 = GJEffectManager::getColorSprite(a1->m_effectManager, 1001);
if ( v5 )
{
v6 = *(_WORD *)&v5->m_copyColor.r;
v7 = v5->m_copyColor.b;
}
else
{
v6 = -1;
v7 = -1;
}
m_groundLayer = a1->m_groundLayer;
LOWORD(v94) = v6;
BYTE2(v94) = v7;
v9 = m_groundLayer->m_ground1Sprite->getChildren(m_groundLayer->m_ground1Sprite);
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[5].m_unknown2)((__int64)&v13[5].m_unknown2, &v94);
++v12;
}
while ( v12 < cocos2d::CCArray::count(v11) );
}
}
m_groundLayer2 = a1->m_groundLayer2;
v88 = v6;
v89 = v7;
v15 = m_groundLayer2->m_ground1Sprite->getChildren(m_groundLayer2->m_ground1Sprite);
v16 = v15;
if ( v15 )
{
v17 = 0;
if ( cocos2d::CCArray::count(v15) )
{
do
{
v18 = cocos2d::CCArray::objectAtIndex(v16, v17);
(**(void (__fastcall ***)(__int64, __int16 *))&v18[5].m_unknown2)((__int64)&v18[5].m_unknown2, &v88);
++v17;
}
while ( v17 < cocos2d::CCArray::count(v16) );
}
}
if ( a1->m_groundLayer->m_ground2Sprite )
{
v19 = GJEffectManager::getColorSprite(a1->m_effectManager, 1009);
if ( v19 )
{
v20 = *(_WORD *)&v19->m_copyColor.r;
v21 = v19->m_copyColor.b;
}
else
{
v20 = -1;
v21 = -1;
}
v22 = a1->m_groundLayer;
LOWORD(v94) = v20;
BYTE2(v94) = v21;
m_ground2Sprite = v22->m_ground2Sprite;
if ( m_ground2Sprite )
{
v24 = m_ground2Sprite->getChildren(m_ground2Sprite);
v25 = v24;
if ( v24 )
{
v26 = 0;
if ( cocos2d::CCArray::count(v24) )
{
do
{
v27 = cocos2d::CCArray::objectAtIndex(v25, v26);
(**(void (__fastcall ***)(__int64, __int64 *))&v27[5].m_unknown2)((__int64)&v27[5].m_unknown2, &v94);
++v26;
}
while ( v26 < cocos2d::CCArray::count(v25) );
}
}
}
v28 = a1->m_groundLayer2;
v88 = v20;
v89 = v21;
v29 = v28->m_ground2Sprite;
if ( v29 )
{
v30 = v29->getChildren(v29);
v31 = v30;
if ( v30 )
{
v32 = 0;
if ( cocos2d::CCArray::count(v30) )
{
do
{
v33 = cocos2d::CCArray::objectAtIndex(v31, v32);
(**(void (__fastcall ***)(__int64, __int16 *))&v33[5].m_unknown2)((__int64)&v33[5].m_unknown2, &v88);
++v32;
}
while ( v32 < cocos2d::CCArray::count(v31) );
}
}
}
}
v34 = GJEffectManager::getColorSprite(a1->m_effectManager, 1002);
if ( v34 )
{
v90 = *(_WORD *)&v34->m_copyColor.r;
v35 = v34->m_copyColor.b;
}
else
{
v90 = -1;
v35 = -1;
}
m_effectManager = a1->m_effectManager;
v91 = v35;
v37 = GJEffectManager::getColorSprite(m_effectManager, 1002);
v38 = 1.0;
if ( v37 )
v39 = v37->m_opacity / 255.0;
else
v39 = 1.0;
v40 = &a1->m_groundLayer->m_lineSprite->cocos2d::CCRGBAProtocol;
v40->setColor(v40, (const cocos2d::ccColor3B *)&v90);
v41 = &a1->m_groundLayer2->m_lineSprite->cocos2d::CCRGBAProtocol;
v41->setColor(v41, (const cocos2d::ccColor3B *)&v90);
v42 = (int)(float)(v39 * 255.0);
v43 = &a1->m_groundLayer->m_lineSprite->cocos2d::CCRGBAProtocol;
v43->setOpacity(v43, v42);
v44 = &a1->m_groundLayer2->m_lineSprite->cocos2d::CCRGBAProtocol;
v44->setOpacity(v44, v42);
v45 = *((_QWORD *)a1->m_effectManager->m_colorActionVector._Mypair._Myval2._Myfirst + 1002);
if ( v45 )
LOBYTE(v45) = *(_BYTE *)(v45 + 84);
v46 = a1->m_groundLayer;
if ( v46->m_blendLine != (_BYTE)v45 )
{
v46->m_blendLine = v45;
v47 = &v46->m_lineSprite->cocos2d::CCTextureProtocol;
v48 = (_BYTE)v45 == 0;
v49 = v47->__vftable;
if ( v48 )
v94 = 0x30300000001LL;
else
v94 = 0x100000302LL;
((void (__fastcall *)(cocos2d::CCTextureProtocol *, __int64))v49->setBlendFunc)(v47, v94);
}
v50 = *((_QWORD *)a1->m_effectManager->m_colorActionVector._Mypair._Myval2._Myfirst + 1002);
if ( v50 )
LOBYTE(v50) = *(_BYTE *)(v50 + 84);
v51 = a1->m_groundLayer2;
if ( v51->m_blendLine != (_BYTE)v50 )
{
v51->m_blendLine = v50;
v52 = &v51->m_lineSprite->cocos2d::CCTextureProtocol;
v48 = (_BYTE)v50 == 0;
v53 = v52->__vftable;
if ( v48 )
v94 = 0x30300000001LL;
else
v94 = 0x100000302LL;
((void (__fastcall *)(cocos2d::CCTextureProtocol *, __int64))v53->setBlendFunc)(v52, v94);
}
if ( a1->m_middleground )
{
v54 = GJEffectManager::getColorSprite(a1->m_effectManager, 1013);
if ( v54 )
{
v55 = *(_WORD *)&v54->m_copyColor.r;
v56 = v54->m_copyColor.b;
}
else
{
v55 = -1;
v56 = -1;
}
m_middleground = a1->m_middleground;
LOWORD(v94) = v55;
BYTE2(v94) = v56;
m_ground1Sprite = m_middleground->m_ground1Sprite;
if ( m_ground1Sprite )
{
v59 = m_ground1Sprite->getChildren(m_ground1Sprite);
for ( i = 0; i < cocos2d::CCArray::count(v59); ++i )
{
v61 = cocos2d::CCArray::objectAtIndex(v59, i);
(**(void (__fastcall ***)(__int64, __int64 *))&v61[5].m_unknown2)((__int64)&v61[5].m_unknown2, &v94);
}
}
v62 = GJEffectManager::getColorSprite(a1->m_effectManager, 1014);
if ( v62 )
{
v63 = *(_WORD *)&v62->m_copyColor.r;
v64 = v62->m_copyColor.b;
}
else
{
v63 = -1;
v64 = -1;
}
v65 = a1->m_middleground;
LOWORD(v94) = v63;
BYTE2(v94) = v64;
v66 = v65->m_ground2Sprite;
if ( v66 )
{
v67 = v66->getChildren(v66);
for ( j = 0; j < cocos2d::CCArray::count(v67); ++j )
{
v69 = cocos2d::CCArray::objectAtIndex(v67, j);
(**(void (__fastcall ***)(__int64, __int64 *))&v69[5].m_unknown2)((__int64)&v69[5].m_unknown2, &v94);
}
}
v70 = GJEffectManager::getColorSprite(a1->m_effectManager, 1013);
if ( v70 )
v71 = v70->m_opacity / 255.0;
else
v71 = 1.0;
v72 = a1->m_middleground->m_ground1Sprite;
if ( v72 )
{
v73 = v72->getChildren(v72);
for ( k = 0; k < cocos2d::CCArray::count(v73); ++k )
{
v75 = cocos2d::CCArray::objectAtIndex(v73, k);
(*(void (__fastcall **)(int *, _QWORD))(*(_QWORD *)&v75[5].m_unknown2 + 40LL))(
&v75[5].m_unknown2,
(unsigned __int8)(int)(float)(v71 * 255.0));
}
}
v76 = GJEffectManager::getColorSprite(a1->m_effectManager, 1014);
if ( v76 )
v38 = v76->m_opacity / 255.0;
v77 = a1->m_middleground->m_ground2Sprite;
if ( v77 )
{
v78 = v77->getChildren(v77);
if ( cocos2d::CCArray::count(v78) )
{
do
{
v79 = cocos2d::CCArray::objectAtIndex(v78, v10);
(*(void (__fastcall **)(int *, _QWORD))(*(_QWORD *)&v79[5].m_unknown2 + 40LL))(
&v79[5].m_unknown2,
(unsigned __int8)(int)(float)(v38 * 255.0));
++v10;
}
while ( v10 < cocos2d::CCArray::count(v78) );
}
}
v80 = a1->m_effectManager;
v81 = *((_QWORD *)v80->m_colorActionVector._Mypair._Myval2._Myfirst + 1013);
if ( v81 )
LOBYTE(v81) = *(_BYTE *)(v81 + 84);
v82 = a1->m_middleground;
v83 = 0x100000302LL;
if ( v82->m_blendMG1 != (_BYTE)v81 )
{
v82->m_blendMG1 = v81;
v84 = 0x100000302LL;
v85 = &v82->m_mg1BatchNode->cocos2d::CCTextureProtocol;
if ( !(_BYTE)v81 )
v84 = 0x30300000001LL;
((void (__fastcall *)(cocos2d::CCTextureProtocol *, __int64))v85->setBlendFunc)(v85, v84);
v80 = a1->m_effectManager;
v82 = a1->m_middleground;
}
v86 = *((_QWORD *)v80->m_colorActionVector._Mypair._Myval2._Myfirst + 1014);
if ( v86 )
LOBYTE(v86) = *(_BYTE *)(v86 + 84);
if ( v82->m_blendMG2 != (_BYTE)v86 )
{
v82->m_blendMG2 = v86;
v87 = &v82->m_mg2BatchNode->cocos2d::CCTextureProtocol;
if ( !(_BYTE)v86 )
v83 = 0x30300000001LL;
((void (__fastcall *)(cocos2d::CCTextureProtocol *, __int64))v87->setBlendFunc)(v87, v83);
}
}
}