//
// RetryLevelLayer::setupLastProgress from 0x1004f8cd0 to 0x1004f9055 (901 bytes)
//
// 1 xrefs:
// > RetryLevelLayer::customSetup @ 0x1004f86f2
//
// 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 __fastcall RetryLevelLayer::setupLastProgress(RetryLevelLayer *a1)
{
cocos2d::CCSprite *v1; // r14
cocos2d::CCSprite *v2; // r15
__int64 v3; // rax
GameManager *v4; // rax
__m128 width_low; // xmm2
GameManager *v6; // rax
cocos2d::CCString *v7; // rax
const char *CString; // rax
cocos2d::CCLabelBMFont *v9; // r12
__int64 v10; // rax
cocos2d::CCString *v11; // rax
const char *v12; // rax
cocos2d::CCLabelBMFont *v13; // r15
unsigned __int64 *v14; // rbx
char v15; // [rsp+0h] [rbp-50h]
char v16; // [rsp+0h] [rbp-50h]
unsigned __int64 v17; // [rsp+8h] [rbp-48h] BYREF
double v18[2]; // [rsp+10h] [rbp-40h] BYREF
float v19[2]; // [rsp+20h] [rbp-30h] BYREF
__int16 v20; // [rsp+28h] [rbp-28h] BYREF
char v21; // [rsp+2Ah] [rbp-26h]
float width; // [rsp+2Ch] [rbp-24h]
double v23; // 0:xmm0_8.8
cocos2d::CCDirector::sharedDirector();
*(cocos2d::CCSize *)&v23 = cocos2d::CCDirector::getWinSize((cocos2d::CCDirector *)v19);
v21 = 0;
v20 = 0;
v1 = cocos2d::CCSprite::create_1("GJ_progressBar_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, __int16 *, double))v1->setColor)(v1, &v20, v23);
((void (__fastcall *)(cocos2d::CCSprite *, __int64))v1->setOpacity)(v1, 125);
((void (__fastcall *)(cocos2d::CCSprite *, float))v1->setScale)(v1, 1.0);
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v1,
3);
sub_10028CBE0((float *)v18, v19[0] * 0.5, (float)((float)(v19[1] * 0.5) + 25.0) + -15.0);
((void (__fastcall *)(cocos2d::CCSprite *, double *))v1->setPosition)(v1, v18);
v2 = cocos2d::CCSprite::create_1("GJ_progressBar_001.png");
((void (__fastcall *)(cocos2d::CCSprite *, float))v2->setScaleX)(v2, 0.99199998);
((void (__fastcall *)(cocos2d::CCSprite *, float))v2->setScaleY)(v2, 0.86000001);
((void (__fastcall *)(cocos2d::CCSprite *, void *))v2->setColor)(v2, &unk_10081DE80);
width = v2->m_obRect.size.width - (float)(0.99199998 * v2->m_obRect.size.width);
((void (__fastcall *)(cocos2d::CCSprite *, cocos2d::CCSprite *, __int64))v1->addChild_0)(v1, v2, 1);
sub_10028CBE0((float *)v18, 0.0, 0.5);
((void (__fastcall *)(cocos2d::CCSprite *, double *))v2->setAnchorPoint)(v2, v18);
width = width * 0.5;
v3 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))v1->getContentSize)(v1);
sub_10028CBE0((float *)v18, width, 0.5 * *(float *)(v3 + 4));
((void (__fastcall *)(cocos2d::CCSprite *, double *))v2->setPosition)(v2, v18);
width = v2->m_obRect.size.width;
v4 = GameManager::sharedState();
width_low = (__m128)LODWORD(v2->m_obRect.size.width);
if ( width > (float)((float)((float)v4->m_playLayer->m_lastAttemptPercent / 100.0) * width) )
{
width = v2->m_obRect.size.width;
v6 = GameManager::sharedState();
width_low = (__m128)LODWORD(width);
width_low.f32[0] = width * (float)((float)v6->m_playLayer->m_lastAttemptPercent / 100.0);
}
sub_10028CC00((__int64)v18, 0.0, 0.0, width_low, (__m128)LODWORD(v2->m_obRect.size.height));
((void (__fastcall *)(cocos2d::CCSprite *, double *))v2->setTextureRect)(v2, v18);
GameManager::sharedState();
v7 = (cocos2d::CCString *)sub_1007AB580("%i%%", v15);
CString = cocos2d::CCString::getCString(v7);
v9 = cocos2d::CCLabelBMFont::create_3(CString, "bigFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v9,
4);
v10 = ((__int64 (__fastcall *)(cocos2d::CCSprite *))v1->getPosition)(v1);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int64))v9->setPosition)(v9, v10);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v9->setScale)(v9, 0.5);
GameManager::sharedState();
v11 = (cocos2d::CCString *)sub_1007AB580("Attempt %i", v16);
v12 = cocos2d::CCString::getCString(v11);
v13 = cocos2d::CCLabelBMFont::create_3(v12, "bigFont.fnt");
((void (__fastcall *)(cocos2d::CCLayer *, cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v13,
4);
v14 = (unsigned __int64 *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v1->getPosition)(v1);
sub_10028CBE0((float *)&v17, 0.0, 23.0);
sub_10028CCE0(v18, v14, &v17);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, double *))v13->setPosition)(v13, v18);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, float))v13->setScale)(v13, 0.5);
}