//
// GJBaseGameLayer::visitWithColorFlash from 0x1402482c0 to 0x14024887e (1470 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::visit @ 0x140247ff9
// > ??> @ 0x1406ce784
//
// 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::visitWithColorFlash(GJBaseGameLayer *a1)
{
ColorActionSprite *ColorSprite; // rax
GLubyte b; // al
GJEffectManager *m_effectManager; // rcx
ColorActionSprite *v5; // rax
__int16 v6; // r12
GLubyte v7; // r15
GJEffectManager *v8; // rcx
ColorActionSprite *v9; // rax
__int16 v10; // di
GLubyte v11; // bl
cocos2d::CCRGBAProtocol *v12; // rcx
cocos2d::CCArray *v13; // rax
unsigned int v14; // ebx
cocos2d::CCArray *v15; // rsi
unsigned int v16; // edi
struct cocos2d::CCObject *v17; // rax
cocos2d::CCArray *v18; // rax
cocos2d::CCArray *v19; // rsi
unsigned int v20; // edi
struct cocos2d::CCObject *v21; // rax
__int16 *v22; // r13
cocos2d::CCSprite *m_ground2Sprite; // rcx
cocos2d::CCArray *v24; // rax
cocos2d::CCArray *v25; // rsi
unsigned int v26; // edi
struct cocos2d::CCObject *v27; // rax
cocos2d::CCSprite *v28; // rcx
cocos2d::CCArray *v29; // rax
cocos2d::CCArray *v30; // rsi
unsigned int v31; // edi
struct cocos2d::CCObject *v32; // rax
GJGroundLayer *m_groundLayer; // rax
cocos2d::CCArray *v34; // rax
cocos2d::CCArray *v35; // rsi
unsigned int v36; // edi
struct cocos2d::CCObject *v37; // rax
GJGroundLayer *m_groundLayer2; // rax
cocos2d::CCArray *v39; // rax
cocos2d::CCArray *v40; // rsi
unsigned int v41; // edi
struct cocos2d::CCObject *v42; // rax
GJGroundLayer *v43; // rax
cocos2d::CCSprite *v44; // rcx
cocos2d::CCArray *v45; // rax
cocos2d::CCArray *v46; // rsi
unsigned int v47; // edi
struct cocos2d::CCObject *v48; // rax
GJGroundLayer *v49; // rax
cocos2d::CCSprite *v50; // rcx
cocos2d::CCArray *v51; // rax
cocos2d::CCArray *v52; // rdi
struct cocos2d::CCObject *v53; // rax
cocos2d::ccColor3B v54[5]; // [rsp+20h] [rbp-A9h] BYREF
cocos2d::ccColor3B v55[5]; // [rsp+30h] [rbp-99h] BYREF
cocos2d::ccHSVValue v56; // [rsp+40h] [rbp-89h] BYREF
cocos2d::ccColor3B v57; // [rsp+50h] [rbp-79h] BYREF
cocos2d::ccColor3B v58; // [rsp+60h] [rbp-69h] BYREF
__int16 v59; // [rsp+70h] [rbp-59h] BYREF
char v60; // [rsp+72h] [rbp-57h]
__int16 v61; // [rsp+80h] [rbp-49h] BYREF
char v62; // [rsp+82h] [rbp-47h]
__int16 v63; // [rsp+90h] [rbp-39h] BYREF
GLubyte v64; // [rsp+92h] [rbp-37h]
__int16 v65; // [rsp+A0h] [rbp-29h] BYREF
GLubyte v66; // [rsp+A2h] [rbp-27h]
__int16 v67; // [rsp+B0h] [rbp-19h] BYREF
GLubyte v68; // [rsp+B2h] [rbp-17h]
__int16 v69; // [rsp+C0h] [rbp-9h] BYREF
GLubyte v70; // [rsp+C2h] [rbp-7h]
int v71; // [rsp+DCh] [rbp+13h]
GLubyte v72; // [rsp+130h] [rbp+67h]
__int16 v73; // [rsp+138h] [rbp+6Fh]
cocos2d::ccColor3B v74; // [rsp+140h] [rbp+77h] BYREF
cocos2d::ccColor3B v75; // [rsp+148h] [rbp+7Fh] BYREF
ColorSprite = GJEffectManager::getColorSprite(a1->m_effectManager, 1000);
if ( ColorSprite )
{
*(_WORD *)&v55[0].r = *(_WORD *)&ColorSprite->m_copyColor.r;
b = ColorSprite->m_copyColor.b;
}
else
{
*(_WORD *)&v55[0].r = -1;
b = -1;
}
m_effectManager = a1->m_effectManager;
v55[0].b = b;
v5 = GJEffectManager::getColorSprite(m_effectManager, 1001);
if ( v5 )
{
v6 = *(_WORD *)&v5->m_copyColor.r;
v7 = v5->m_copyColor.b;
}
else
{
v6 = -1;
v7 = -1;
}
v8 = a1->m_effectManager;
v74.b = v7;
*(_WORD *)&v74.r = v6;
v9 = GJEffectManager::getColorSprite(v8, 1009);
if ( v9 )
{
v10 = *(_WORD *)&v9->m_copyColor.r;
v11 = v9->m_copyColor.b;
}
else
{
v10 = -1;
v11 = -1;
}
LOWORD(v71) = 257;
*(_DWORD *)&v56.absoluteSaturation = v71;
v75.b = v11;
v72 = v11;
*(_WORD *)&v75.r = v10;
v73 = v10;
*(_QWORD *)&v56.h = 0xBE4CCCCD00000000uLL;
v56.v = 0.2;
GameToolbox::transformColor(v54, v55, &v56);
v57 = v54[0];
if ( (_BYTE)v6 || v74.g || v7 )
{
LOWORD(v71) = 257;
*(_DWORD *)&v56.absoluteSaturation = v71;
*(_QWORD *)&v56.h = 0xBE4CCCCD00000000uLL;
v56.v = 0.2;
GameToolbox::transformColor(v54, &v74, &v56);
v74 = v54[0];
}
else
{
*(_WORD *)&v74.r = v6;
v74.b = 0;
}
if ( (_BYTE)v10 || v75.g || v11 )
{
LOWORD(v71) = 257;
*(_DWORD *)&v56.absoluteSaturation = v71;
*(_QWORD *)&v56.h = 0xBE4CCCCD00000000uLL;
v56.v = 0.2;
GameToolbox::transformColor(v54, &v75, &v56);
v75 = v54[0];
}
else
{
*(_WORD *)&v75.r = v10;
v75.b = 0;
}
v12 = &a1->m_background->cocos2d::CCRGBAProtocol;
*(_QWORD *)&v56.h = &v75;
v12->setColor(v12, &v57);
v54[0] = v74;
v13 = a1->m_groundLayer->m_ground1Sprite->getChildren(a1->m_groundLayer->m_ground1Sprite);
v14 = 0;
v15 = v13;
if ( v13 )
{
v16 = 0;
if ( cocos2d::CCArray::count(v13) )
{
do
{
v17 = cocos2d::CCArray::objectAtIndex(v15, v16);
(**(void (__fastcall ***)(__int64, cocos2d::ccColor3B *))&v17[5].m_unknown2)((__int64)&v17[5].m_unknown2, v54);
++v16;
}
while ( v16 < cocos2d::CCArray::count(v15) );
}
}
v58 = v74;
v18 = a1->m_groundLayer2->m_ground1Sprite->getChildren(a1->m_groundLayer2->m_ground1Sprite);
v19 = v18;
if ( v18 )
{
v20 = 0;
if ( cocos2d::CCArray::count(v18) )
{
do
{
v21 = cocos2d::CCArray::objectAtIndex(v19, v20);
(**(void (__fastcall ***)(__int64, cocos2d::ccColor3B *))&v21[5].m_unknown2)((__int64)&v21[5].m_unknown2, &v58);
++v20;
}
while ( v20 < cocos2d::CCArray::count(v19) );
}
}
v22 = *(__int16 **)&v56.h;
v59 = **(_WORD **)&v56.h;
v60 = *(_BYTE *)(*(_QWORD *)&v56.h + 2LL);
m_ground2Sprite = a1->m_groundLayer->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, __int16 *))&v27[5].m_unknown2)((__int64)&v27[5].m_unknown2, &v59);
++v26;
}
while ( v26 < cocos2d::CCArray::count(v25) );
}
}
}
v61 = *v22;
v62 = *((_BYTE *)v22 + 2);
v28 = a1->m_groundLayer2->m_ground2Sprite;
if ( v28 )
{
v29 = v28->getChildren(v28);
v30 = v29;
if ( v29 )
{
v31 = 0;
if ( cocos2d::CCArray::count(v29) )
{
do
{
v32 = cocos2d::CCArray::objectAtIndex(v30, v31);
(**(void (__fastcall ***)(__int64, __int16 *))&v32[5].m_unknown2)((__int64)&v32[5].m_unknown2, &v61);
++v31;
}
while ( v31 < cocos2d::CCArray::count(v30) );
}
}
}
cocos2d::CCNode::visit(a1);
a1->m_background->setColor(&a1->m_background->cocos2d::CCRGBAProtocol, v55);
m_groundLayer = a1->m_groundLayer;
v63 = v6;
v64 = v7;
v34 = m_groundLayer->m_ground1Sprite->getChildren(m_groundLayer->m_ground1Sprite);
v35 = v34;
if ( v34 )
{
v36 = 0;
if ( cocos2d::CCArray::count(v34) )
{
do
{
v37 = cocos2d::CCArray::objectAtIndex(v35, v36);
(**(void (__fastcall ***)(__int64, __int16 *))&v37[5].m_unknown2)((__int64)&v37[5].m_unknown2, &v63);
++v36;
}
while ( v36 < cocos2d::CCArray::count(v35) );
}
}
m_groundLayer2 = a1->m_groundLayer2;
v65 = v6;
v66 = v7;
v39 = m_groundLayer2->m_ground1Sprite->getChildren(m_groundLayer2->m_ground1Sprite);
v40 = v39;
if ( v39 )
{
v41 = 0;
if ( cocos2d::CCArray::count(v39) )
{
do
{
v42 = cocos2d::CCArray::objectAtIndex(v40, v41);
(**(void (__fastcall ***)(__int64, __int16 *))&v42[5].m_unknown2)((__int64)&v42[5].m_unknown2, &v65);
++v41;
}
while ( v41 < cocos2d::CCArray::count(v40) );
}
}
v43 = a1->m_groundLayer;
v67 = v73;
v68 = v72;
v44 = v43->m_ground2Sprite;
if ( v44 )
{
v45 = v44->getChildren(v44);
v46 = v45;
if ( v45 )
{
v47 = 0;
if ( cocos2d::CCArray::count(v45) )
{
do
{
v48 = cocos2d::CCArray::objectAtIndex(v46, v47);
(**(void (__fastcall ***)(__int64, __int16 *))&v48[5].m_unknown2)((__int64)&v48[5].m_unknown2, &v67);
++v47;
}
while ( v47 < cocos2d::CCArray::count(v46) );
}
}
}
v49 = a1->m_groundLayer2;
v69 = v73;
v70 = v72;
v50 = v49->m_ground2Sprite;
if ( v50 )
{
v51 = v50->getChildren(v50);
v52 = v51;
if ( v51 )
{
if ( cocos2d::CCArray::count(v51) )
{
do
{
v53 = cocos2d::CCArray::objectAtIndex(v52, v14);
(**(void (__fastcall ***)(__int64, __int16 *))&v53[5].m_unknown2)((__int64)&v53[5].m_unknown2, &v69);
++v14;
}
while ( v14 < cocos2d::CCArray::count(v52) );
}
}
}
}