//
// GJEffectManager::processInheritedColors from 0x1002de900 to 0x1002dec6e (878 bytes)
//
// 3 xrefs:
// > PlayLayer::loadDefaultColors @ 0x1000b1f30
// > GJEffectManager::processColors @ 0x1002de750
// > GJEffectManager::loadFromState @ 0x1002efa4e
//
// 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 GJEffectManager::processInheritedColors(GJEffectManager *a1)
{
GJEffectManager *v1; // r12
cocos2d::CCDictionary *m_unkDict268; // rax
cocos2d::CCDictElement *m_pElements; // rcx
cocos2d::CCObject *m_pObject; // rdx
cocos2d::CCDictionary *m_colorActionDict; // rcx
cocos2d::CCDictElement *next; // rdx
cocos2d::CCObject *v7; // rbx
int m_uID; // r15d
int m_uUnknown; // eax
unsigned int v10; // r13d
InheritanceNode *v11; // r14
std::__vector_base::pointer begin; // rax
intptr_t v13; // rcx
InheritanceNode *v14; // r12
int v15; // esi
cocos2d::CCDictElement *v16; // r15
ColorAction *ColorAction; // rax
int m_colorID; // ecx
InheritanceNode *v19; // rax
std::__vector_base::pointer v20; // rax
cocos2d::CCDictElement *v21; // rbx
cocos2d::CCObject *v22; // r14
int v23; // esi
cocos2d::CCArray *m_unkArray430; // rdi
cocos2d::ccArray *data; // rax
unsigned __int64 arr; // r14
unsigned __int64 v27; // r15
intptr_t v28; // [rsp+8h] [rbp-48h]
cocos2d::CCDictElement *v29; // [rsp+18h] [rbp-38h]
cocos2d::CCDictElement *v30; // [rsp+18h] [rbp-38h]
v1 = a1;
if ( cocos2d::CCDictionary::count(a1->m_colorActionDict) )
{
m_unkDict268 = a1->m_unkDict268;
if ( m_unkDict268 )
{
m_pElements = m_unkDict268->m_pElements;
while ( m_pElements )
{
m_pObject = m_pElements->m_pObject;
m_pElements = (cocos2d::CCDictElement *)m_pElements->hh.next;
if ( !BYTE1(m_pObject[1].m_uAutoReleaseCount) )
{
*(_QWORD *)&m_pObject[1].m_uID = 0;
LOWORD(m_pObject[1].m_uAutoReleaseCount) = 257;
}
}
}
m_colorActionDict = a1->m_colorActionDict;
if ( m_colorActionDict )
{
next = m_colorActionDict->m_pElements;
if ( next )
{
while ( 1 )
{
v7 = next->m_pObject;
next = (cocos2d::CCDictElement *)next->hh.next;
LOBYTE(v7[2].m_nLuaID) = 0;
BYTE2(v7[2].m_nLuaID) = 0;
m_uID = v7[2].m_uID;
if ( m_uID <= 0 )
m_uID = 0;
m_uUnknown = v7[1].m_uUnknown;
if ( m_uID >= 9999 )
m_uID = 9999;
v10 = 9999;
if ( (unsigned int)m_uUnknown < 0x270F )
v10 = v7[1].m_uUnknown;
if ( m_uUnknown <= 0 )
v10 = 0;
v11 = *(InheritanceNode **)&v7[2].m_unknown2;
begin = v1->m_unkVector270.__begin_;
if ( v11 )
break;
v11 = begin[v10];
if ( v11 )
break;
v30 = next;
v11 = (InheritanceNode *)operator new(0x58u);
cocos2d::CCObject::CCObject(v11);
v11->__vftable = (InheritanceNode_vtbl *)off_100909FC8;
*(_WORD *)&v11->m_unk050 = 1;
v11->m_colorID = v10;
*(_OWORD *)&v11->m_inheritanceNode = 0;
cocos2d::CCObject::autorelease(v11);
cocos2d::CCDictionary::setObject(a1->m_unkDict268, v11, v10);
v20 = a1->m_unkVector270.__begin_;
v20[v10] = v11;
next = v30;
v13 = (unsigned int)m_uID;
v14 = v20[m_uID];
if ( !v14 )
goto LABEL_23;
LABEL_24:
*(_QWORD *)&v7[2].m_unknown2 = v11;
v11->m_unk051 = 0;
v14->m_unk051 = 0;
v11->m_colorAction = (ColorAction *)v7;
if ( !v14->m_colorAction )
{
v15 = m_uID;
v16 = next;
ColorAction = GJEffectManager::getColorAction(a1, v15);
next = v16;
v14->m_colorAction = ColorAction;
}
m_colorID = v14->m_colorID;
v19 = v14;
while ( 1 )
{
if ( m_colorID == v10 )
{
LABEL_10:
BYTE2(v7[2].m_nLuaID) = 1;
goto LABEL_11;
}
v19 = v19->m_inheritanceNode;
if ( !v19 )
break;
m_colorID = v19->m_colorID;
if ( m_colorID == v10 )
goto LABEL_10;
}
if ( !v11->m_inheritanceNode )
{
v11->m_inheritanceNode = v14;
v14->m_unk050 = 0;
}
LABEL_11:
v1 = a1;
if ( !next )
{
m_unkDict268 = a1->m_unkDict268;
goto LABEL_36;
}
}
v13 = (unsigned int)m_uID;
v14 = begin[m_uID];
if ( v14 )
goto LABEL_24;
LABEL_23:
v28 = v13;
v29 = next;
v14 = (InheritanceNode *)operator new(0x58u);
cocos2d::CCObject::CCObject(v14);
v14->__vftable = (InheritanceNode_vtbl *)off_100909FC8;
*(_WORD *)&v14->m_unk050 = 1;
v14->m_colorID = m_uID;
*(_OWORD *)&v14->m_inheritanceNode = 0;
cocos2d::CCObject::autorelease(v14);
cocos2d::CCDictionary::setObject(a1->m_unkDict268, v14, v28);
a1->m_unkVector270.__begin_[v28] = v14;
next = v29;
goto LABEL_24;
}
}
LABEL_36:
if ( m_unkDict268 )
{
v21 = m_unkDict268->m_pElements;
while ( v21 )
{
v22 = v21->m_pObject;
v21 = (cocos2d::CCDictElement *)v21->hh.next;
if ( !BYTE1(v22[1].m_uAutoReleaseCount) && LOBYTE(v22[1].m_uAutoReleaseCount) == 1 )
{
do
{
v23 = (int)v22;
sub_10071FCD0(v1->m_unkArray430, v22);
v22 = *(cocos2d::CCObject **)&v22[1].m_uID;
}
while ( v22 );
m_unkArray430 = v1->m_unkArray430;
if ( m_unkArray430 )
{
data = m_unkArray430->data;
if ( data->num )
{
arr = (unsigned __int64)data->arr;
v27 = arr + 8LL * data->num - 8;
do
{
if ( !*(_QWORD *)v27 )
break;
GJEffectManager::calculateInheritedColor(v1, v23, *(ColorAction **)(*(_QWORD *)v27 + 72LL));
v27 -= 8LL;
}
while ( v27 >= arr );
m_unkArray430 = v1->m_unkArray430;
}
sub_100720270(m_unkArray430);
}
else
{
sub_100720270(0);
}
}
}
}
}
}