//
// GameObject::addColorSpriteToParent from 0x100256338 to 0x100256560 (552 bytes)
//
// 3 xrefs:
// > PlayLayer::updateVisibility @ 0x10011c904
// > GameObject::activateObject @ 0x1002562b8
// > LevelEditorLayer::updateVisibility @ 0x10035e9c4
//
// 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::addColorSpriteToParent(GameObject *a1, bool a2)
{
cocos2d::CCSprite *m_colorSprite; // x22
_BOOL4 m_shouldBlendDetail; // w8
_BOOL4 v5; // w20
_BOOL4 m_colorSpriteLocked; // w24
ZLayer m_zLayer; // w21
cocos2d::CCSprite *v8; // x22
cocos2d::CCSprite *v9; // x22
cocos2d::CCSprite *v10; // x22
bool v11; // w22
int ParentMode; // w23
_BOOL4 m_editorEnabled; // w25
GameManager *v14; // x0
__int64 v15; // x8
cocos2d::CCNode *v16; // x21
cocos2d::CCSprite *v17; // x20
__int64 v18; // x1
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
{
v5 = a2;
m_colorSpriteLocked = a1->m_colorSpriteLocked;
a1->m_colorSpriteLocked = 0;
m_zLayer = a1->m_zLayer;
if ( !m_zLayer )
m_zLayer = a1->m_defaultZLayer;
if ( m_shouldBlendDetail )
m_zLayer += a1->m_colorZLayerRelated;
((void (__fastcall *)(GameObject *))a1->getScaleX)(a1);
((void (__fastcall *)(cocos2d::CCSprite *))m_colorSprite->setScaleX)(m_colorSprite);
v8 = a1->m_colorSprite;
((void (__fastcall *)(GameObject *))a1->getScaleY)(a1);
((void (__fastcall *)(cocos2d::CCSprite *))v8->setScaleY)(v8);
v9 = a1->m_colorSprite;
((void (__fastcall *)(GameObject *))a1->getRotationX)(a1);
((void (__fastcall *)(cocos2d::CCSprite *))v9->setRotationX)(v9);
v10 = a1->m_colorSprite;
((void (__fastcall *)(GameObject *))a1->getRotationY)(a1);
((void (__fastcall *)(cocos2d::CCSprite *))v10->setRotationY)(v10);
v11 = a1->m_shouldBlendDetail;
ParentMode = GameObject::getParentMode(a1);
m_editorEnabled = a1->m_editorEnabled;
v14 = GameManager::sharedState();
v15 = 504;
if ( m_editorEnabled )
v15 = 512;
v16 = GJBaseGameLayer::parentForZLayer(
*(GJBaseGameLayer **)((char *)&v14->__vftable + v15),
m_zLayer,
v11,
ParentMode,
a1->m_isUIObject);
if ( (cocos2d::CCNode *)((__int64 (__fastcall *)(cocos2d::CCSprite *))a1->m_colorSprite->getParent)(a1->m_colorSprite) == v16 )
{
if ( v5 )
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCSprite *))v16->reorderChild)(v16, a1->m_colorSprite);
}
else
{
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))a1->m_colorSprite->removeFromParentAndCleanup)(
a1->m_colorSprite,
0);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCSprite *))v16->addChild_0)(v16, a1->m_colorSprite);
if ( m_colorSpriteLocked )
{
v17 = a1->m_colorSprite;
v18 = ((__int64 (__fastcall *)(GameObject *))a1->getPosition)(a1);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v17->setPosition)(v17, v18);
}
}
}
}
}