//
// GameObject::setObjectColor from 0x641264 to 0x6414d0 (620 bytes)
//
// 47 xrefs:
// > ParticleGameObject::setObjectColor @ 0x74a990
// > LabelGameObject::setObjectColor @ 0x74aa84
// > ??> @ 0xc3510
// > ??> @ 0x1152ca8
// > ??> @ 0x1153a78
// > ??> @ 0x1154248
// > ??> @ 0x1154a48
// > ??> @ 0x11623f8
// > ??> @ 0x1162bf8
// > ??> @ 0x11633f8
// > ??> @ 0x1163bf8
// > ??> @ 0x11643f8
// > ??> @ 0x1164bf8
// > ??> @ 0x11653f8
// > ??> @ 0x1165bf8
// > ??> @ 0x1166bc8
// > ??> @ 0x11673c8
// > ??> @ 0x1167bc8
// > ??> @ 0x1168c08
// > ??> @ 0x1169408
// > ??> @ 0x1169c08
// > ??> @ 0x116a408
// > ??> @ 0x116ac08
// > ??> @ 0x116bc18
// > ??> @ 0x116c418
// > ??> @ 0x116cc18
// > ??> @ 0x116d418
// > ??> @ 0x116dc18
// > ??> @ 0x116e418
// > ??> @ 0x116ec18
// > ??> @ 0x116f418
// > ??> @ 0x116fc18
// > ??> @ 0x1170418
// > ??> @ 0x1170c18
// > ??> @ 0x1171418
// > ??> @ 0x1171c18
// > ??> @ 0x1172418
// > ??> @ 0x1172c18
// > ??> @ 0x1173418
// > ??> @ 0x1173c18
// > ??> @ 0x1174418
// > ??> @ 0x1174c18
// > ??> @ 0x1175418
// > ??> @ 0x1175c18
// > ??> @ 0x1176418
// > ??> @ 0x1176c18
// > ??> @ 0x1177438
//
// 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 GameObject::setObjectColor(GameObject *a1, const cocos2d::ccColor3B *a2)
{
unsigned __int64 v2; // x23
unsigned int r; // w0
__int16 v6; // w1
_BOOL4 m_isObjectBlack; // w0
cocos2d::CCArray *m_pChildren; // x0
cocos2d::ccArray *data; // x1
cocos2d::CCSprite **arr; // x19
__int64 v11; // x0
char *v12; // x22
cocos2d::CCSprite *i; // x26
void (__fastcall *setColor)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // x28
unsigned __int64 v15; // x0
__int16 v16; // [xsp+60h] [xbp+60h] BYREF
char v17; // [xsp+62h] [xbp+62h]
r = a2->r;
if ( __PAIR64__(a1->_realColor.g, a1->_realColor.r) == __PAIR64__(a2->g, r) && a1->_realColor.b == a2->b )
{
if ( a1->m_colorType == 1 )
a1->m_colorType = 2;
return;
}
v6 = 0;
if ( !r )
{
v6 = 0;
if ( !a2->g )
{
v6 = 0;
if ( !a2->b )
{
if ( a1->m_colorType == 1 )
v6 = 2;
else
v6 = 1;
}
}
}
m_isObjectBlack = a1->m_isObjectBlack;
a1->m_colorType = v6;
if ( m_isObjectBlack )
{
if ( a1->m_customGlowColor )
goto LABEL_5;
}
else
{
a1->setColor(a1, a2);
if ( a1->m_customGlowColor )
{
LABEL_5:
if ( !a1->m_particleUseObjectColor )
goto LABEL_6;
LABEL_28:
a1->updateParticleColor(a1, a2);
if ( !a1->m_hasCustomChild )
return;
goto LABEL_7;
}
}
a1->setGlowColor(a1, a2);
if ( a1->m_particleUseObjectColor )
goto LABEL_28;
LABEL_6:
if ( !a1->m_hasCustomChild )
return;
LABEL_7:
m_pChildren = a1->m_pChildren;
if ( m_pChildren )
{
data = m_pChildren->data;
if ( data->num )
{
arr = (cocos2d::CCSprite **)data->arr;
v11 = 8LL * data->num - 8;
v12 = (char *)arr + v11;
if ( arr <= (cocos2d::CCSprite **)((char *)arr + v11) )
{
for ( i = *arr; *arr; i = *arr )
{
if ( i->getTag(i) == 2 )
{
setColor = i->setColor;
v2 = v2 & 0xFFFF000000000000LL | 0x1003E19999ALL;
v15 = GameToolbox::transformColor(&a2->r, 0x3F26666600000000uLL, v2);
v16 = v15;
v17 = BYTE2(v15);
setColor(i, (const cocos2d::ccColor3B *)&v16);
}
else if ( (!a1->m_isColorSpriteBlack || i->getTag(i) == 997) && i != a1->m_colorSprite )
{
i->setColor(i, a2);
}
if ( v12 < (char *)++arr )
break;
}
}
}
}
}