//
// ShareLevelLayer::setupStars from 0x6e3e0c to 0x6e4188 (892 bytes)
//
// 2 xrefs:
// > ShareLevelLayer::init @ 0x6e4898
// > ??> @ 0x951c0
//
// 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 ShareLevelLayer::setupStars(ShareLevelLayer *a1)
{
int v2; // w19
cocos2d::CCDirector *v3; // x0
cocos2d::CCArray *v4; // x0
cocos2d::CCArray *v5; // x0
cocos2d::CCArray *v6; // x0
cocos2d::CCArray *v7; // x23
cocos2d::CCArray *v8; // x22
CCMenuItemSpriteExtra *StarsButton; // x20
cocos2d::CCMenu *m_buttonMenu; // x27
GJGameLevel *m_level; // x0
char *v12; // x1
cocos2d::CCLabelBMFont *v13; // x22
void (__fastcall *setPosition)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCSprite *v15; // x0
cocos2d::CCLayer *m_mainLayer; // x3
cocos2d::CCSprite *m_difficultySprite; // x22
void (__fastcall *v18)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // x23
cocos2d::CCArray **p_m_pTargetArray; // x0
unsigned int *p_m_nExtraKerning; // x2
int m_nExtraKerning; // w1
_QWORD v22[2]; // [xsp+0h] [xbp+0h] BYREF
float v23; // [xsp+68h] [xbp+68h]
float v24; // [xsp+6Ch] [xbp+6Ch]
cocos2d::CCPoint v25; // [xsp+70h] [xbp+70h] BYREF
cocos2d::CCPoint v26; // [xsp+78h] [xbp+78h] BYREF
cocos2d::CCLabelBMFont *v27; // [xsp+80h] [xbp+80h] BYREF
cocos2d::CCPoint v28; // [xsp+88h] [xbp+88h] BYREF
cocos2d::CCPoint v29; // [xsp+90h] [xbp+90h] BYREF
cocos2d::SEL_MenuHandler v30; // 0:x2.16
cocos2d::CCPoint v31; // 0:s1.4,4:s2.4
cocos2d::CCPoint v32; // 0:s1.4,4:s2.4
v2 = 1;
v3 = cocos2d::CCDirector::sharedDirector();
cocos2d::CCDirector::getWinSize(v3);
v5 = (cocos2d::CCArray *)cocos2d::CCArray::create(v4);
a1->m_starButtons = v5;
cocos2d::CCObject::retain(v5);
v7 = (cocos2d::CCArray *)cocos2d::CCArray::create(v6);
v8 = (cocos2d::CCArray *)cocos2d::CCArray::create(v7);
do
{
while ( 1 )
{
v30.ptr = (void (__cdecl *)(cocos2d::CCObject *))ShareLevelLayer::selectRating;
v30.adj = 0;
StarsButton = ShareLevelLayer::getStarsButton(a1, v2, v30, a1->m_buttonMenu, 0.8);
cocos2d::CCArray::addObject(a1->m_starButtons, StarsButton);
StarsButton->setTag(StarsButton, v2);
if ( v2 > 5 )
break;
++v2;
cocos2d::CCArray::addObject(v7, StarsButton);
if ( v2 == 11 )
goto LABEL_5;
}
++v2;
cocos2d::CCArray::addObject(v8, StarsButton);
}
while ( v2 != 11 );
LABEL_5:
cocos2d::CCPoint::CCPoint(&v25, v23 * 0.5, (float)((float)((float)(v24 * 0.5) + -50.0) + 35.0) + 2.0);
m_buttonMenu = a1->m_buttonMenu;
cocos2d::CCNode::convertToWorldSpace(a1->m_mainLayer, &v25);
cocos2d::CCNode::convertToNodeSpace(m_buttonMenu, &v29);
cocos2d::CCPoint::CCPoint(&v29, &v26);
GameToolbox::alignItemsHorisontally(v7, 18.0, v31, (unsigned __int8)v22 - 112);
cocos2d::CCPoint::CCPoint(&v28, 0.0, -35.0);
cocos2d::CCPoint::operator+(&v29, &v26, &v28);
GameToolbox::alignItemsHorisontally(v8, 18.0, v32, (unsigned __int8)v22 - 112);
m_level = a1->m_level;
a1->m_starsRequested = m_level->m_starsRequested;
if ( GJGameLevel::isPlatformer(m_level) )
v12 = "Request Moons";
else
v12 = "Request Stars";
sub_D153B8((int)&v27, v12);
v13 = cocos2d::CCLabelBMFont::create();
v13->setScale(v13, 0.5);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v13, 2);
setPosition = v13->setPosition;
cocos2d::CCPoint::CCPoint(&v28, 0.0, 30.0);
cocos2d::CCPoint::operator+(&v29, &v25, &v28);
setPosition(v13, &v29);
v15 = cocos2d::CCSprite::createWithSpriteFrameName("difficulty_00_btn_001.png");
m_mainLayer = a1->m_mainLayer;
a1->m_difficultySprite = v15;
m_mainLayer->addChild_0(m_mainLayer, v15, 3);
m_difficultySprite = a1->m_difficultySprite;
v18 = m_difficultySprite->setPosition;
cocos2d::CCPoint::CCPoint(&v28, 155.0, -18.0);
cocos2d::CCPoint::operator+(&v29, &v25, &v28);
v18(m_difficultySprite, &v29);
ShareLevelLayer::selectRating(a1, nullptr);
p_m_pTargetArray = &v27[-1].m_pTargetArray;
if ( &v27[-1].m_pTargetArray != (cocos2d::CCArray **)&qword_124B6B0 )
{
if ( &pthread_create )
{
p_m_nExtraKerning = (unsigned int *)&v27[-1].m_nExtraKerning;
do
m_nExtraKerning = __ldaxr(p_m_nExtraKerning);
while ( __stlxr(m_nExtraKerning - 1, p_m_nExtraKerning) );
}
else
{
m_nExtraKerning = v27[-1].m_nExtraKerning;
v27[-1].m_nExtraKerning = m_nExtraKerning - 1;
}
if ( m_nExtraKerning <= 0 )
operator delete(p_m_pTargetArray);
}
}