//
// GJEffectManager::init from 0x8c1688 to 0x8c1934 (684 bytes)
//
// 2 xrefs:
// > ??> @ 0x981d8
// > ??> @ 0x1192c40
//
// 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
//
bool GJEffectManager::init(GJEffectManager *a1)
{
bool v2; // w20
cocos2d::CCDictionary *v4; // x0
cocos2d::CCDictionary *v5; // x0
cocos2d::CCArray *v6; // x0
cocos2d::CCArray *v7; // x0
cocos2d::CCDictionary *v8; // x0
cocos2d::CCDictionary *v9; // x0
ColorActionSprite **m_start; // x0
unsigned __int64 v11; // x1
ColorAction **v12; // x0
unsigned __int64 v13; // x1
std::uintptr_t *m_bitptr; // x5
unsigned int m_offset; // w6
std::uintptr_t *v16; // x4
__int64 v17; // x1
unsigned __int64 v18; // x2
__int64 v19; // x1
InheritanceNode **v20; // x0
unsigned __int64 v21; // x1
std::uintptr_t *v22; // x5
unsigned int v23; // w6
std::uintptr_t *v24; // x4
__int64 v25; // x1
unsigned __int64 v26; // x2
__int64 v27; // x1
unsigned __int64 v28; // x1
unsigned __int64 v29; // x2
__int64 v30; // x0
std::uintptr_t *v31; // x4
__int64 i; // x0
ColorAction **m_finish; // x1
v2 = cocos2d::CCNode::init(a1);
if ( !v2 )
return 0;
v4 = cocos2d::CCDictionary::create();
a1->m_unkObject148 = v4;
cocos2d::CCObject::retain(v4);
v5 = cocos2d::CCDictionary::create();
a1->m_unkDict150 = v5;
cocos2d::CCObject::retain(v5);
v7 = (cocos2d::CCArray *)cocos2d::CCArray::create(v6);
a1->m_unkArray430 = v7;
cocos2d::CCObject::retain(v7);
v8 = cocos2d::CCDictionary::create();
a1->m_unkDict268 = v8;
cocos2d::CCObject::retain(v8);
v9 = cocos2d::CCDictionary::create();
a1->m_colorActionDict = v9;
cocos2d::CCObject::retain(v9);
m_start = a1->m_colorActionSpriteVector.m_start;
v11 = a1->m_colorActionSpriteVector.m_finish - m_start;
if ( v11 <= 0x44D )
{
std::vector::_M_default_append((__int64)&a1->m_colorActionSpriteVector, 1102 - v11);
LABEL_5:
v12 = a1->m_colorActionVector.m_start;
v13 = a1->m_colorActionVector.m_finish - v12;
if ( v13 > 0x44D )
goto LABEL_6;
goto LABEL_21;
}
if ( v11 == 1102 )
goto LABEL_5;
m_finish = a1->m_colorActionVector.m_finish;
a1->m_colorActionSpriteVector.m_finish = m_start + 1102;
v12 = a1->m_colorActionVector.m_start;
v13 = m_finish - v12;
if ( v13 > 0x44D )
{
LABEL_6:
if ( v13 != 1102 )
a1->m_colorActionVector.m_finish = v12 + 1102;
goto LABEL_8;
}
LABEL_21:
std::vector::_M_default_append((__int64)&a1->m_colorActionVector, 1102 - v13);
LABEL_8:
m_bitptr = a1->m_unkVector438.m_end.m_bitptr;
m_offset = a1->m_unkVector438.m_end.m_offset;
v16 = a1->m_unkVector438.m_start.m_bitptr;
v17 = a1->m_unkVector438.m_start.m_offset;
v18 = m_offset + 8 * ((char *)m_bitptr - (char *)v16) - v17;
if ( v18 <= 0x2710 )
{
std::vector::_M_fill_insert((__int64)&a1->m_unkVector438, (__int64)m_bitptr, m_offset, 10000 - v18, 0);
}
else
{
v19 = v17 + 10000;
a1->m_unkVector438.m_end.m_offset = v19 & 0x3F;
a1->m_unkVector438.m_end.m_bitptr = &v16[v19 >> 6];
}
v20 = a1->m_unkVector270.m_start;
v21 = a1->m_unkVector270.m_finish - v20;
if ( v21 <= 0x270F )
{
std::vector::_M_default_append((__int64)&a1->m_unkVector270, 10000 - v21);
}
else if ( v21 != 10000 )
{
a1->m_unkVector270.m_finish = v20 + 10000;
}
v22 = a1->m_unkVector2f0.m_end.m_bitptr;
v23 = a1->m_unkVector2f0.m_end.m_offset;
v24 = a1->m_unkVector2f0.m_start.m_bitptr;
v25 = a1->m_unkVector2f0.m_start.m_offset;
v26 = v23 + 8 * ((char *)v22 - (char *)v24) - v25;
if ( v26 <= 0x2710 )
{
std::vector::_M_fill_insert((__int64)&a1->m_unkVector2f0, (__int64)v22, v23, 10000 - v26, 0);
}
else
{
v27 = v25 + 10000;
a1->m_unkVector2f0.m_end.m_offset = v27 & 0x3F;
a1->m_unkVector2f0.m_end.m_bitptr = &v24[v27 >> 6];
}
v28 = 0;
do
{
v29 = v28 >> 6;
v30 = 1LL << (v28 & 0x3F);
a1->m_unkVector270.m_start[v28++] = nullptr;
v31 = a1->m_unkVector438.m_start.m_bitptr;
a1->m_unkVector2f0.m_start.m_bitptr[v29] &= ~v30;
v31[v29] |= v30;
}
while ( v28 != 10000 );
for ( i = 0; i != 1102; ++i )
{
a1->m_colorActionSpriteVector.m_start[i] = nullptr;
a1->m_colorActionVector.m_start[i] = nullptr;
}
return v2;
}