//
// AnimatedShopKeeper::playReactAnimation from 0x92f6b0 to 0x92f93c (652 bytes)
//
// 2 xrefs:
// > GJShopLayer::ccTouchBegan @ 0x92fb3c
// > ??> @ 0x2bc38
//
// 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 AnimatedShopKeeper::playReactAnimation(AnimatedShopKeeper *a1)
{
unsigned __int64 v2; // x1
cocos2d::CCString *v3; // x0
char *CString; // x0
FMODAudioEngine *v5; // x25
void *v6; // x0
void *v7; // x0
int m_reactCount; // w0
void *v9; // x0
unsigned int *v10; // x20
int v11; // w1
unsigned int *v12; // x1
int v13; // w2
unsigned int *v14; // x1
int v15; // w2
__int64 v16; // [xsp+0h] [xbp+0h] BYREF
__int64 v17; // [xsp+60h] [xbp+60h]
__int64 v18; // [xsp+68h] [xbp+68h] BYREF
__int64 v19; // [xsp+70h] [xbp+70h] BYREF
if ( !a1->m_reacting )
{
v2 = (unsigned int)(a1->m_gruntIndex + 1);
if ( (int)v2 > 3 )
v2 = 1;
a1->m_gruntIndex = v2;
v3 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"grunt0%i.ogg", (const char *)v2);
CString = (char *)cocos2d::CCString::getCString(v3);
sub_D153B8((unsigned int)&v16 + 96, CString);
v5 = FMODAudioEngine::sharedEngine();
sub_D18D28(&v18);
FMODAudioEngine::playEffect((__int64)v5, (__int64)&v18, 1.0, 0.0, 0.65);
v6 = (void *)(v18 - 24);
if ( (__int64 *)(v18 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v12 = (unsigned int *)(v18 - 8);
do
v13 = __ldaxr(v12);
while ( __stlxr(v13 - 1, v12) );
}
else
{
v13 = *(_DWORD *)(v18 - 8);
*(_DWORD *)(v18 - 8) = v13 - 1;
}
if ( v13 <= 0 )
operator delete(v6);
}
sub_D153B8((int)&v19, "react01");
CCAnimatedSprite::runAnimationForced((__int64)a1, (__int64)&v19);
v7 = (void *)(v19 - 24);
if ( (__int64 *)(v19 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)(v19 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *(_DWORD *)(v19 - 8);
*(_DWORD *)(v19 - 8) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v7);
}
m_reactCount = a1->m_reactCount;
a1->m_reacting = 1;
a1->m_reactCount = m_reactCount + 1;
v9 = (void *)(v17 - 24);
if ( (__int64 *)(v17 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v10 = (unsigned int *)(v17 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
}
else
{
v11 = *(_DWORD *)(v17 - 8);
*(_DWORD *)(v17 - 8) = v11 - 1;
}
if ( v11 <= 0 )
operator delete(v9);
}
}
}