//
// GJBaseGameLayer::processAreaTintGroupAction from 0x14022aba0 to 0x14022b5c7 (2599 bytes)
//
// 4 xrefs:
// > GJBaseGameLayer::processAreaEffects @ 0x140228c16
// > ??> @ 0x140680828
// > ??> @ 0x140680870
// > ??> @ 0x1406cdb48
//
// 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::processAreaTintGroupAction(
GJBaseGameLayer *a1,
cocos2d::CCArray *a2,
EnterEffectInstance *a3,
cocos2d::CCPoint a4,
bool a5)
{
EnterEffectObject *m_gameObject; // rdi
EnterEffectInstance *v7; // r15
int m_tintChannelID; // edx
ColorActionSprite *ColorSprite; // rax
__int16 v10; // si
unsigned __int8 b; // r14
bool m_pulseMainOnly; // r12
bool m_pulseDetailOnly; // r13
unsigned int v14; // eax
GJBaseGameLayer *v15; // r10
int v16; // edx
unsigned int v17; // r8d
cocos2d::ccArray *v18; // r14
__int64 v19; // rax
GameObject **v20; // r14
GameObject **v21; // r15
bool v22; // r12
GameObject *v23; // rbx
EnterEffectInstance *v24; // rdi
float v25; // xmm0_4
__m128 m_hsvValue; // xmm1
float v27; // xmm2_4
float v28; // xmm4_4
float v29; // xmm5_4
float v30; // xmm3_4
float v31; // xmm0_4
float v32; // xmm1_4
cocos2d::ccHSVValue v33; // xmm6
const cocos2d::ccColor3B *v34; // rax
cocos2d::CCSprite *v35; // rcx
const cocos2d::ccColor3B *v36; // rax
__int64 v37; // rbx
cocos2d::CCDictionary *v38; // rax
cocos2d::CCArray *v39; // rbx
cocos2d::ccArray *v40; // rdi
__int64 v41; // rax
cocos2d::CCObject **v42; // rdi
cocos2d::CCObject **v43; // rsi
cocos2d::ccHSVValue v44; // xmm6
bool v45; // r12
cocos2d::CCObject *v46; // rbx
const cocos2d::ccColor3B *v47; // rax
cocos2d::CCObject_vtbl *v48; // rcx
const cocos2d::ccColor3B *v49; // rax
cocos2d::ccArray *data; // rax
__int64 num; // rcx
GameObject **arr; // rbx
unsigned __int8 v53; // di
unsigned __int64 v54; // rax
GameObject *v55; // rbx
float AreaObjectValue; // xmm0_4
float v57; // xmm8_4
__int64 v58; // rcx
float v59; // xmm2_4
__int16 v60; // ax
int v61; // r9d
__int16 v62; // ax
int v63; // edx
GameObject_vtbl *v64; // rax
cocos2d::CCSprite *m_colorSprite; // rcx
__int64 v66; // rcx
float v67; // xmm2_4
__int16 v68; // ax
int v69; // r9d
__int16 v70; // ax
int v71; // edx
GameObject_vtbl *v72; // rax
__int64 m_uniqueID; // rbx
cocos2d::CCDictionary *v74; // rax
cocos2d::CCArray *v75; // rdi
cocos2d::ccArray *v76; // rdi
__int64 v77; // rax
cocos2d::CCObject **v78; // rdi
cocos2d::CCObject **v79; // r15
cocos2d::CCObject *v80; // rbx
__int64 v81; // rcx
float v82; // xmm2_4
__int16 v83; // ax
int v84; // r9d
__int16 v85; // ax
int v86; // edx
cocos2d::CCObject_vtbl *v87; // rax
cocos2d::CCObject_vtbl *v88; // rcx
__int64 v89; // rcx
float v90; // xmm2_4
__int16 v91; // ax
int v92; // r9d
__int16 v93; // ax
int v94; // edx
cocos2d::CCObject_vtbl *v95; // rax
unsigned int v96; // [rsp+30h] [rbp-D0h]
int v97; // [rsp+34h] [rbp-CCh]
int v98; // [rsp+34h] [rbp-CCh]
bool v99[4]; // [rsp+38h] [rbp-C8h] BYREF
__int16 v100; // [rsp+3Ch] [rbp-C4h]
bool v101; // [rsp+40h] [rbp-C0h]
cocos2d::ccColor3B v102; // [rsp+42h] [rbp-BEh] BYREF
cocos2d::ccColor3B v103; // [rsp+46h] [rbp-BAh] BYREF
cocos2d::ccColor3B v104; // [rsp+4Ah] [rbp-B6h] BYREF
cocos2d::ccColor3B v105; // [rsp+4Eh] [rbp-B2h] BYREF
GJBaseGameLayer *v106; // [rsp+58h] [rbp-A8h]
__int16 v107; // [rsp+60h] [rbp-A0h] BYREF
char v108; // [rsp+62h] [rbp-9Eh]
__int16 v109; // [rsp+63h] [rbp-9Dh] BYREF
char v110; // [rsp+65h] [rbp-9Bh]
__int16 v111; // [rsp+66h] [rbp-9Ah] BYREF
char v112; // [rsp+68h] [rbp-98h]
__int16 v113; // [rsp+69h] [rbp-97h] BYREF
char v114; // [rsp+6Bh] [rbp-95h]
cocos2d::ccColor3B v115; // [rsp+70h] [rbp-90h] BYREF
cocos2d::ccColor3B v116; // [rsp+80h] [rbp-80h] BYREF
cocos2d::ccColor3B v117; // [rsp+90h] [rbp-70h] BYREF
cocos2d::ccColor3B v118; // [rsp+A0h] [rbp-60h] BYREF
GameObject **v119; // [rsp+B0h] [rbp-50h]
float v120; // [rsp+BCh] [rbp-44h]
cocos2d::ccHSVValue v121; // [rsp+C0h] [rbp-40h]
EnterEffectInstance *v122; // [rsp+D0h] [rbp-30h]
cocos2d::ccHSVValue v123; // [rsp+E0h] [rbp-20h] BYREF
cocos2d::CCPoint *v124; // [rsp+F0h] [rbp-10h]
m_gameObject = a3->m_gameObject;
v124 = (cocos2d::CCPoint *)a4;
v7 = a3;
v122 = a3;
v106 = a1;
m_tintChannelID = m_gameObject->m_tintChannelID;
if ( m_tintChannelID )
{
if ( m_tintChannelID == 1010 )
{
v10 = 0;
b = 0;
goto LABEL_8;
}
if ( m_tintChannelID != 1011 )
{
ColorSprite = GJEffectManager::getColorSprite(a1->m_effectManager, m_tintChannelID);
if ( ColorSprite )
{
v10 = *(_WORD *)&ColorSprite->m_copyColor.r;
b = ColorSprite->m_copyColor.b;
goto LABEL_8;
}
}
}
b = -1;
v10 = -1;
LABEL_8:
m_pulseMainOnly = m_gameObject->m_pulseMainOnly;
m_pulseDetailOnly = m_gameObject->m_pulseDetailOnly;
v101 = m_pulseMainOnly;
v100 = v10;
v14 = cocos2d::CCArray::count(a2);
v15 = v106;
v16 = 0;
v17 = 0;
v96 = 0;
v106->m_areaColorCount += v14;
if ( !a2 )
goto LABEL_100;
if ( !m_gameObject->m_hsvEnabled )
{
data = a2->data;
num = data->num;
if ( !(_DWORD)num )
goto LABEL_100;
arr = (GameObject **)data->arr;
*(_QWORD *)&v121.h = arr;
v119 = &arr[num - 1];
if ( arr > v119 )
goto LABEL_100;
v53 = HIBYTE(v100);
v54 = (unsigned __int64)v119;
while ( 1 )
{
v55 = *arr;
if ( !v55 )
{
v17 = v96;
goto LABEL_100;
}
if ( !v55->m_isActivated )
goto LABEL_69;
v99[0] = 0;
v98 = v16 + 1;
AreaObjectValue = GJBaseGameLayer::getAreaObjectValue(v15, v7, v55, v124, v99);
if ( AreaObjectValue >= 1.0 )
goto LABEL_68;
v57 = (float)(v7->m_tint * AreaObjectValue) + (float)(1.0 - v7->m_tint);
if ( !a5 )
break;
m_uniqueID = v55->m_uniqueID;
v74 = (cocos2d::CCDictionary *)cocos2d::CCArray::objectAtIndex(
v106->m_targetGroupsArray,
v7->m_targetGroupIndex + 1);
v75 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v74, m_uniqueID);
v17 = cocos2d::CCArray::count(v75) + v96 - 1;
v96 = v17;
if ( v75 )
{
v76 = v75->data;
v77 = v76->num;
if ( (_DWORD)v77 )
{
v78 = v76->arr;
v79 = &v78[v77 - 1];
if ( v78 > v79 )
{
v53 = HIBYTE(v100);
v15 = v106;
v7 = v122;
v54 = (unsigned __int64)v119;
v16 = v98;
goto LABEL_70;
}
while ( 2 )
{
v80 = *v78;
if ( !*v78 )
{
LABEL_94:
v53 = HIBYTE(v100);
v7 = v122;
goto LABEL_68;
}
if ( !m_pulseDetailOnly )
{
v81 = (*(__int64 (__fastcall **)(int *))(*(_QWORD *)&v80[5].m_unknown2 + 8LL))(&v80[5].m_unknown2);
v82 = fminf(1.0, v57);
v83 = *(_WORD *)v81;
v84 = *(unsigned __int8 *)(v81 + 2);
*(_WORD *)&v117.r = *(_WORD *)v81;
if ( v82 <= 0.0 )
{
v85 = v10;
LOBYTE(v86) = b;
LABEL_82:
*(_WORD *)&v104.r = v85;
}
else
{
if ( v82 == 1.0 )
{
v85 = *(_WORD *)v81;
LOBYTE(v86) = *(_BYTE *)(v81 + 2);
goto LABEL_82;
}
v104.r = (int)(float)((float)((float)((unsigned __int8)v83 - (unsigned __int8)v10) * v82)
+ (float)(unsigned __int8)v10);
v104.g = (int)(float)((float)((float)(v117.g - HIBYTE(v100)) * v82) + (float)HIBYTE(v100));
v85 = *(_WORD *)&v104.r;
v86 = (int)(float)((float)((float)(v84 - b) * v82) + (float)b);
}
v111 = v85;
v87 = v80->__vftable;
v112 = v86;
((void (__fastcall *)(cocos2d::CCObject *, __int16 *))v87[19].canEncode)(v80, &v111);
}
if ( !m_pulseMainOnly )
{
v88 = v80[16].__vftable;
if ( v88 )
{
v89 = (*((__int64 (__fastcall **)(void (__fastcall **)(cocos2d::CCObject *__hidden, float)))v88[4].update
+ 1))(&v88[4].update);
v90 = fminf(1.0, v57);
v91 = *(_WORD *)v89;
v92 = *(unsigned __int8 *)(v89 + 2);
*(_WORD *)&v118.r = *(_WORD *)v89;
if ( v90 <= 0.0 )
{
v93 = v10;
LOBYTE(v94) = b;
LABEL_91:
*(_WORD *)&v105.r = v93;
}
else
{
if ( v90 == 1.0 )
{
v93 = *(_WORD *)v89;
LOBYTE(v94) = *(_BYTE *)(v89 + 2);
goto LABEL_91;
}
v105.r = (int)(float)((float)((float)((unsigned __int8)v91 - (unsigned __int8)v10) * v90)
+ (float)(unsigned __int8)v10);
v105.g = (int)(float)((float)((float)(v118.g - HIBYTE(v100)) * v90) + (float)HIBYTE(v100));
v93 = *(_WORD *)&v105.r;
v94 = (int)(float)((float)((float)(v92 - b) * v90) + (float)b);
}
v113 = v93;
v95 = v80->__vftable;
v114 = v94;
((void (__fastcall *)(cocos2d::CCObject *, __int16 *))v95[19].getTag)(v80, &v113);
}
}
if ( ++v78 > v79 )
goto LABEL_94;
continue;
}
}
v53 = HIBYTE(v100);
v15 = v106;
v54 = (unsigned __int64)v119;
v16 = v98;
}
else
{
v53 = HIBYTE(v100);
v15 = v106;
v54 = (unsigned __int64)v119;
v16 = v98;
}
LABEL_70:
arr = (GameObject **)(*(_QWORD *)&v121.h + 8LL);
*(_QWORD *)&v121.h = arr;
if ( (unsigned __int64)arr > v54 )
goto LABEL_100;
}
if ( m_pulseDetailOnly )
{
LABEL_59:
if ( !m_pulseMainOnly )
{
m_colorSprite = v55->m_colorSprite;
if ( m_colorSprite )
{
v66 = (__int64)m_colorSprite->getColor(&m_colorSprite->cocos2d::CCRGBAProtocol);
v67 = fminf(1.0, v57);
v68 = *(_WORD *)v66;
v69 = *(unsigned __int8 *)(v66 + 2);
*(_WORD *)&v116.r = *(_WORD *)v66;
if ( v67 <= 0.0 )
{
v70 = v10;
LOBYTE(v71) = b;
}
else
{
if ( v67 != 1.0 )
{
v103.r = (int)(float)((float)((float)((unsigned __int8)v68 - (unsigned __int8)v10) * v67)
+ (float)(unsigned __int8)v10);
v103.g = (int)(float)((float)((float)(v116.g - v53) * v67) + (float)v53);
v70 = *(_WORD *)&v103.r;
v71 = (int)(float)((float)((float)(v69 - b) * v67) + (float)b);
LABEL_67:
v109 = v70;
v72 = v55->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v110 = v71;
v72->updateSecondaryColor(v55, (const cocos2d::ccColor3B *)&v109);
goto LABEL_68;
}
v70 = *(_WORD *)v66;
LOBYTE(v71) = *(_BYTE *)(v66 + 2);
}
*(_WORD *)&v103.r = v70;
goto LABEL_67;
}
}
LABEL_68:
v15 = v106;
v54 = (unsigned __int64)v119;
v16 = v98;
LABEL_69:
v17 = v96;
goto LABEL_70;
}
v58 = (__int64)v55->getColor(&v55->cocos2d::CCRGBAProtocol);
v59 = fminf(1.0, v57);
v60 = *(_WORD *)v58;
v61 = *(unsigned __int8 *)(v58 + 2);
*(_WORD *)&v115.r = *(_WORD *)v58;
if ( v59 <= 0.0 )
{
v62 = v10;
LOBYTE(v63) = b;
}
else
{
if ( v59 != 1.0 )
{
v102.r = (int)(float)((float)((float)((unsigned __int8)v60 - (unsigned __int8)v10) * v59)
+ (float)(unsigned __int8)v10);
v102.g = (int)(float)((float)((float)(v115.g - v53) * v59) + (float)v53);
v62 = *(_WORD *)&v102.r;
v63 = (int)(float)((float)((float)(v61 - b) * v59) + (float)b);
LABEL_58:
v107 = v62;
v64 = v55->CCSpritePlus::cocos2d::CCSprite::cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v108 = v63;
v64->updateMainColor(v55, (const cocos2d::ccColor3B *)&v107);
goto LABEL_59;
}
v62 = *(_WORD *)v58;
LOBYTE(v63) = *(_BYTE *)(v58 + 2);
}
*(_WORD *)&v102.r = v62;
goto LABEL_58;
}
v18 = a2->data;
v19 = v18->num;
if ( (_DWORD)v19 )
{
v20 = (GameObject **)v18->arr;
v21 = &v20[v19 - 1];
if ( v20 <= v21 )
{
v22 = a5;
do
{
v23 = *v20;
if ( !*v20 )
{
v17 = v96;
break;
}
if ( v23->m_isActivated )
{
v24 = v122;
v97 = v16 + 1;
v99[0] = 0;
v25 = GJBaseGameLayer::getAreaObjectValue(v15, v122, v23, v124, v99);
if ( v25 < 1.0 )
{
m_hsvValue = (__m128)v24->m_hsvValue;
v27 = 1.0 - v25;
v28 = _mm_shuffle_ps(m_hsvValue, m_hsvValue, 255).m128_f32[0];
v120 = v28;
v29 = m_hsvValue.m128_f32[0] * (float)(1.0 - v25);
v30 = 1.0 - (float)(1.0 - v25);
v31 = _mm_shuffle_ps(m_hsvValue, m_hsvValue, 85).m128_f32[0] * (float)(1.0 - v25);
if ( !LOBYTE(v28) )
v31 = v31 + v30;
v32 = _mm_shuffle_ps(m_hsvValue, m_hsvValue, 170).m128_f32[0] * v27;
if ( !BYTE1(v120) )
v32 = v32 + v30;
*(_QWORD *)&v121.h = __PAIR64__(LODWORD(v31), LODWORD(v29));
*(_QWORD *)&v121.v = __PAIR64__(LODWORD(v28), LODWORD(v32));
if ( v22 )
{
v37 = v23->m_uniqueID;
v38 = (cocos2d::CCDictionary *)cocos2d::CCArray::objectAtIndex(
v106->m_targetGroupsArray,
v24->m_targetGroupIndex + 1);
v39 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v38, v37);
v17 = cocos2d::CCArray::count(v39) + v96 - 1;
v96 = v17;
if ( !v39 )
{
v15 = v106;
v16 = v97;
goto LABEL_28;
}
v40 = v39->data;
v41 = v40->num;
if ( !(_DWORD)v41 || (v42 = v40->arr, v43 = &v42[v41 - 1], v42 > v43) )
{
v15 = v106;
v16 = v97;
goto LABEL_28;
}
v44 = v121;
v45 = v101;
do
{
v46 = *v42;
if ( !*v42 )
break;
if ( !m_pulseDetailOnly )
{
v123 = v44;
v47 = (const cocos2d::ccColor3B *)(*(__int64 (__fastcall **)(int *))(*(_QWORD *)&v46[5].m_unknown2
+ 8LL))(&v46[5].m_unknown2);
v103 = *GameToolbox::transformColor(&v116, v47, &v123);
((void (__fastcall *)(cocos2d::CCObject *, cocos2d::ccColor3B *))v46->__vftable[19].canEncode)(
v46,
&v103);
}
if ( !v45 )
{
v48 = v46[16].__vftable;
if ( v48 )
{
v123 = v44;
v49 = (const cocos2d::ccColor3B *)(*((__int64 (__fastcall **)(void (__fastcall **)(cocos2d::CCObject *__hidden, float)))v48[4].update
+ 1))(&v48[4].update);
v102 = *GameToolbox::transformColor(&v115, v49, &v123);
((void (__fastcall *)(cocos2d::CCObject *, cocos2d::ccColor3B *))v46->__vftable[19].getTag)(
v46,
&v102);
}
}
++v42;
}
while ( v42 <= v43 );
v22 = a5;
}
else
{
v33 = v121;
if ( !m_pulseDetailOnly )
{
v123 = v121;
v34 = v23->getColor(&v23->cocos2d::CCRGBAProtocol);
v105 = *GameToolbox::transformColor(&v118, v34, &v123);
v23->updateMainColor(v23, &v105);
}
if ( !v101 )
{
v35 = v23->m_colorSprite;
if ( v35 )
{
v123 = v33;
v36 = v35->getColor(&v35->cocos2d::CCRGBAProtocol);
v104 = *GameToolbox::transformColor(&v117, v36, &v123);
v23->updateSecondaryColor(v23, &v104);
}
}
}
}
v15 = v106;
v16 = v97;
}
v17 = v96;
LABEL_28:
++v20;
}
while ( v20 <= v21 );
}
}
LABEL_100:
v15->m_areaColorCount += v17;
v15->m_areaColorCountTotal += v17 + v16;
}