//
// GJBaseGameLayer::addAreaEffect from 0x140227480 to 0x1402277ee (878 bytes)
//
// 9 xrefs:
// > GJBaseGameLayer::triggerAreaEffect @ 0x14022720e
// > GJBaseGameLayer::triggerAreaEffect @ 0x14022722b
// > GJBaseGameLayer::triggerAreaEffect @ 0x140227248
// > GJBaseGameLayer::triggerAreaEffect @ 0x140227265
// > GJBaseGameLayer::triggerAreaEffect @ 0x140227282
// > ??> @ 0x140680340
// > ??> @ 0x140680350
// > ??> @ 0x140680380
// > ??> @ 0x1406cd8a8
//
// 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::addAreaEffect(
GJBaseGameLayer *a1,
EnterEffectObject *a2,
std::vector *a3,
GJAreaActionType a4)
{
std::_Vector_val>::pointer Myfirst; // r10
std::_Vector_val>::pointer Mylast; // r8
EnterEffectInstance *v10; // rcx
EnterEffectObject *m_gameObject; // rdx
__int64 m_effectID; // r9
int v13; // r15d
int v14; // ecx
unsigned __int64 v15; // rdx
EnterEffectObject **p_m_gameObject; // r8
std::_Vector_val>::pointer v17; // rbp
std::_Simple_types::value_type *v18; // rsi
std::_Simple_types::value_type *i; // rbx
std::_Vector_val>::pointer v20; // rbx
int v21; // eax
int v22; // r11d
unsigned int v23; // r8d
__int64 *v24; // rcx
__int64 v25; // rax
__int64 v26; // rcx
__int64 v27; // rax
int m_controlID; // edx
int v29; // r10d
std::_Vector_val>::pointer v30; // rax
int m_centerGroupID; // r9d
int m_targetGroupID; // r8d
int v33; // [rsp+50h] [rbp-68h] BYREF
unsigned int v34; // [rsp+54h] [rbp-64h] BYREF
int v35; // [rsp+58h] [rbp-60h] BYREF
int v36; // [rsp+5Ch] [rbp-5Ch] BYREF
int v37; // [rsp+60h] [rbp-58h] BYREF
_BYTE v38[24]; // [rsp+68h] [rbp-50h] BYREF
EnterEffectObject *v39; // [rsp+C8h] [rbp+10h] BYREF
GJAreaActionType v40; // [rsp+D0h] [rbp+18h] BYREF
v39 = a2;
Myfirst = a3->_Mypair._Myval2._Myfirst;
Mylast = a3->_Mypair._Myval2._Mylast;
v10 = Myfirst;
if ( Myfirst == Mylast )
{
LABEL_7:
m_effectID = (unsigned int)a2->m_effectID;
v13 = 0;
if ( (int)m_effectID > 0 )
{
v14 = 0;
v15 = Mylast - Myfirst;
if ( v15 )
{
p_m_gameObject = &Myfirst->m_gameObject;
while ( (*p_m_gameObject)->m_effectID != (_DWORD)m_effectID )
{
++v14;
p_m_gameObject += 29;
if ( v14 >= v15 )
goto LABEL_17;
}
v17 = a3->_Mypair._Myval2._Mylast;
v18 = &Myfirst[v14];
for ( i = v18 + 1; i != v17; ++i )
sub_140250C90(v18++, i, p_m_gameObject, m_effectID);
v20 = a3->_Mypair._Myval2._Mylast;
sub_14005E430((__int64)&v20[-1].m_easeIndices);
sub_1402508A0(&v20[-1], &v20[-1]);
--a3->_Mypair._Myval2._Mylast;
}
}
LABEL_17:
v21 = a2->m_ignoreGroupParent + 10;
v33 = 0;
v22 = 0;
v40 = 0;
v23 = a2->m_targetGroupID + 1000000 * (a2->m_ignoreLinkedObjects + 10 * v21);
v34 = v23;
v24 = (__int64 *)((char *)a1->m_targetGroups._Vec._Mypair._Myval2._Myfirst
+ 16
* ((0x100000001B3LL
* (((unsigned __int64)v23 >> 24)
^ (0x100000001B3LL
* (BYTE2(v23)
^ (0x100000001B3LL
* ((0x100000001B3LL * ((unsigned __int8)v23 ^ 0xCBF29CE484222325uLL)) ^ BYTE1(v23)))))))
& a1->m_targetGroups._Mask));
v25 = v24[1];
if ( (std::_List_val>>>::_Nodeptr)v25 != a1->m_targetGroups._List._Mypair._Myval2._Myhead )
{
v26 = *v24;
if ( v23 == *(_DWORD *)(v25 + 16) )
{
LABEL_23:
if ( v25 )
{
v27 = sub_14024ED30(&a1->m_targetGroups, v38, &v34);
v13 = *(_DWORD *)(*(_QWORD *)v27 + 20LL);
v22 = *(_DWORD *)(*(_QWORD *)v27 + 24LL);
v33 = v13;
v40 = v22;
}
m_controlID = a2->m_controlID;
v29 = a1->m_gameState.m_unkUint7 + 1;
v35 = m_controlID;
a1->m_gameState.m_unkUint7 = v29;
v30 = a3->_Mypair._Myval2._Mylast;
m_centerGroupID = a2->m_centerGroupID;
m_targetGroupID = a2->m_targetGroupID;
v36 = m_centerGroupID;
v37 = m_targetGroupID;
if ( v30 == a3->_Mypair._Myval2._Myend )
{
sub_140251180(
(_DWORD)a3,
(_DWORD)v30,
(unsigned int)&v39,
(unsigned int)&v37,
(__int64)&v36,
(__int64)&a1->m_gameState.m_unkUint7,
(__int64)&v33,
(__int64)&v40,
(__int64)&v35);
}
else
{
EnterEffectInstance::EnterEffectInstance(
v30,
a2,
m_targetGroupID,
m_centerGroupID,
v29,
v13,
v22,
m_controlID);
++a3->_Mypair._Myval2._Mylast;
}
v40 = a4;
sub_140060D70((__int64)&a1->m_gameState.m_unsortedAreaEffects, (__int64)v38, (unsigned __int8 *)&v40);
return;
}
while ( v25 != v26 )
{
v25 = *(_QWORD *)(v25 + 8);
if ( v23 == *(_DWORD *)(v25 + 16) )
goto LABEL_23;
}
}
v25 = 0;
goto LABEL_23;
}
while ( 1 )
{
m_gameObject = v10->m_gameObject;
if ( m_gameObject == a2
&& v10->m_targetID == a2->m_targetGroupID
&& v10->m_centerID == a2->m_centerGroupID
&& v10->m_controlID == a2->m_controlID )
{
break;
}
if ( ++v10 == Mylast )
goto LABEL_7;
}
EnterEffectInstance::loadValuesFromObject(v10, m_gameObject);
}