//
// GJBaseGameLayer::processAreaEffects from 0x496494 to 0x496b0a (1654 bytes)
//
// 5 xrefs:
// > GJBaseGameLayer::processAreaActions @ 0x496b42
// > GJBaseGameLayer::processAreaActions @ 0x496b52
// > GJBaseGameLayer::processAreaActions @ 0x496b62
// > GJBaseGameLayer::processAreaVisualActions @ 0x497e9a
// > GJBaseGameLayer::processAreaVisualActions @ 0x497eaa
//
// 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)
{
double v5; // d4
double v6; // d5
int *p_m_unsortedAreaEffects; // r6
EnterEffectInstance *m_start; // r4
EnterEffectInstance *m_finish; // r5
int v12; // r10
EnterEffectInstance *v13; // r4
EnterEffectObject *m_gameObject; // r8
int m_specialTarget; // r6
PlayerObject *m_player2; // r6
float v17; // r0
int v18; // r2
bool v19; // r3
cocos2d::CCPoint *v20; // r9
const cocos2d::CCPoint *LastPosition; // r2
cocos2d::CCDirector *v22; // r0
float m_cameraZoom; // s14
float width; // r1
float height; // r2
float v26; // s15
int v27; // r2
bool v28; // r3
int v29; // r2
bool v30; // r3
cocos2d::CCPoint *p_m_cameraPosition; // r1
int v32; // r2
bool v33; // r3
GameObject *MainObject; // r6
int v35; // r2
bool v36; // r3
float *p_m_sectionXFactor; // r2
float v38; // s12
bool v39; // cc
double v40; // d7
int v41; // r3
float v42; // s14
double v43; // d6
bool v44; // cc
float v45; // s13
float v46; // r6
float v47; // s15
bool v48; // cc
float v49; // s15
float *p_m_sectionYFactor; // r3
bool v51; // cc
float v52; // s13
int m_twoDirections; // r5
float v54; // s14
float v55; // s15
bool v56; // cc
int v57; // s15
float v58; // s15
int m_directionType; // r2
float m_moveAngle; // s15
int v61; // r2
bool v62; // r3
float m_offset; // s14
_BOOL4 v64; // r3
int v65; // r10
int v66; // r3
int m_targetGroupIndex; // r1
cocos2d::CCArray *Group; // r0
cocos2d::CCArray *v69; // r9
bool v70; // [sp+4h] [bp-80h]
bool v71; // [sp+1Ch] [bp-68h]
int v72; // [sp+24h] [bp-60h]
int v73; // [sp+28h] [bp-5Ch]
int v75; // [sp+30h] [bp-54h]
int v76; // [sp+30h] [bp-54h]
int v77; // [sp+34h] [bp-50h]
int v78; // [sp+34h] [bp-50h]
int v79; // [sp+3Ch] [bp-48h]
EnterEffectInstance *v80; // [sp+40h] [bp-44h]
cocos2d::CCPoint v82; // [sp+54h] [bp-30h] BYREF
cocos2d::CCPoint v83; // [sp+5Ch] [bp-28h] BYREF
cocos2d::CCSize v84; // [sp+64h] [bp-20h] BYREF
cocos2d::CCPoint v85; // [sp+6Ch] [bp-18h] BYREF
cocos2d::CCPoint v86; // [sp+74h] [bp-10h] BYREF
cocos2d::CCPoint v87; // 0:r3.4,4:^0.4
cocos2d::CCPoint v88; // 0:r3.4,4:^0.4
cocos2d::CCPoint v89; // 0:r3.4,4:^0.4
cocos2d::CCPoint v90; // 0:r3.4,4:^0.4
cocos2d::CCPoint v91; // 0:r3.4,4:^0.4
p_m_unsortedAreaEffects = (int *)&a1->m_gameState.m_unsortedAreaEffects;
if ( sub_46C3EE(&a1->m_gameState.m_unsortedAreaEffects._M_h._M_buckets, a3) )
{
m_start = a2->m_start;
m_finish = a2->m_finish;
if ( a2->m_start != m_finish )
{
std::__introsort_loop<__gnu_cxx::__normal_iterator>,int,__gnu_cxx::__ops::_Iter_comp_iter>(
(int)a2->m_start,
(int)a2->m_finish,
2 * (31 - __clz(-1944890851 * (((char *)m_finish - (char *)m_start) >> 2))),
(int (__fastcall *)(int, int))compEnterEffectSort);
if ( (char *)m_finish - (char *)m_start <= 3603 )
{
std::__insertion_sort<__gnu_cxx::__normal_iterator>,__gnu_cxx::__ops::_Iter_comp_iter>(
(int)m_start,
(int)m_finish,
(int (__fastcall *)(int, int))compEnterEffectSort);
}
else
{
v12 = (int)&m_start[16];
std::__insertion_sort<__gnu_cxx::__normal_iterator>,__gnu_cxx::__ops::_Iter_comp_iter>(
(int)m_start,
(int)&m_start[16],
(int (__fastcall *)(int, int))compEnterEffectSort);
while ( (EnterEffectInstance *)v12 != m_finish )
{
std::__unguarded_linear_insert<__gnu_cxx::__normal_iterator>,__gnu_cxx::__ops::_Val_comp_iter>(
v12,
(int (__fastcall *)(EnterEffectInstance *, int))compEnterEffectSort);
v12 += 212;
}
}
}
LODWORD(v86.x) = a3;
sub_48CCE8(p_m_unsortedAreaEffects, &v86);
}
v13 = a2->m_start;
v80 = a2->m_finish;
while ( v13 != v80 )
{
if ( v13->m_paused )
goto LABEL_128;
m_gameObject = v13->m_gameObject;
EnterEffectInstance::updateTransitions(v13, a4, a1);
cocos2d::CCPoint::CCPoint(&v82);
cocos2d::CCPoint::CCPoint(&v83);
m_specialTarget = m_gameObject->m_specialTarget;
if ( !m_specialTarget )
m_specialTarget = v13->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;
v17 = ((float (__fastcall *)(PlayerObject *))m_player2->getPosition)(m_player2);
cocos2d::CCPoint::operator=((PlayerObject *)&v82, v17, v18, v19);
v20 = (cocos2d::CCPoint *)m_player2->getPosition(m_player2);
LastPosition = GameObject::getLastPosition(m_player2);
goto LABEL_40;
}
v22 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(&v84, v22);
m_cameraZoom = a1->m_gameState.m_cameraZoom;
v84.width = v84.width / m_cameraZoom;
v84.height = v84.height / m_cameraZoom;
cocos2d::CCPoint::CCPoint(&v85, &stru_AC68C0);
switch ( m_specialTarget )
{
case -11:
width = v84.width;
goto LABEL_32;
case -10:
width = v84.width;
goto LABEL_30;
case -9:
width = v84.width;
goto LABEL_28;
case -8:
width = v84.width * 0.5;
goto LABEL_32;
case -7:
width = v84.width * 0.5;
LABEL_28:
height = 0.0;
goto LABEL_35;
case -6:
width = 0.0;
LABEL_32:
height = v84.height;
goto LABEL_35;
case -5:
width = 0.0;
LABEL_30:
v26 = 0.5;
goto LABEL_34;
case -4:
width = 0.0;
height = 0.0;
goto LABEL_35;
default:
v26 = 0.5;
width = v84.width * 0.5;
LABEL_34:
height = v84.height * v26;
LABEL_35:
cocos2d::CCPoint::CCPoint(&v86, width, height);
cocos2d::CCPoint::operator=((PlayerObject *)&v85, COERCE_FLOAT(&v86), v27, v28);
cocos2d::CCPoint::operator+(&v86, &a1->m_gameState.m_cameraPosition, &v85);
cocos2d::CCPoint::operator=((PlayerObject *)&v82, COERCE_FLOAT(&v86), v29, v30);
LastPosition = &a1->m_gameState.m_cameraPosition2;
p_m_cameraPosition = &a1->m_gameState.m_cameraPosition;
break;
}
LABEL_36:
cocos2d::CCPoint::operator-(&v86, p_m_cameraPosition, LastPosition);
cocos2d::CCPoint::operator=((PlayerObject *)&v83, COERCE_FLOAT(&v86), v32, v33);
goto LABEL_43;
}
MainObject = GJBaseGameLayer::tryGetMainObject(a1, m_specialTarget);
if ( MainObject )
{
if ( (unsigned int)(a3 - 3) > 1 && GJBaseGameLayer::resetAreaObjectValues(a1, MainObject, 1) )
a1->updateObjectSection(a1, MainObject);
v20 = &v85;
MainObject->getRealPosition(&v86, MainObject);
cocos2d::CCPoint::operator=((PlayerObject *)&v82, COERCE_FLOAT(&v86), v35, v36);
MainObject->getRealPosition(&v85, MainObject);
LastPosition = GameObject::getLastPosition(MainObject);
LABEL_40:
p_m_cameraPosition = v20;
goto LABEL_36;
}
LABEL_43:
p_m_sectionXFactor = &a1->m_sectionXFactor;
*(float *)&v6 = fabsf(v13->m_modFront);
*(float *)&v5 = fabsf(v13->m_modBack);
v38 = (float)((float)(v13->m_length + v13->m_lengthVariance) + v13->m_offset) + v13->m_offsetVariance;
v39 = *(float *)&v6 <= *(float *)&v5;
if ( *(float *)&v6 <= *(float *)&v5 )
v6 = *(float *)&v6;
else
v5 = *(float *)&v5;
if ( v39 )
v40 = 1.0 / v6;
else
v40 = 1.0 / v5;
v41 = (int)v38;
v43 = (double)(int)v38;
m_gameObject->m_areaRange = v41;
v42 = v43 * v40;
*((float *)&v43 + 1) = v82.x - v42;
if ( (float)(v82.x - v42) <= 0.0 )
{
v46 = 0.0;
}
else
{
v44 = *((float *)&v43 + 1) < 10000000.0;
if ( *((float *)&v43 + 1) < 10000000.0 )
*(float *)&v43 = *p_m_sectionXFactor;
else
*((float *)&v43 + 1) = *p_m_sectionXFactor;
if ( v44 )
v45 = *((float *)&v43 + 1) * *(float *)&v43;
else
v45 = *((float *)&v43 + 1) * 10000000.0;
HIDWORD(v43) = (int)v45;
v46 = *((float *)&v43 + 1);
}
v47 = v82.x + v42;
if ( (float)(v82.x + v42) <= 0.0 )
{
v75 = 0;
}
else
{
v48 = v47 < 10000000.0;
if ( v47 < 10000000.0 )
*((float *)&v43 + 1) = *p_m_sectionXFactor;
else
v47 = *p_m_sectionXFactor;
if ( v48 )
v49 = v47 * *((float *)&v43 + 1);
else
v49 = v47 * 10000000.0;
v75 = (int)v49;
}
p_m_sectionYFactor = &a1->m_sectionYFactor;
*((float *)&v43 + 1) = v82.y - v42;
if ( (float)(v82.y - v42) <= 0.0 )
{
m_twoDirections = 0;
}
else
{
v51 = *((float *)&v43 + 1) < 10000000.0;
if ( *((float *)&v43 + 1) < 10000000.0 )
*(float *)&v43 = *p_m_sectionYFactor;
else
*((float *)&v43 + 1) = *p_m_sectionYFactor;
if ( v51 )
v52 = *((float *)&v43 + 1) * *(float *)&v43;
else
v52 = *((float *)&v43 + 1) * 10000000.0;
m_twoDirections = (int)v52;
}
v54 = v82.y + v42;
if ( v54 <= 0.0 )
{
v77 = 0;
}
else
{
v55 = *p_m_sectionYFactor;
v56 = v54 < 10000000.0;
if ( v54 < 10000000.0 )
v54 = v54 * v55;
else
v55 = v55 * 10000000.0;
if ( v56 )
v57 = (int)v54;
else
v57 = (int)v55;
v77 = v57;
}
v58 = *p_m_sectionXFactor;
m_directionType = m_gameObject->m_directionType;
v72 = (int)(float)(v58 * 10000000.0);
v73 = (int)(float)(*p_m_sectionYFactor * 10000000.0);
if ( m_directionType != 1 )
{
if ( m_directionType == 2 )
{
LODWORD(v46) = m_gameObject->m_twoDirections;
if ( m_gameObject->m_inbound )
{
if ( !m_gameObject->m_twoDirections )
goto LABEL_104;
goto LABEL_100;
}
if ( m_gameObject->m_twoDirections )
{
v46 = 0.0;
v73 = v77;
goto LABEL_104;
}
m_twoDirections = 0;
v73 = v77;
LABEL_101:
v46 = 0.0;
goto LABEL_104;
}
if ( !m_gameObject->m_inbound )
{
v73 = v77;
v72 = v75;
goto LABEL_104;
}
LABEL_100:
m_twoDirections = 0;
goto LABEL_101;
}
m_twoDirections = m_gameObject->m_twoDirections;
if ( m_gameObject->m_inbound )
{
if ( !m_gameObject->m_twoDirections )
goto LABEL_104;
goto LABEL_100;
}
if ( !m_gameObject->m_twoDirections )
{
v72 = v75;
goto LABEL_101;
}
m_twoDirections = 0;
v72 = v75;
LABEL_104:
if ( v83.x != 0.0 )
m_gameObject->m_negativeTargetX = v83.x < 0.0;
v13->m_easeIndex += 2;
if ( !a3 )
{
if ( v13->m_moveAngleVariance == 0.0 )
{
m_moveAngle = v13->m_moveAngle;
m_gameObject->m_startAngle = 1;
cocos2d::ccpForAngle(&v86, (float)(m_moveAngle - 90.0) * 0.017453);
cocos2d::CCPoint::operator=((PlayerObject *)&m_gameObject->m_anglePosition, COERCE_FLOAT(&v86), v61, v62);
}
else
{
m_gameObject->m_startAngle = 0;
}
}
m_offset = v13->m_offset;
if ( m_gameObject->m_directionType )
{
v13->m_offsetY = m_offset;
v13->m_offsetYVariance = v13->m_offsetVariance;
}
v64 = m_gameObject->m_twoDirections;
v82.x = v82.x + m_offset;
v82.y = v82.y + v13->m_offsetY;
if ( v64 )
v13->m_modFront = -fabsf(v13->m_modFront);
v65 = 0;
v76 = 0;
if ( v13->m_targetGroupIndex <= 0 )
v66 = 1;
else
v66 = 2;
v79 = v66;
do
{
m_targetGroupIndex = v13->m_targetGroupIndex;
if ( m_targetGroupIndex <= 0 )
Group = GJBaseGameLayer::getGroup(a1, v13->m_targetID);
else
Group = (cocos2d::CCArray *)cocos2d::CCArray::objectAtIndex(
a1->m_targetGroupsArray,
m_targetGroupIndex + v65 - 1);
v78 = v65 & 1;
v69 = Group;
switch ( a3 )
{
case 0:
cocos2d::CCPoint::CCPoint(&v86, &v82);
v89.y = v46;
LODWORD(v89.x) = &v86;
GJBaseGameLayer::processAreaMoveGroupAction(a1, v69, v13, v89, v72, m_twoDirections, v73, v76, v78, a5, v71);
break;
case 1:
cocos2d::CCPoint::CCPoint(&v86, &v82);
v88.y = v46;
LODWORD(v88.x) = &v86;
GJBaseGameLayer::processAreaRotateGroupAction(a1, v69, v13, v88, v72, m_twoDirections, v73, v76, v78, a5, v71);
break;
case 2:
cocos2d::CCPoint::CCPoint(&v86, &v82);
v87.y = v46;
LODWORD(v87.x) = &v86;
GJBaseGameLayer::processAreaTransformGroupAction(
a1,
v69,
v13,
v87,
v72,
m_twoDirections,
v73,
v76,
v78,
a5,
v71);
break;
case 3:
cocos2d::CCPoint::CCPoint(&v86, &v82);
LODWORD(v90.y) = v65 & 1;
LODWORD(v90.x) = &v86;
GJBaseGameLayer::processAreaFadeGroupAction(a1, v69, v13, v90, v70);
break;
case 4:
cocos2d::CCPoint::CCPoint(&v86, &v82);
LODWORD(v91.y) = v65 & 1;
LODWORD(v91.x) = &v86;
GJBaseGameLayer::processAreaTintGroupAction(a1, v69, v13, v91, v70);
break;
default:
break;
}
++v65;
v76 += cocos2d::CCArray::count(v69);
}
while ( v65 != v79 );
LABEL_128:
++v13;
}
}