//
// RetryLevelLayer::setupLastProgress from 0x1403cb7c0 to 0x1403cbbf5 (1077 bytes)
//
// 2 xrefs:
// > RetryLevelLayer::customSetup @ 0x1403cb19e
// > ??> @ 0x1406d7b38
//
// 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
//
// Hidden C++ exception states: #wind=4
void RetryLevelLayer::setupLastProgress(RetryLevelLayer *a1)
{
cocos2d::CCDirector *v2; // rax
struct cocos2d::CCSprite *v3; // rsi
__int64 v4; // rdx
float v5; // xmm0_4
cocos2d::CCSprite_vtbl *v6; // rbx
const cocos2d::CCPoint *v7; // rax
struct cocos2d::CCSprite *v8; // rdi
float v9; // xmm7_4
float v10; // xmm0_4
cocos2d::CCSprite_vtbl *v11; // rbx
double v12; // xmm0_8
const cocos2d::CCPoint *v13; // rax
cocos2d::CCSprite_vtbl *v14; // rbx
const cocos2d::CCPoint *v15; // rax
__int64 v16; // rax
float v17; // xmm1_4
float width; // xmm3_4
cocos2d::CCSprite_vtbl *v19; // rbx
const cocos2d::CCRect *v20; // rax
__int64 v21; // rdx
cocos2d::CCString *v22; // rax
const char *CString; // rax
struct cocos2d::CCLabelBMFont *v24; // rdi
cocos2d::CCLabelBMFont_vtbl *v25; // rbx
__int64 v26; // rax
__int64 v27; // rdx
cocos2d::CCString *v28; // rax
const char *v29; // rax
struct cocos2d::CCLabelBMFont *v30; // rdi
float v31; // xmm0_4
__int64 v32; // rax
cocos2d::CCRect v33; // [rsp+30h] [rbp-58h] BYREF
__int16 v34; // [rsp+90h] [rbp+8h] BYREF
char v35; // [rsp+92h] [rbp+Ah]
float v36; // [rsp+98h] [rbp+10h]
void *v37; // [rsp+A0h] [rbp+18h] BYREF
void *v38; // [rsp+A8h] [rbp+20h]
v2 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(a1);
cocos2d::CCDirector::getWinSize(v2);
v34 = 0;
v35 = 0;
v3 = cocos2d::CCSprite::create("GJ_progressBar_001.png");
v3->setColor(&v3->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&v34);
LOBYTE(v4) = 125;
v3->setOpacity(&v3->cocos2d::CCRGBAProtocol, v4);
((void (__fastcall *)(struct cocos2d::CCSprite *))v3->setScale_0)(v3);
v5 = ((float (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::CCSprite *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v3,
3);
v6 = v3->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCPoint::CCPoint(v5, v36 * 0.5);
v6->setPosition_0(v3, v7);
v8 = cocos2d::CCSprite::create("GJ_progressBar_001.png");
((void (__fastcall *)(struct cocos2d::CCSprite *))v8->setScaleX)(v8);
((void (__fastcall *)(struct cocos2d::CCSprite *))v8->setScaleY)(v8);
v8->setColor(&v8->cocos2d::CCRGBAProtocol, (const cocos2d::ccColor3B *)&unk_140529BDC);
v9 = v8->m_obRect.size.width - (float)(v8->m_obRect.size.width * 0.99199998);
v10 = ((float (__fastcall *)(struct cocos2d::CCSprite *, struct cocos2d::CCSprite *, __int64))v3->addChild_0)(
v3,
v8,
1);
v11 = v8->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v12 = cocos2d::CCPoint::CCPoint(v10, 0.0);
v11->setAnchorPoint(v8, v13);
v14 = v8->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v3->getContentSize(v3);
cocos2d::CCPoint::CCPoint(*(float *)&v12, v9 * 0.5);
v14->setPosition_0(v8, v15);
v16 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v38 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v38);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v16 = qword_1406C2ED8;
}
v17 = (float)*(int *)(*(_QWORD *)(v16 + 520) + 14720LL) / 100.0;
width = v8->m_obRect.size.width;
if ( (float)(width * v17) <= width )
width = width * v17;
v19 = v8->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
cocos2d::CCRect::CCRect(&v33, 0.0, 0.0, width, v8->m_obRect.size.height);
v19->setTextureRect_0(v8, v20);
v21 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v37 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v37);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v21 = qword_1406C2ED8;
}
v22 = cocos2d::CCString::createWithFormat("%i%%", *(_DWORD *)(*(_QWORD *)(v21 + 520) + 14720LL));
CString = cocos2d::CCString::getCString(v22);
v24 = cocos2d::CCLabelBMFont::create(CString, (const char *)&qword_14052A4D8);
a1->m_mainLayer->addChild_0(a1->m_mainLayer, v24, 4);
v25 = v24->cocos2d::CCSpriteBatchNode::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v26 = (__int64)v3->getPosition_0(v3);
v25->setPosition_0(v24, (const cocos2d::CCPoint *)v26);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v24->setScale_0)(v24);
v27 = qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v37 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00((__int64)v37);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v27 = qword_1406C2ED8;
}
v28 = cocos2d::CCString::createWithFormat("Attempt %i", *(_DWORD *)(*(_QWORD *)(v27 + 520) + 12420LL));
v29 = cocos2d::CCString::getCString(v28);
v30 = cocos2d::CCLabelBMFont::create(v29, (const char *)&qword_14052A4D8);
v31 = ((float (__fastcall *)(cocos2d::CCLayer *, struct cocos2d::CCLabelBMFont *, __int64))a1->m_mainLayer->addChild_0)(
a1->m_mainLayer,
v30,
4);
cocos2d::CCPoint::CCPoint(v31, 0.0);
v32 = (__int64)v3->getPosition_0(v3);
cocos2d::CCPoint::operator+(v32, &v37);
v30->setPosition_0(v30, (const cocos2d::CCPoint *)&v37);
((void (__fastcall *)(struct cocos2d::CCLabelBMFont *))v30->setScale_0)(v30);
}