//
// GJRateLevelLayer::selectRating from 0x1402f68c0 to 0x1402f6aa7 (487 bytes)
//
// 6 xrefs:
// > GJRateLevelLayer::init @ 0x1402f540c
// > GJRateLevelLayer::init @ 0x1402f4c88
// > ??> @ 0x140690618
// > ??> @ 0x140690654
// > ??> @ 0x140690664
// > ??> @ 0x1406d4028
//
// 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 GJRateLevelLayer::selectRating(GJRateLevelLayer *a1, cocos2d::CCObject *a2)
{
int v3; // eax
int v4; // esi
unsigned int i; // r14d
struct cocos2d::CCObject *v6; // rbx
ButtonSprite *v7; // rdi
int v8; // eax
const char *v9; // rdx
CCMenuItemSpriteExtra *m_submitButton; // rcx
char v11; // al
cocos2d::CCNode *v12; // rbx
cocos2d::CCComponentContainer *m_pComponentContainer; // rcx
__int64 v14; // rcx
cocos2d::CCNode_vtbl *v15; // rcx
int m_stars; // eax
bool v17; // zf
__int16 v18; // [rsp+50h] [rbp+8h] BYREF
char v19; // [rsp+52h] [rbp+Ah]
if ( a2 )
v3 = a2->getTag(a2);
else
v3 = -1;
v4 = 0;
a1->m_stars = v3;
for ( i = 0; i < cocos2d::CCArray::count(a1->m_starButtons); ++i )
{
v6 = cocos2d::CCArray::objectAtIndex(a1->m_starButtons, i);
v7 = (ButtonSprite *)((__int64 (__fastcall *)(struct cocos2d::CCObject *))v6->__vftable[13].copyWithZone)(v6);
v8 = v6->getTag(v6);
v9 = "GJ_button_04.png";
if ( a1->m_stars == v8 )
v9 = "GJ_button_01.png";
ButtonSprite::updateBGImage(v7, v9);
}
m_submitButton = a1->m_submitButton;
if ( a1->m_stars == -1 )
{
v18 = -22874;
v11 = -90;
}
else
{
v18 = -1;
v11 = -1;
}
v19 = v11;
v12 = m_submitButton->getNormalImage(m_submitButton);
m_pComponentContainer = v12[1].m_pComponentContainer;
if ( m_pComponentContainer )
((void (__fastcall *)(cocos2d::CCDictionary **, __int16 *))m_pComponentContainer[15].m_pComponents->__vftable)(
&m_pComponentContainer[15].m_pComponents,
&v18);
v14 = *(_QWORD *)&v12[1].m_bUseChildIndex;
if ( v14 )
(**(void (__fastcall ***)(__int64, __int16 *))(v14 + 320))(v14 + 320, &v18);
v15 = *(cocos2d::CCNode_vtbl **)&v12[2].m_uID;
if ( v15 || (v15 = v12[2].__vftable) != nullptr )
(*(void (__fastcall **)(__int64, __int16 *))v15->setVisible)((__int64)&v15->setVisible, &v18);
m_stars = a1->m_stars;
v17 = m_stars == 1;
if ( m_stars > 1 )
{
if ( m_stars == 2 )
{
v4 = 1;
}
else if ( m_stars == 3 )
{
v4 = 2;
}
else if ( m_stars > 5 )
{
if ( m_stars > 7 )
{
if ( m_stars > 9 )
{
if ( m_stars == 10 )
v4 = 6;
}
else
{
v4 = 5;
}
}
else
{
v4 = 4;
}
}
else
{
v4 = 3;
}
v17 = m_stars == 1;
}
if ( v17 )
v4 = -1;
GJDifficultySprite::updateDifficultyFrame(a1->m_difficultySprite, v4, Short);
}