//
// GameObject::addGlow from 0x642318 to 0x642a20 (1800 bytes)
//
// 2 xrefs:
// > GameObject::objectFromVector @ 0x655524
// > ??> @ 0x753f0
//
// 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
//
__int64 __fastcall GameObject::addGlow(__int64 a1, char **a2)
{
int v4; // w0
char *v5; // x0
char *v6; // x0
void *v7; // x0
unsigned int *v8; // x20
int v9; // w1
unsigned int *v10; // x1
int v11; // w2
unsigned int *v12; // x1
int v13; // w2
__int64 v15; // [xsp+58h] [xbp+58h] BYREF
char *v16; // [xsp+60h] [xbp+60h] BYREF
if ( !*(_BYTE *)(a1 + 649)
&& (!GameManager::sharedState()->m_addGlow || *(_BYTE *)(a1 + 1056))
&& !*(_BYTE *)(a1 + 1278) )
{
v4 = *(_DWORD *)(a1 + 1012);
if ( v4 != 323 )
{
if ( v4 > 323 )
{
if ( v4 > 712 )
{
if ( v4 > 1345 )
{
if ( v4 > 1736 )
{
if ( v4 > 1911 )
{
if ( v4 < 3004 || v4 > 3005 && v4 != 3027 )
return _stack_chk_guard;
}
else if ( v4 < 1908 && v4 != 1751 && (v4 < 1751 || (unsigned int)(v4 - 1903) > 2) )
{
return _stack_chk_guard;
}
}
else if ( v4 < 1734 )
{
if ( v4 > 1704 )
{
if ( (unsigned int)(v4 - 1708) > 2 )
return _stack_chk_guard;
}
else if ( v4 < 1701 && v4 != 1594 && (v4 < 1594 || (unsigned int)(v4 - 1619) > 1) )
{
return _stack_chk_guard;
}
}
}
else if ( v4 < 1338 )
{
if ( v4 > 1210 )
{
if ( v4 > 1265 )
{
if ( v4 != 1330 && (v4 < 1330 || (unsigned int)(v4 - 1332) > 2) )
return _stack_chk_guard;
}
else if ( v4 < 1260 && (unsigned int)(v4 - 1220) > 6 )
{
return _stack_chk_guard;
}
}
else if ( v4 < 1202 )
{
if ( v4 > 742 )
{
if ( v4 != 1022 && (v4 < 1022 || (unsigned int)(v4 - 1154) > 4) )
return _stack_chk_guard;
}
else if ( v4 < 740 && (unsigned int)(v4 - 726) > 3 )
{
return _stack_chk_guard;
}
}
}
}
else if ( v4 < 709 && v4 != 392 )
{
if ( v4 > 392 )
{
if ( v4 > 484 )
{
if ( v4 > 652 )
{
if ( v4 < 661 || v4 > 666 && (unsigned int)(v4 - 673) > 7 )
return _stack_chk_guard;
}
else if ( v4 < 651 && (unsigned int)(v4 - 492) > 1 )
{
return _stack_chk_guard;
}
}
else if ( v4 < 483 )
{
if ( v4 > 459 )
{
if ( (unsigned int)(v4 - 467) > 8 )
return _stack_chk_guard;
}
else if ( v4 < 458 && (unsigned int)(v4 - 397) > 2 )
{
return _stack_chk_guard;
}
}
}
else if ( v4 != 345 )
{
if ( v4 <= 345 )
{
if ( v4 != 333 )
{
if ( v4 <= 333 )
{
if ( v4 < 326 || v4 > 329 && v4 != 331 )
return _stack_chk_guard;
}
else if ( v4 != 339 && v4 != 343 && v4 != 337 )
{
return _stack_chk_guard;
}
}
}
else if ( v4 != 355 )
{
if ( v4 > 355 )
{
if ( v4 < 369 || v4 > 370 && (unsigned int)(v4 - 373) > 1 )
return _stack_chk_guard;
}
else if ( v4 != 351 && v4 != 353 && v4 != 349 )
{
return _stack_chk_guard;
}
}
}
}
}
else if ( v4 <= 188 )
{
if ( v4 < 183 )
{
if ( v4 > 92 )
{
if ( v4 > 141 )
{
if ( v4 > 163 )
{
if ( (unsigned int)(v4 - 165) > 0xE )
return _stack_chk_guard;
}
else if ( v4 < 160 && (unsigned int)(v4 - 143) > 4 )
{
return _stack_chk_guard;
}
}
else if ( v4 < 140 )
{
if ( v4 > 119 )
{
if ( (unsigned int)(v4 - 121) > 1 )
return _stack_chk_guard;
}
else if ( v4 < 116 && (v4 < 95 || v4 > 96 && v4 != 103) )
{
return _stack_chk_guard;
}
}
}
else if ( v4 < 90 )
{
if ( v4 <= 40 )
{
if ( v4 < 39 )
{
if ( v4 > 8 )
{
if ( (unsigned int)(v4 - 35) > 1 )
return _stack_chk_guard;
}
else if ( v4 < 6 && (unsigned int)(v4 - 1) > 3 )
{
return _stack_chk_guard;
}
}
}
else if ( v4 > 72 )
{
if ( v4 < 74 || v4 > 78 && (unsigned int)(v4 - 81) > 3 )
return _stack_chk_guard;
}
else if ( v4 < 65 && v4 != 44 && v4 != 62 )
{
return _stack_chk_guard;
}
}
}
}
else if ( v4 <= 265 )
{
if ( v4 < 263 )
{
if ( v4 > 220 )
{
if ( v4 > 258 )
{
if ( (unsigned int)(v4 - 260) > 1 )
return _stack_chk_guard;
}
else if ( v4 < 252 && (unsigned int)(v4 - 247) > 3 )
{
return _stack_chk_guard;
}
}
else if ( v4 < 215 )
{
if ( v4 > 210 )
{
if ( (unsigned int)(v4 - 212) > 1 )
return _stack_chk_guard;
}
else if ( v4 < 200 && v4 != 192 && (v4 < 192 || (unsigned int)(v4 - 194) > 3) )
{
return _stack_chk_guard;
}
}
}
}
else if ( v4 != 299 )
{
if ( v4 <= 299 )
{
if ( v4 <= 275 )
{
if ( v4 < 274 && (unsigned int)(v4 - 267) > 5 )
return _stack_chk_guard;
}
else if ( v4 != 291 )
{
if ( v4 > 291 )
{
if ( (unsigned int)(v4 - 294) > 3 )
return _stack_chk_guard;
}
else if ( v4 != 289 )
{
return _stack_chk_guard;
}
}
}
else if ( v4 != 309 )
{
if ( v4 <= 309 )
{
if ( v4 != 305 && v4 != 307 && v4 != 301 )
return _stack_chk_guard;
}
else if ( v4 != 315 )
{
if ( v4 <= 315 )
{
if ( v4 != 311 )
return _stack_chk_guard;
}
else if ( v4 != 317 && v4 != 321 )
{
return _stack_chk_guard;
}
}
}
}
}
sub_642030(*a2, "_001.png", "_glow_001.png", (__int64)&v16);
sub_D153B8((int)&v15, v16);
v5 = v16 - 24;
if ( v16 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v10 = (unsigned int *)(v16 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
}
else
{
v11 = *((_DWORD *)v16 - 2);
*((_DWORD *)v16 - 2) = v11 - 1;
}
if ( v11 <= 0 )
operator delete(v5);
}
sub_D18D28(&v16, &v15);
GameObject::createGlow((_QWORD *)a1, (const char **)&v16);
v6 = v16 - 24;
if ( v16 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)(v16 - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *((_DWORD *)v16 - 2);
*((_DWORD *)v16 - 2) = v13 - 1;
}
if ( v13 <= 0 )
operator delete(v6);
}
v7 = (void *)(v15 - 24);
if ( (__int64 *)(v15 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v8 = (unsigned int *)(v15 - 8);
do
v9 = __ldaxr(v8);
while ( __stlxr(v9 - 1, v8) );
}
else
{
v9 = *(_DWORD *)(v15 - 8);
*(_DWORD *)(v15 - 8) = v9 - 1;
}
if ( v9 <= 0 )
operator delete(v7);
}
}
return _stack_chk_guard;
}