//
// GJBaseGameLayer::processAreaEffects from 0x89c22c to 0x89cdb8 (2956 bytes)
//
// 6 xrefs:
// > GJBaseGameLayer::processAreaActions @ 0x89ce1c
// > GJBaseGameLayer::processAreaActions @ 0x89ce3c
// > GJBaseGameLayer::processAreaActions @ 0x89ce54
// > GJBaseGameLayer::processAreaVisualActions @ 0x89e96c
// > GJBaseGameLayer::processAreaVisualActions @ 0x89e990
// > ??> @ 0xb8e18
//
// 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)
{
__int64 *p_m_unsortedAreaEffects; // x21
EnterEffectInstance *v10; // x28
EnterEffectObject *m_gameObject; // x22
int m_specialTarget; // w20
GameObject *MainObject; // x0
GameObject *v14; // x21
signed int m_commandIndex; // w1
float v16; // s0
float v17; // s1
const cocos2d::CCPoint *v18; // x0
float v19; // s0
float v20; // s1
float m_offset; // s4
float v22; // s1
float v23; // s2
int v24; // w0
double v25; // d3
double v26; // d0
float x; // s3
float v28; // s0
float v29; // s5
float m_sectionXFactor; // s1
float v31; // s6
int v32; // w20
float y; // s1
float v34; // s5
float m_sectionYFactor; // s6
float v36; // s0
int v37; // w1
int m_directionType; // w0
float m_offsetY; // s0
_BOOL4 m_twoDirections; // w0
int m_targetGroupIndex; // w20
int v42; // w19
int v43; // w23
int v44; // w21
int v45; // w23
int v46; // w1
cocos2d::CCArray *Group; // x20
bool v48; // w25
float m_offsetVariance; // w0
double v50; // d0
int v51; // w0
cocos2d::CCDirector *v52; // x0
float m_cameraZoom; // s0
float v54; // s1
float v55; // s2
float v56; // s0
float v57; // s0
float v58; // s1
float v59; // s0
float v60; // s1
float v61; // s0
float v62; // s1
PlayerObject *m_player2; // x20
float v64; // s0
float v65; // s1
__int64 v66; // x23
const cocos2d::CCPoint *LastPosition; // x0
float v68; // s0
float v69; // s1
int v70; // w0
float v71; // s0
int v72; // w0
float m_positionXOffset; // s0
int v74; // w20
double v75; // d1
float m_positionYOffset; // s0
double v77; // d1
float m_unk2BC; // s0
float m_unk2C0; // s2
float v80; // s1
float v81; // s3
float v82; // s4
float m_unk2A8; // s0
float m_unk2B0; // s2
float v85; // s0
float v86; // s3
int m_areaObjectsCount; // w2
int m_areaObjectsIndex; // w3
GameObject **v89; // x1
int v90; // w0
unsigned int m_unk4C4; // w2
double m_positionX; // d1
float m_positionY; // s0
float m_scaleX; // w2
float m_scaleY; // w1
float v96; // s0
float v97; // s1
float v98; // s0
float v99; // s1
float v100; // s2
float v101; // s1
float v102; // s0
float v103; // s1
float v104; // s0
float v105; // s1
EnterEffectInstance *m_start; // x24
EnterEffectInstance *m_finish; // x23
EnterEffectInstance *v108; // x19
__int64 v109; // x0
EnterEffectInstance *v110; // [xsp+B8h] [xbp+98h]
int v111; // [xsp+D0h] [xbp+B0h]
int v112; // [xsp+D4h] [xbp+B4h]
int v113; // [xsp+D8h] [xbp+B8h]
int v114; // [xsp+DCh] [xbp+BCh]
cocos2d::CCPoint v115; // [xsp+E8h] [xbp+C8h] BYREF
cocos2d::CCPoint v116; // [xsp+F0h] [xbp+D0h] BYREF
float v117; // [xsp+F8h] [xbp+D8h]
float v118; // [xsp+FCh] [xbp+DCh]
cocos2d::CCPoint v119; // [xsp+100h] [xbp+E0h] BYREF
cocos2d::CCPoint v120; // [xsp+108h] [xbp+E8h] BYREF
GameObject *v121; // [xsp+110h] [xbp+F0h] BYREF
cocos2d::CCPoint v122; // 0:kr10_8.8
cocos2d::CCPoint v123; // 0:s0.4,4:s1.4
cocos2d::CCPoint v124; // 0:s0.4,4:s1.4
cocos2d::CCPoint v125; // 0:s0.4,4:s1.4
cocos2d::CCPoint v126; // 0:s0.4,4:s1.4
cocos2d::CCPoint v127; // 0:s0.4,4:s1.4
p_m_unsortedAreaEffects = (__int64 *)&a1->m_gameState.m_unsortedAreaEffects;
if ( sub_855BD4(&a1->m_gameState.m_unsortedAreaEffects._M_h._M_buckets, a3) )
{
m_start = a2->m_start;
m_finish = a2->m_finish;
if ( m_finish != a2->m_start )
{
std::__introsort_loop<__gnu_cxx::__normal_iterator>,long,__gnu_cxx::__ops::_Iter_comp_iter>(
(__int64)a2->m_start,
(unsigned __int64)a2->m_finish,
2 * (63 - __clz(0xF83E0F83E0F83E1LL * (((char *)m_finish - (char *)m_start) >> 3))),
(__int64 (__fastcall *)(__int64, __int64))compEnterEffectSort);
if ( (char *)m_finish - (char *)m_start <= 4487 )
{
std::__insertion_sort<__gnu_cxx::__normal_iterator>,__gnu_cxx::__ops::_Iter_comp_iter>(
(__int64)m_start,
(__int64)m_finish,
(unsigned __int8 (__fastcall *)(char *, __int64))compEnterEffectSort);
LODWORD(v121) = a3;
sub_888850(p_m_unsortedAreaEffects, (int *)&v121);
goto LABEL_2;
}
v108 = m_start + 16;
std::__insertion_sort<__gnu_cxx::__normal_iterator>,__gnu_cxx::__ops::_Iter_comp_iter>(
(__int64)m_start,
(__int64)&m_start[16],
(unsigned __int8 (__fastcall *)(char *, __int64))compEnterEffectSort);
if ( m_finish != &m_start[16] )
{
do
{
v109 = (__int64)v108++;
std::__unguarded_linear_insert<__gnu_cxx::__normal_iterator>,__gnu_cxx::__ops::_Val_comp_iter>(
v109,
(unsigned __int8 (__fastcall *)(char *, __int64))compEnterEffectSort);
}
while ( m_finish != v108 );
}
}
LODWORD(v121) = a3;
sub_888850(p_m_unsortedAreaEffects, (int *)&v121);
}
LABEL_2:
v10 = a2->m_start;
v110 = a2->m_finish;
if ( a2->m_start != v110 )
{
while ( v10->m_paused )
{
LABEL_4:
if ( v110 == ++v10 )
return;
}
m_gameObject = v10->m_gameObject;
EnterEffectInstance::updateTransitions(v10, a4, a1);
cocos2d::CCPoint::CCPoint(&v115);
cocos2d::CCPoint::CCPoint(&v116);
m_specialTarget = m_gameObject->m_specialTarget;
if ( !m_specialTarget )
m_specialTarget = v10->m_centerID;
if ( m_specialTarget < 0 )
{
if ( (unsigned int)(m_specialTarget + 2) <= 1 )
{
if ( m_specialTarget == -2 && a1->m_gameState.m_isDualMode )
m_player2 = a1->m_player2;
else
m_player2 = a1->m_player1;
v64 = ((float (__fastcall *)(PlayerObject *))m_player2->getPosition)(m_player2);
cocos2d::CCPoint::operator=(&v115, v64, v65);
v66 = (__int64)m_player2->getPosition(m_player2);
LastPosition = GameObject::getLastPosition(m_player2);
cocos2d::CCPoint::operator-(&v120, v66, LastPosition);
cocos2d::CCPoint::operator=(&v116, v68, v69);
}
else
{
v52 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v52);
m_cameraZoom = a1->m_gameState.m_cameraZoom;
v117 = v117 / m_cameraZoom;
v118 = v118 / m_cameraZoom;
cocos2d::CCPoint::CCPoint(&v119, &stru_1242DA8);
switch ( m_specialTarget )
{
case -11:
v96 = v117;
goto LABEL_115;
case -10:
v55 = v118;
v56 = v117;
v54 = 0.5;
goto LABEL_66;
case -9:
v96 = v117;
v97 = 0.0;
goto LABEL_116;
case -8:
v100 = v117;
v101 = v118;
goto LABEL_118;
case -7:
v100 = v117;
v101 = 0.0;
LABEL_118:
cocos2d::CCPoint::CCPoint(&v120, v100 * 0.5, v101);
cocos2d::CCPoint::operator=(&v119, v102, v103);
goto LABEL_67;
case -6:
v96 = 0.0;
LABEL_115:
v97 = v118;
LABEL_116:
cocos2d::CCPoint::CCPoint(&v120, v96, v97);
cocos2d::CCPoint::operator=(&v119, v98, v99);
goto LABEL_67;
case -5:
v55 = v118;
v56 = 0.0;
v54 = 0.5;
goto LABEL_66;
case -4:
cocos2d::CCPoint::CCPoint(&v120, 0.0, 0.0);
cocos2d::CCPoint::operator=(&v119, v104, v105);
goto LABEL_67;
default:
v54 = 0.5;
v55 = v118;
v56 = v117 * 0.5;
LABEL_66:
cocos2d::CCPoint::CCPoint(&v120, v56, v55 * v54);
cocos2d::CCPoint::operator=(&v119, v57, v58);
LABEL_67:
cocos2d::CCPoint::operator+(&v120, &a1->m_gameState.m_cameraPosition, &v119);
cocos2d::CCPoint::operator=(&v115, v59, v60);
cocos2d::CCPoint::operator-(&v120, &a1->m_gameState.m_cameraPosition, &a1->m_gameState.m_cameraPosition2);
cocos2d::CCPoint::operator=(&v116, v61, v62);
break;
}
}
}
else
{
MainObject = GJBaseGameLayer::tryGetMainObject(a1, m_specialTarget);
v14 = MainObject;
if ( MainObject )
{
if ( (unsigned int)(a3 - 3) > 1 )
{
m_commandIndex = a1->m_gameState.m_commandIndex;
if ( m_commandIndex > MainObject->m_unk4C8 )
{
if ( !MainObject->m_isDecoration2 )
{
m_unk4C4 = MainObject->m_unk4C4;
if ( m_commandIndex != m_unk4C4 )
{
m_positionX = MainObject->m_positionX;
MainObject->m_unk4C4 = m_commandIndex;
*(float *)&m_positionX = m_positionX;
m_positionY = MainObject->m_positionY;
MainObject->m_lastPosition.x = *(float *)&m_positionX;
MainObject->m_lastPosition.y = m_positionY;
GameObject::dirtifyObjectRect(MainObject);
m_unk4C4 = a1->m_gameState.m_commandIndex;
}
m_commandIndex = m_unk4C4;
if ( v14->m_unk4CC != m_unk4C4 )
{
m_scaleX = v14->m_scaleX;
v14->m_unk4CC = m_commandIndex;
m_scaleY = v14->m_scaleY;
v14->m_customScaleX = m_scaleX;
v14->m_customScaleY = m_scaleY;
GameObject::dirtifyObjectRect(v14);
m_commandIndex = a1->m_gameState.m_commandIndex;
}
}
m_positionXOffset = v14->m_positionXOffset;
v74 = 0;
if ( m_positionXOffset != 0.0 )
{
v75 = v14->m_positionX;
v14->m_isUnmodifiedPosDirty = 1;
v74 = 1;
v14->m_positionXOffset = 0.0;
v14->m_positionX = v75 - m_positionXOffset;
}
m_positionYOffset = v14->m_positionYOffset;
if ( m_positionYOffset != 0.0 )
{
v77 = v14->m_positionY;
v14->m_isUnmodifiedPosDirty = 1;
v74 = 1;
v14->m_positionYOffset = 0.0;
v14->m_positionY = v77 - m_positionYOffset;
}
m_unk2BC = v14->m_unk2BC;
m_unk2C0 = v14->m_unk2C0;
if ( m_unk2BC != 0.0 || m_unk2C0 != 0.0 )
{
v80 = v14->m_scaleX;
v81 = v14->m_scaleY;
v82 = v14->m_scaleYOffset - m_unk2C0;
v14->m_scaleXOffset = v14->m_scaleXOffset - m_unk2BC;
v14->m_unk2BC = 0.0;
v14->m_scaleX = v80 - m_unk2BC;
v14->m_scaleYOffset = v82;
v14->m_scaleY = v81 - m_unk2C0;
v14->m_unk2C0 = 0.0;
}
m_unk2A8 = v14->m_unk2A8;
m_unk2B0 = v14->m_unk2B0;
if ( m_unk2A8 != 0.0 || m_unk2B0 != 0.0 )
{
v85 = v14->m_rotationXOffset - m_unk2A8;
v86 = v14->m_rotationYOffset - m_unk2B0;
v14->m_unk2A8 = 0.0;
v14->m_rotationXOffset = v85;
v14->m_rotationYOffset = v86;
v14->m_unk2B0 = 0.0;
}
m_areaObjectsCount = a1->m_areaObjectsCount;
m_areaObjectsIndex = a1->m_areaObjectsIndex;
v14->m_unk4C8 = m_commandIndex;
v121 = v14;
if ( m_areaObjectsIndex > m_areaObjectsCount )
{
a1->m_areaObjects.m_start[m_areaObjectsCount] = v14;
}
else
{
v89 = a1->m_areaObjects.m_finish;
if ( v89 == a1->m_areaObjects.m_reserveEnd )
{
std::vector::_M_emplace_back_aux((__int64)&a1->m_areaObjects, &v121);
m_areaObjectsCount = a1->m_areaObjectsCount;
m_areaObjectsIndex = a1->m_areaObjectsIndex;
}
else
{
if ( v89 )
{
*v89 = v14;
v89 = a1->m_areaObjects.m_finish;
}
a1->m_areaObjects.m_finish = v89 + 1;
}
a1->m_areaObjectsIndex = m_areaObjectsIndex + 1;
}
a1->m_areaObjectsCount = m_areaObjectsCount + 1;
if ( v74 )
a1->updateObjectSection(a1, v14);
}
}
((void (__fastcall *)(cocos2d::CCPoint *__return_ptr, GameObject *))v14->getRealPosition)(&v120, v14);
cocos2d::CCPoint::operator=(&v115, v16, v17);
((void (__fastcall *)(cocos2d::CCPoint *__return_ptr, GameObject *))v14->getRealPosition)(&v119, v14);
v18 = GameObject::getLastPosition(v14);
cocos2d::CCPoint::operator-(&v120, &v119, v18);
cocos2d::CCPoint::operator=(&v116, v19, v20);
}
}
m_offset = v10->m_offset;
v22 = fabsf(v10->m_modFront);
v23 = fabsf(v10->m_modBack);
v24 = (int)(float)((float)((float)(v10->m_length + v10->m_lengthVariance) + m_offset) + v10->m_offsetVariance);
m_gameObject->m_areaRange = v24;
v25 = (double)v24;
if ( v22 <= v23 )
{
v50 = v25 * (1.0 / v22);
x = v115.x;
v28 = v50;
v29 = v115.x - v28;
if ( (float)(v115.x - v28) > 0.0 )
{
LABEL_15:
m_sectionXFactor = a1->m_sectionXFactor;
if ( v29 < 10000000.0 )
v112 = (int)(float)(v29 * m_sectionXFactor);
else
v112 = (int)(float)(m_sectionXFactor * 10000000.0);
v114 = (int)(float)(m_sectionXFactor * 10000000.0);
v31 = v28 + x;
if ( (float)(v28 + x) > 0.0 )
{
LABEL_18:
v32 = v114;
if ( v31 < 10000000.0 )
v32 = (int)(float)(m_sectionXFactor * v31);
y = v115.y;
v34 = v115.y - v28;
if ( (float)(v115.y - v28) > 0.0 )
{
LABEL_21:
m_sectionYFactor = a1->m_sectionYFactor;
if ( v34 < 10000000.0 )
v111 = (int)(float)(v34 * m_sectionYFactor);
else
v111 = (int)(float)(m_sectionYFactor * 10000000.0);
v113 = (int)(float)(m_sectionYFactor * 10000000.0);
v36 = v28 + y;
if ( v36 > 0.0 )
{
LABEL_24:
v37 = v113;
if ( v36 < 10000000.0 )
v37 = (int)(float)(v36 * m_sectionYFactor);
m_directionType = m_gameObject->m_directionType;
if ( m_directionType != 1 )
goto LABEL_27;
goto LABEL_59;
}
LABEL_58:
m_directionType = m_gameObject->m_directionType;
v37 = 0;
if ( m_directionType != 1 )
{
LABEL_27:
if ( m_directionType == 2 )
{
if ( m_gameObject->m_inbound )
{
v112 = 0;
v90 = v111;
if ( m_gameObject->m_twoDirections )
v90 = 0;
v111 = v90;
}
else
{
v113 = v37;
v70 = v111;
v112 = 0;
if ( !m_gameObject->m_twoDirections )
v70 = 0;
v111 = v70;
}
}
else if ( m_gameObject->m_inbound )
{
v111 = 0;
v112 = 0;
}
else
{
v113 = v37;
v114 = v32;
}
LABEL_30:
if ( v116.x != 0.0 )
m_gameObject->m_negativeTargetX = v116.x < 0.0;
v10->m_easeIndex += 2;
if ( !a3 )
{
if ( v10->m_moveAngleVariance == 0.0 )
{
v71 = v10->m_moveAngle - 90.0;
m_gameObject->m_startAngle = (unsigned __int8)&dword_0 + 1;
v122 = cocos2d::ccpForAngle(v71 * 0.017453);
cocos2d::CCPoint::operator=(&m_gameObject->m_anglePosition, v122.x, v122.y);
m_offset = v10->m_offset;
x = v115.x;
y = v115.y;
}
else
{
m_gameObject->m_startAngle = 0;
}
}
if ( m_gameObject->m_directionType )
{
m_offsetVariance = v10->m_offsetVariance;
m_offsetY = m_offset;
v10->m_offsetY = m_offset;
v10->m_offsetYVariance = m_offsetVariance;
}
else
{
m_offsetY = v10->m_offsetY;
}
m_twoDirections = m_gameObject->m_twoDirections;
v115.x = m_offset + x;
v115.y = y + m_offsetY;
if ( m_twoDirections )
v10->m_modFront = -fabsf(v10->m_modFront);
m_targetGroupIndex = v10->m_targetGroupIndex;
v42 = 1;
if ( m_targetGroupIndex > 0 )
v43 = 2;
else
v43 = 1;
v44 = 0;
v45 = v43 + 1;
v46 = 0;
if ( m_targetGroupIndex > 0 )
{
LABEL_43:
Group = (cocos2d::CCArray *)cocos2d::CCArray::objectAtIndex(
a1->m_targetGroupsArray,
v46 + m_targetGroupIndex - 1);
goto LABEL_44;
}
while ( 1 )
{
Group = GJBaseGameLayer::getGroup(a1, v10->m_targetID);
LABEL_44:
v48 = !(v42 & 1);
switch ( a3 )
{
case 0:
cocos2d::CCPoint::CCPoint(&v120, &v115);
GJBaseGameLayer::processAreaMoveGroupAction(
a1,
Group,
v10,
v127,
(int)&v120,
v112,
v114,
v111,
v113,
v44,
v48);
break;
case 1:
cocos2d::CCPoint::CCPoint(&v120, &v115);
GJBaseGameLayer::processAreaRotateGroupAction(
a1,
Group,
v10,
v125,
(int)&v120,
v112,
v114,
v111,
v113,
v44,
v48);
break;
case 2:
cocos2d::CCPoint::CCPoint(&v120, &v115);
GJBaseGameLayer::processAreaTransformGroupAction(
a1,
Group,
v10,
v124,
(int)&v120,
v112,
v114,
v111,
v113,
v44,
v48);
break;
case 3:
cocos2d::CCPoint::CCPoint(&v120, &v115);
GJBaseGameLayer::processAreaFadeGroupAction(a1, Group, v10, v123, (bool)&v120);
break;
case 4:
cocos2d::CCPoint::CCPoint(&v120, &v115);
GJBaseGameLayer::processAreaTintGroupAction(a1, Group, v10, v126, (bool)&v120);
break;
default:
break;
}
++v42;
v44 += cocos2d::CCArray::count(Group);
if ( v42 == v45 )
goto LABEL_4;
m_targetGroupIndex = v10->m_targetGroupIndex;
v46 = v42 - 1;
if ( m_targetGroupIndex > 0 )
goto LABEL_43;
}
}
LABEL_59:
if ( m_gameObject->m_inbound )
{
v111 = 0;
v72 = v112;
if ( m_gameObject->m_twoDirections )
v72 = 0;
v112 = v72;
}
else
{
v114 = v32;
v51 = v112;
v111 = 0;
if ( !m_gameObject->m_twoDirections )
v51 = 0;
v112 = v51;
}
goto LABEL_30;
}
LABEL_57:
m_sectionYFactor = a1->m_sectionYFactor;
v111 = 0;
v36 = v28 + y;
v113 = (int)(float)(m_sectionYFactor * 10000000.0);
if ( v36 > 0.0 )
goto LABEL_24;
goto LABEL_58;
}
LABEL_56:
y = v115.y;
v32 = 0;
v34 = v115.y - v28;
if ( (float)(v115.y - v28) > 0.0 )
goto LABEL_21;
goto LABEL_57;
}
}
else
{
v26 = v25 * (1.0 / v23);
x = v115.x;
v28 = v26;
v29 = v115.x - v28;
if ( (float)(v115.x - v28) > 0.0 )
goto LABEL_15;
}
m_sectionXFactor = a1->m_sectionXFactor;
v112 = 0;
v31 = v28 + x;
v114 = (int)(float)(m_sectionXFactor * 10000000.0);
if ( (float)(v28 + x) > 0.0 )
goto LABEL_18;
goto LABEL_56;
}
}