//
// GJBaseGameLayer::processAreaFadeGroupAction from 0x47415c to 0x474294 (312 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::processAreaEffects @ 0x496ab8
//
// 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::processAreaFadeGroupAction(
GJBaseGameLayer *a1,
cocos2d::CCArray *a2,
EnterEffectInstance *a3,
cocos2d::CCPoint a4,
bool a5)
{
float x; // r10
cocos2d::CCArray *num; // r4
float m_fromOpacity; // s17
float m_toOpacity; // s19
cocos2d::ccArray *v11; // r3
cocos2d::CCObject **arr; // r7
char *v13; // r6
cocos2d::CCArray *v14; // r8
cocos2d::CCObject **v15; // r11
GameObject *v16; // r6
GameObject *v17; // t1
float AreaObjectValue; // r0
float v19; // s16
float v20; // s18
cocos2d::CCArray *TargetGroup; // r6
cocos2d::ccArray *data; // r3
int v23; // r6
cocos2d::CCObject **v24; // r3
unsigned int v25; // r6
GameObject **i; // r12
GameObject *v27; // r0
GameObject **v28; // r12
GameObject *v29; // t1
GameObject **v30; // [sp+14h] [bp-10h]
bool v31; // [sp+1Bh] [bp-9h] BYREF
x = a4.x;
num = a2;
m_fromOpacity = a3->m_fromOpacity;
m_toOpacity = a3->m_toOpacity;
a1->m_areaColorCount += cocos2d::CCArray::count(a2);
if ( num && (v11 = num->data, (num = (cocos2d::CCArray *)v11->num) != nullptr) )
{
arr = v11->arr;
v13 = (char *)&num[19173961].m_uID + 3;
num = nullptr;
v14 = nullptr;
v15 = &arr[(_DWORD)v13];
while ( arr <= v15 )
{
v17 = (GameObject *)*arr++;
v16 = v17;
if ( !v17 )
break;
if ( v16->m_isActivated )
{
v31 = 0;
v14 = (cocos2d::CCArray *)((char *)v14 + 1);
AreaObjectValue = GJBaseGameLayer::getAreaObjectValue(a1, a3, v16, (cocos2d::CCPoint *)LODWORD(x), &v31);
v19 = AreaObjectValue;
v20 = m_fromOpacity + (float)((float)(m_toOpacity - m_fromOpacity) * AreaObjectValue);
if ( LOBYTE(a4.y) )
{
TargetGroup = GJBaseGameLayer::getTargetGroup(a1, a3->m_targetGroupIndex, v16->m_uniqueID);
num = (cocos2d::CCArray *)((char *)&num->data + cocos2d::CCArray::count(TargetGroup) - 53);
if ( TargetGroup )
{
data = TargetGroup->data;
if ( data->num )
{
v23 = data->num + 0x40000000;
v24 = data->arr;
v25 = (unsigned int)&v24[v23 - 1];
for ( i = (GameObject **)v24; (unsigned int)i <= v25; i = v30 )
{
v29 = *i;
v28 = i + 1;
v27 = v29;
if ( !v29 )
break;
v30 = v28;
GameObject::setAreaOpacity(v27, v20, v19, a1->m_gameState.m_commandIndex);
}
}
}
}
else
{
GameObject::setAreaOpacity(v16, v20, AreaObjectValue, a1->m_gameState.m_commandIndex);
}
}
}
}
else
{
v14 = num;
}
a1->m_areaColorCount += (int)num;
a1->m_areaColorCountTotal += (int)v14 + (_DWORD)num;
}