//
// PlayLayer::updateProgressbar from 0x3126e8 to 0x31284a (354 bytes)
//
// 4 xrefs:
// > PlayLayer::toggleProgressbar @ 0x31295e
// > PlayLayer::postUpdate @ 0x31bafc
// > PlayLayer::setupHasCompleted @ 0x31c0d0
// > PlayLayer::resetLevel @ 0x31fd9a
//
// 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 PlayLayer::updateProgressbar(PlayLayer *a1)
{
float CurrentPercent; // r0
float m_progressWidth; // s14
float v4; // s16
float v5; // s15
float v6; // s15
cocos2d::CCSprite *m_progressFill; // r7
void (__fastcall *setTextureRect)(cocos2d::CCSprite *__hidden, const cocos2d::CCRect *); // r8
const char *v9; // r1
cocos2d::CCLabelBMFont *m_percentageLabel; // r4
void (__fastcall *setString)(cocos2d::CCLabelBMFont *__hidden, const unsigned __int8 *); // r5
cocos2d::CCString *v12; // r0
const char *CString; // r0
int v14; // r1
cocos2d::CCRect v15; // [sp+Ch] [bp-14h] BYREF
if ( !a1->m_isPlatformer )
{
CurrentPercent = PlayLayer::getCurrentPercent(a1);
m_progressWidth = a1->m_progressWidth;
v4 = CurrentPercent;
if ( CurrentPercent <= 0.01 )
v5 = 0.0001;
else
v5 = 100.0;
if ( CurrentPercent > 0.01 )
v5 = CurrentPercent / v5;
if ( m_progressWidth > (float)(m_progressWidth * v5) )
{
if ( CurrentPercent <= 0.01 )
v6 = 0.0001;
else
v6 = 100.0;
if ( CurrentPercent > 0.01 )
v6 = CurrentPercent / v6;
m_progressWidth = m_progressWidth * v6;
}
m_progressFill = a1->m_progressFill;
setTextureRect = m_progressFill->setTextureRect;
cocos2d::CCRect::CCRect(&v15, 0.0, 0.0, m_progressWidth, a1->m_progressHeight);
setTextureRect(m_progressFill, &v15);
if ( a1->m_decimalPercentage )
{
if ( v4 < 0.0 )
{
v4 = 0.0;
}
else if ( v4 >= 100.0 )
{
v4 = 100.0;
}
else if ( v4 < 0.0 )
{
v4 = 0.0;
}
m_percentageLabel = a1->m_percentageLabel;
setString = m_percentageLabel->setString;
v12 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%.2f%%", v9, v4);
CString = cocos2d::CCString::getCString(v12);
setString(m_percentageLabel, (const unsigned __int8 *)CString);
}
else
{
if ( (int)v4 > 99 )
v14 = 100;
else
v14 = (int)v4 & ~((int)v4 >> 31);
GameToolbox::intToString((GameToolbox *)&v15, v14);
sub_774544((int)&v15, "%");
a1->m_percentageLabel->setString(a1->m_percentageLabel, (const unsigned __int8 *)LODWORD(v15.origin.x));
sub_774008(&v15);
}
}
}