//
// GameObject::addColorSpriteToParent from 0x14019bfc0 to 0x14019c1b8 (504 bytes)
//
// 8 xrefs:
// > GameObject::activateObject @ 0x140190b7e
// > LevelEditorLayer::updateVisibility @ 0x1402d9238
// > PlayLayer::updateVisibility @ 0x1403afcfa
// > AnimatedGameObject::activateObject @ 0x1404a3bb0
// > ??> @ 0x1406791c0
// > ??> @ 0x1406791d4
// > ??> @ 0x1406791e4
// > ??> @ 0x1406cbd18
//
// 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::addColorSpriteToParent(GameObject *a1, bool a2)
{
cocos2d::CCSprite *m_colorSprite; // rbx
bool m_shouldBlendDetail; // al
ZLayer m_zLayer; // esi
bool m_colorSpriteLocked; // r14
cocos2d::CCSprite_vtbl *v8; // rbx
cocos2d::CCSprite_vtbl *v9; // rbx
cocos2d::CCSprite_vtbl *v10; // rbx
cocos2d::CCSprite_vtbl *v11; // rbx
int ParentMode; // eax
cocos2d::CCNode *v13; // rbx
cocos2d::CCSprite_vtbl *v14; // rbx
const cocos2d::CCPoint *v15; // rax
m_colorSprite = a1->m_colorSprite;
if ( m_colorSprite && !a1->m_unk28c )
{
m_shouldBlendDetail = a1->m_shouldBlendDetail;
if ( a1->m_shouldBlendBase == m_shouldBlendDetail )
{
GameObject::addColorSpriteToSelf(a1);
}
else
{
m_zLayer = a1->m_zLayer;
m_colorSpriteLocked = a1->m_colorSpriteLocked;
a1->m_colorSpriteLocked = 0;
if ( !m_zLayer )
m_zLayer = a1->m_defaultZLayer;
if ( m_shouldBlendDetail && a1->m_colorZLayerRelated )
++m_zLayer;
v8 = m_colorSprite->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
a1->getScaleX(a1);
((void (__fastcall *)(cocos2d::CCSprite *))v8->setScaleX)(a1->m_colorSprite);
v9 = a1->m_colorSprite->__vftable;
a1->getScaleY(a1);
((void (__fastcall *)(cocos2d::CCSprite *))v9->setScaleY)(a1->m_colorSprite);
v10 = a1->m_colorSprite->__vftable;
a1->getRotationX(a1);
((void (__fastcall *)(cocos2d::CCSprite *))v10->setRotationX)(a1->m_colorSprite);
v11 = a1->m_colorSprite->__vftable;
a1->getRotationY(a1);
((void (__fastcall *)(cocos2d::CCSprite *))v11->setRotationY)(a1->m_colorSprite);
ParentMode = GameObject::getParentMode(a1);
v13 = GameObject::parentForZLayer(a1, m_zLayer, a1->m_shouldBlendDetail, ParentMode);
if ( a1->m_colorSprite->getParent(a1->m_colorSprite) == v13 )
{
if ( a2 )
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCSprite *))v13->reorderChild)(v13, a1->m_colorSprite);
}
else
{
a1->m_colorSprite->removeFromParentAndCleanup(a1->m_colorSprite, 0);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCSprite *))v13->addChild_0)(v13, a1->m_colorSprite);
if ( m_colorSpriteLocked )
{
v14 = a1->m_colorSprite->__vftable;
v15 = a1->getPosition_0(a1);
v14->setPosition_0(a1->m_colorSprite, v15);
}
}
}
}
}