//
// GameObject::setOpacity from 0x354eec to 0x3550ae (450 bytes)
//
// 5 xrefs:
// > PlayerObject::setOpacity @ 0x33bf88
// > `non-virtual thunk to'GameObject::setOpacity @ 0x3550b8
// > EffectGameObject::setOpacity @ 0x3e0df0
// > LabelGameObject::setOpacity @ 0x3e0e7a
// > AnimatedGameObject::setOpacity @ 0x3e4a0c
//
// 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 GameObject::setOpacity(GameObject *a1, unsigned __int8 a2)
{
float m_opacityMod2; // s14
_BOOL4 m_isDisabled2; // r3
float v5; // s16
float v6; // s17
unsigned __int8 v7; // r5
cocos2d::CCSprite *m_colorSprite; // r0
float m_blackChildOpacity; // s15
unsigned int v10; // s17
cocos2d::CCArray *v11; // r0
cocos2d::ccArray *data; // r2
cocos2d::CCObject **arr; // r6
cocos2d::CCObject **v14; // r7
int v15; // r9
int v16; // t1
void (__fastcall *v17)(int, int); // r11
int v18; // r1
float v19; // s15
unsigned __int8 v20[4]; // [sp+0h] [bp-Ch]
m_opacityMod2 = a1->m_opacityMod2;
m_isDisabled2 = a1->m_isDisabled2;
a1->m_areaOpacityRelated = a2;
if ( m_opacityMod2 > 0.0 )
*(_DWORD *)&a2 = (unsigned __int8)(unsigned int)(float)((float)a2 * m_opacityMod2);
if ( m_isDisabled2 )
*(_DWORD *)&a2 = 0;
v5 = (float)a2;
v6 = (float)a2 * a1->m_baseColor->m_opacity;
v7 = (unsigned int)v6;
a1->updateMainParticleOpacity(a1, v7);
if ( a1->m_colorType == 2 && a1->m_shouldBlendBase )
v6 = 0.0;
*(_DWORD *)v20 = (unsigned int)v6;
if ( (float)a1->_realOpacity != v6 )
{
cocos2d::CCSprite::setOpacity(a1, v20[0]);
if ( !a1->m_customGlowColor )
{
if ( a1->m_colorType == 2 )
v7 = 0;
else
v7 = (unsigned int)v6;
}
GameObject::setGlowOpacity(a1, v7);
if ( a1->m_hasCustomChild && !a1->m_blackChildOpacityLocked )
{
m_blackChildOpacity = a1->m_blackChildOpacity;
if ( m_blackChildOpacity > 0.0 )
v6 = v6 * m_blackChildOpacity;
v10 = (unsigned int)v6;
a1->updateSecondaryParticleOpacity(a1, v10);
v11 = a1->getChildren(a1);
if ( v11 )
{
data = v11->data;
if ( data->num )
{
arr = data->arr;
v14 = &arr[data->num] + 0x3FFFFFFF;
while ( arr <= v14 )
{
v16 = (int)*arr++;
v15 = v16;
if ( !v16 )
break;
v17 = *(void (__fastcall **)(int, int))(*(_DWORD *)v15 + 448);
if ( (*(int (__fastcall **)(int))(*(_DWORD *)v15 + 32))(v15) == 997 )
v18 = v20[0];
else
v18 = (unsigned __int8)v10;
v17(v15, v18);
}
}
}
}
}
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;
m_colorSprite->setOpacity(m_colorSprite, (unsigned int)v19);
a1->m_colorSprite->setChildOpacity(a1->m_colorSprite, (unsigned int)v19);
}
a1->updateParticleOpacity(a1, v20[0]);
}