//
// GameObject::addMainSpriteToParent from 0x10025cd58 to 0x10025ceac (340 bytes)
//
// 47 xrefs:
// > ParticleGameObject::addMainSpriteToParent @ 0x100380eb4
// > LabelGameObject::addMainSpriteToParent @ 0x100389364
// > ??> @ 0x1007c40a8
// > ??> @ 0x1007cfd78
// > ??> @ 0x1007d0560
// > ??> @ 0x1007d0d70
// > ??> @ 0x1007f55e0
// > ??> @ 0x1007f5e18
// > ??> @ 0x1007f6e08
// > ??> @ 0x1007f7600
// > ??> @ 0x1007f7df8
// > ??> @ 0x1007f85f0
// > ??> @ 0x1007f8de8
// > ??> @ 0x1007f9de0
// > ??> @ 0x1007fa648
// > ??> @ 0x1007fae58
// > ??> @ 0x1007fb668
// > ??> @ 0x1007fbe78
// > ??> @ 0x1007fc688
// > ??> @ 0x1007fce98
// > ??> @ 0x1007fd6a8
// > ??> @ 0x1007fdeb8
// > ??> @ 0x1007fe6c8
// > ??> @ 0x1007feed8
// > ??> @ 0x1007ff700
// > ??> @ 0x1007fff58
// > ??> @ 0x100800780
// > ??> @ 0x100800fa8
// > ??> @ 0x1008017d0
// > ??> @ 0x100801ff8
// > ??> @ 0x100802808
// > ??> @ 0x100803018
// > ??> @ 0x100803828
// > ??> @ 0x100804038
// > ??> @ 0x100804848
// > ??> @ 0x100805058
// > ??> @ 0x100805868
// > ??> @ 0x100806078
// > ??> @ 0x100806888
// > ??> @ 0x100807098
// > ??> @ 0x1008078a8
// > ??> @ 0x1008080b8
// > ??> @ 0x1008088c8
// > ??> @ 0x1008090d8
// > ??> @ 0x1008098e8
// > ??> @ 0x10080a0f8
// > ??> @ 0x100816418
//
// 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::addMainSpriteToParent(GameObject *a1, bool a2)
{
_BOOL4 v2; // w20
ZLayer m_zLayer; // w21
_BOOL4 m_shouldBlendBase; // w22
bool v6; // zf
int ParentMode; // w23
_BOOL4 m_editorEnabled; // w24
GameManager *v9; // x0
__int64 v10; // x8
cocos2d::CCNode *v11; // x21
__int64 v12; // x8
int m_baseOrDetailBlending; // w8
bool v14; // w9
int v15; // w9
v2 = a2;
GameObject::updateBlendMode(a1);
m_zLayer = a1->m_zLayer;
if ( !m_zLayer )
m_zLayer = a1->m_defaultZLayer;
m_shouldBlendBase = a1->m_shouldBlendBase;
v6 = !m_shouldBlendBase || a1->m_colorSprite == nullptr;
if ( !v6 && !a1->m_shouldBlendDetail )
m_zLayer += !a1->m_colorZLayerRelated;
ParentMode = GameObject::getParentMode(a1);
m_editorEnabled = a1->m_editorEnabled;
v9 = GameManager::sharedState();
v10 = 504;
if ( m_editorEnabled )
v10 = 512;
v11 = GJBaseGameLayer::parentForZLayer(
*(GJBaseGameLayer **)((char *)&v9->__vftable + v10),
m_zLayer,
m_shouldBlendBase,
ParentMode,
a1->m_isUIObject);
if ( (cocos2d::CCNode *)((__int64 (__fastcall *)(GameObject *))a1->getParent)(a1) != v11 )
{
((void (__fastcall *)(GameObject *, _QWORD))a1->removeFromParentAndCleanup)(a1, 0);
v12 = 448;
LABEL_13:
(*(void (__fastcall **)(cocos2d::CCNode *, GameObject *))((char *)&v11->copyWithZone + v12))(v11, a1);
goto LABEL_14;
}
if ( v2 )
{
v12 = 576;
goto LABEL_13;
}
LABEL_14:
m_baseOrDetailBlending = a1->m_baseOrDetailBlending;
v14 = a1->m_shouldBlendBase || a1->m_shouldBlendDetail;
v15 = v14;
a1->m_baseOrDetailBlending = v15;
if ( m_baseOrDetailBlending != v15 )
((void (__fastcall *)(GameObject *))a1->blendModeChanged)(a1);
}