//
// cocos2d::CCAnimate::initWithAnimation from 0x10018d2c4 to 0x10018d3d4 (272 bytes)
//
// 2 xrefs:
// > cocos2d::CCAnimate::create @ 0x10018d294
// > cocos2d::CCAnimate::copyWithZone @ 0x10018d56c
//
// 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
//
bool __fastcall cocos2d::CCAnimate::initWithAnimation(cocos2d::CCAnimate *a1, cocos2d::CCAnimation *a2)
{
float v4; // s8
float v5; // s0
__int64 v6; // x21
unsigned int v7; // w0
cocos2d::CCArray *m_pFrames; // x8
cocos2d::ccArray *data; // x9
__int64 num; // x8
float m_fTotalDelayUnits; // s0
cocos2d::CCObject **arr; // x20
unsigned __int64 v13; // x21
float v14; // s9
float v15; // s10
cocos2d::CCObject *v16; // x8
float v18; // [xsp+Ch] [xbp-44h] BYREF
v4 = ((float (__fastcall *)(cocos2d::CCAnimation *))a2->getTotalDelayUnits)(a2);
v5 = v4 * (float)a2->m_uLoops;
if ( v5 == 0.0 )
v5 = 0.00000011921;
a1->m_fDuration = v5;
a1->m_elapsed = 0.0;
a1->m_bFirstTick = 1;
LODWORD(a1->m_pOrigFrame) = 0;
sub_10018D3D4(a1, a2);
*(_QWORD *)&a1->m_uExecutedLoops = 0;
LODWORD(a1[1].__vftable) = 0;
v6 = *(_QWORD *)&a1->m_nNextFrame;
v7 = sub_10024A36C(a2->m_pFrames);
sub_100015908(v6, v7);
m_pFrames = a2->m_pFrames;
if ( m_pFrames )
{
data = m_pFrames->data;
num = data->num;
if ( (_DWORD)num )
{
m_fTotalDelayUnits = a2->m_fTotalDelayUnits;
arr = data->arr;
v13 = (unsigned __int64)&arr[num - 1];
v14 = 0.0;
v15 = v4 / m_fTotalDelayUnits;
do
{
v16 = *arr;
if ( !*arr )
break;
v18 = (float)(v15 * v14) / v4;
v14 = v14 + *(float *)&v16[1].m_uID;
sub_10018D41C(*(_QWORD *)&a1->m_nNextFrame, &v18);
++arr;
}
while ( (unsigned __int64)arr <= v13 );
}
}
return 1;
}