//
// AnimatedGameObject::playAnimation from 0x100384d20 to 0x100384e38 (280 bytes)
//
// 2 xrefs:
// > PlayLayer::loadActiveSaveObjects @ 0x10012156c
// > GJBaseGameLayer::playAnimationCommand @ 0x1001ea61c
//
// 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
//
// local variable allocation has failed, the output may be wrong!
void __fastcall AnimatedGameObject::playAnimation(AnimatedGameObject *a1, int a2)
{
std::string::size_type size; // x8
_BOOL4 m_isActivated; // w9
CCAnimatedSprite *m_animatedSprite; // x19
std::string *p_dst; // x8
std::string v8; // [xsp+0h] [xbp-60h] BYREF
std::string __dst; // [xsp+20h] [xbp-40h] BYREF
std::string __str; // [xsp+38h] [xbp-28h] BYREF
AnimatedGameObject::animationForID(&__str, *(_QWORD *)&a2, (unsigned int)a1->m_objectID);
size = HIBYTE(__str.__r_.__value_.__r.__words[2]);
if ( (__str.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) != 0LL )
size = __str.__r_.__value_.__l.__size_;
if ( size )
{
a1->m_animationID = a2;
std::string::operator=((std::string *)&a1->m_currentAnimation, &__str);
a1->m_playingAnimation = 1;
m_isActivated = a1->m_isActivated;
m_animatedSprite = a1->m_animatedSprite;
if ( m_isActivated )
{
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__dst, __str.__r_.__value_.__l.__data_, __str.__r_.__value_.__l.__size_);
else
__dst = __str;
CCAnimatedSprite::tweenToAnimation((__int64)m_animatedSprite, (__int64)&__dst, 0.05);
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
{
p_dst = &__dst;
LABEL_15:
operator delete(p_dst->__r_.__value_.__l.__data_);
}
}
else
{
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&v8, __str.__r_.__value_.__l.__data_, __str.__r_.__value_.__l.__size_);
else
v8 = __str;
CCAnimatedSprite::runAnimationForced((__int64)m_animatedSprite, (__int64)&v8);
if ( SHIBYTE(v8.__r_.__value_.__r.__words[2]) < 0 )
{
p_dst = &v8;
goto LABEL_15;
}
}
}
if ( SHIBYTE(__str.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__str.__r_.__value_.__l.__data_);
}