//
// GameObject::addColorSpriteToParent from 0x1005aa070 to 0x1005aa276 (518 bytes)
//
// 3 xrefs:
// > PlayLayer::updateVisibility @ 0x1000b78d8
// > LevelEditorLayer::updateVisibility @ 0x1000eaee9
// > GameObject::activateObject @ 0x1005a9fe9
//
// 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; // r15
bool m_shouldBlendDetail; // al
ZLayer m_zLayer; // ebx
cocos2d::CCSprite *v6; // r15
cocos2d::CCSprite *v7; // r15
cocos2d::CCSprite *v8; // r15
int ParentMode; // r12d
_BOOL8 m_editorEnabled; // r13
GameManager *v11; // rax
cocos2d::CCNode *v12; // rbx
cocos2d::CCSprite *v13; // rbx
__int64 v14; // rax
bool m_colorSpriteLocked; // [rsp+7h] [rbp-29h]
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_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 (*)(void))a1->getScaleX)();
((void (__fastcall *)(cocos2d::CCSprite *))m_colorSprite->setScaleX)(m_colorSprite);
v6 = a1->m_colorSprite;
((void (__fastcall *)(GameObject *))a1->getScaleY)(a1);
((void (__fastcall *)(cocos2d::CCSprite *))v6->setScaleY)(v6);
v7 = a1->m_colorSprite;
((void (__fastcall *)(GameObject *))a1->getRotationX)(a1);
((void (__fastcall *)(cocos2d::CCSprite *))v7->setRotationX)(v7);
v8 = a1->m_colorSprite;
((void (__fastcall *)(GameObject *))a1->getRotationY)(a1);
((void (__fastcall *)(cocos2d::CCSprite *))v8->setRotationY)(v8);
LOBYTE(v8) = a1->m_shouldBlendDetail;
ParentMode = GameObject::getParentMode(a1);
m_editorEnabled = a1->m_editorEnabled;
v11 = GameManager::sharedState();
v12 = GJBaseGameLayer::parentForZLayer(
*((GJBaseGameLayer **)&v11->m_playLayer + m_editorEnabled),
m_zLayer,
(bool)v8,
ParentMode,
a1->m_isUIObject);
if ( (cocos2d::CCNode *)((__int64 (__fastcall *)(cocos2d::CCSprite *))a1->m_colorSprite->getParent)(a1->m_colorSprite) == v12 )
{
if ( a2 )
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCSprite *))v12->reorderChild)(v12, a1->m_colorSprite);
}
else
{
((void (__fastcall *)(cocos2d::CCSprite *, _QWORD))a1->m_colorSprite->removeFromParentAndCleanup)(
a1->m_colorSprite,
0);
((void (__fastcall *)(cocos2d::CCNode *, cocos2d::CCSprite *))v12->addChild_0)(v12, a1->m_colorSprite);
if ( m_colorSpriteLocked )
{
v13 = a1->m_colorSprite;
v14 = ((__int64 (__fastcall *)(GameObject *))a1->getPosition)(a1);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v13->setPosition)(v13, v14);
}
}
}
}
}