//
// GameObject::setOpacity from 0x10025b9a4 to 0x10025bb9c (504 bytes)
//
// 15 xrefs:
// > PlayerObject::setOpacity @ 0x10022c6c8
// > sub_10025BBFC @ 0x10025bc00
// > AnimatedGameObject::setOpacity @ 0x100383f3c
// > EffectGameObject::setOpacity @ 0x10038529c
// > sub_1003852CC @ 0x1003852e0
// > LabelGameObject::setOpacity @ 0x100388d00
// > sub_100388D30 @ 0x100388d44
// > KeyframeGameObject::setOpacity @ 0x10038b2c8
// > ??> @ 0x1007cfc08
// > ??> @ 0x1007d03f0
// > ??> @ 0x1007d0c00
// > ??> @ 0x1007f8c78
// > ??> @ 0x1007f9460
// > ??> @ 0x1007f9c70
// > ??> @ 0x1008162a8
//
// 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
//
void __fastcall GameObject::setOpacity(GameObject *a1, unsigned __int8 a2)
{
float m_opacityMod2; // s0
unsigned int v4; // w8
float v5; // s8
float v6; // s9
int v7; // w21
unsigned int v8; // s0
float m_blackChildOpacity; // s0
float v10; // s10
__int64 v11; // x0
unsigned int *v12; // x9
__int64 v13; // x8
_QWORD *v14; // x22
unsigned __int64 v15; // x23
__int64 v16; // x21
float v17; // s0
cocos2d::CCSprite *m_colorSprite; // x0
float v19; // s0
__int64 v20; // x21
a1->m_areaOpacityRelated = a2;
m_opacityMod2 = a1->m_opacityMod2;
v4 = (int)(float)(m_opacityMod2 * (float)a2);
if ( m_opacityMod2 <= 0.0 )
v4 = a2;
if ( a1->m_isDisabled2 )
v5 = 0.0;
else
v5 = (float)v4;
v6 = a1->m_baseColor->m_opacity * v5;
v7 = (int)v6;
((void (__fastcall *)(GameObject *, _QWORD))a1->updateMainParticleOpacity)(a1, (unsigned int)(int)v6);
if ( a1->m_colorType == 2 && a1->m_shouldBlendBase )
v6 = 0.0;
LOBYTE(v8) = a1->_realOpacity;
if ( v6 != (float)v8 )
{
cocos2d::CCSprite::setOpacity(a1, (int)v6);
if ( !a1->m_customGlowColor )
{
if ( a1->m_colorType == 2 )
LOBYTE(v7) = 0;
else
LOBYTE(v7) = (int)v6;
}
GameObject::setGlowOpacity(a1, v7);
if ( a1->m_hasCustomChild && !a1->m_blackChildOpacityLocked )
{
m_blackChildOpacity = a1->m_blackChildOpacity;
v10 = m_blackChildOpacity <= 0.0 ? v6 : v6 * m_blackChildOpacity;
((void (__fastcall *)(GameObject *, _QWORD))a1->updateSecondaryParticleOpacity)(a1, (unsigned int)(int)v10);
v11 = ((__int64 (__fastcall *)(GameObject *))a1->getChildren)(a1);
if ( v11 )
{
v12 = *(unsigned int **)(v11 + 56);
v13 = *v12;
if ( (_DWORD)v13 )
{
v14 = *((_QWORD **)v12 + 2);
v15 = (unsigned __int64)&v14[v13 - 1];
do
{
v16 = *v14;
if ( !*v14 )
break;
v17 = (*(unsigned int (__fastcall **)(_QWORD))(*(_QWORD *)v16 + 64LL))(*v14) == 997 ? v6 : v10;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v16 + 896LL))(v16, (unsigned int)(int)v17);
++v14;
}
while ( (unsigned __int64)v14 <= v15 );
}
}
}
}
m_colorSprite = a1->m_colorSprite;
if ( m_colorSprite && !a1->m_blackChildOpacityLocked )
{
v19 = v5 * a1->m_detailColor->m_opacity;
if ( a1->m_childColorType == 2 && a1->m_shouldBlendDetail )
v19 = 0.0;
v20 = (unsigned int)(int)v19;
((void (__fastcall *)(cocos2d::CCSprite *, __int64))m_colorSprite->setOpacity)(m_colorSprite, v20);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))a1->m_colorSprite->setChildOpacity)(a1->m_colorSprite, v20);
}
((void (__fastcall *)(GameObject *, _QWORD))a1->updateParticleOpacity)(a1, (unsigned int)(int)v6);
}