//
// cocos2d::CCProgressTimer::initWithSprite from 0x18005ddf0 to 0x18005df83 (403 bytes)
//
// 3 xrefs:
// > cocos2d::CCProgressTimer::create @ 0x18005dae6
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b321c
//
// 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
//
char __fastcall cocos2d::CCProgressTimer::initWithSprite(
cocos2d::CCProgressTimer *this,
struct cocos2d::CCSprite *a2,
__int64 a3,
float a4)
{
float v6; // xmm0_4
cocos2d::CCProgressTimerType m_eType; // ecx
cocos2d::CCSize *v8; // rax
cocos2d::CCProgressTimer_vtbl *v9; // rbx
float *v10; // rax
float *v11; // rax
cocos2d::CCSprite *m_pSprite; // rcx
cocos2d::CCProgressTimer_vtbl *v13; // rbx
__int64 v14; // rax
cocos2d::ccV2F_C4B_T2F *m_pVertexData; // rcx
cocos2d::CCProgressTimer_vtbl *v16; // rbx
cocos2d::CCShaderCache *v17; // rax
struct cocos2d::CCGLProgram *v18; // rax
float v20; // [rsp+40h] [rbp+8h] BYREF
if ( this->m_fPercentage != 0.0 )
{
v6 = cocos2d::clampf((cocos2d *)this, 0.0, 100.0, a4);
m_eType = this->m_eType;
this->m_fPercentage = v6;
if ( m_eType )
{
if ( m_eType == kCCProgressTimerTypeBar )
cocos2d::CCProgressTimer::updateBar(this);
}
else
{
cocos2d::CCProgressTimer::updateRadial(this);
}
}
this->m_pVertexData = nullptr;
this->m_nVertexDataCount = 0;
v8 = (cocos2d::CCSize *)kmVec2Fill(&v20, 0.5, 0.5);
cocos2d::CCNode::setAnchorPoint(this, v8);
v9 = this->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
this->m_eType = kCCProgressTimerTypeRadial;
this->m_bReverseDirection = 0;
v10 = kmVec2Fill(&v20, 0.5, 0.5);
((void (__fastcall *)(cocos2d::CCProgressTimer *, float *))v9->setMidpoint)(this, v10);
v11 = kmVec2Fill(&v20, 1.0, 1.0);
cocos2d::CCSize::operator=(&this->m_tBarChangeRate, v11);
if ( this->m_pSprite != a2 )
{
if ( a2 )
cocos2d::CCObject::retain(a2);
m_pSprite = this->m_pSprite;
if ( m_pSprite )
cocos2d::CCObject::release(m_pSprite);
v13 = this->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
this->m_pSprite = a2;
v14 = ((__int64 (__fastcall *)(struct cocos2d::CCSprite *))a2->getContentSize)(a2);
((void (__fastcall *)(cocos2d::CCProgressTimer *, __int64))v13->setContentSize)(this, v14);
m_pVertexData = this->m_pVertexData;
if ( m_pVertexData )
{
free(m_pVertexData);
this->m_pVertexData = nullptr;
this->m_nVertexDataCount = 0;
}
}
v16 = this->cocos2d::CCNodeRGBA::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v17 = cocos2d::CCShaderCache::sharedShaderCache();
v18 = cocos2d::CCShaderCache::programForKey(v17, "ShaderPositionTextureColor");
((void (__fastcall *)(cocos2d::CCProgressTimer *, struct cocos2d::CCGLProgram *))v16->setShaderProgram)(this, v18);
return 1;
}