//
// GameObject::addCustomBlackChild from 0x643b30 to 0x643d34 (516 bytes)
//
// 1 xrefs:
// > ??> @ 0xc8ce8
//
// 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
//
cocos2d::CCSprite *__fastcall GameObject::addCustomBlackChild(GameObject *a1, __int64 a2, char a3, float a4)
{
cocos2d::CCSprite *v6; // x20
char *v7; // x0
cocos2d::CCSprite_vtbl *v8; // x2
void *v10; // x0
unsigned int *v11; // x2
int v12; // w1
unsigned int *v13; // x2
int v14; // w1
const char *v15; // [xsp+48h] [xbp+48h] BYREF
cocos2d::CCPoint v16; // [xsp+50h] [xbp+50h] BYREF
if ( a3 )
{
sub_D18D28(&v16, a2);
v6 = GameObject::addCustomColorChild(a1, (const char **)&v16);
v10 = (void *)(*(_QWORD *)&v16 - 24LL);
if ( (__int64 *)(*(_QWORD *)&v16 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = (unsigned int *)(*(_QWORD *)&v16 - 8LL);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *(_DWORD *)(*(_QWORD *)&v16 - 8LL);
*(_DWORD *)(*(_QWORD *)&v16 - 8LL) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v10);
}
}
else
{
sub_D18D28(&v15, a2);
cocos2d::CCPoint::CCPoint(&v16, &stru_1242068);
v6 = GameObject::addCustomChild((__int64)a1, &v15, (__int64)&v16, 0xFFFFFFFE);
v7 = (char *)(v15 - 24);
if ( v15 - 24 != (const char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(v15 - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *((_DWORD *)v15 - 2);
*((_DWORD *)v15 - 2) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v7);
}
v6->setColor(v6, (const cocos2d::ccColor3B *)&unk_EC3610);
v8 = v6->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->m_blackChildOpacity = a4;
v8->setOpacity(v6, (unsigned int)(float)(a4 * 255.0));
a1->m_isColorSpriteBlack = 1;
}
return v6;
}