//
// GJBaseGameLayer::processAreaMoveGroupAction from 0x14022a4d0 to 0x14022aaac (1500 bytes)
//
// 4 xrefs:
// > GJBaseGameLayer::processAreaEffects @ 0x140228ecd
// > ??> @ 0x140680790
// > ??> @ 0x1406807e4
// > ??> @ 0x1406cdb00
//
// 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::processAreaMoveGroupAction(
GJBaseGameLayer *a1,
cocos2d::CCArray *a2,
EnterEffectInstance *a3,
cocos2d::CCPoint a4,
int a5,
int a6,
int a7,
int a8,
int a9,
bool a10,
bool a11)
{
EnterEffectObject *m_gameObject; // r13
float m_relativeFade; // xmm13_4
unsigned int v16; // edx
int v17; // r8d
cocos2d::ccArray *data; // rax
__int64 num; // rcx
GameObject **arr; // r15
int v21; // r12d
__int64 v22; // rbx
GameObject *v23; // rsi
bool v24; // zf
int m_outerSectionIndex; // eax
int m_middleSectionIndex; // eax
bool v27; // bp
GameObject *v28; // rdx
float AreaObjectValue; // xmm0_4
float v30; // xmm10_4
float v31; // xmm6_4
__int64 m_varianceIndex; // rcx
float x; // xmm8_4
float v34; // xmm7_4
float v35; // xmm10_4
float m_moveDistanceVariance; // xmm7_4
float v37; // xmm7_4
float v38; // xmm7_4
float EasedAreaValue; // xmm10_4
__int64 v40; // rax
float y; // xmm9_4
float v42; // xmm1_4
float v43; // xmm0_4
struct cocos2d::CCPoint v44; // rax
cocos2d::CCPoint *p_m_anglePosition; // rdx
__int64 m_uniqueID; // rbx
cocos2d::CCDictionary *v47; // rax
cocos2d::CCArray *v48; // rbx
cocos2d::ccArray *v49; // rbx
__int64 v50; // rax
GameObject **v51; // rbx
GameObject **i; // rbp
GameObject *v53; // rdx
cocos2d::CCPoint v54; // [rsp+30h] [rbp-128h] BYREF
_BYTE v55[8]; // [rsp+38h] [rbp-120h] BYREF
__int64 v56; // [rsp+40h] [rbp-118h]
GameObject **v57; // [rsp+48h] [rbp-110h]
_BYTE v58[8]; // [rsp+50h] [rbp-108h] BYREF
_BYTE v59[16]; // [rsp+60h] [rbp-F8h] BYREF
bool v60; // [rsp+160h] [rbp+8h]
unsigned int v61; // [rsp+168h] [rbp+10h]
int v62; // [rsp+170h] [rbp+18h]
m_gameObject = a3->m_gameObject;
m_relativeFade = m_gameObject->m_relativeFade;
if ( m_relativeFade < 0.0 )
m_relativeFade = 0.0;
a1->m_areaMovedCount += cocos2d::CCArray::count(a2);
v16 = 0;
v17 = 0;
v61 = 0;
if ( a2 )
{
data = a2->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (GameObject **)data->arr;
v57 = &arr[num - 1];
if ( arr <= v57 )
{
v21 = a9 - 1;
v22 = 4LL * a9 - 4;
while ( 1 )
{
v23 = *arr;
if ( !*arr )
{
LABEL_56:
v16 = v61;
goto LABEL_57;
}
v22 += 4;
++v21;
v24 = !v23->m_isActivated;
v56 = v22;
if ( !v24 )
break;
m_outerSectionIndex = v23->m_outerSectionIndex;
if ( m_outerSectionIndex <= a6 && m_outerSectionIndex >= a5 )
{
m_middleSectionIndex = v23->m_middleSectionIndex;
if ( m_middleSectionIndex <= a8 && m_middleSectionIndex >= a7 )
break;
}
LABEL_55:
if ( ++arr > v57 )
goto LABEL_56;
}
v62 = v17 + 1;
v27 = GJBaseGameLayer::resetAreaObjectValues(a1, v23, 1);
v60 = v27;
a11 = 0;
AreaObjectValue = GJBaseGameLayer::getAreaObjectValue(a1, a3, v23, *(cocos2d::CCPoint **)&a4, &a11);
if ( AreaObjectValue >= 1.0 )
{
if ( m_gameObject->m_easeOutEnabled )
*(std::_Vector_val>::pointer)((char *)a3->m_easeIndices._Mypair._Myval2._Myfirst
+ v22) = 0;
goto LABEL_52;
}
v30 = 0.0;
v31 = 0.0;
if ( a3->m_gameObject->m_xyMode )
{
m_varianceIndex = v23->m_varianceIndex;
x = (float)(a1->m_varianceValues._Elems[m_varianceIndex + 8] * a3->m_moveXVariance) + a3->m_moveX;
v34 = (float)(a1->m_varianceValues._Elems[m_varianceIndex + 9] * a3->m_moveYVariance) + a3->m_moveY;
if ( x != 0.0 || v34 != 0.0 )
{
v35 = 1.0 - GJBaseGameLayer::getEasedAreaValue(a1, v28, a3, AreaObjectValue, a11, v21);
v31 = v35 * v34;
LABEL_36:
v30 = v35 * x;
}
LABEL_37:
if ( a10 )
{
m_uniqueID = v23->m_uniqueID;
v47 = (cocos2d::CCDictionary *)cocos2d::CCArray::objectAtIndex(
a1->m_targetGroupsArray,
a3->m_targetGroupIndex + 1);
v48 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v47, m_uniqueID);
v61 = cocos2d::CCArray::count(v48) + v61 - 1;
if ( a3->m_gameObject->m_dontEditAreaParent )
v23->m_unk508 = 1;
if ( v48 )
{
v49 = v48->data;
v50 = v49->num;
if ( (_DWORD)v50 )
{
v51 = (GameObject **)v49->arr;
for ( i = &v51[v50 - 1]; v51 <= i; ++v51 )
{
v53 = *v51;
if ( !*v51 )
break;
if ( !v53->m_unk508 )
GJBaseGameLayer::moveAreaObject(a1, v53, v30, v31);
}
v27 = v60;
}
}
v22 = v56;
v23->m_unk508 = 0;
}
else
{
GJBaseGameLayer::moveAreaObject(a1, v23, v30, v31);
}
LABEL_52:
if ( v27 )
a1->updateObjectSection(a1, v23);
v17 = v62;
goto LABEL_55;
}
m_moveDistanceVariance = a3->m_moveDistanceVariance;
if ( m_moveDistanceVariance == 0.0 )
v37 = 0.0;
else
v37 = m_moveDistanceVariance * a1->m_varianceValues._Elems[v23->m_varianceIndex + 10];
v38 = v37 + a3->m_moveDistance;
if ( v38 == 0.0 )
goto LABEL_37;
EasedAreaValue = GJBaseGameLayer::getEasedAreaValue(a1, v28, a3, AreaObjectValue, a11, v21);
cocos2d::CCPoint::CCPoint(&v54);
if ( m_gameObject->m_relative )
{
v40 = ((__int64 (__fastcall *)(GameObject *, _BYTE *))v23->getRealPosition)(v23, v58);
((void (__fastcall *)(_QWORD, _QWORD, _QWORD))cocos2d::CCPoint::operator-)(v40, v55, a4);
cocos2d::CCPoint::operator=(&v54, v55);
x = v54.x;
y = v54.y;
v42 = (float)(x * x) + (float)(y * y);
if ( v42 < 0.0 )
v43 = sqrtf(v42);
else
v43 = fsqrt(v42);
if ( m_relativeFade > v43 )
v38 = v38 * (float)(v43 * (float)(1.0 / m_relativeFade));
if ( v43 <= 0.0 )
goto LABEL_35;
cocos2d::CCPoint::CCPoint(v43, x / v43);
}
else
{
if ( m_gameObject->m_startAngle )
{
p_m_anglePosition = &m_gameObject->m_anglePosition;
LABEL_34:
cocos2d::CCPoint::operator=(&v54, p_m_anglePosition);
y = v54.y;
x = v54.x;
LABEL_35:
v35 = (float)(1.0 - EasedAreaValue) * v38;
v31 = v35 * y;
goto LABEL_36;
}
v44 = cocos2d::ccpForAngle(
(cocos2d *)v59,
(float)((float)((float)(a1->m_varianceValues._Elems[v23->m_varianceIndex + 11]
* a3->m_moveAngleVariance)
+ a3->m_moveAngle)
- 90.0)
* 0.017453292);
}
p_m_anglePosition = (cocos2d::CCPoint *)v44;
goto LABEL_34;
}
}
}
LABEL_57:
a1->m_areaMovedCount += v16;
a1->m_areaMovedCountTotal += v16 + v17;
}