//
// GJBaseGameLayer::processAreaTintGroupAction from 0x1403337f0 to 0x140334218 (2600 bytes)
//
// 4 xrefs:
// > GJBaseGameLayer::processAreaEffects @ 0x140331852
// > ??> @ 0x1408b6a88
// > ??> @ 0x1408b6ac0
// > ??> @ 0x14091f7d8
//
// 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:33 +0000
//
__int64 __fastcall GJBaseGameLayer::processAreaTintGroupAction(
__int64 a1,
cocos2d::CCArray *a2,
__int64 a3,
float *a4,
char a5)
{
__int64 v5; // rdi
__int64 v7; // r15
__int64 v8; // rdx
__int64 ColorSprite; // rax
__int16 v10; // si
unsigned __int8 v11; // r14
char v12; // r12
char v13; // r13
unsigned int v14; // eax
__int64 v15; // r10
int v16; // edx
unsigned int v17; // r8d
unsigned int *v18; // r14
__int64 v19; // rax
__int64 *v20; // r14
__int64 *v21; // r15
char v22; // r12
__int64 v23; // rbx
__int64 v24; // rdi
float v25; // xmm0_4
__m128 v26; // xmm1
float v27; // xmm2_4
__m128i v28; // xmm3
float v29; // xmm5_4
float v30; // xmm4_4
float v31; // xmm0_4
float v32; // xmm1_4
__int128 v33; // xmm6
unsigned __int16 *v34; // rax
__int64 v35; // rax
__int64 v36; // rcx
unsigned __int16 *v37; // rax
__int64 v38; // rax
__int64 v39; // rbx
cocos2d::CCDictionary *v40; // rax
struct cocos2d::CCObject *v41; // rbx
unsigned int *v42; // rdi
__int64 v43; // rax
_QWORD **v44; // rdi
_QWORD **v45; // rsi
__int128 v46; // xmm6
char v47; // r12
_QWORD *v48; // rbx
unsigned __int16 *v49; // rax
__int64 v50; // rax
__int64 v51; // rcx
unsigned __int16 *v52; // rax
__int64 v53; // rax
unsigned int *v54; // rax
__int64 v55; // rcx
__int64 **v56; // rbx
unsigned __int8 v57; // di
unsigned __int64 v58; // rax
__int64 *v59; // rbx
float AreaObjectValue; // xmm0_4
float v61; // xmm9_4
float v62; // xmm6_4
__int64 v63; // rcx
__int16 v64; // ax
int v65; // r9d
__int16 v66; // ax
int v67; // edx
__int64 v68; // rax
__int64 v69; // rcx
__int64 v70; // rcx
__int16 v71; // ax
int v72; // r9d
__int16 v73; // ax
int v74; // edx
__int64 v75; // rax
__int64 v76; // rbx
cocos2d::CCDictionary *v77; // rax
struct cocos2d::CCObject *v78; // rbx
unsigned int *v79; // rdi
__int64 v80; // rax
__int64 **v81; // rdi
__int64 **v82; // r15
__int64 *v83; // rbx
__int64 v84; // rcx
float v85; // xmm2_4
__int16 v86; // ax
int v87; // r9d
__int16 v88; // ax
int v89; // edx
__int64 v90; // rax
__int64 v91; // rcx
__int64 v92; // rcx
float v93; // xmm2_4
__int16 v94; // ax
int v95; // r9d
__int16 v96; // ax
__int64 v97; // rax
__int64 result; // rax
unsigned int v99; // [rsp+30h] [rbp-D0h]
int v100; // [rsp+34h] [rbp-CCh]
int v101; // [rsp+34h] [rbp-CCh]
bool v102[4]; // [rsp+38h] [rbp-C8h] BYREF
__int16 v103; // [rsp+3Ch] [rbp-C4h]
char v104; // [rsp+40h] [rbp-C0h]
__int16 v105; // [rsp+44h] [rbp-BCh] BYREF
char v106; // [rsp+46h] [rbp-BAh]
__int16 v107; // [rsp+48h] [rbp-B8h] BYREF
char v108; // [rsp+4Ah] [rbp-B6h]
__int16 v109; // [rsp+4Ch] [rbp-B4h] BYREF
char v110; // [rsp+4Eh] [rbp-B2h]
__int16 v111; // [rsp+50h] [rbp-B0h] BYREF
char v112; // [rsp+52h] [rbp-AEh]
__int64 v113; // [rsp+58h] [rbp-A8h]
__int16 v114; // [rsp+60h] [rbp-A0h] BYREF
char v115; // [rsp+62h] [rbp-9Eh]
__int16 v116; // [rsp+63h] [rbp-9Dh] BYREF
char v117; // [rsp+65h] [rbp-9Bh]
__int16 v118; // [rsp+66h] [rbp-9Ah] BYREF
char v119; // [rsp+68h] [rbp-98h]
__int16 v120; // [rsp+69h] [rbp-97h] BYREF
char v121; // [rsp+6Bh] [rbp-95h]
__int16 v122; // [rsp+70h] [rbp-90h] BYREF
__int16 v123; // [rsp+80h] [rbp-80h] BYREF
__int16 v124; // [rsp+90h] [rbp-70h] BYREF
__int16 v125; // [rsp+A0h] [rbp-60h] BYREF
__int64 **v126; // [rsp+B0h] [rbp-50h]
__int32 v127; // [rsp+BCh] [rbp-44h]
__int128 v128; // [rsp+C0h] [rbp-40h]
__int64 v129; // [rsp+D0h] [rbp-30h]
__int128 v130; // [rsp+E0h] [rbp-20h] BYREF
float *v131; // [rsp+F0h] [rbp-10h]
v5 = *(_QWORD *)(a3 + 160);
v113 = a1;
v131 = a4;
v7 = a3;
v129 = a3;
v8 = *(unsigned int *)(v5 + 1976);
if ( (_DWORD)v8 )
{
if ( (_DWORD)v8 == 1010 )
{
v10 = 0;
v11 = 0;
goto LABEL_8;
}
if ( (_DWORD)v8 != 1011 )
{
ColorSprite = GJEffectManager::getColorSprite(*(_QWORD *)(a1 + 2408), v8);
if ( ColorSprite )
{
v10 = *(_WORD *)(ColorSprite + 327);
v11 = *(_BYTE *)(ColorSprite + 329);
goto LABEL_8;
}
}
}
v11 = -1;
v10 = -1;
LABEL_8:
v12 = *(_BYTE *)(v5 + 1650);
v13 = *(_BYTE *)(v5 + 1649);
v104 = v12;
v103 = v10;
v14 = cocos2d::CCArray::count(a2);
v15 = v113;
v16 = 0;
v17 = 0;
v99 = 0;
*(_DWORD *)(v113 + 14352) += v14;
if ( !a2 )
goto LABEL_101;
if ( !*(_BYTE *)(v5 + 2029) )
{
v54 = *((unsigned int **)a2 + 7);
v55 = *v54;
if ( !(_DWORD)v55 )
goto LABEL_101;
v56 = *((__int64 ***)v54 + 2);
*(_QWORD *)&v128 = v56;
v126 = &v56[v55 - 1];
if ( v56 > v126 )
goto LABEL_101;
v57 = HIBYTE(v103);
v58 = (unsigned __int64)v126;
LABEL_47:
v59 = *v56;
if ( !v59 )
{
v17 = v99;
goto LABEL_101;
}
if ( !*((_BYTE *)v59 + 773) )
goto LABEL_70;
v102[0] = 0;
v101 = v16 + 1;
AreaObjectValue = GJBaseGameLayer::getAreaObjectValue(v15, v7, (__int16 *)v59, v131, v102);
if ( AreaObjectValue >= 1.0 )
goto LABEL_68;
v61 = (float)(*(float *)(v7 + 112) * AreaObjectValue) + (float)(1.0 - *(float *)(v7 + 112));
if ( !a5 )
{
v62 = fminf(1.0, v61);
if ( !v12 )
{
v63 = (*(__int64 (__fastcall **)(__int64 *))(v59[40] + 8))(v59 + 40);
v64 = *(_WORD *)v63;
v122 = *(_WORD *)v63;
v65 = *(unsigned __int8 *)(v63 + 2);
if ( v62 <= 0.0 )
{
v66 = v10;
LOBYTE(v67) = v11;
LABEL_57:
v105 = v66;
}
else
{
if ( v62 == 1.0 )
{
v66 = *(_WORD *)v63;
LOBYTE(v67) = *(_BYTE *)(v63 + 2);
goto LABEL_57;
}
LOBYTE(v105) = (int)(float)((float)((float)((unsigned __int8)v64 - (unsigned __int8)v10) * v62)
+ (float)(unsigned __int8)v10);
HIBYTE(v105) = (int)(float)((float)((float)(HIBYTE(v122) - v57) * v62) + (float)v57);
v66 = v105;
v67 = (int)(float)((float)((float)(v65 - v11) * v62) + (float)v11);
}
v114 = v66;
v68 = *v59;
v115 = v67;
(*(void (__fastcall **)(__int64 *, __int16 *))(v68 + 1432))(v59, &v114);
}
if ( !v13 )
{
v69 = v59[112];
if ( v69 )
{
v70 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(v69 + 320) + 8LL))(v69 + 320);
v71 = *(_WORD *)v70;
v123 = *(_WORD *)v70;
v72 = *(unsigned __int8 *)(v70 + 2);
if ( v62 <= 0.0 )
{
v73 = v10;
LOBYTE(v74) = v11;
LABEL_66:
v107 = v73;
}
else
{
if ( v62 == 1.0 )
{
v73 = *(_WORD *)v70;
LOBYTE(v74) = *(_BYTE *)(v70 + 2);
goto LABEL_66;
}
LOBYTE(v107) = (int)(float)((float)((float)((unsigned __int8)v71 - (unsigned __int8)v10) * v62)
+ (float)(unsigned __int8)v10);
HIBYTE(v107) = (int)(float)((float)((float)(HIBYTE(v123) - v57) * v62) + (float)v57);
v73 = v107;
v74 = (int)(float)((float)((float)(v72 - v11) * v62) + (float)v11);
}
v116 = v73;
v75 = *v59;
v117 = v74;
(*(void (__fastcall **)(__int64 *, __int16 *))(v75 + 1440))(v59, &v116);
}
}
LABEL_68:
v58 = (unsigned __int64)v126;
v15 = v113;
goto LABEL_69;
}
v76 = *((int *)v59 + 231);
v77 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v113 + 4184), *(_DWORD *)(v7 + 192) + 1);
v78 = cocos2d::CCDictionary::objectForKey(v77, v76);
v17 = cocos2d::CCArray::count(v78) + v99 - 1;
v99 = v17;
if ( !v78 )
{
v58 = (unsigned __int64)v126;
v15 = v113;
v16 = v101;
goto LABEL_71;
}
v79 = *((unsigned int **)v78 + 7);
v80 = *v79;
if ( !(_DWORD)v80 )
{
v57 = HIBYTE(v103);
v58 = (unsigned __int64)v126;
v15 = v113;
v16 = v101;
goto LABEL_71;
}
v81 = *((__int64 ***)v79 + 2);
v82 = &v81[v80 - 1];
if ( v81 > v82 )
{
v57 = HIBYTE(v103);
v58 = (unsigned __int64)v126;
v15 = v113;
v7 = v129;
v16 = v101;
goto LABEL_71;
}
while ( 1 )
{
v83 = *v81;
if ( !*v81 )
{
LABEL_95:
v57 = HIBYTE(v103);
v58 = (unsigned __int64)v126;
v15 = v113;
v7 = v129;
LABEL_69:
v16 = v101;
LABEL_70:
v17 = v99;
LABEL_71:
v56 = (__int64 **)(v128 + 8);
*(_QWORD *)&v128 = v56;
if ( (unsigned __int64)v56 > v58 )
goto LABEL_101;
goto LABEL_47;
}
if ( !v12 )
break;
LABEL_85:
if ( v13 )
goto LABEL_94;
v91 = v83[112];
if ( !v91 )
goto LABEL_94;
v92 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(v91 + 320) + 8LL))(v91 + 320);
v93 = fminf(1.0, v61);
v94 = *(_WORD *)v92;
v95 = *(unsigned __int8 *)(v92 + 2);
v125 = *(_WORD *)v92;
if ( v93 <= 0.0 )
{
v96 = v10;
LOBYTE(v92) = v11;
goto LABEL_92;
}
if ( v93 == 1.0 )
{
v96 = *(_WORD *)v92;
LOBYTE(v92) = *(_BYTE *)(v92 + 2);
LABEL_92:
v111 = v96;
goto LABEL_93;
}
LOBYTE(v111) = (int)(float)((float)((float)((unsigned __int8)v94 - (unsigned __int8)v10) * v93)
+ (float)(unsigned __int8)v10);
HIBYTE(v111) = (int)(float)((float)((float)(HIBYTE(v125) - HIBYTE(v103)) * v93) + (float)HIBYTE(v103));
v96 = v111;
LODWORD(v92) = (int)(float)((float)((float)(v95 - v11) * v93) + (float)v11);
LABEL_93:
v120 = v96;
v97 = *v83;
v121 = v92;
(*(void (__fastcall **)(__int64 *, __int16 *))(v97 + 1440))(v83, &v120);
LABEL_94:
if ( ++v81 > v82 )
goto LABEL_95;
}
v84 = (*(__int64 (__fastcall **)(__int64 *))(v83[40] + 8))(v83 + 40);
v85 = fminf(1.0, v61);
v86 = *(_WORD *)v84;
v87 = *(unsigned __int8 *)(v84 + 2);
v124 = *(_WORD *)v84;
if ( v85 <= 0.0 )
{
v88 = v10;
LOBYTE(v89) = v11;
}
else
{
if ( v85 != 1.0 )
{
LOBYTE(v109) = (int)(float)((float)((float)((unsigned __int8)v86 - (unsigned __int8)v10) * v85)
+ (float)(unsigned __int8)v10);
HIBYTE(v109) = (int)(float)((float)((float)(HIBYTE(v124) - HIBYTE(v103)) * v85) + (float)HIBYTE(v103));
v88 = v109;
v89 = (int)(float)((float)((float)(v87 - v11) * v85) + (float)v11);
LABEL_84:
v118 = v88;
v90 = *v83;
v119 = v89;
(*(void (__fastcall **)(__int64 *, __int16 *))(v90 + 1432))(v83, &v118);
goto LABEL_85;
}
v88 = *(_WORD *)v84;
LOBYTE(v89) = *(_BYTE *)(v84 + 2);
}
v109 = v88;
goto LABEL_84;
}
v18 = *((unsigned int **)a2 + 7);
v19 = *v18;
if ( (_DWORD)v19 )
{
v20 = *((__int64 **)v18 + 2);
v21 = &v20[v19 - 1];
if ( v20 <= v21 )
{
v22 = a5;
do
{
v23 = *v20;
if ( !*v20 )
{
v17 = v99;
break;
}
if ( *(_BYTE *)(v23 + 773) )
{
v24 = v129;
v100 = v16 + 1;
v102[0] = 0;
v25 = GJBaseGameLayer::getAreaObjectValue(v15, v129, (__int16 *)v23, v131, v102);
if ( v25 < 1.0 )
{
v26 = *(__m128 *)(v24 + 128);
v27 = 1.0 - v25;
v28 = (__m128i)_mm_shuffle_ps(v26, v26, 255);
v127 = v28.m128i_i32[0];
v29 = v26.m128_f32[0] * (float)(1.0 - v25);
v30 = 1.0 - (float)(1.0 - v25);
v31 = _mm_shuffle_ps(v26, v26, 85).m128_f32[0] * (float)(1.0 - v25);
if ( !v28.m128i_i8[0] )
v31 = v31 + v30;
v32 = _mm_shuffle_ps(v26, v26, 170).m128_f32[0] * v27;
if ( !((unsigned __int16)_mm_cvtsi128_si32(v28) >> 8) )
v32 = v32 + v30;
*(_QWORD *)&v128 = __PAIR64__(LODWORD(v31), LODWORD(v29));
*((_QWORD *)&v128 + 1) = __PAIR64__(v28.m128i_u32[0], LODWORD(v32));
if ( v22 )
{
v39 = *(int *)(v23 + 924);
v40 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v113 + 4184), *(_DWORD *)(v24 + 192) + 1);
v41 = cocos2d::CCDictionary::objectForKey(v40, v39);
v17 = cocos2d::CCArray::count(v41) + v99 - 1;
v99 = v17;
if ( !v41 )
{
v15 = v113;
v16 = v100;
goto LABEL_28;
}
v42 = *((unsigned int **)v41 + 7);
v43 = *v42;
if ( !(_DWORD)v43 || (v44 = *((_QWORD ***)v42 + 2), v45 = &v44[v43 - 1], v44 > v45) )
{
v15 = v113;
v16 = v100;
goto LABEL_28;
}
v46 = v128;
v47 = v104;
do
{
v48 = *v44;
if ( !*v44 )
break;
if ( !v47 )
{
v130 = v46;
v49 = (unsigned __int16 *)(*(__int64 (__fastcall **)(_QWORD *))(v48[40] + 8LL))(v48 + 40);
v50 = GameToolbox::transformColor((__int64)&v123, v49, (float *)&v130);
v107 = *(_WORD *)v50;
v108 = *(_BYTE *)(v50 + 2);
(*(void (__fastcall **)(_QWORD *, __int16 *))(*v48 + 1432LL))(v48, &v107);
}
if ( !v13 )
{
v51 = v48[112];
if ( v51 )
{
v130 = v46;
v52 = (unsigned __int16 *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(v51 + 320) + 8LL))(v51 + 320);
v53 = GameToolbox::transformColor((__int64)&v122, v52, (float *)&v130);
v105 = *(_WORD *)v53;
v106 = *(_BYTE *)(v53 + 2);
(*(void (__fastcall **)(_QWORD *, __int16 *))(*v48 + 1440LL))(v48, &v105);
}
}
++v44;
}
while ( v44 <= v45 );
v22 = a5;
}
else
{
v33 = v128;
if ( !v104 )
{
v130 = v128;
v34 = (unsigned __int16 *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(v23 + 320) + 8LL))(v23 + 320);
v35 = GameToolbox::transformColor((__int64)&v125, v34, (float *)&v130);
v111 = *(_WORD *)v35;
v112 = *(_BYTE *)(v35 + 2);
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v23 + 1432LL))(v23, &v111);
}
if ( !v13 )
{
v36 = *(_QWORD *)(v23 + 896);
if ( v36 )
{
v130 = v33;
v37 = (unsigned __int16 *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)(v36 + 320) + 8LL))(v36 + 320);
v38 = GameToolbox::transformColor((__int64)&v124, v37, (float *)&v130);
v109 = *(_WORD *)v38;
v110 = *(_BYTE *)(v38 + 2);
(*(void (__fastcall **)(__int64, __int16 *))(*(_QWORD *)v23 + 1440LL))(v23, &v109);
}
}
}
}
v15 = v113;
v16 = v100;
}
v17 = v99;
LABEL_28:
++v20;
}
while ( v20 <= v21 );
}
}
LABEL_101:
*(_DWORD *)(v15 + 14352) += v17;
result = v17 + v16;
*(_DWORD *)(v15 + 14368) += result;
return result;
}