//
// RateLevelLayer::selectRating from 0x1403c9c90 to 0x1403c9ddb (331 bytes)
//
// 3 xrefs:
// > RateLevelLayer::init @ 0x1403c9c61
// > RateLevelLayer::init @ 0x1403c994b
// > ??> @ 0x1406d7a3c
//
// 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 RateLevelLayer::selectRating(RateLevelLayer *a1, cocos2d::CCObject *a2)
{
int v3; // eax
unsigned int i; // ebx
int *p_m_unknown2; // rcx
void (__fastcall *v6)(int *, __int16 *); // r8
__int16 *v7; // rdx
CCMenuItemSpriteExtra *m_submitButton; // rcx
char v9; // al
cocos2d::CCNode *v10; // rbx
cocos2d::CCComponentContainer *m_pComponentContainer; // rcx
__int64 v12; // rcx
cocos2d::CCNode_vtbl *v13; // rcx
_BYTE v14[3]; // [rsp+30h] [rbp+8h] BYREF
if ( a2 )
v3 = a2->getTag(a2);
else
v3 = -1;
a1->m_levelRate = v3;
for ( i = 0; i < cocos2d::CCArray::count(a1->m_difficulties); ++i )
{
p_m_unknown2 = &cocos2d::CCArray::objectAtIndex(a1->m_difficulties, i)[5].m_unknown2;
v6 = **(void (__fastcall ***)(int *, __int16 *))p_m_unknown2;
if ( a1->m_levelRate == i )
{
v7 = &word_140529BCC;
}
else
{
memset(v14, 125, sizeof(v14));
v7 = (__int16 *)v14;
}
v6(p_m_unknown2, v7);
}
m_submitButton = a1->m_submitButton;
if ( a1->m_levelRate == -1 )
{
*(_WORD *)v14 = -22874;
v9 = -90;
}
else
{
*(_WORD *)v14 = -1;
v9 = -1;
}
v14[2] = v9;
v10 = m_submitButton->getNormalImage(m_submitButton);
m_pComponentContainer = v10[1].m_pComponentContainer;
if ( m_pComponentContainer )
((void (__fastcall *)(cocos2d::CCDictionary **, _BYTE *))m_pComponentContainer[15].m_pComponents->__vftable)(
&m_pComponentContainer[15].m_pComponents,
v14);
v12 = *(_QWORD *)&v10[1].m_bUseChildIndex;
if ( v12 )
(**(void (__fastcall ***)(__int64, _BYTE *))(v12 + 320))(v12 + 320, v14);
v13 = *(cocos2d::CCNode_vtbl **)&v10[2].m_uID;
if ( v13 || (v13 = v10[2].__vftable) != nullptr )
(*(void (__fastcall **)(__int64, _BYTE *))v13->setVisible)((__int64)&v13->setVisible, v14);
}