//
// GJEffectManager::opacityModForGroup from 0x1002d2c50 to 0x1002d2d9a (330 bytes)
//
// 11 xrefs:
// > LevelEditorLayer::updateVisibility @ 0x1000be27c
// > LevelEditorLayer::updateVisibility @ 0x1000be4dc
// > LevelEditorLayer::updateObjectColors @ 0x1000be93c
// > LevelEditorLayer::updateObjectColors @ 0x1000beb4c
// > GJBaseGameLayer::opacityForObject @ 0x10012f02c
// > GameObject::groupOpacityMod @ 0x100690678
// > GameObject::updateMainColor @ 0x10069bed8
// > GameObject::updateMainOpacity @ 0x10069c1a8
// > GameObject::opacityModForMode @ 0x10069c2c8
// > GameObject::updateSecondaryColor @ 0x10069c3e8
// > GameObject::updateSecondaryOpacity @ 0x10069c4b8
//
// 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 12:28:14 +0000
//
float __fastcall GJEffectManager::opacityModForGroup(__int64 a1, int a2)
{
int v2; // eax
unsigned __int64 v3; // rcx
unsigned __int64 v4; // rsi
float result; // xmm0_4
unsigned __int64 v6; // r9
unsigned __int64 v7; // r8
float **v8; // rax
float *v9; // rdi
unsigned __int64 v10; // rsi
__int64 v11; // rax
unsigned __int64 v12; // rax
v2 = 0;
if ( a2 > 0 )
v2 = a2;
v3 = 9999;
if ( v2 < 9999 )
v3 = (unsigned int)v2;
v4 = *(_QWORD *)(a1 + 416);
result = 1.0;
if ( v4 )
{
v6 = (0x101010101010101LL
* ((((v4 - ((v4 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((v4 - ((v4 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)
+ ((((v4 - ((v4 >> 1) & 0x5555555555555555LL)) & 0x3333333333333333LL)
+ (((v4 - ((v4 >> 1) & 0x5555555555555555LL)) >> 2) & 0x3333333333333333LL)) >> 4))
& 0xF0F0F0F0F0F0F0FLL)) >> 56;
if ( v6 > 1 )
{
v7 = v3;
if ( v4 <= v3 )
v7 = (unsigned __int16)((unsigned __int16)v3 % (unsigned __int16)v4);
}
else
{
v7 = ((_DWORD)v4 + 0x3FFF) & (unsigned int)v3;
}
v8 = *(float ***)(*(_QWORD *)(a1 + 408) + 8 * v7);
if ( v8 )
{
v9 = *v8;
if ( *v8 )
{
if ( (unsigned int)v6 < 2 )
{
v10 = v4 - 1;
while ( 1 )
{
v11 = *((_QWORD *)v9 + 1);
if ( v11 == v3 )
{
if ( *((_DWORD *)v9 + 4) == (_DWORD)v3 )
return v9[11];
}
else if ( (v10 & v11) != v7 )
{
return result;
}
v9 = *(float **)v9;
if ( !v9 )
return result;
}
}
do
{
v12 = *((_QWORD *)v9 + 1);
if ( v12 == v3 )
{
if ( *((_DWORD *)v9 + 4) == (_DWORD)v3 )
return v9[11];
}
else
{
if ( v12 < v4 )
goto LABEL_25;
if ( (v4 | v12) >> 32 )
{
v12 %= v4;
LABEL_25:
if ( v12 != v7 )
return result;
goto LABEL_20;
}
if ( (unsigned int)v12 % (unsigned int)v4 != v7 )
return result;
}
LABEL_20:
v9 = *(float **)v9;
}
while ( v9 );
}
}
}
return result;
}