//
// CCAnimatedSprite::tweenToAnimation from 0x100350b30 to 0x100350dde (686 bytes)
//
// 12 xrefs:
// > AnimatedGameObject::playAnimation @ 0x1001b8be0
// > GJMapObject::monsterIdle @ 0x100267856
// > PlayerObject::updateJump @ 0x1003ff7ac
// > PlayerObject::updateJump @ 0x1003ff830
// > PlayerObject::updateJump @ 0x1003ffba1
// > PlayerObject::updateJump @ 0x1003ffbe3
// > PlayerObject::updateJump @ 0x1003ffd16
// > PlayerObject::updateMove @ 0x1004007a9
// > PlayerObject::updateMove @ 0x1004008c9
// > PlayerObject::boostPlayer @ 0x10040664a
// > PlayerObject::ringJump @ 0x1004150fd
// > PlayerObject::playingEndEffect @ 0x10041aa9d
//
// 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 CCAnimatedSprite::tweenToAnimation(__int64 a1, std::string *a2, __m128 a3)
{
__int64 v5; // r15
int AnimType; // r15d
unsigned int v7; // r15d
unsigned int v8; // r13d
size_t v9; // r13
const void *v10; // rdi
char *data; // r12
size_t size; // r15
std::string::pointer v13; // rsi
size_t v14; // rdx
std::string *v15; // r15
__int64 v16; // rax
CCPartAnimSprite *v17; // rdi
cocos2d::CCSpriteFrame *v18; // rsi
cocos2d::CCString *v19; // rax
size_t v20; // rax
size_t v21; // r13
char *v22; // r12
__int64 v23; // r15
void *v24; // rsi
size_t v25; // r15
char *v26; // rax
__int64 v27; // r12
unsigned int v28; // r14d
unsigned int v29; // eax
int v30; // ecx
int v31; // r8d
int v32; // r9d
cocos2d::CCAction *v33; // r14
char v34; // [rsp+0h] [rbp-80h]
__m128 v35; // [rsp+10h] [rbp-70h] BYREF
void *__p; // [rsp+20h] [rbp-60h]
__int64 v37; // [rsp+28h] [rbp-58h]
void *__src; // [rsp+30h] [rbp-50h]
_QWORD __dst[2]; // [rsp+38h] [rbp-48h] BYREF
void *v40; // [rsp+48h] [rbp-38h]
float v41; // [rsp+54h] [rbp-2Ch]
v41 = a3.f32[0];
v5 = *(_QWORD *)(a1 + 648);
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) != 0 )
{
sub_100006B70(&v35, a2->__r_.__value_.__l.__data_, a2->__r_.__value_.__l.__size_, *(double *)a3.i64);
}
else
{
__p = a2->__r_.__value_.__l.__data_;
a3 = *(__m128 *)&a2->__r_.__value_.__l.0;
v35 = *(__m128 *)&a2->__r_.__value_.__l.0;
}
AnimType = SpriteAnimationManager::getAnimType(v5, &v35);
if ( (v35.i8[0] & 1) != 0 )
operator delete(__p);
if ( AnimType != 2 )
return;
v7 = (unsigned int)a2->__r_.__value_.__l.0;
v8 = *(unsigned __int8 *)(a1 + 624);
if ( (v8 & 1) != 0 )
{
v9 = *(_QWORD *)(a1 + 632);
v10 = *(const void **)(a1 + 640);
data = a2->__r_.__value_.__s.__data_;
if ( (v7 & 1) == 0 )
{
LABEL_9:
size = v7 >> 1;
v13 = data;
goto LABEL_12;
}
}
else
{
v9 = v8 >> 1;
v10 = (const void *)(a1 + 625);
data = a2->__r_.__value_.__s.__data_;
if ( (v7 & 1) == 0 )
goto LABEL_9;
}
size = a2->__r_.__value_.__l.__size_;
v13 = a2->__r_.__value_.__l.__data_;
LABEL_12:
v14 = v9;
if ( size < v9 )
v14 = size;
if ( memcmp(v10, v13, v14) || size != v9 || !cocos2d::CCNode::getActionByTag((cocos2d::CCNode *)a1, 1) )
{
v15 = (std::string *)(a1 + 624);
SpriteAnimationManager::stopAnimations(*(SpriteAnimationManager **)(a1 + 648));
cocos2d::CCNode::stopActionByTag((cocos2d::CCNode *)a1, 1);
std::string::operator=((std::string *)(a1 + 624), a2);
v16 = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(*(_QWORD *)(a1 + 648) + 392LL), (char *)a2);
if ( v16 )
{
if ( *(_DWORD *)(v16 + 28) )
{
v17 = *(CCPartAnimSprite **)(a1 + 672);
v18 = (cocos2d::CCSpriteFrame *)v16;
LABEL_31:
CCPartAnimSprite::tweenToFrame(v17, v18, v41);
std::string::operator=(v15, a2);
v28 = (unsigned int)cocos2d::CCDelayTime::create(v41);
v29 = (unsigned int)cocos2d::CCCallFunc::create(
(cocos2d::CCObject *)a1,
(cocos2d::SEL_CallFunc)(unsigned __int64)CCAnimatedSprite::tweenToAnimationFinished);
v33 = (cocos2d::CCAction *)sub_1003B5760(v28, v29, 0, v30, v31, v32);
((void (__fastcall *)(cocos2d::CCAction *, __int64))v33->setTag)(v33, 1);
cocos2d::CCNode::runAction((cocos2d::CCNode *)a1, v33);
return;
}
v37 = *(_QWORD *)(*(_QWORD *)(a1 + 648) + 392LL);
v19 = (cocos2d::CCString *)sub_1007AB580("%s_first", v34);
__src = (void *)cocos2d::CCString::getCString(v19);
v20 = strlen((const char *)__src);
if ( v20 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)a3.i64);
v21 = v20;
if ( v20 >= 0x17 )
{
v25 = 26;
if ( (v20 | 7) != 0x17 )
v25 = (v20 | 7) + 1;
v26 = (char *)operator new(v25);
v24 = __src;
v22 = v26;
v40 = v26;
__dst[0] = v25 | 1;
__dst[1] = v21;
v23 = v37;
}
else
{
LOBYTE(__dst[0]) = 2 * v20;
v22 = (char *)__dst + 1;
v23 = v37;
v24 = __src;
if ( !v20 )
goto LABEL_28;
}
memmove(v22, v24, v21);
LABEL_28:
v22[v21] = 0;
v27 = cocos2d::CCDictionary::objectForKey_1(v23, (char *)__dst);
v15 = (std::string *)(a1 + 624);
if ( (__dst[0] & 1) != 0 )
operator delete(v40);
v17 = *(CCPartAnimSprite **)(a1 + 672);
v18 = (cocos2d::CCSpriteFrame *)v27;
goto LABEL_31;
}
}
}