//
// GJBaseGameLayer::processAreaEffects from 0x1402283e0 to 0x140228fb8 (3032 bytes)
//
// 10 xrefs:
// > GJBaseGameLayer::processAreaActions @ 0x140229012
// > GJBaseGameLayer::processAreaActions @ 0x14022902f
// > GJBaseGameLayer::processAreaActions @ 0x140229049
// > LevelEditorLayer::updateVisibility @ 0x1402d9da0
// > LevelEditorLayer::updateVisibility @ 0x1402d9dbf
// > PlayLayer::updateVisibility @ 0x1403b0213
// > PlayLayer::updateVisibility @ 0x1403b0231
// > ??> @ 0x140680498
// > ??> @ 0x1406804a8
// > ??> @ 0x1406cd974
//
// 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::processAreaEffects(
GJBaseGameLayer *a1,
std::vector *a2,
GJAreaActionType a3,
float a4,
bool a5)
{
GJAreaActionType v6; // r14d
float v8; // xmm0_4
std::_Vector_val>, std::_Iterator_base0>>>::pointer Myfirst; // rdx
unsigned __int64 v10; // rcx
std::_List_unchecked_const_iterator>, std::_Iterator_base0>::_Nodeptr Ptr; // rax
std::_List_unchecked_const_iterator>, std::_Iterator_base0>::_Nodeptr v12; // rcx
std::_Vector_val>::pointer Mylast; // rax
std::_Vector_val>::pointer v14; // r15
EnterEffectObject *m_gameObject; // rsi
__int64 v16; // rcx
int m_specialTarget; // ebx
bool v18; // sf
cocos2d::CCDirector *v19; // rax
float m_cameraZoom; // xmm2_4
double v21; // xmm0_8
float v22; // xmm1_4
__int64 v23; // rax
char *v24; // rdx
PlayerObject *m_player1; // rbx
__int64 v26; // rax
__int64 v27; // rax
GameObject *MainObject; // rax
GameObject *v29; // rbx
__int64 v30; // rax
__int64 v31; // rax
int v32; // eax
float m_modFront; // xmm2_4
float v34; // xmm4_4
float v35; // xmm1_4
float v36; // xmm1_4
float v37; // xmm2_4
float m_sectionXFactor; // xmm0_4
float v39; // xmm3_4
float v40; // xmm2_4
float v41; // xmm0_4
float v42; // xmm0_4
float v43; // xmm3_4
float m_sectionYFactor; // xmm2_4
float v45; // xmm5_4
float v46; // xmm3_4
int m_directionType; // r8d
bool m_inbound; // dl
int v49; // r12d
bool m_twoDirections; // cl
bool v51; // al
struct cocos2d::CCPoint v52; // rax
float v53; // xmm1_4
bool v54; // zf
int v55; // r14d
int v56; // esi
int m_targetGroupIndex; // eax
std::_Simple_types::value_type v58; // r13
int m_targetID; // eax
__int64 v60; // rbx
struct cocos2d::CCObject *v61; // rax
cocos2d::CCDictionary *m_groupDict; // rcx
cocos2d::CCPoint v63; // rax
float m_fromOpacity; // xmm9_4
float m_toOpacity; // xmm8_4
cocos2d::CCPoint *v66; // rax
float v67; // xmm8_4
unsigned int v68; // r8d
GJAreaActionType v69; // edx
cocos2d::ccArray *data; // rax
__int64 num; // rcx
GameObject **arr; // r14
GameObject **v73; // r12
GJAreaActionType v74; // r13d
GameObject *v75; // rbx
GameObject *v76; // r8
float AreaObjectValue; // xmm0_4
float v78; // xmm6_4
__int64 m_uniqueID; // rbx
cocos2d::CCDictionary *v80; // rax
cocos2d::CCArray *v81; // rbx
unsigned int v82; // eax
cocos2d::ccArray *v83; // rbx
__int64 v84; // rax
GameObject **v85; // rbx
GameObject **v86; // rsi
cocos2d::CCPoint v87; // rax
cocos2d::CCPoint v88; // rax
cocos2d::CCPoint v89; // rax
unsigned int v90; // eax
bool v91; // [rsp+50h] [rbp-B0h]
float v92; // [rsp+60h] [rbp-A0h]
float v93; // [rsp+64h] [rbp-9Ch]
cocos2d::CCPoint v94; // [rsp+68h] [rbp-98h] BYREF
int v95; // [rsp+70h] [rbp-90h]
int v96; // [rsp+74h] [rbp-8Ch]
int v97; // [rsp+78h] [rbp-88h]
int v98; // [rsp+7Ch] [rbp-84h]
cocos2d::CCPoint v99; // [rsp+80h] [rbp-80h] BYREF
int v100; // [rsp+88h] [rbp-78h]
int v101; // [rsp+8Ch] [rbp-74h]
cocos2d::CCPoint v102; // [rsp+90h] [rbp-70h] BYREF
int v103; // [rsp+98h] [rbp-68h]
cocos2d::CCArray *v104; // [rsp+A0h] [rbp-60h]
char v105[8]; // [rsp+A8h] [rbp-58h] BYREF
char v106[8]; // [rsp+B0h] [rbp-50h] BYREF
char v107[8]; // [rsp+B8h] [rbp-48h] BYREF
char v108[8]; // [rsp+C0h] [rbp-40h] BYREF
cocos2d::CCPoint *v109; // [rsp+C8h] [rbp-38h]
std::_Simple_types::value_type *v110; // [rsp+D0h] [rbp-30h]
char v111[8]; // [rsp+120h] [rbp+20h] BYREF
char v112[8]; // [rsp+128h] [rbp+28h] BYREF
char v113[8]; // [rsp+130h] [rbp+30h] BYREF
cocos2d::CCPoint v114; // [rsp+138h] [rbp+38h] BYREF
cocos2d::CCPoint v115; // [rsp+140h] [rbp+40h] BYREF
cocos2d::CCPoint v116; // [rsp+148h] [rbp+48h] BYREF
cocos2d::CCPoint v117; // [rsp+150h] [rbp+50h] BYREF
cocos2d::CCPoint v118; // [rsp+158h] [rbp+58h] BYREF
GJAreaActionType v119; // [rsp+250h] [rbp+150h] BYREF
unsigned int v120; // [rsp+258h] [rbp+158h]
GJAreaActionType v121; // [rsp+260h] [rbp+160h]
float v122; // [rsp+268h] [rbp+168h]
v122 = a4;
v121 = a3;
v6 = a3;
v8 = a4;
Myfirst = a1->m_gameState.m_unsortedAreaEffects._Vec._Mypair._Myval2._Myfirst;
v10 = 2
* ((0x100000001B3LL
* (HIBYTE(a3)
^ (0x100000001B3LL
* (BYTE2(a3)
^ (0x100000001B3LL * (BYTE1(a3) ^ (0x100000001B3LL * ((unsigned __int8)a3 ^ 0xCBF29CE484222325uLL))))))))
& a1->m_gameState.m_unsortedAreaEffects._Mask);
Ptr = Myfirst[v10 + 1]._Ptr;
if ( Ptr != a1->m_gameState.m_unsortedAreaEffects._List._Mypair._Myval2._Myhead )
{
v12 = Myfirst[v10]._Ptr;
if ( a3 == *((_DWORD *)Ptr + 4) )
goto LABEL_7;
while ( Ptr != v12 )
{
Ptr = *((std::_List_unchecked_const_iterator>, std::_Iterator_base0>::_Nodeptr *)Ptr
+ 1);
if ( a3 == *((_DWORD *)Ptr + 4) )
goto LABEL_7;
}
}
Ptr = nullptr;
LABEL_7:
if ( Ptr )
{
sub_1402520F0(
a2->_Mypair._Myval2._Myfirst,
a2->_Mypair._Myval2._Mylast,
a2->_Mypair._Myval2._Mylast - a2->_Mypair._Myval2._Myfirst,
sub_140205230);
v119 = v6;
sub_14005D780(&a1->m_gameState.m_unsortedAreaEffects._Traitsobj._Mypair._Myval2._Myval2, (unsigned __int8 *)&v119);
v8 = v122;
}
Mylast = a2->_Mypair._Myval2._Mylast;
v14 = a2->_Mypair._Myval2._Myfirst;
v110 = Mylast;
if ( v14 == Mylast )
return;
do
{
if ( v14->m_paused )
goto LABEL_128;
m_gameObject = v14->m_gameObject;
EnterEffectInstance::updateTransitions(v14, v8, a1);
cocos2d::CCPoint::CCPoint(&v94);
cocos2d::CCPoint::CCPoint(&v102);
m_specialTarget = m_gameObject->m_specialTarget;
v18 = m_specialTarget < 0;
if ( !m_specialTarget )
{
m_specialTarget = v14->m_centerID;
v18 = m_specialTarget < 0;
}
if ( v18 )
{
if ( m_specialTarget == -1 )
goto LABEL_29;
if ( m_specialTarget != -2 )
{
v19 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v16);
cocos2d::CCDirector::getWinSize(v19);
m_cameraZoom = a1->m_gameState.m_cameraZoom;
v92 = v92 / m_cameraZoom;
v93 = v93 / m_cameraZoom;
v21 = cocos2d::CCPoint::CCPoint(&v99);
switch ( m_specialTarget )
{
case -11:
v22 = v92;
break;
case -10:
v22 = v92;
break;
case -9:
v22 = v92;
break;
case -8:
v22 = v92 * 0.5;
break;
case -7:
v22 = v92 * 0.5;
break;
case -6:
v22 = 0.0;
break;
case -5:
v22 = 0.0;
break;
case -4:
v22 = 0.0;
break;
default:
v22 = v92 * 0.5;
break;
}
cocos2d::CCPoint::CCPoint(*(float *)&v21, v22);
cocos2d::CCPoint::operator=(&v99, v23);
cocos2d::CCPoint::operator+(&a1->m_gameState.m_cameraPosition, v105);
cocos2d::CCPoint::operator=(&v94, v105);
cocos2d::CCPoint::operator-(&a1->m_gameState.m_cameraPosition, v106, &a1->m_gameState.m_cameraPosition2);
v24 = v106;
goto LABEL_36;
}
if ( !a1->m_gameState.m_isDualMode )
LABEL_29:
m_player1 = a1->m_player1;
else
m_player1 = a1->m_player2;
v26 = (__int64)m_player1->getPosition_0(m_player1);
cocos2d::CCPoint::operator=(&v94, v26);
v27 = (__int64)m_player1->getPosition_0(m_player1);
cocos2d::CCPoint::operator-(v27, v107, &m_player1->m_lastPosition);
v24 = v107;
}
else
{
MainObject = GJBaseGameLayer::tryGetMainObject(a1, m_specialTarget);
v29 = MainObject;
if ( !MainObject )
goto LABEL_37;
if ( (unsigned int)(v6 - 3) > 1 && GJBaseGameLayer::resetAreaObjectValues(a1, MainObject, 1) )
a1->updateObjectSection(a1, v29);
v30 = ((__int64 (__fastcall *)(GameObject *, char *))v29->getRealPosition)(v29, v111);
cocos2d::CCPoint::operator=(&v94, v30);
v31 = ((__int64 (__fastcall *)(GameObject *, char *))v29->getRealPosition)(v29, v112);
cocos2d::CCPoint::operator-(v31, v108, &v29->m_lastPosition);
v24 = v108;
}
LABEL_36:
cocos2d::CCPoint::operator=(&v102, v24);
LABEL_37:
v32 = (int)(float)((float)((float)(v14->m_lengthVariance + v14->m_length) + v14->m_offset) + v14->m_offsetVariance);
m_gameObject->m_areaRange = v32;
m_modFront = v14->m_modFront;
if ( fabs(v14->m_modBack) <= fabs(m_modFront) )
m_modFront = v14->m_modBack;
v34 = (float)(1.0 / fabs(m_modFront)) * (float)v32;
v35 = v94.x - v34;
if ( (float)(v94.x - v34) > 0.0 )
{
m_sectionXFactor = a1->m_sectionXFactor;
if ( v35 < 10000000.0 )
v37 = m_sectionXFactor * v35;
else
v37 = m_sectionXFactor * 10000000.0;
v36 = a1->m_sectionXFactor;
}
else
{
v36 = a1->m_sectionXFactor;
v37 = 0.0;
m_sectionXFactor = v36;
}
v39 = v94.x + v34;
v97 = (int)v37;
if ( (float)(v94.x + v34) > 0.0 )
{
v36 = m_sectionXFactor;
if ( v39 < 10000000.0 )
v40 = m_sectionXFactor * v39;
else
v40 = m_sectionXFactor * 10000000.0;
}
else
{
v40 = 0.0;
}
v41 = v94.y - v34;
v96 = (int)v40;
if ( (float)(v94.y - v34) > 0.0 )
{
m_sectionYFactor = a1->m_sectionYFactor;
if ( v41 < 10000000.0 )
v43 = m_sectionYFactor * v41;
else
v43 = m_sectionYFactor * 10000000.0;
v42 = a1->m_sectionYFactor;
}
else
{
v42 = a1->m_sectionYFactor;
v43 = 0.0;
m_sectionYFactor = v42;
}
v45 = v94.y + v34;
v95 = (int)v43;
if ( (float)(v94.y + v34) > 0.0 )
{
v42 = m_sectionYFactor;
if ( v45 < 10000000.0 )
v46 = m_sectionYFactor * v45;
else
v46 = m_sectionYFactor * 10000000.0;
}
else
{
v46 = 0.0;
}
m_directionType = m_gameObject->m_directionType;
m_inbound = m_gameObject->m_inbound;
v49 = (int)v46;
v98 = (int)v46;
if ( m_directionType == 1 )
{
v98 = (int)(float)(v42 * 10000000.0);
v49 = v98;
m_twoDirections = m_gameObject->m_twoDirections;
v95 = 0;
if ( m_inbound )
{
v96 = (int)(float)(v36 * 10000000.0);
if ( !m_twoDirections )
goto LABEL_76;
goto LABEL_75;
}
if ( !m_twoDirections )
goto LABEL_75;
}
else
{
if ( m_directionType == 2 )
{
v96 = (int)(float)(v36 * 10000000.0);
v51 = m_gameObject->m_twoDirections;
v97 = 0;
if ( m_inbound )
{
v98 = (int)(float)(v42 * 10000000.0);
v49 = v98;
if ( v51 )
v95 = 0;
}
else if ( !v51 )
{
v95 = 0;
}
goto LABEL_76;
}
if ( m_inbound )
{
v96 = (int)(float)(v36 * 10000000.0);
v49 = (int)(float)(v42 * 10000000.0);
v95 = 0;
v98 = v49;
LABEL_75:
v97 = 0;
}
}
LABEL_76:
if ( v102.x != 0.0 )
m_gameObject->m_negativeTargetX = v102.x < 0.0;
v14->m_easeIndex += 2;
if ( !v6 )
{
if ( v14->m_moveAngleVariance == 0.0 )
{
m_gameObject->m_startAngle = 1;
v52 = cocos2d::ccpForAngle((cocos2d *)v113, (float)(v14->m_moveAngle - 90.0) * 0.017453292);
((void (__fastcall *)(_QWORD, _QWORD))cocos2d::CCPoint::operator=)(&m_gameObject->m_anglePosition, v52);
}
else
{
m_gameObject->m_startAngle = 0;
}
}
if ( m_gameObject->m_directionType )
{
v14->m_offsetY = v14->m_offset;
v14->m_offsetYVariance = v14->m_offsetVariance;
}
v53 = v94.y + v14->m_offsetY;
v94.x = v94.x + v14->m_offset;
v94.y = v53;
if ( m_gameObject->m_twoDirections )
v14->m_modFront = -fabs(v14->m_modFront);
v54 = v14->m_targetGroupIndex == 0;
v18 = v14->m_targetGroupIndex < 0;
v55 = 0;
v100 = 0;
v101 = 0;
v56 = 0;
v103 = (!v18 && !v54) + 1;
do
{
m_targetGroupIndex = v14->m_targetGroupIndex;
if ( m_targetGroupIndex <= 0 )
{
m_targetID = v14->m_targetID;
if ( m_targetID > 9999 )
m_targetID = 9999;
if ( m_targetID < 0 )
m_targetID = 0;
v60 = (unsigned int)m_targetID;
v58 = a1->m_groups._Mypair._Myval2._Myfirst[m_targetID];
v104 = v58;
if ( !v58 )
{
v61 = (struct cocos2d::CCObject *)cocos2d::CCArray::create(9999);
m_groupDict = a1->m_groupDict;
v104 = (cocos2d::CCArray *)v61;
v58 = (std::_Simple_types::value_type)v61;
cocos2d::CCDictionary::setObject(m_groupDict, v61, (unsigned int)v60);
a1->m_groups._Mypair._Myval2._Myfirst[v60] = v58;
}
}
else
{
v58 = (std::_Simple_types::value_type)cocos2d::CCArray::objectAtIndex(
a1->m_targetGroupsArray,
v56 + m_targetGroupIndex - 1);
v104 = v58;
}
switch ( v121 )
{
case 0:
cocos2d::CCPoint::CCPoint(&v118);
GJBaseGameLayer::processAreaMoveGroupAction(a1, v58, v14, v89, v97, v96, v95, v49, v55, v56 == 1, v91);
goto LABEL_126;
case 1:
cocos2d::CCPoint::CCPoint(&v117);
GJBaseGameLayer::processAreaRotateGroupAction(a1, v58, v14, v88, v97, v96, v95, v49, v55, v56 == 1, a5);
goto LABEL_126;
case 2:
cocos2d::CCPoint::CCPoint(&v116);
GJBaseGameLayer::processAreaTransformGroupAction(a1, v58, v14, v87, v97, v96, v95, v49, v55, v56 == 1, a5);
goto LABEL_126;
}
if ( v121 != 3 )
{
if ( v121 == Tint )
{
cocos2d::CCPoint::CCPoint(&v114);
GJBaseGameLayer::processAreaTintGroupAction(a1, v58, v14, v63, v56 == 1);
}
goto LABEL_126;
}
cocos2d::CCPoint::CCPoint(&v115);
m_fromOpacity = v14->m_fromOpacity;
m_toOpacity = v14->m_toOpacity;
v109 = v66;
v67 = m_toOpacity - m_fromOpacity;
a1->m_areaColorCount += cocos2d::CCArray::count(v58);
v68 = 0;
v69 = 0;
v120 = 0;
if ( !v58 )
goto LABEL_122;
data = v58->data;
num = data->num;
if ( !(_DWORD)num )
goto LABEL_122;
arr = (GameObject **)data->arr;
v73 = &arr[num - 1];
if ( arr > v73 )
goto LABEL_121;
v74 = 0;
while ( 1 )
{
v75 = *arr;
if ( !*arr )
break;
if ( v75->m_isActivated )
{
v76 = *arr;
LOBYTE(v119) = 0;
++v74;
AreaObjectValue = GJBaseGameLayer::getAreaObjectValue(a1, v14, v76, v109, (bool *)&v119);
v78 = (float)(AreaObjectValue * v67) + m_fromOpacity;
if ( v56 == 1 )
{
m_uniqueID = v75->m_uniqueID;
v80 = (cocos2d::CCDictionary *)cocos2d::CCArray::objectAtIndex(
a1->m_targetGroupsArray,
v14->m_targetGroupIndex + 1);
v81 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(v80, m_uniqueID);
v82 = cocos2d::CCArray::count(v81);
v68 = v82 + v120 - 1;
v120 = v68;
if ( v81 )
{
v83 = v81->data;
v84 = v83->num;
if ( (_DWORD)v84 )
{
v85 = (GameObject **)v83->arr;
v86 = &v85[v84 - 1];
if ( v85 > v86 )
{
v56 = v101;
}
else
{
do
{
if ( !*v85 )
break;
GameObject::setAreaOpacity(*v85++, v78, AreaObjectValue, a1->m_gameState.m_commandIndex);
}
while ( v85 <= v86 );
v56 = v101;
v68 = v120;
}
}
}
goto LABEL_117;
}
GameObject::setAreaOpacity(v75, v78, AreaObjectValue, a1->m_gameState.m_commandIndex);
}
v68 = v120;
LABEL_117:
if ( ++arr > v73 )
goto LABEL_120;
}
v68 = v120;
LABEL_120:
v119 = v74;
v58 = v104;
v69 = v119;
LABEL_121:
v55 = v100;
LABEL_122:
a1->m_areaColorCount += v68;
a1->m_areaColorCountTotal += v68 + v69;
LABEL_126:
v90 = cocos2d::CCArray::count(v58);
v49 = v98;
++v56;
v55 += v90;
v101 = v56;
v100 = v55;
}
while ( v56 < v103 );
v6 = v121;
Mylast = v110;
LABEL_128:
v8 = v122;
++v14;
}
while ( v14 != Mylast );
}