//
// CustomizeObjectLayer::determineStartValues from 0x1400a8750 to 0x1400a8971 (545 bytes)
//
// 2 xrefs:
// > CustomizeObjectLayer::init @ 0x1400a5973
// > ??> @ 0x1406c77c4
//
// 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 CustomizeObjectLayer::determineStartValues(CustomizeObjectLayer *a1)
{
GameObject *m_targetObject; // rcx
__int16 m_customColorType; // ax
bool m_maybeNotColorable; // al
int m_defaultColorID; // edx
GJSpriteColor *m_baseColor; // rsi
__int16 v7; // ax
bool v8; // al
GJSpriteColor *m_detailColor; // rax
int v10; // edx
cocos2d::CCArray *m_targetObjects; // rcx
unsigned int v12; // edi
struct cocos2d::CCObject *v13; // rax
struct cocos2d::CCObject *v14; // rcx
__int16 m_unknown2; // ax
char m_nLuaID; // al
int v17; // edx
__int64 v18; // rax
__int16 v19; // ax
char v20; // al
__int64 v21; // rax
int v22; // edx
m_targetObject = a1->m_targetObject;
if ( !m_targetObject )
{
m_targetObjects = a1->m_targetObjects;
v12 = 0;
a1->m_glowDisabled = 1;
if ( !cocos2d::CCArray::count(m_targetObjects) )
return;
while ( 1 )
{
v13 = cocos2d::CCArray::objectAtIndex(a1->m_targetObjects, v12);
v14 = v13;
if ( !a1->m_hasBaseColor )
break;
if ( !a1->m_hasDetailColor )
goto LABEL_33;
LABEL_43:
if ( !LOBYTE(v14[18].m_uReference) )
a1->m_glowDisabled = 0;
if ( ++v12 >= cocos2d::CCArray::count(a1->m_targetObjects) )
return;
}
m_unknown2 = v13[18].m_unknown2;
if ( m_unknown2 )
m_nLuaID = m_unknown2 == 1;
else
m_nLuaID = v14[23].m_nLuaID;
if ( m_nLuaID
|| v14[16].__vftable
|| (v17 = *(_DWORD *)(*(_QWORD *)&v14[19].m_unknown2 + 4LL), v17 == 1004)
|| (v18 = 0, !v17) )
{
v18 = *(_QWORD *)&v14[19].m_unknown2;
}
a1->m_hasBaseColor = v18 != 0;
LABEL_33:
if ( !a1->m_hasDetailColor )
{
v19 = v14[18].m_unknown2;
if ( v19 )
v20 = v19 == 1;
else
v20 = v14[23].m_nLuaID;
if ( v20
|| v14[16].__vftable
|| (v21 = *(_QWORD *)&v14[19].m_unknown2, v22 = *(_DWORD *)(v21 + 4), v22 == 1004)
|| !v22 )
{
v21 = *(_QWORD *)&v14[19].m_uOrderOfArrival;
}
a1->m_hasDetailColor = v21 != 0;
}
goto LABEL_43;
}
m_customColorType = m_targetObject->m_customColorType;
if ( m_customColorType )
m_maybeNotColorable = m_customColorType == 1;
else
m_maybeNotColorable = m_targetObject->m_maybeNotColorable;
if ( m_maybeNotColorable
|| m_targetObject->m_colorSprite
|| (m_defaultColorID = m_targetObject->m_baseColor->m_defaultColorID, m_defaultColorID == 1004)
|| !m_defaultColorID )
{
m_baseColor = m_targetObject->m_baseColor;
}
else
{
m_baseColor = nullptr;
}
a1->m_hasBaseColor = m_baseColor != nullptr;
v7 = m_targetObject->m_customColorType;
if ( v7 )
v8 = v7 == 1;
else
v8 = m_targetObject->m_maybeNotColorable;
if ( v8
|| m_targetObject->m_colorSprite
|| (m_detailColor = m_targetObject->m_baseColor, v10 = m_detailColor->m_defaultColorID, v10 == 1004)
|| !v10 )
{
m_detailColor = m_targetObject->m_detailColor;
}
a1->m_hasDetailColor = m_detailColor != nullptr;
a1->m_glowDisabled = m_targetObject->m_hasNoGlow;
}