//
// ColorSelectPopup::onPlayerColor2 from 0x140090d40 to 0x140090e1e (222 bytes)
//
// 2 xrefs:
// > ColorSelectPopup::init @ 0x14008ead8
// > ??> @ 0x1406c6f90
//
// 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 ColorSelectPopup::onPlayerColor2(ColorSelectPopup *a1, cocos2d::CCObject *a2)
{
int m_playerColor; // eax
unsigned int v4; // edi
int v5; // edx
EffectGameObject *m_gameObject; // rcx
cocos2d::CCArray *m_gameObjects; // rcx
struct cocos2d::CCObject *v8; // rax
ColorAction *m_colorAction; // rax
CCMenuItemToggler::toggle(a1->m_playerColor1Toggle, 0);
m_playerColor = a1->m_playerColor;
v4 = 0;
v5 = 0;
if ( m_playerColor != 2 )
v5 = 2;
m_gameObject = a1->m_gameObject;
a1->m_playerColor = v5;
if ( m_gameObject )
{
m_gameObject->m_usesPlayerColor2 = m_playerColor != 2;
a1->m_gameObject->m_usesPlayerColor1 = 0;
}
else
{
m_gameObjects = a1->m_gameObjects;
if ( m_gameObjects )
{
if ( cocos2d::CCArray::count(m_gameObjects) )
{
do
{
v8 = cocos2d::CCArray::objectAtIndex(a1->m_gameObjects, v4++);
BYTE2(v8[26].m_nZOrder) = a1->m_playerColor == 2;
BYTE1(v8[26].m_nZOrder) = 0;
}
while ( v4 < cocos2d::CCArray::count(a1->m_gameObjects) );
}
}
else
{
m_colorAction = a1->m_colorAction;
if ( m_colorAction )
m_colorAction->m_playerColor = v5;
}
}
}