//
// CCPartAnimSprite::tweenSpriteTo from 0x577adc to 0x577cf0 (532 bytes)
//
// 2 xrefs:
// > CCPartAnimSprite::tweenToFrame @ 0x577dc0
// > ??> @ 0x58470
//
// 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 CCPartAnimSprite::tweenSpriteTo(CCPartAnimSprite *a1, SpriteDescription *a2, float a3)
{
CCSpritePart *v6; // x19
float x; // s1
cocos2d::CCRotateTo *v8; // x24
cocos2d::CCAction *v9; // x23
char *v10; // x0
unsigned int *v11; // x2
int v12; // w1
float v13; // [xsp+60h] [xbp+60h]
cocos2d::CCMoveTo *v14; // [xsp+78h] [xbp+78h]
_DWORD *v15; // [xsp+90h] [xbp+90h] BYREF
v6 = (CCSpritePart *)cocos2d::CCArray::objectAtIndex(a1->m_spriteParts, a2->m_tag);
cocos2d::CCNode::stopAllActions(v6);
x = a2->m_scale.x;
if ( a2->m_flipped.x != 0.0 )
x = -x;
v13 = x;
v14 = cocos2d::CCMoveTo::create(a3, &a2->m_position);
v8 = (cocos2d::CCRotateTo *)cocos2d::CCScaleTo::create(a3, v13);
v9 = (cocos2d::CCAction *)cocos2d::CCRotateTo::create(v8, a3, a2->m_rotation);
cocos2d::CCNode::runAction(v6, v14);
cocos2d::CCNode::runAction(v6, v8);
cocos2d::CCNode::runAction(v6, v9);
if ( a2->m_usesCustomTag )
{
v6->setDisplayFrame(v6, a2->m_texture);
sub_D18D28(&v15, &a2->m_texture->m_strFrameName);
CCSpritePart::frameChanged((__int64)v6, (const void **)&v15);
v10 = (char *)(v15 - 6);
if ( v15 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = v15 - 2;
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *(v15 - 2);
*(v15 - 2) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v10);
}
}
if ( v6->getZOrder(v6) != a2->m_zValue )
((void (__fastcall *)(CCPartAnimSprite *, CCSpritePart *))a1->reorderChild)(a1, v6);
CCSpritePart::setBeingUsed(v6, 1);
v6->setVisible(v6, 1);
}