//
// GameObject::setOpacity from 0x1005bc660 to 0x1005bc8e9 (649 bytes)
//
// 17 xrefs:
// > AnimatedGameObject::setOpacity @ 0x1001b73ad
// > EffectGameObject::setOpacity @ 0x1001b94d9
// > sub_1001B9510 @ 0x1001b9520
// > LabelGameObject::setOpacity @ 0x1001c12d9
// > sub_1001C1310 @ 0x1001c1320
// > KeyframeGameObject::setOpacity @ 0x1001c6b5c
// > sub_1001C6BE0 @ 0x1001c6c13
// > PlayerObject::setOpacity @ 0x10041a40c
// > sub_10041A4E0 @ 0x10041a4f3
// > sub_1005BC950 @ 0x1005bc95c
// > ??> @ 0x1008c7bf0
// > ??> @ 0x1008c83d8
// > ??> @ 0x1008c8be8
// > ??> @ 0x1009236b8
// > ??> @ 0x100971768
// > ??> @ 0x100971f50
// > ??> @ 0x100972760
//
// 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; // xmm0_4
float v4; // xmm2_4
int v5; // eax
__m128 v6; // xmm1
int v7; // r15d
cocos2d::CCSprite *m_glowSprite; // rdi
unsigned int v9; // r14d
__m128 v10; // xmm0
__m128 v11; // xmm3
__int64 v12; // rax
unsigned int *v13; // rax
_QWORD *v14; // r12
unsigned __int64 v15; // r13
__int64 v16; // r14
float v17; // xmm0_4
cocos2d::CCSprite *m_colorSprite; // rdi
float v19; // xmm1_4
float v20; // xmm0_4
float v21; // [rsp+20h] [rbp-40h]
float v22; // [rsp+20h] [rbp-40h]
a1->m_areaOpacityRelated = a2;
m_opacityMod2 = a1->m_opacityMod2;
v4 = 0.0;
v5 = (int)(float)((float)a2 * m_opacityMod2);
if ( m_opacityMod2 <= 0.0 )
LOBYTE(v5) = a2;
if ( !a1->m_isDisabled2 )
v4 = (float)(unsigned __int8)v5;
v21 = a1->m_baseColor->m_opacity * v4;
((void (__fastcall *)(GameObject *, _QWORD))a1->updateMainParticleOpacity)(a1, (unsigned __int8)(int)v21);
v6 = (__m128)LODWORD(v21);
if ( a1->m_colorType == 2 )
{
v6 = 0;
if ( !a1->m_shouldBlendBase )
v6 = (__m128)LODWORD(v21);
}
v7 = (int)v6.f32[0];
if ( v6.f32[0] != (float)a1->_realOpacity )
{
cocos2d::CCSprite::setOpacity(a1, v7);
if ( !a1->m_customGlowColor )
{
v21 = 0.0;
if ( a1->m_colorType != 2 )
v21 = v6.f32[0];
}
m_glowSprite = a1->m_glowSprite;
if ( m_glowSprite )
{
v9 = (unsigned __int8)(int)(float)((float)(unsigned __int8)(int)v21 * a1->m_opacityMod);
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))m_glowSprite->setOpacity)(
m_glowSprite,
(unsigned __int8)(int)(float)((float)(unsigned __int8)(int)v21 * a1->m_opacityMod));
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))a1->m_glowSprite->setChildOpacity)(a1->m_glowSprite, v9);
}
if ( a1->m_hasCustomChild && !a1->m_blackChildOpacityLocked )
{
v10.i32[0] = LODWORD(a1->m_blackChildOpacity);
v11 = _mm_cmplt_ss((__m128)0LL, v10);
LODWORD(v22) = _mm_andnot_ps(v11, v6).u32[0] | COERCE_UNSIGNED_INT(v6.f32[0] * v10.f32[0]) & v11.i32[0];
((void (__fastcall *)(GameObject *, _QWORD))a1->updateSecondaryParticleOpacity)(a1, (unsigned __int8)(int)v22);
v12 = ((__int64 (__fastcall *)(GameObject *))a1->getChildren)(a1);
if ( v12 )
{
v13 = *(unsigned int **)(v12 + 56);
if ( *v13 )
{
v14 = *((_QWORD **)v13 + 2);
v15 = (unsigned __int64)&v14[*v13 - 1];
do
{
v16 = *v14;
if ( !*v14 )
break;
v17 = v6.f32[0];
if ( (*(unsigned int (__fastcall **)(_QWORD))(*(_QWORD *)v16 + 64LL))(*v14) != 997 )
v17 = v22;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v16 + 896LL))(v16, (unsigned __int8)(int)v17);
++v14;
}
while ( (unsigned __int64)v14 <= v15 );
}
}
}
}
m_colorSprite = a1->m_colorSprite;
if ( m_colorSprite && !a1->m_blackChildOpacityLocked )
{
v19 = v4 * a1->m_detailColor->m_opacity;
if ( a1->m_childColorType == 2 )
{
v20 = 0.0;
if ( !a1->m_shouldBlendDetail )
v20 = v4 * a1->m_detailColor->m_opacity;
v19 = v20;
}
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))m_colorSprite->setOpacity)(
m_colorSprite,
(unsigned __int8)(int)v19);
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))a1->m_colorSprite->setChildOpacity)(
a1->m_colorSprite,
(unsigned __int8)(int)v19);
}
((void (__fastcall *)(GameObject *, _QWORD))a1->updateParticleOpacity)(a1, (unsigned __int8)v7);
}