//
// cocos2d::CCAnimate::initWithAnimation from 0x1800352b0 to 0x180035410 (352 bytes)
//
// 5 xrefs:
// > cocos2d::CCAnimate::copyWithZone @ 0x180031b11
// > cocos2d::CCAnimate::create @ 0x180033586
// > cocos2d::CCAnimate::reverse @ 0x180035ad5
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b0750
//
// 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::CCAnimate::initWithAnimation(cocos2d::CCAnimate *this, struct cocos2d::CCAnimation *a2)
{
double v4; // xmm0_8
float v5; // xmm8_4
float v6; // xmm6_4
float v7; // xmm1_4
cocos2d::CCObject *m_pSplitTimes; // rcx
unsigned int v9; // eax
_QWORD *v10; // rcx
float v11; // xmm7_4
cocos2d::CCArray *m_pFrames; // rbx
cocos2d::ccArray *data; // rbx
__int64 num; // rax
cocos2d::CCObject **arr; // rbx
cocos2d::CCObject **i; // rsi
__int64 v17; // rcx
float v18; // xmm0_4
float *v19; // rdx
float v20; // xmm0_4
__int64 v22; // [rsp+60h] [rbp+8h] BYREF
v4 = ((double (__fastcall *)(struct cocos2d::CCAnimation *))a2->getTotalDelayUnits)(a2);
v5 = *(float *)&v4;
v6 = 0.0;
v7 = (float)(int)a2->m_uLoops * *(float *)&v4;
this->m_fDuration = v7;
if ( v7 == 0.0 )
this->m_fDuration = 0.00000011920929;
this->m_bFirstTick = 1;
this->m_elapsed = 0.0;
LODWORD(this->m_pOrigFrame) = 0;
if ( (struct cocos2d::CCAnimation *)this->m_pSplitTimes != a2 )
{
cocos2d::CCObject::retain(a2);
m_pSplitTimes = (cocos2d::CCObject *)this->m_pSplitTimes;
if ( m_pSplitTimes )
cocos2d::CCObject::release(m_pSplitTimes);
this->m_pSplitTimes = (std::vector *)a2;
}
*(_QWORD *)&this->m_uExecutedLoops = 0;
*((_DWORD *)this + 32) = 0;
v9 = cocos2d::CCArray::count(a2->m_pFrames);
v10 = *(_QWORD **)&this->m_nNextFrame;
v22 = v9;
if ( v9 > (unsigned __int64)((__int64)(v10[2] - *v10) >> 2) )
sub_1800308E0((__int64)v10, &v22);
v11 = *(float *)&v4 / a2->m_fTotalDelayUnits;
m_pFrames = a2->m_pFrames;
if ( m_pFrames )
{
data = m_pFrames->data;
num = data->num;
if ( (_DWORD)num )
{
arr = data->arr;
for ( i = &arr[num - 1]; arr <= i; ++arr )
{
if ( !*arr )
break;
v17 = *(_QWORD *)&this->m_nNextFrame;
v18 = v11 * v6;
v6 = v6 + *(float *)&(*arr)[1].m_uID;
v19 = *(float **)(v17 + 8);
v20 = v18 / v5;
*(float *)&v22 = v20;
if ( v19 == *(float **)(v17 + 16) )
{
sub_180030780((const void **)v17, v19, &v22);
}
else
{
*v19 = v20;
*(_QWORD *)(v17 + 8) = v19 + 1;
}
}
}
}
return 1;
}