//
// GJEffectManager::opacityModForGroup from 0x1002e81b0 to 0x1002e82fa (330 bytes)
//
// 11 xrefs:
// > LevelEditorLayer::updateVisibility @ 0x1000eb3cc
// > LevelEditorLayer::updateVisibility @ 0x1000eb61c
// > LevelEditorLayer::updateObjectColors @ 0x1000eba7c
// > LevelEditorLayer::updateObjectColors @ 0x1000ebc8c
// > GJBaseGameLayer::opacityForObject @ 0x10015110c
// > GameObject::groupOpacityMod @ 0x1005befc8
// > GameObject::updateMainColor @ 0x1005ca7d8
// > GameObject::updateMainOpacity @ 0x1005caaa8
// > GameObject::opacityModForMode @ 0x1005cabc8
// > GameObject::updateSecondaryColor @ 0x1005cace8
// > GameObject::updateSecondaryOpacity @ 0x1005cadb8
//
// 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
//
float __fastcall GJEffectManager::opacityModForGroup(GJEffectManager *a1, int a2)
{
int v2; // eax
unsigned __int64 v3; // rcx
unsigned __int64 value; // rsi
float result; // xmm0_4
unsigned __int64 v6; // r9
unsigned __int64 v7; // r8
std::__hash_node_base, void *> *> *v8; // rax
std::__hash_node_base, void *> *>::__next_pointer next; // rdi
unsigned __int64 v10; // rsi
std::__hash_node_base, void *> *>::__next_pointer v11; // rax
unsigned __int64 v12; // rax
v2 = 0;
if ( a2 > 0 )
v2 = a2;
v3 = 9999;
if ( v2 < 9999 )
v3 = (unsigned int)v2;
value = a1->m_opacityEffectMap.__table_.__bucket_list_.__ptr_.__value_.__data_.__value_;
result = 1.0;
if ( value )
{
v6 = (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 ( v6 > 1 )
{
v7 = v3;
if ( value <= v3 )
v7 = (unsigned __int16)((unsigned __int16)v3 % (unsigned __int16)value);
}
else
{
v7 = ((_DWORD)value + 0x3FFF) & (unsigned int)v3;
}
v8 = a1->m_opacityEffectMap.__table_.__bucket_list_.__ptr_.__value_[v7];
if ( v8 )
{
next = v8->__next_;
if ( v8->__next_ )
{
if ( (unsigned int)v6 < 2 )
{
v10 = value - 1;
while ( 1 )
{
v11 = next[1].__next_;
if ( v11 == (std::__hash_node_base, void *> *>::__next_pointer)v3 )
{
if ( LODWORD(next[2].__next_) == (_DWORD)v3 )
return *((float *)&next[5].__next_ + 1);
}
else if ( (v10 & (unsigned __int64)v11) != v7 )
{
return result;
}
next = next->__next_;
if ( !next )
return result;
}
}
do
{
v12 = (unsigned __int64)next[1].__next_;
if ( v12 == v3 )
{
if ( LODWORD(next[2].__next_) == (_DWORD)v3 )
return *((float *)&next[5].__next_ + 1);
}
else
{
if ( v12 < value )
goto LABEL_25;
if ( (value | v12) >> 32 )
{
v12 %= value;
LABEL_25:
if ( v12 != v7 )
return result;
goto LABEL_20;
}
if ( (unsigned int)v12 % (unsigned int)value != v7 )
return result;
}
LABEL_20:
next = next->__next_;
}
while ( next );
}
}
}
return result;
}