//
// GJBaseGameLayer::processAreaTintGroupAction from 0x9a53cc to 0x9a5d94 (2504 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::processAreaEffects @ 0x9d72e4
// > ??> @ 0x5e7b0
//
// 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:10 +0000
//
__int64 __fastcall GJBaseGameLayer::processAreaTintGroupAction(
__int64 a1,
cocos2d::CCArray *a2,
__int64 a3,
float *a4,
unsigned __int8 a5)
{
__int64 v8; // x19
__int64 active; // x0
int v11; // w24
unsigned int *v12; // x0
GameObject **v13; // x27
__int64 v14; // x9
char *v15; // x25
GameObject *v16; // x21
int v17; // w19
int v18; // w28
int v19; // w0
unsigned int *v20; // x0
GameObject **v21; // x28
__int64 v22; // x4
char *v23; // x21
int v24; // w1
GameObject *v26; // x25
int v27; // w27
__int64 v28; // x1
float v29; // s2
int v30; // w0
float v31; // s1
float v32; // s3
float v33; // s2
const cocos2d::CCPoint *v34; // x2
float v35; // s0
float v36; // s3
float v37; // s2
float v38; // s3
float v39; // s1
float v40; // s0
bool v41; // nf
float v42; // s8
_QWORD *v43; // x0
unsigned __int64 v44; // x0
__int64 v45; // x1
float v46; // s2
int v47; // w0
float v48; // s1
float v49; // s3
float v50; // s2
const cocos2d::CCPoint *v51; // x2
float v52; // s0
float v53; // s3
float v54; // s2
float v55; // s3
float v56; // s1
float v57; // s0
bool v58; // nf
int v59; // w10
int v60; // w2
char v61; // w8
int v62; // w1
__int64 v63; // x1
void (__fastcall *v64)(GameObject *, _DWORD *); // x24
unsigned __int8 *v65; // x0
unsigned __int64 v66; // x0
float v67; // s0
float v68; // s1
float v69; // s0
float v70; // s0
float v71; // s1
float v72; // s0
cocos2d::CCArray *TargetGroup; // x25
unsigned int *v74; // x0
cocos2d::CCPoint *v75; // x2
__int64 v76; // x25
GameObject *v77; // x25
_QWORD *v78; // x0
unsigned __int64 v79; // x0
bool hasSecondaryColor; // w0
_QWORD *v81; // x0
unsigned __int64 v82; // x0
_QWORD *v83; // x0
unsigned __int64 v84; // x0
cocos2d::CCArray *v85; // x21
unsigned int *v86; // x1
GameObject **v87; // x24
GameObject *v88; // x21
unsigned __int8 *v89; // x0
unsigned __int64 v90; // x0
unsigned __int8 *v91; // x0
unsigned __int64 v92; // x0
void (__fastcall *v93)(GameObject *, _DWORD *); // x24
unsigned __int8 *v94; // x0
unsigned __int64 v95; // x0
void (__fastcall *v96)(GameObject *, _DWORD *); // [xsp+70h] [xbp+70h]
void (__fastcall *v97)(GameObject *, _DWORD *); // [xsp+70h] [xbp+70h]
unsigned __int64 MultipliedHSV; // [xsp+80h] [xbp+80h]
void (__fastcall *v99)(GameObject *, _DWORD *); // [xsp+80h] [xbp+80h]
cocos2d::CCPoint *v100; // [xsp+80h] [xbp+80h]
void (__fastcall *v101)(GameObject *, _DWORD *); // [xsp+80h] [xbp+80h]
__int64 v102; // [xsp+88h] [xbp+88h]
cocos2d::CCPoint *v103; // [xsp+90h] [xbp+90h]
cocos2d::CCPoint *v104; // [xsp+90h] [xbp+90h]
GameObject **j; // [xsp+90h] [xbp+90h]
cocos2d::CCPoint *v106; // [xsp+98h] [xbp+98h]
cocos2d::CCPoint *i; // [xsp+98h] [xbp+98h]
cocos2d::CCPoint *v108; // [xsp+98h] [xbp+98h]
int v109; // [xsp+A4h] [xbp+A4h]
int v110; // [xsp+A8h] [xbp+A8h]
int v111; // [xsp+ACh] [xbp+ACh]
int v112; // [xsp+B8h] [xbp+B8h]
__int64 v113; // [xsp+C0h] [xbp+C0h] BYREF
_DWORD v114[3]; // [xsp+C8h] [xbp+C8h] BYREF
char v115; // [xsp+D4h] [xbp+D4h]
char v116; // [xsp+D5h] [xbp+D5h]
v109 = a5;
v8 = *(_QWORD *)(a3 + 168);
active = GJEffectManager::activeColorForIndex(*(GJEffectManager **)(a1 + 2152), *(_DWORD *)(v8 + 1960));
LOWORD(v112) = active;
v111 = *(unsigned __int8 *)(v8 + 1634) ^ 1;
BYTE2(v112) = BYTE2(active);
v110 = *(unsigned __int8 *)(v8 + 1633) ^ 1;
v11 = cocos2d::CCArray::count(a2) + *(_DWORD *)(a1 + 13720);
*(_DWORD *)(a1 + 13720) = v11;
if ( !*(_BYTE *)(v8 + 2013) )
{
if ( !a2 )
goto LABEL_14;
v20 = *((unsigned int **)a2 + 7);
if ( !*v20 )
goto LABEL_14;
v21 = *((GameObject ***)v20 + 2);
v22 = 8LL * *v20 - 8;
v23 = (char *)v21 + v22;
if ( v21 > (GameObject **)((char *)v21 + v22) )
goto LABEL_14;
v26 = *v21;
if ( !*v21 )
goto LABEL_14;
v17 = 0;
v27 = 0;
while ( 1 )
{
if ( !*((_BYTE *)v26 + 773) )
goto LABEL_19;
++v27;
(*(void (__fastcall **)(GameObject *))(*(_QWORD *)v26 + 1360LL))(v26);
v28 = *(_QWORD *)(a3 + 168);
v29 = *(float *)(a3 + 36);
v30 = *(_DWORD *)(v28 + 1968);
if ( v30 == 1 )
break;
if ( v30 == 2 )
{
v70 = 0.0;
v71 = *((float *)&v113 + 1) - a4[1];
if ( v29 != 0.0 )
LABEL_81:
v70 = v29 * *(float *)(a1 + 4LL * (*((__int16 *)v26 + 502) + 1) + 4108);
LABEL_82:
v72 = v71 + v70;
if ( v72 < 0.0 )
v35 = v72 * *(float *)(a3 + 48);
else
v35 = v72 * *(float *)(a3 + 52);
goto LABEL_29;
}
v31 = 0.0;
if ( v29 != 0.0 )
v31 = v29 * *(float *)(a1 + 4LL * (*((__int16 *)v26 + 502) + 1) + 4108);
v32 = *(float *)(a3 + 44);
v33 = 0.0;
if ( v32 != 0.0 )
v33 = v32 * *(float *)(a1 + 4LL * (*((__int16 *)v26 + 502) + 2) + 4108);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v114, *a4 + v31, a4[1] + v33);
cocos2d::ccpDistance((cocos2d *)&v113, (const cocos2d::CCPoint *)v114, v34);
v28 = *(_QWORD *)(a3 + 168);
LABEL_29:
v36 = *(float *)(a3 + 28);
v37 = 0.0;
if ( v36 != 0.0 )
v37 = v36 * *(float *)(a1 + 4LL * *((__int16 *)v26 + 502) + 4108);
v38 = *(float *)(a3 + 56);
v39 = (float)(int)(float)(*(float *)(a3 + 24) + v37);
if ( v38 == 0.0 )
{
v40 = v35 / v39;
v41 = v40 < 1.0;
if ( v40 < 1.0 )
goto LABEL_33;
}
else
{
v40 = (float)((float)(v35 / v39) - v38) / (float)(1.0 - v38);
v41 = v40 < 1.0;
if ( v40 < 1.0 )
{
LABEL_33:
if ( v40 > 0.0 )
{
if ( *(_BYTE *)(v28 + 2012) )
v40 = 1.0 - v40;
}
else
{
if ( !*(_BYTE *)(v28 + 2012) )
{
v40 = 0.0;
LABEL_37:
v42 = (float)(1.0 - *(float *)(a3 + 120)) + (float)(*(float *)(a3 + 120) * v40);
if ( v109 )
{
TargetGroup = (cocos2d::CCArray *)GJBaseGameLayer::getTargetGroup(
(cocos2d::CCArray **)a1,
*(_DWORD *)(a3 + 200),
*((_DWORD *)v26 + 229));
v17 = v17 - 1 + cocos2d::CCArray::count(TargetGroup);
if ( TargetGroup )
{
v74 = *((unsigned int **)TargetGroup + 7);
if ( *v74 )
{
v75 = *((cocos2d::CCPoint **)v74 + 2);
v76 = 8LL * *v74 - 8;
for ( i = (cocos2d::CCPoint *)((char *)v75 + v76); i >= v75; v75 = (cocos2d::CCPoint *)((char *)v75 + 8) )
{
v77 = *(GameObject **)v75;
if ( !*(_QWORD *)v75 )
break;
if ( v111 )
{
v103 = v75;
v99 = *(void (__fastcall **)(GameObject *, _DWORD *))(*(_QWORD *)v77 + 1584LL);
v78 = (_QWORD *)(*(__int64 (__fastcall **)(_QWORD))(*(_QWORD *)v77 + 944LL))(*(_QWORD *)v75);
v79 = GameToolbox::multipliedColorValue(v112, *v78, v42);
LOWORD(v114[0]) = v79;
BYTE2(v114[0]) = BYTE2(v79);
v99(v77, v114);
v75 = v103;
}
if ( v110 )
{
v100 = v75;
hasSecondaryColor = GameObject::hasSecondaryColor(v77);
v75 = v100;
if ( hasSecondaryColor )
{
v104 = v100;
v101 = *(void (__fastcall **)(GameObject *, _DWORD *))(*(_QWORD *)v77 + 1592LL);
v81 = (_QWORD *)(*(__int64 (__fastcall **)(_QWORD *))(**((_QWORD **)v77 + 111) + 944LL))(*((_QWORD **)v77 + 111));
v82 = GameToolbox::multipliedColorValue(v112, *v81, v42);
LOWORD(v114[0]) = v82;
BYTE2(v114[0]) = BYTE2(v82);
v101(v77, v114);
v75 = v104;
}
}
}
}
}
}
else
{
if ( v111 )
{
v108 = *(cocos2d::CCPoint **)(*(_QWORD *)v26 + 1584LL);
v83 = (_QWORD *)(*(__int64 (__fastcall **)(GameObject *))(*(_QWORD *)v26 + 944LL))(v26);
v84 = GameToolbox::multipliedColorValue(v112, *v83, v42);
LOWORD(v114[0]) = v84;
BYTE2(v114[0]) = BYTE2(v84);
((void (__fastcall *)(GameObject *, _DWORD *))v108)(v26, v114);
}
if ( v110 && GameObject::hasSecondaryColor(v26) )
{
v106 = *(cocos2d::CCPoint **)(*(_QWORD *)v26 + 1592LL);
v43 = (_QWORD *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)v26 + 111) + 944LL))(*((_QWORD *)v26 + 111));
v44 = GameToolbox::multipliedColorValue(v112, *v43, v42);
LOWORD(v114[0]) = v44;
BYTE2(v114[0]) = BYTE2(v44);
((void (__fastcall *)(GameObject *, _DWORD *))v106)(v26, v114);
}
}
goto LABEL_19;
}
v40 = 1.0;
}
goto LABEL_36;
}
}
if ( v41 )
{
if ( !*(_BYTE *)(v28 + 2012) )
goto LABEL_37;
v40 = 1.0 - v40;
}
else
{
v40 = 0.0;
if ( !*(_BYTE *)(v28 + 2012) )
goto LABEL_19;
}
LABEL_36:
if ( v40 < 1.0 )
goto LABEL_37;
LABEL_19:
if ( v23 >= (char *)++v21 )
{
v26 = *v21;
if ( *v21 )
continue;
}
v11 = *(_DWORD *)(a1 + 13720);
v19 = v27 + v17;
goto LABEL_15;
}
v70 = 0.0;
v71 = *(float *)&v113 - *a4;
if ( v29 != 0.0 )
goto LABEL_81;
goto LABEL_82;
}
if ( !a2
|| (v12 = *((unsigned int **)a2 + 7), !*v12)
|| (v13 = *((GameObject ***)v12 + 2),
v14 = 8LL * *v12 - 8,
v15 = (char *)v13 + v14,
v13 > (GameObject **)((char *)v13 + v14))
|| (v16 = *v13) == nullptr )
{
LABEL_14:
v19 = 0;
v17 = 0;
goto LABEL_15;
}
v17 = 0;
v18 = 0;
do
{
if ( !*((_BYTE *)v16 + 773) )
goto LABEL_8;
++v18;
(*(void (__fastcall **)(__int64 *__return_ptr, GameObject *))(*(_QWORD *)v16 + 1360LL))(&v113, v16);
v45 = *(_QWORD *)(a3 + 168);
v46 = *(float *)(a3 + 36);
v47 = *(_DWORD *)(v45 + 1968);
if ( v47 == 1 )
{
v67 = 0.0;
v68 = *(float *)&v113 - *a4;
if ( v46 == 0.0 )
goto LABEL_78;
goto LABEL_77;
}
if ( v47 == 2 )
{
v67 = 0.0;
v68 = *((float *)&v113 + 1) - a4[1];
if ( v46 == 0.0 )
{
LABEL_78:
v69 = v68 + v67;
if ( v69 < 0.0 )
v52 = v69 * *(float *)(a3 + 48);
else
v52 = v69 * *(float *)(a3 + 52);
goto LABEL_50;
}
LABEL_77:
v67 = v46 * *(float *)(a1 + 4LL * (*((__int16 *)v16 + 502) + 1) + 4108);
goto LABEL_78;
}
v48 = 0.0;
if ( v46 != 0.0 )
v48 = v46 * *(float *)(a1 + 4LL * (*((__int16 *)v16 + 502) + 1) + 4108);
v49 = *(float *)(a3 + 44);
v50 = 0.0;
if ( v49 != 0.0 )
v50 = v49 * *(float *)(a1 + 4LL * (*((__int16 *)v16 + 502) + 2) + 4108);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v114, *a4 + v48, a4[1] + v50);
cocos2d::ccpDistance((cocos2d *)&v113, (const cocos2d::CCPoint *)v114, v51);
v45 = *(_QWORD *)(a3 + 168);
LABEL_50:
v53 = *(float *)(a3 + 28);
v54 = 0.0;
if ( v53 != 0.0 )
v54 = v53 * *(float *)(a1 + 4LL * *((__int16 *)v16 + 502) + 4108);
v55 = *(float *)(a3 + 56);
v56 = (float)(int)(float)(*(float *)(a3 + 24) + v54);
if ( v55 == 0.0 )
{
v57 = v52 / v56;
v58 = v57 < 1.0;
if ( v57 >= 1.0 )
goto LABEL_73;
}
else
{
v57 = (float)((float)(v52 / v56) - v55) / (float)(1.0 - v55);
v58 = v57 < 1.0;
if ( v57 >= 1.0 )
{
LABEL_73:
if ( v58 )
{
if ( !*(_BYTE *)(v45 + 2012) )
goto LABEL_58;
v57 = 1.0 - v57;
}
else
{
v57 = 0.0;
if ( !*(_BYTE *)(v45 + 2012) )
goto LABEL_8;
}
LABEL_57:
if ( v57 >= 1.0 )
goto LABEL_8;
goto LABEL_58;
}
}
if ( v57 > 0.0 )
{
if ( *(_BYTE *)(v45 + 2012) )
v57 = 1.0 - v57;
goto LABEL_57;
}
if ( *(_BYTE *)(v45 + 2012) )
{
v57 = 1.0;
goto LABEL_57;
}
v57 = 0.0;
LABEL_58:
v59 = *(_DWORD *)(a3 + 140);
v60 = *(_DWORD *)(a3 + 144);
v61 = *(_BYTE *)(a3 + 149);
v62 = *(_DWORD *)(a3 + 136);
v115 = *(_BYTE *)(a3 + 148);
v114[1] = v59;
v116 = v61;
v114[2] = v60;
v114[0] = v62;
MultipliedHSV = GameToolbox::getMultipliedHSV((__int64)v114, 1.0 - v57);
v102 = v63;
if ( v109 )
{
v85 = (cocos2d::CCArray *)GJBaseGameLayer::getTargetGroup(
(cocos2d::CCArray **)a1,
*(_DWORD *)(a3 + 200),
*((_DWORD *)v16 + 229));
v17 = v17 - 1 + cocos2d::CCArray::count(v85);
if ( v85 )
{
v86 = *((unsigned int **)v85 + 7);
if ( *v86 )
{
v87 = *((GameObject ***)v86 + 2);
for ( j = &v87[*v86 - 1]; j >= v87; ++v87 )
{
v88 = *v87;
if ( !*v87 )
break;
if ( v111 )
{
v96 = *(void (__fastcall **)(GameObject *, _DWORD *))(*(_QWORD *)v88 + 1584LL);
v89 = (unsigned __int8 *)(*(__int64 (__fastcall **)(GameObject *))(*(_QWORD *)v88 + 944LL))(*v87);
v90 = GameToolbox::transformColor(v89, MultipliedHSV, v102);
LOWORD(v114[0]) = v90;
BYTE2(v114[0]) = BYTE2(v90);
v96(v88, v114);
}
if ( v110 && GameObject::hasSecondaryColor(v88) )
{
v97 = *(void (__fastcall **)(GameObject *, _DWORD *))(*(_QWORD *)v88 + 1592LL);
v91 = (unsigned __int8 *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)v88 + 111) + 944LL))(*((_QWORD *)v88 + 111));
v92 = GameToolbox::transformColor(v91, MultipliedHSV, v102);
LOWORD(v114[0]) = v92;
BYTE2(v114[0]) = BYTE2(v92);
v97(v88, v114);
}
}
}
}
}
else
{
if ( v111 )
{
v93 = *(void (__fastcall **)(GameObject *, _DWORD *))(*(_QWORD *)v16 + 1584LL);
v94 = (unsigned __int8 *)(*(__int64 (__fastcall **)(GameObject *))(*(_QWORD *)v16 + 944LL))(v16);
v95 = GameToolbox::transformColor(v94, MultipliedHSV, v102);
LOWORD(v114[0]) = v95;
BYTE2(v114[0]) = BYTE2(v95);
v93(v16, v114);
}
if ( v110 && GameObject::hasSecondaryColor(v16) )
{
v64 = *(void (__fastcall **)(GameObject *, _DWORD *))(*(_QWORD *)v16 + 1592LL);
v65 = (unsigned __int8 *)(*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)v16 + 111) + 944LL))(*((_QWORD *)v16 + 111));
v66 = GameToolbox::transformColor(v65, MultipliedHSV, v102);
LOWORD(v114[0]) = v66;
BYTE2(v114[0]) = BYTE2(v66);
v64(v16, v114);
}
}
LABEL_8:
if ( v15 < (char *)++v13 )
break;
v16 = *v13;
}
while ( *v13 );
v11 = *(_DWORD *)(a1 + 13720);
v19 = v18 + v17;
LABEL_15:
v24 = *(_DWORD *)(a1 + 13736);
*(_DWORD *)(a1 + 13720) = v17 + v11;
*(_DWORD *)(a1 + 13736) = v24 + v19;
return _stack_chk_guard;
}