//
// GJBaseGameLayer::processAreaFadeGroupAction from 0x861abc to 0x861e40 (900 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::processAreaEffects @ 0x89c5b0
// > ??> @ 0x586e0
//
// 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
//
// local variable allocation has failed, the output may be wrong!
void GJBaseGameLayer::processAreaFadeGroupAction(
GJBaseGameLayer *a1,
cocos2d::CCArray *a2,
EnterEffectInstance *a3,
cocos2d::CCPoint a4,
bool a5)
{
unsigned __int8 v5; // w4
float m_fromOpacity; // s9
float m_toOpacity; // s11
float *v10; // x26
int m_areaColorCount; // w28
cocos2d::ccArray *data; // x0
GameObject **arr; // x27
GameObject **v14; // x22
GameObject *v15; // x23
int v16; // w19
int v17; // w21
int v18; // w21
int m_areaColorCountTotal; // w0
EnterEffectObject *m_gameObject; // x1
int m_directionType; // w0
float v22; // s2
float v23; // s1
float m_offsetYVariance; // s3
float v25; // s2
float v26; // s0
float m_lengthVariance; // s2
float v28; // s1
float m_deadzone; // s2
int v30; // w0
float v31; // s8
bool v32; // nf
cocos2d::CCArray *TargetGroup; // x23
cocos2d::ccArray *v34; // x0
GameObject **v35; // x28
GameObject **v36; // x23
GameObject *v37; // x0
float m_offsetVariance; // s1
float v39; // s0
float v40; // s8
float v41; // s0
int v43; // [xsp+ACh] [xbp+ACh]
cocos2d::CCPoint v44; // [xsp+B8h] [xbp+B8h] BYREF
cocos2d::CCPoint v45; // [xsp+C0h] [xbp+C0h] BYREF
m_fromOpacity = a3->m_fromOpacity;
v43 = v5;
m_toOpacity = a3->m_toOpacity;
v10 = (float *)a5;
m_areaColorCount = cocos2d::CCArray::count(a2) + a1->m_areaColorCount;
a1->m_areaColorCount = m_areaColorCount;
if ( !a2
|| (data = a2->data, !data->num)
|| (arr = (GameObject **)data->arr, v14 = &arr[data->num - 1], arr > v14)
|| (v15 = *arr) == nullptr )
{
v18 = 0;
v16 = 0;
goto LABEL_11;
}
v16 = 0;
v17 = 0;
do
{
if ( !v15->m_isActivated )
goto LABEL_7;
++v17;
v15->getRealPosition(v15);
m_gameObject = a3->m_gameObject;
m_directionType = m_gameObject->m_directionType;
if ( m_directionType == 1 )
{
m_offsetVariance = a3->m_offsetVariance;
v39 = 0.0;
v40 = v44.x - *v10;
if ( m_offsetVariance == 0.0 )
goto LABEL_40;
goto LABEL_39;
}
if ( m_directionType == 2 )
{
m_offsetVariance = a3->m_offsetVariance;
v40 = v44.y - v10[1];
if ( m_offsetVariance == 0.0 )
{
v41 = v40 + 0.0;
if ( (float)(v40 + 0.0) >= 0.0 )
{
LABEL_41:
v26 = v41 * a3->m_modBack;
goto LABEL_19;
}
goto LABEL_44;
}
LABEL_39:
v39 = m_offsetVariance * a1->m_varianceValues.__elems_[v15->m_varianceIndex + 1];
LABEL_40:
v41 = v40 + v39;
if ( v41 >= 0.0 )
goto LABEL_41;
LABEL_44:
v26 = v41 * a3->m_modFront;
goto LABEL_19;
}
v22 = a3->m_offsetVariance;
v23 = 0.0;
if ( v22 != 0.0 )
v23 = v22 * a1->m_varianceValues.__elems_[v15->m_varianceIndex + 1];
m_offsetYVariance = a3->m_offsetYVariance;
v25 = 0.0;
if ( m_offsetYVariance != 0.0 )
v25 = m_offsetYVariance * *((float *)&a1->m_uID + v15->m_varianceIndex + 1097);
cocos2d::CCPoint::CCPoint(&v45, *v10 + v23, v10[1] + v25);
v26 = cocos2d::ccpDistance(&v44, &v45);
m_gameObject = a3->m_gameObject;
LABEL_19:
m_lengthVariance = a3->m_lengthVariance;
v28 = 0.0;
if ( m_lengthVariance != 0.0 )
v28 = m_lengthVariance * a1->m_varianceValues.__elems_[v15->m_varianceIndex];
m_deadzone = a3->m_deadzone;
v30 = (int)(float)(a3->m_length + v28);
if ( m_deadzone == 0.0 )
{
v31 = v26 / (float)v30;
v32 = v31 < 1.0;
if ( v31 >= 1.0 )
goto LABEL_30;
}
else
{
v31 = (float)((float)(v26 / (float)v30) - m_deadzone) / (float)(1.0 - m_deadzone);
v32 = v31 < 1.0;
if ( v31 >= 1.0 )
{
LABEL_30:
if ( !v32 )
v31 = 1.0;
goto LABEL_25;
}
}
if ( v31 <= 0.0 )
v31 = 0.0;
LABEL_25:
if ( m_gameObject->m_inbound )
v31 = 1.0 - v31;
if ( v43 )
{
TargetGroup = GJBaseGameLayer::getTargetGroup(a1, a3->m_targetGroupIndex, v15->m_uniqueID);
v16 = v16 - 1 + cocos2d::CCArray::count(TargetGroup);
if ( TargetGroup )
{
v34 = TargetGroup->data;
if ( v34->num )
{
v35 = (GameObject **)v34->arr;
v36 = &v35[v34->num - 1];
while ( v36 >= v35 )
{
v37 = *v35;
if ( !*v35 )
break;
++v35;
GameObject::setAreaOpacity(
v37,
m_fromOpacity + (float)((float)(m_toOpacity - m_fromOpacity) * v31),
v31,
a1->m_gameState.m_commandIndex);
}
}
}
}
else
{
GameObject::setAreaOpacity(
v15,
m_fromOpacity + (float)((float)(m_toOpacity - m_fromOpacity) * v31),
v31,
a1->m_gameState.m_commandIndex);
}
LABEL_7:
if ( v14 < ++arr )
break;
v15 = *arr;
}
while ( *arr );
m_areaColorCount = a1->m_areaColorCount;
v18 = v17 + v16;
LABEL_11:
m_areaColorCountTotal = a1->m_areaColorCountTotal;
a1->m_areaColorCount = v16 + m_areaColorCount;
a1->m_areaColorCountTotal = m_areaColorCountTotal + v18;
}