//
// GJEffectManager::processInheritedColors from 0x8c0e6c to 0x8c10d8 (620 bytes)
//
// 4 xrefs:
// > PlayLayer::loadDefaultColors @ 0x5da910
// > GJEffectManager::loadFromState @ 0x8c139c
// > GJEffectManager::processColors @ 0x8c1674
// > ??> @ 0xac578
//
// 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 GJEffectManager::processInheritedColors(GJEffectManager *a1)
{
cocos2d::CCDictionary *m_unkDict268; // x5
cocos2d::CCDictElement *m_pElements; // x2
cocos2d::CCDictElement *i; // x0
cocos2d::CCObject *m_pObject; // x1
cocos2d::CCDictionary *m_colorActionDict; // x0
cocos2d::CCDictElement *v7; // x0
ColorAction *v8; // x19
_QWORD *next; // x24
int m_copyID; // w0
int m_colorID; // w21
int v12; // w23
__int64 v13; // x3
InheritanceNode *m_inheritanceNode; // x20
InheritanceNode **m_start; // x0
InheritanceNode *v16; // x22
_QWORD *v17; // x0
cocos2d::CCDictElement *v18; // x0
cocos2d::CCDictElement *j; // x19
InheritanceNode *v20; // x1
cocos2d::CCDictionary *v21; // x0
__int64 v22; // [xsp+68h] [xbp+68h]
__int64 v23; // [xsp+68h] [xbp+68h]
if ( !cocos2d::CCDictionary::count(a1->m_colorActionDict) )
return;
m_unkDict268 = a1->m_unkDict268;
if ( m_unkDict268 )
{
m_pElements = m_unkDict268->m_pElements;
if ( m_pElements )
{
for ( i = (cocos2d::CCDictElement *)m_pElements->hh.next; ; i = (cocos2d::CCDictElement *)i->hh.next )
{
m_pObject = m_pElements->m_pObject;
m_pElements = i;
if ( !BYTE1(m_pObject[1].m_uAutoReleaseCount) )
{
*(_QWORD *)&m_pObject[1].m_uID = 0;
LOBYTE(m_pObject[1].m_uAutoReleaseCount) = 1;
BYTE1(m_pObject[1].m_uAutoReleaseCount) = 1;
}
if ( !i )
break;
}
}
m_colorActionDict = a1->m_colorActionDict;
if ( !m_colorActionDict || (v7 = m_colorActionDict->m_pElements) == nullptr )
{
LABEL_34:
v18 = m_unkDict268->m_pElements;
if ( v18 )
{
for ( j = (cocos2d::CCDictElement *)v18->hh.next; ; j = (cocos2d::CCDictElement *)j->hh.next )
{
v20 = (InheritanceNode *)v18->m_pObject;
if ( !v20->m_unk051 && v20->m_unk050 )
GJEffectManager::traverseInheritanceChain(a1, v20);
if ( !j )
break;
v18 = j;
}
}
return;
}
}
else
{
v21 = a1->m_colorActionDict;
if ( !v21 )
return;
v7 = v21->m_pElements;
if ( !v7 )
return;
}
v8 = (ColorAction *)v7->m_pObject;
next = v7->hh.next;
m_copyID = v8->m_copyID;
v8->m_copyColorCalculated = 0;
v8->m_copyColorLoop = 0;
if ( m_copyID <= 9998 )
goto LABEL_12;
LABEL_28:
m_colorID = v8->m_colorID;
v12 = 9999;
v13 = 79992;
if ( m_colorID <= 0 )
{
LABEL_29:
m_inheritanceNode = v8->m_inheritanceNode;
m_colorID = 0;
m_start = a1->m_unkVector270.m_start;
if ( m_inheritanceNode )
goto LABEL_19;
LABEL_30:
m_inheritanceNode = m_start[m_colorID];
if ( !m_inheritanceNode )
{
v22 = v13;
m_inheritanceNode = InheritanceNode::create(m_colorID, nullptr);
cocos2d::CCDictionary::setObject(a1->m_unkDict268, m_inheritanceNode, m_colorID);
v13 = v22;
a1->m_unkVector270.m_start[m_colorID] = m_inheritanceNode;
m_start = a1->m_unkVector270.m_start;
}
goto LABEL_19;
}
while ( 1 )
{
m_inheritanceNode = v8->m_inheritanceNode;
if ( m_colorID > 9998 )
m_colorID = 9999;
m_start = a1->m_unkVector270.m_start;
if ( !m_inheritanceNode )
goto LABEL_30;
LABEL_19:
v16 = *(InheritanceNode **)((char *)m_start + v13);
if ( !v16 )
{
v23 = v13;
v16 = InheritanceNode::create(v12, nullptr);
cocos2d::CCDictionary::setObject(a1->m_unkDict268, v16, v12);
*(InheritanceNode **)((char *)a1->m_unkVector270.m_start + v23) = v16;
}
v8->m_inheritanceNode = m_inheritanceNode;
m_inheritanceNode->m_unk051 = 0;
v16->m_unk051 = 0;
m_inheritanceNode->m_colorAction = v8;
if ( !v16->m_colorAction )
v16->m_colorAction = GJEffectManager::getColorAction(a1, v12);
if ( GJEffectManager::wouldCreateLoop(a1, v16, m_colorID) )
{
v8->m_copyColorLoop = 1;
if ( !next )
break;
goto LABEL_27;
}
if ( !m_inheritanceNode->m_inheritanceNode )
{
m_inheritanceNode->m_inheritanceNode = v16;
v16->m_unk050 = 0;
}
if ( !next )
break;
LABEL_27:
v17 = next;
next = (_QWORD *)next[36];
v8 = (ColorAction *)v17[33];
m_copyID = v8->m_copyID;
v8->m_copyColorCalculated = 0;
v8->m_copyColorLoop = 0;
if ( m_copyID > 9998 )
goto LABEL_28;
LABEL_12:
m_colorID = v8->m_colorID;
if ( m_copyID < 0 )
v12 = 0;
else
v12 = m_copyID;
v13 = 8LL * v12;
if ( m_colorID <= 0 )
goto LABEL_29;
}
m_unkDict268 = a1->m_unkDict268;
if ( m_unkDict268 )
goto LABEL_34;
}