//
// GJBaseGameLayer::addAreaEffect from 0x10013fcd0 to 0x10014010f (1087 bytes)
//
// 5 xrefs:
// > GJBaseGameLayer::triggerAreaEffect @ 0x10013fc57
// > GJBaseGameLayer::triggerAreaEffect @ 0x10013fc69
// > GJBaseGameLayer::triggerAreaEffect @ 0x10013fc7b
// > GJBaseGameLayer::triggerAreaEffect @ 0x10013fc8a
// > GJBaseGameLayer::triggerAreaEffect @ 0x10013fc9c
//
// 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 __fastcall GJBaseGameLayer::addAreaEffect(
GJBaseGameLayer *a1,
EnterEffectObject *m_gameObject,
std::vector *a3,
GJAreaActionType a4)
{
__m128 v4; // xmm0
std::__vector_base::pointer begin; // rax
std::__vector_base::pointer end; // rdx
EnterEffectInstance *v10; // rdi
int m_effectID; // ecx
__int64 v12; // rdi
int m_targetGroupID; // r10d
int v14; // edx
int v15; // ecx
unsigned __int64 value; // r12
int v17; // r11d
std::unordered_map> *p_m_targetGroups; // rdi
unsigned __int64 v19; // r15
unsigned __int64 v20; // r9
std::__hash_node_base>, void *> *> *v21; // rax
int v22; // ecx
std::__hash_node_base>, void *> *>::__next_pointer next; // r13
unsigned __int64 v24; // r12
unsigned __int64 v25; // rax
std::__hash_node_base>, void *> *>::__next_pointer v26; // rax
__int64 v27; // rax
int m_centerGroupID; // eax
int v29; // edx
int m_controlID; // edi
std::__vector_base::pointer v31; // r12
EnterEffectInstance *v32; // r12
EnterEffectObject *v33; // [rsp+18h] [rbp-58h] BYREF
int v34; // [rsp+24h] [rbp-4Ch] BYREF
int v35; // [rsp+28h] [rbp-48h] BYREF
int v36; // [rsp+2Ch] [rbp-44h] BYREF
int v37; // [rsp+30h] [rbp-40h] BYREF
int v38; // [rsp+34h] [rbp-3Ch] BYREF
int *v39; // [rsp+38h] [rbp-38h] BYREF
GJAreaActionType v40; // [rsp+44h] [rbp-2Ch]
v33 = m_gameObject;
begin = a3->__begin_;
end = a3->__end_;
if ( begin != end )
{
v10 = begin;
do
{
if ( v10->m_gameObject == m_gameObject
&& v10->m_targetID == m_gameObject->m_targetGroupID
&& v10->m_centerID == m_gameObject->m_centerGroupID
&& v10->m_controlID == m_gameObject->m_controlID )
{
EnterEffectInstance::loadValuesFromObject(v10, v10->m_gameObject);
return;
}
++v10;
}
while ( v10 != end );
m_effectID = m_gameObject->m_effectID;
if ( m_effectID > 0 )
{
v12 = (0xEEEEEEEEEEEEEEEFLL * (((char *)end - (char *)begin) >> 4) == 0)
- 0x1111111111111111LL * (((char *)end - (char *)begin) >> 4);
while ( begin->m_gameObject->m_effectID != m_effectID )
{
++begin;
if ( !--v12 )
goto LABEL_15;
}
sub_10011ECC0((__int64)a3, (__int64)begin);
}
}
LABEL_15:
m_targetGroupID = m_gameObject->m_targetGroupID;
v14 = m_targetGroupID + 110000000;
if ( !m_gameObject->m_ignoreGroupParent )
v14 = m_targetGroupID + 100000000;
v15 = v14 + 1000000;
if ( !m_gameObject->m_ignoreLinkedObjects )
v15 = v14;
v34 = v15;
v36 = 0;
v37 = 0;
value = a1->m_targetGroups.__table_.__bucket_list_.__ptr_.__value_.__data_.__value_;
v17 = 0;
if ( !value )
{
LABEL_22:
v22 = 0;
goto LABEL_47;
}
p_m_targetGroups = &a1->m_targetGroups;
v19 = (0x101010101010101LL
* ((((value - ((value >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((value - ((value >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)
+ ((((value - ((value >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((value - ((value >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)) >> 4))
& 0xF0F0F0F0F0F0F0FLL)) >> 56;
if ( v19 <= 1 )
{
v20 = v15 & (value - 1);
v21 = p_m_targetGroups->__table_.__bucket_list_.__ptr_.__value_[v20];
if ( !v21 )
goto LABEL_22;
goto LABEL_27;
}
v20 = v15;
if ( value > v15 )
goto LABEL_26;
if ( (value | v15) >> 32 )
{
v20 = v15 % value;
LABEL_26:
v21 = p_m_targetGroups->__table_.__bucket_list_.__ptr_.__value_[v20];
if ( !v21 )
goto LABEL_22;
goto LABEL_27;
}
v20 = v15 % (unsigned int)value;
v21 = p_m_targetGroups->__table_.__bucket_list_.__ptr_.__value_[v20];
if ( !v21 )
goto LABEL_22;
LABEL_27:
v40 = a4;
next = v21->__next_;
if ( !v21->__next_ )
{
LABEL_44:
v22 = 0;
goto LABEL_46;
}
if ( (unsigned int)v19 < 2 )
{
v24 = value - 1;
while ( 1 )
{
v26 = next[1].__next_;
if ( v26 == (std::__hash_node_base>, void *> *>::__next_pointer)v15 )
{
if ( LODWORD(next[2].__next_) == v15 )
goto LABEL_45;
}
else if ( (v24 & (unsigned __int64)v26) != v20 )
{
goto LABEL_44;
}
next = next->__next_;
if ( !next )
goto LABEL_44;
}
}
while ( 1 )
{
v25 = (unsigned __int64)next[1].__next_;
if ( v25 == v15 )
break;
if ( v25 < value )
goto LABEL_36;
if ( (value | v25) >> 32 )
{
v25 %= value;
LABEL_36:
if ( v25 != v20 )
goto LABEL_39;
goto LABEL_31;
}
if ( (unsigned int)v25 % (unsigned int)value != v20 )
{
LABEL_39:
v17 = 0;
v22 = 0;
goto LABEL_46;
}
LABEL_31:
next = next->__next_;
if ( !next )
goto LABEL_39;
}
if ( LODWORD(next[2].__next_) != v15 )
goto LABEL_31;
LABEL_45:
v39 = &v34;
v27 = sub_100167180(p_m_targetGroups, &v34, &unk_100816AE0, &v39, &v38);
v22 = *(_DWORD *)(v27 + 20);
v36 = v22;
v17 = *(_DWORD *)(v27 + 24);
v37 = v17;
m_targetGroupID = m_gameObject->m_targetGroupID;
LABEL_46:
a4 = v40;
LABEL_47:
LODWORD(v39) = m_targetGroupID;
m_centerGroupID = m_gameObject->m_centerGroupID;
v38 = m_centerGroupID;
v29 = a1->m_gameState.m_unkUint7 + 1;
a1->m_gameState.m_unkUint7 = v29;
m_controlID = m_gameObject->m_controlID;
v35 = m_controlID;
v31 = a3->__end_;
if ( v31 >= a3->__end_cap_.__value_ )
{
v32 = (EnterEffectInstance *)sub_100167620(
(_DWORD)a3,
(unsigned int)&v33,
(unsigned int)&v39,
(unsigned int)&v38,
(int)a1 + 968,
(unsigned int)&v36,
(__int64)&v37,
(__int64)&v35);
}
else
{
v4 = 0;
*(_OWORD *)&v31->m_enterEffectAnimMap.__tree_.__pair1_.__value_.__left_ = 0;
v31->m_enterEffectAnimMap.__tree_.__begin_node_ = &v31->m_enterEffectAnimMap.__tree_.__pair1_.__value_;
v31->m_reversed = 0;
v31->m_easeIndex = 0;
*(int *)((char *)&v31->m_easeIndex + 3) = 0;
*(_OWORD *)&v31->m_easeIndices.__begin_ = 0;
v31->m_easeIndices.__end_cap_.__value_ = nullptr;
v31->m_gameObject = m_gameObject;
v31->m_targetID = m_targetGroupID;
v31->m_centerID = m_centerGroupID;
v31->m_unkFloat3 = v29;
v31->m_targetGroupIndex = v22;
v31->m_controlID = m_controlID;
if ( v17 > 0 )
{
sub_100165950(&v31->m_easeIndices, (unsigned int)v17);
m_gameObject = v31->m_gameObject;
}
EnterEffectInstance::loadValuesFromObject(v31, m_gameObject);
v32 = v31 + 1;
a3->__end_ = v32;
}
a3->__end_ = v32;
LODWORD(v39) = a4;
sub_100056510((float *)&a1->m_gameState.m_unsortedAreaEffects, (int *)&v39, &v39, v4);
}