//
// AnimatedShopKeeper::playReactAnimation from 0x1402afbe0 to 0x1402afe6b (651 bytes)
//
// 2 xrefs:
// > GJShopLayer::ccTouchBegan @ 0x1402aeb39
// > ??> @ 0x1406d22b8
//
// 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
//
// Hidden C++ exception states: #wind=4
void AnimatedShopKeeper::playReactAnimation(AnimatedShopKeeper *a1)
{
int v2; // edx
cocos2d::CCString *v3; // rax
const char *CString; // rax
size_t v5; // r8
__int64 v6; // rdx
__int64 v7; // rcx
__int64 v8; // r8
__int64 v9; // r9
void **v10; // r15
char *v11; // r14
unsigned __int64 v12; // r13
__int64 v13; // rbx
unsigned __int64 v14; // rsi
int v15; // ecx
_QWORD *v16; // rax
char *v17; // rax
__int128 v18; // [rsp+30h] [rbp-49h] BYREF
__int64 v19; // [rsp+40h] [rbp-39h]
__int64 v20; // [rsp+48h] [rbp-31h]
FMODAudioEngine *v21; // [rsp+50h] [rbp-29h]
__int128 *v22; // [rsp+58h] [rbp-21h]
char v23[32]; // [rsp+60h] [rbp-19h] BYREF
void *Src[2]; // [rsp+80h] [rbp+7h] BYREF
unsigned __int64 v25; // [rsp+90h] [rbp+17h]
unsigned __int64 v26; // [rsp+98h] [rbp+1Fh]
if ( !a1->m_reacting )
{
v2 = a1->m_gruntIndex + 1;
a1->m_gruntIndex = v2;
if ( v2 > 3 )
{
v2 = 1;
a1->m_gruntIndex = 1;
}
v3 = cocos2d::CCString::createWithFormat("grunt0%i.ogg", v2);
CString = cocos2d::CCString::getCString(v3);
*(_OWORD *)Src = 0;
v25 = 0;
v26 = 0;
v5 = -1;
do
++v5;
while ( CString[v5] );
sub_14003A930(Src, CString, v5);
v22 = &v18;
v18 = 0;
v19 = 0;
v20 = 0;
v10 = Src;
v11 = (char *)Src[0];
v12 = v26;
if ( v26 > 0xF )
v10 = (void **)Src[0];
v13 = 0x7FFFFFFFFFFFFFFFLL;
v14 = v25;
if ( v25 > 0x7FFFFFFFFFFFFFFFLL )
sub_140007B50(v7, v6, v8, v9);
v20 = 15;
if ( v25 > 0xF )
{
if ( (v25 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL )
{
v13 = v25 | 0xF;
if ( (v25 | 0xF) < 0x16 )
v13 = 22;
}
*(_QWORD *)&v18 = sub_14003AA10(v13 + 1);
v19 = v14;
v20 = v13;
memcpy((void *)v18, v10, v14 + 1);
}
else
{
v19 = v25;
v18 = *(_OWORD *)v10;
}
v15 = qword_1406C2E88;
if ( !qword_1406C2E88 )
{
v21 = (FMODAudioEngine *)operator new(0x888u);
qword_1406C2E88 = (__int64)FMODAudioEngine::FMODAudioEngine(v21);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2E88 + 72LL))(qword_1406C2E88);
v15 = qword_1406C2E88;
}
FMODAudioEngine::playEffect(v15, (__int64)&v18, v8, v9, 1059481190);
v19 = 7;
v20 = 15;
v18 = 0x31307463616572uLL;
v21 = (FMODAudioEngine *)&v18;
SpriteAnimationManager::overridePrio(a1->m_animationManager);
v16 = (_QWORD *)sub_14003BDB0((__int64)v23, (__int64)&v18);
SpriteAnimationManager::runAnimation((__int64)a1->m_animationManager, v16);
sub_14003A830((__int64)&v18);
a1->m_reacting = 1;
++a1->m_reactCount;
if ( v12 > 0xF )
{
v17 = v11;
if ( v12 + 1 >= 0x1000 )
{
v11 = *((char **)v11 - 1);
if ( (unsigned __int64)(v17 - v11 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v11);
}
}
}