//
// GJBaseGameLayer::controlAreaEffectWithID from 0x140330470 to 0x140330669 (505 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::controlTriggersWithControlID @ 0x140326073
// > ??> @ 0x14091f568
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// 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:30:32 +0000
//
void __fastcall GJBaseGameLayer::controlAreaEffectWithID(__int64 a1, unsigned int a2, int a3, int a4)
{
__int64 v6; // r9
__int64 v7; // rdx
int v8; // ecx
int v9; // ecx
int v10; // ecx
int v11; // ecx
__int64 v12; // rax
__int64 *v13; // r14
__int64 v14; // rsi
__int64 v15; // r8
int v16; // ebp
__int64 v17; // r15
char v18; // cl
__int64 i; // rbx
__int64 v20; // rbx
int v23; // [rsp+70h] [rbp+18h]
v6 = a2;
v7 = a1;
v8 = 0;
v23 = 0;
do
{
if ( v8 )
{
v9 = v8 - 1;
if ( v9 )
{
v10 = v9 - 1;
if ( v10 )
{
v11 = v10 - 1;
if ( v11 )
{
if ( v11 != 1 )
goto LABEL_33;
v12 = 1720;
}
else
{
v12 = 1696;
}
}
else
{
v12 = 1672;
}
}
else
{
v12 = 1648;
}
}
else
{
v12 = 1624;
}
v13 = (__int64 *)(v7 + v12);
if ( v7 + v12 )
{
v14 = v13[1];
v15 = *v13;
v16 = 0;
if ( (v14 - *v13) / 232 )
{
v17 = 0;
do
{
v18 = 1;
if ( a3 == -1 )
{
if ( *(_DWORD *)(*(_QWORD *)(v17 + v15 + 160) + 2008LL) != (_DWORD)v6 )
goto LABEL_30;
}
else if ( *(_DWORD *)(v17 + v15 + 224) != a3 )
{
goto LABEL_30;
}
if ( a4 )
{
if ( a4 == 1 )
{
*(_WORD *)(v17 + v15 + 188) = 257;
}
else if ( a4 == 2 )
{
*(_WORD *)(v17 + v15 + 188) = 0;
}
}
else
{
for ( i = v15 + 232LL * v16 + 232; i != v14; i += 232 )
sub_140359F40(i - 232, i, v15, v6);
v20 = v13[1];
sub_140069730(v20 - 32);
sub_140358980(v20 - 232, v20 - 232);
v13[1] -= 232;
v6 = a2;
v18 = 0;
}
if ( a3 == -1 && (int)v6 > 0 )
break;
if ( v18 )
{
LABEL_30:
++v16;
v17 += 232;
}
v14 = v13[1];
v15 = *v13;
}
while ( v16 < (unsigned __int64)((v14 - *v13) / 232) );
}
v7 = a1;
}
LABEL_33:
v8 = v23 + 1;
v23 = v8;
}
while ( v8 < 5 );
}