//
// PlayLayer::updateProgressbar from 0x1001184ec to 0x100118644 (344 bytes)
//
// 4 xrefs:
// > PlayLayer::setupHasCompleted @ 0x100117018
// > PlayLayer::toggleProgressbar @ 0x10011e690
// > PlayLayer::postUpdate @ 0x10011f69c
// > PlayLayer::resetLevel @ 0x1001222c8
//
// 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 PlayLayer::updateProgressbar(PlayLayer *a1)
{
bool *p_m_isPlatformer; // x21
float CurrentPercent; // s8
float m_progressWidth; // s0
float v5; // s1
float v6; // s2
cocos2d::CCSprite *m_progressFill; // x20
float v8; // s0
cocos2d::CCLabelBMFont *m_percentageLabel; // x19
cocos2d::CCString *v10; // x0
const char *CString; // x0
int v12; // w8
__int64 v13; // x0
std::string *v14; // x1
std::string v15; // [xsp+8h] [xbp-48h] BYREF
p_m_isPlatformer = &a1->m_isPlatformer;
if ( !a1->m_isPlatformer )
{
CurrentPercent = PlayLayer::getCurrentPercent(a1);
m_progressWidth = a1->m_progressWidth;
v5 = m_progressWidth * (float)(fmaxf(CurrentPercent, 0.01) / 100.0);
if ( m_progressWidth <= v5 )
v6 = a1->m_progressWidth;
else
v6 = v5;
m_progressFill = a1->m_progressFill;
sub_100022990((float *)&v15, 0.0, 0.0, v6, a1->m_progressHeight);
((void (__fastcall *)(cocos2d::CCSprite *, std::string *))m_progressFill->setTextureRect)(m_progressFill, &v15);
if ( p_m_isPlatformer[1930] )
{
if ( CurrentPercent >= 0.0 )
v8 = CurrentPercent;
else
v8 = 0.0;
m_percentageLabel = a1->m_percentageLabel;
v10 = (cocos2d::CCString *)sub_100268F4C("%.2f%%", fminf(v8, 100.0));
CString = cocos2d::CCString::getCString(v10);
((void (__fastcall *)(cocos2d::CCLabelBMFont *, const char *))m_percentageLabel->setString)(
m_percentageLabel,
CString);
}
else
{
v12 = (int)CurrentPercent & ~((int)CurrentPercent >> 31);
if ( v12 >= 100 )
v13 = 100;
else
v13 = (unsigned int)v12;
GameToolbox::intToString(v13, &v15);
std::string::append(&v15, "%");
if ( (v15.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v14 = &v15;
else
v14 = (std::string *)v15.__r_.__value_.__r.__words[0];
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))a1->m_percentageLabel->setString)(
a1->m_percentageLabel,
v14);
if ( SHIBYTE(v15.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v15.__r_.__value_.__l.__data_);
}
}
}