//
// GJBaseGameLayer::addAreaEffect from 0x5abf6c to 0x5ac29a (814 bytes)
//
// 1 xrefs:
// > GJBaseGameLayer::triggerAreaEffect @ 0x5ac2d4
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:53:26 +0000
//
void __fastcall GJBaseGameLayer::addAreaEffect(GJBaseGameLayer *this, EnterEffectObject *a2, int *a3, unsigned int a4)
{
int v4; // r8
int v9; // r3
int v10; // r7
int v11; // lr
int i; // r0
int v13; // r2
int v14; // r7
int v15; // r11
int v16; // r3
int j; // r1
int v18; // r10
int k; // r10
int v20; // r0
char **v21; // r0
int *v22; // r0
int v23; // r3
EnterEffectInstance *v24; // r0
unsigned int v25; // r10
int v26; // r2
unsigned int v27; // r1
unsigned int v28; // r5
unsigned int v29; // r10
_DWORD *v30; // r3
_DWORD *m; // r6
unsigned int v32; // r0
int v33; // r1
float v34; // s13
float v35; // s15
bool v36; // r6
unsigned int v37; // r6
unsigned int v38; // r1
_DWORD *v39; // r3
unsigned int v40; // r0
int v41; // r1
int v42; // [sp+10h] [bp-34h]
int v43; // [sp+14h] [bp-30h]
int v44; // [sp+18h] [bp-2Ch]
int SpecialKey; // [sp+20h] [bp-24h] BYREF
unsigned int v46; // [sp+24h] [bp-20h] BYREF
void *v47[2]; // [sp+28h] [bp-1Ch] BYREF
EnterEffectInstance *v48; // [sp+30h] [bp-14h]
v9 = *a3;
v10 = a3[1];
v11 = *a3;
for ( i = *a3; i != v10; i += 200 )
{
if ( *(EnterEffectObject **)(i + 152) == a2
&& *(_DWORD *)(i + 160) == *((_DWORD *)a2 + 321)
&& *(_DWORD *)(i + 164) == *((_DWORD *)a2 + 322)
&& *(_DWORD *)(i + 196) == *((_DWORD *)a2 + 373) )
{
EnterEffectInstance::loadValuesFromObject((EnterEffectInstance *)i, a2);
return;
}
}
v13 = *((_DWORD *)a2 + 450);
if ( v13 > 0 )
{
v16 = -1030792151 * ((v10 - v9) >> 3);
for ( j = 0; j != v16; ++j )
{
v18 = v11;
v11 += 200;
if ( *(_DWORD *)(*(_DWORD *)(v18 + 152) + 1800) == v13 )
{
for ( k = v11; k != v10; k += 200 )
EnterEffectInstance::operator=(k - 200, k);
while ( 1 )
{
v20 = a3[1];
if ( k - 200 == v20 )
break;
v21 = (char **)(v20 - 200);
a3[1] = (int)v21;
EnterEffectInstance::~EnterEffectInstance(v21);
}
break;
}
}
}
SpecialKey = GJBaseGameLayer::getSpecialKey(
this,
*((_DWORD *)a2 + 321),
*((unsigned __int8 *)a2 + 1640),
*((unsigned __int8 *)a2 + 1641));
if ( std::__hash_table>,std::__unordered_map_hasher>,std::hash,true>,std::__unordered_map_equal>,std::equal_to,true>,std::allocator>>>::find(
(_DWORD *)this + 599,
(unsigned int *)&SpecialKey) )
{
v22 = std::unordered_map>::operator[]((int)this + 2396, (unsigned int *)&SpecialKey);
v15 = *v22;
v14 = v22[1];
}
else
{
v14 = 0;
v15 = 0;
}
v42 = *((_DWORD *)a2 + 321);
v43 = *((_DWORD *)a2 + 322);
v23 = *((_DWORD *)this + 208) + 1;
*((_DWORD *)this + 208) = v23;
v24 = (EnterEffectInstance *)a3[1];
v25 = a3[2];
v44 = *((_DWORD *)a2 + 373);
if ( (unsigned int)v24 >= v25 )
{
v26 = -1030792151 * (((int)v24 - *a3) >> 3);
if ( (unsigned int)(v26 + 1) > 0x147AE14 )
sub_388B48();
if ( (unsigned int)(-1030792151 * ((int)(v25 - *a3) >> 3)) > 0xA3D709 )
{
v27 = 21474836;
}
else
{
v27 = -2061584302 * ((int)(v25 - *a3) >> 3);
if ( v27 < v26 + 1 )
v27 = v26 + 1;
}
std::__split_buffer::__split_buffer(v47, v27, v26, (int)(a3 + 2));
if ( v48 )
EnterEffectInstance::EnterEffectInstance(v48, a2, v42, v43, *((_DWORD *)this + 208), v15, v14, v44);
v48 = (EnterEffectInstance *)((char *)v48 + 200);
std::vector::__swap_out_circular_buffer(a3, v47);
std::__split_buffer::~__split_buffer((int)v47);
}
else
{
if ( v24 )
EnterEffectInstance::EnterEffectInstance(v24, a2, v42, v43, v23, v15, v14, *((_DWORD *)a2 + 373));
a3[1] += 200;
}
v28 = *((_DWORD *)this + 306);
v46 = a4;
if ( v28 )
{
v29 = v28 - 1;
v4 = ((v28 - 1) & v28) != 0 ? a4 % v28 : v29 & a4;
v30 = *(_DWORD **)(*((_DWORD *)this + 305) + 4 * v4);
if ( v30 )
{
for ( m = (_DWORD *)*v30; m; m = (_DWORD *)*m )
{
v32 = m[1];
v33 = ((v28 - 1) & v28) != 0 ? v32 % v28 : v29 & v32;
if ( v33 != v4 )
break;
if ( m[2] == a4 )
return;
}
}
}
std::__hash_table,std::equal_to,std::allocator>::__construct_node_hash(
(int)v47,
(int)this + 1220,
a4,
&v46);
v34 = *((float *)this + 309);
v35 = (float)(unsigned int)(*((_DWORD *)this + 308) + 1);
if ( v35 > (float)((float)v28 * v34) )
{
v36 = v28 > 2 && ((v28 - 1) & v28) == 0;
goto LABEL_49;
}
if ( !v28 )
{
v36 = 0;
LABEL_49:
v37 = 2 * v28 + !v36;
v38 = (unsigned int)ceilf(v35 / v34);
if ( v38 < v37 )
v38 = v37;
std::__hash_table,std::equal_to,std::allocator>::rehash((int)this + 1220, v38);
v28 = *((_DWORD *)this + 306);
if ( ((v28 - 1) & v28) != 0 )
v4 = a4 % v28;
else
v4 = (v28 - 1) & a4;
}
v39 = *(_DWORD **)(*((_DWORD *)this + 305) + 4 * v4);
if ( v39 )
{
*(_DWORD *)v47[0] = *v39;
*v39 = v47[0];
}
else
{
*(_DWORD *)v47[0] = *((_DWORD *)this + 307);
*((void **)this + 307) = v47[0];
*(_DWORD *)(*((_DWORD *)this + 305) + 4 * v4) = (char *)this + 1228;
if ( *(_DWORD *)v47[0] )
{
v40 = *(_DWORD *)(*(_DWORD *)v47[0] + 4);
if ( ((v28 - 1) & v28) != 0 )
v41 = v40 % v28;
else
v41 = (v28 - 1) & v40;
*(void **)(*((_DWORD *)this + 305) + 4 * v41) = v47[0];
}
}
++*((_DWORD *)this + 308);
}