//
// GJRateLevelLayer::setupRateInfo from 0x453eb0 to 0x45457a (1738 bytes)
//
// 1 xrefs:
// > GJRateLevelLayer::rateInfoFinished @ 0x4545fc
//
// 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
//
int __fastcall GJRateLevelLayer::setupRateInfo(int a1, cocos2d::CCArray *a2)
{
cocos2d::CCString *v3; // r0
char *CString; // r0
cocos2d::CCArray *v5; // r6
unsigned int v6; // r5
int v7; // r4
cocos2d::CCString *v8; // r0
const char *v9; // r0
int v10; // r0
unsigned int v11; // r5
float v12; // s14
float v13; // s16
cocos2d::CCString *v14; // r0
const char *v15; // r0
int v16; // r7
char v17; // r3
char v18; // r3
float v19; // s15
char v20; // r3
cocos2d::CCSprite *v21; // r4
void (__fastcall *setScaleY)(cocos2d::CCSprite *__hidden, float); // r5
int v23; // r0
void (__fastcall *setColor)(cocos2d::CCSprite *__hidden, const cocos2d::ccColor3B *); // r3
void (__fastcall *setPosition)(cocos2d::CCSprite *__hidden, const cocos2d::CCPoint *); // r5
cocos2d::CCString *v26; // r0
char *v27; // r0
cocos2d::CCArray *v28; // r7
unsigned int v29; // r5
int v30; // r4
cocos2d::CCString *v31; // r0
const char *v32; // r0
int v33; // r0
unsigned int v34; // r5
float v35; // s17
float v36; // s15
bool v37; // cc
cocos2d::CCString *v38; // r0
const char *v39; // r0
int v40; // r8
char *v41; // r1
float v42; // s15
int v43; // r3
float v44; // s10
float v45; // s9
float v46; // s11
float v47; // s13
cocos2d::CCString *v48; // r0
char *v49; // r0
cocos2d::CCLabelBMFont *v50; // r4
void (__fastcall *setAnchorPoint)(cocos2d::CCLabelBMFont *__hidden, const cocos2d::CCPoint *); // r6
void (__fastcall *v52)(cocos2d::CCNode *__hidden, const cocos2d::CCPoint *); // r6
int v54; // [sp+28h] [bp-3Ch]
cocos2d::CCArray *v55; // [sp+2Ch] [bp-38h]
int v56; // [sp+4Ch] [bp-18h] BYREF
int v57; // [sp+50h] [bp-14h]
GameToolbox v58; // [sp+54h] [bp-10h] BYREF
cocos2d::CCLabelBMFont *v59; // [sp+58h] [bp-Ch] BYREF
cocos2d::CCPoint v60; // [sp+5Ch] [bp-8h] BYREF
cocos2d::CCPoint v61; // [sp+64h] [bp+0h] BYREF
v55 = sub_45313C(a2, ":");
v3 = cocos2d::CCArray::stringAtIndex(v55, 0);
CString = (char *)cocos2d::CCString::getCString(v3);
sub_776584((int)&v61, CString);
v5 = sub_45313C((cocos2d::CCArray *)&v61, ",");
sub_774008(&v61);
v6 = 0;
v7 = 0;
while ( v6 < cocos2d::CCArray::count(v5) )
{
v8 = cocos2d::CCArray::stringAtIndex(v5, v6++);
v9 = cocos2d::CCString::getCString(v8);
v10 = atoi(v9);
if ( v7 < v10 )
v7 = v10;
}
v11 = 0;
v12 = (float)v7 * 10.0;
if ( v12 <= 100.0 )
v13 = 10.0;
else
v13 = 100.0 / (float)v7;
while ( v11 < cocos2d::CCArray::count(v5) )
{
v14 = cocos2d::CCArray::stringAtIndex(v5, v11);
v15 = cocos2d::CCString::getCString(v14);
v16 = atoi(v15);
cocos2d::CCPoint::CCPoint(&v61, (float)(int)(15 * v11 - 120), -42.0);
cocos2d::CCPoint::operator+(&v60, a1 + 740, &v61);
LOWORD(v56) = -26986;
BYTE2(v56) = -106;
LOWORD(v57) = 0;
BYTE2(v57) = 0;
GameToolbox::intToString(&v58, v11 + 1);
if ( v16 <= 0 )
{
LOWORD(v56) = 12371;
BYTE2(v56) = 23;
LOWORD(v57) = 8247;
BYTE2(v57) = 16;
sub_7753D4((int)&v58, (char *)&unk_939830);
v16 = 1;
if ( v13 < 10.0 )
{
v19 = v13;
}
else
{
v19 = v13 * 0.5;
v12 = v60.y - (float)((float)(v13 * 0.5) * 0.5);
}
if ( v13 >= 10.0 )
v60.y = v12;
}
else
{
switch ( v11 )
{
case 0u:
LOBYTE(v56) = 3;
v17 = -45;
goto LABEL_14;
case 1u:
LOBYTE(v56) = 0;
v17 = -109;
LABEL_14:
BYTE1(v56) = v17;
v18 = -1;
goto LABEL_15;
case 2u:
LOWORD(v56) = -1536;
v18 = 60;
goto LABEL_15;
case 3u:
LOBYTE(v56) = 94;
v20 = -40;
goto LABEL_21;
case 4u:
LOWORD(v56) = -4610;
v18 = 20;
goto LABEL_15;
case 5u:
LOBYTE(v56) = -1;
v20 = -73;
goto LABEL_21;
case 6u:
LOBYTE(v56) = -1;
v20 = 120;
goto LABEL_21;
case 7u:
LOWORD(v56) = 30207;
v18 = -21;
goto LABEL_15;
case 8u:
LOWORD(v56) = 11775;
v18 = -20;
goto LABEL_15;
case 9u:
LOBYTE(v56) = -1;
v20 = 45;
LABEL_21:
BYTE1(v56) = v20;
v18 = 0;
LABEL_15:
BYTE2(v56) = v18;
break;
default:
break;
}
v19 = v13;
}
cocos2d::CCPoint::CCPoint(&v61, &v60);
sub_775C20(&v59);
GJRateLevelLayer::createStatPillar(
a1,
10,
(int)v19,
v16,
(cocos2d::ccColor3B)v56,
(cocos2d::ccColor3B)v57,
(int)&v61,
(int *)&v59);
++v11;
sub_774008(&v59);
sub_774008(&v58);
}
v21 = cocos2d::CCSprite::createWithSpriteFrameName("whiteSquare60_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, int))v21->setScaleX)(v21, 1031127695);
setScaleY = v21->setScaleY;
v23 = (int)v21->getContentSize(v21);
((void (__fastcall *)(cocos2d::CCSprite *, _DWORD))setScaleY)(v21, 110.0 / *(float *)(v23 + 4));
setColor = v21->setColor;
LOWORD(v61.x) = 11086;
BYTE2(v61.x) = 24;
setColor(v21, (const cocos2d::ccColor3B *)&v61);
v21->setOpacity(v21, 200);
(*(void (__fastcall **)(_DWORD, cocos2d::CCSprite *, int))(**(_DWORD **)(a1 + 456) + 224))(
*(_DWORD *)(a1 + 456),
v21,
3);
setPosition = v21->setPosition;
v54 = a1 + 740;
cocos2d::CCPoint::CCPoint(&v60, 38.0, 0.0);
cocos2d::CCPoint::operator+(&v61, a1 + 740, &v60);
setPosition(v21, &v61);
v26 = cocos2d::CCArray::stringAtIndex(v55, 1u);
v27 = (char *)cocos2d::CCString::getCString(v26);
sub_776584((int)&v61, v27);
v28 = sub_45313C((cocos2d::CCArray *)&v61, ",");
sub_774008(&v61);
v29 = 0;
v30 = 0;
while ( v29 < cocos2d::CCArray::count(v28) )
{
v31 = cocos2d::CCArray::stringAtIndex(v28, v29++);
v32 = cocos2d::CCString::getCString(v31);
v33 = atoi(v32);
if ( v30 < v33 )
v30 = v33;
}
v34 = 0;
v35 = (float)v30;
v36 = (float)v30 * 10.0;
v37 = v36 <= 100.0;
if ( v36 <= 100.0 )
v35 = 10.0;
else
v36 = 100.0;
if ( !v37 )
v35 = v36 / v35;
while ( v34 < cocos2d::CCArray::count(v28) )
{
v38 = cocos2d::CCArray::stringAtIndex(v28, v34);
v39 = cocos2d::CCString::getCString(v38);
v40 = atoi(v39);
cocos2d::CCPoint::CCPoint(&v61, (float)(int)(15 * v34 + 60), -42.0);
cocos2d::CCPoint::operator+(&v60, v54, &v61);
LOWORD(v57) = 0;
memset(&v56, 150, 3);
BYTE2(v57) = 0;
sub_776584((int)&v58, (char *)&unk_939830);
if ( v40 <= 0 )
{
LOWORD(v56) = 12371;
BYTE2(v56) = 23;
LOWORD(v57) = 8247;
BYTE2(v57) = 16;
sub_7753D4((int)&v58, (char *)&unk_939830);
if ( v35 < 10.0 )
{
v42 = v35;
}
else
{
v42 = v35 * 0.5;
v60.y = v60.y - (float)((float)(v35 * 0.5) * 0.5);
}
v40 = 1;
}
else
{
switch ( v34 )
{
case 1u:
LOWORD(v56) = -1;
v41 = "F";
BYTE2(v56) = 0;
break;
case 2u:
LOWORD(v56) = 32255;
v41 = "E";
BYTE2(v56) = 0;
break;
case 3u:
LOWORD(v56) = 255;
BYTE2(v56) = -1;
v41 = "L";
break;
case 4u:
LOBYTE(v56) = 0;
*(_WORD *)((char *)&v56 + 1) = -1;
v41 = "M";
break;
default:
v41 = "R";
break;
}
sub_7753D4((int)&v58, v41);
v42 = v35;
}
cocos2d::CCPoint::CCPoint(&v61, &v60);
sub_775C20(&v59);
GJRateLevelLayer::createStatPillar(
a1,
10,
(int)v42,
v40,
(cocos2d::ccColor3B)v56,
(cocos2d::ccColor3B)v57,
(int)&v61,
(int *)&v59);
++v34;
sub_774008(&v59);
sub_774008(&v58);
}
v59 = (cocos2d::CCLabelBMFont *)&unk_ACDDA8;
v43 = *(_DWORD *)(a1 + 696);
v44 = (float)*(int *)(v43 + 692);
if ( v44 <= 0.0 )
{
v48 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Req: %i",
*(const char **)(v43 + 684));
}
else
{
v45 = (float)*(int *)(v43 + 700);
v46 = (float)*(int *)(v43 + 704);
v47 = (float)*(int *)(v43 + 696);
v48 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"R: %i (%i- / %i+)\n%.1f | +%.1f | -%.1f | +-%.1f\nReq: %i",
(const char *)(int)v44,
(int)v46,
(int)v45,
(float)(v47 / v44),
(float)((float)(v47 - v46) / (float)(v44 - v46)),
(float)((float)(v47 - (float)(v45 * 10.0)) / (float)(v44 - v45)),
(float)((float)((float)(v47 - (float)(v45 * 10.0)) - v46)
/ (float)((float)(v44 - v45) - v46)),
*(_DWORD *)(v43 + 684));
}
v49 = (char *)cocos2d::CCString::getCString(v48);
sub_7753D4((int)&v59, v49);
v50 = cocos2d::CCLabelBMFont::create();
setAnchorPoint = v50->setAnchorPoint;
cocos2d::CCPoint::CCPoint(&v61, 0.0, 1.0);
setAnchorPoint(v50, &v61);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, int))v50->setScale)(v50, 1058642330);
v50->setColor(v50, (const cocos2d::ccColor3B *)&unk_9AB776);
v50->setOpacity(v50, 225);
(*(void (__fastcall **)(_DWORD, cocos2d::CCLabelBMFont *, int))(**(_DWORD **)(a1 + 456) + 224))(
*(_DWORD *)(a1 + 456),
v50,
2);
v52 = v50->setPosition;
cocos2d::CCPoint::CCPoint(&v60, -130.0, 48.0);
cocos2d::CCPoint::operator+(&v61, v54, &v60);
v52(v50, &v61);
return sub_774008(&v59);
}