//
// AnimatedShopKeeper::animationFinished from 0x1402aff00 to 0x1402b059e (1694 bytes)
//
// 2 xrefs:
// > ??> @ 0x14057eca0
// > ??> @ 0x1406d22d0
//
// 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=6
void AnimatedShopKeeper::animationFinished(AnimatedShopKeeper *a1, const char *a2)
{
size_t v4; // rdi
size_t v5; // r8
void **v6; // rcx
char *v7; // r15
unsigned __int64 v8; // r13
unsigned __int64 v9; // r12
size_t v10; // r8
__int64 v11; // r14
char *v12; // rax
size_t v13; // r8
__int128 *p_Buf2; // rcx
char *v15; // r14
unsigned __int64 v16; // r13
unsigned __int64 v17; // r15
size_t v18; // r8
bool v19; // r15
char *v20; // rax
_QWORD *v21; // rax
size_t v22; // r8
__int128 *v23; // rcx
char *v24; // r14
unsigned __int64 v25; // r13
unsigned __int64 v26; // r15
size_t v27; // r8
bool v28; // r15
char *v29; // rax
_QWORD *v30; // rax
_QWORD *v31; // rax
__int128 *v32; // rcx
char *v33; // rbx
unsigned __int64 v34; // r14
unsigned __int64 v35; // rdi
size_t v36; // r8
bool v37; // di
char *v38; // rax
_QWORD *v39; // rax
_QWORD *v40; // rax
void *Buf1[2]; // [rsp+30h] [rbp-50h] BYREF
unsigned __int64 v42; // [rsp+40h] [rbp-40h]
unsigned __int64 v43; // [rsp+48h] [rbp-38h]
__int128 Buf2; // [rsp+50h] [rbp-30h] BYREF
unsigned __int64 v45; // [rsp+60h] [rbp-20h]
unsigned __int64 v46; // [rsp+68h] [rbp-18h]
--a1->m_idleInt1;
--a1->m_idleInt2;
v45 = 7;
v46 = 15;
Buf2 = 0x31307463616572uLL;
*(_OWORD *)Buf1 = 0;
v42 = 0;
v43 = 0;
v4 = -1;
v5 = -1;
do
++v5;
while ( a2[v5] );
sub_14003A930(Buf1, a2, v5);
v6 = Buf1;
v7 = (char *)Buf1[0];
v8 = v43;
if ( v43 > 0xF )
v6 = (void **)Buf1[0];
v9 = v42;
v10 = v42;
if ( v42 > 7 )
v10 = 7;
LODWORD(v11) = memcmp(v6, &Buf2, v10);
if ( !(_DWORD)v11 )
{
if ( v9 >= 7 )
v11 = v9 > 7;
else
LODWORD(v11) = -1;
}
if ( v8 > 0xF )
{
v12 = v7;
if ( v8 + 1 >= 0x1000 )
{
v7 = *((char **)v7 - 1);
if ( (unsigned __int64)(v12 - v7 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v7);
}
if ( !(_DWORD)v11 )
a1->m_reacting = 0;
*(_OWORD *)Buf1 = 0;
v42 = 6;
v43 = 15;
strcpy((char *)Buf1, "idle03");
Buf2 = 0;
v45 = 0;
v46 = 0;
v13 = -1;
do
++v13;
while ( a2[v13] );
sub_14003A930(&Buf2, a2, v13);
p_Buf2 = &Buf2;
v15 = (char *)Buf2;
v16 = v46;
if ( v46 > 0xF )
p_Buf2 = (__int128 *)Buf2;
v17 = v45;
v18 = v45;
if ( v45 > 6 )
v18 = 6;
v19 = (memcmp(p_Buf2, Buf1, v18) || v17 != 6) && a1->m_idleInt2 <= 0 && a1->m_type != Diamond;
if ( v16 > 0xF )
{
v20 = v15;
if ( v16 + 1 >= 0x1000 )
{
v15 = *((char **)v15 - 1);
if ( (unsigned __int64)(v20 - v15 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v15);
}
if ( v19 )
{
a1->m_looking = 0;
a1->m_idleInt2 = (int)(float)((float)((float)((float)rand() / 32767.0) * 5.0) + 10.0);
*(_OWORD *)Buf1 = 0;
v42 = 6;
v43 = 15;
strcpy((char *)Buf1, "idle03");
SpriteAnimationManager::overridePrio(a1->m_animationManager);
v21 = (_QWORD *)sub_14003BDB0((__int64)&Buf2, (__int64)Buf1);
SpriteAnimationManager::runAnimation((__int64)a1->m_animationManager, v21);
LABEL_79:
sub_14003A830((__int64)Buf1);
return;
}
*(_OWORD *)Buf1 = 0;
v42 = 6;
v43 = 15;
strcpy((char *)Buf1, "idle00");
Buf2 = 0;
v45 = 0;
v46 = 0;
v22 = -1;
do
++v22;
while ( a2[v22] );
sub_14003A930(&Buf2, a2, v22);
v23 = &Buf2;
v24 = (char *)Buf2;
v25 = v46;
if ( v46 > 0xF )
v23 = (__int128 *)Buf2;
v26 = v45;
v27 = v45;
if ( v45 > 6 )
v27 = 6;
v28 = !memcmp(v23, Buf1, v27) && v26 == 6 && a1->m_idleInt1 <= 0;
if ( v25 > 0xF )
{
v29 = v24;
if ( v25 + 1 >= 0x1000 )
{
v24 = *((char **)v24 - 1);
if ( (unsigned __int64)(v29 - v24 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v24);
}
if ( !v28 )
{
*(_OWORD *)Buf1 = 0;
v42 = 6;
v43 = 15;
strcpy((char *)Buf1, "idle03");
Buf2 = 0;
v45 = 0;
v46 = 0;
do
++v4;
while ( a2[v4] );
sub_14003A930(&Buf2, a2, v4);
v32 = &Buf2;
v33 = (char *)Buf2;
v34 = v46;
if ( v46 > 0xF )
v32 = (__int128 *)Buf2;
v35 = v45;
v36 = v45;
if ( v45 > 6 )
v36 = 6;
v37 = !memcmp(v32, Buf1, v36) && v35 == 6 && !a1->m_looking && (float)((float)rand() / 32767.0) > 0.60000002;
if ( v34 > 0xF )
{
v38 = v33;
if ( v34 + 1 >= 0x1000 )
{
v33 = *((char **)v33 - 1);
if ( (unsigned __int64)(v38 - v33 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v33);
}
v42 = 6;
v43 = 15;
*(_OWORD *)Buf1 = 0;
BYTE6(Buf1[0]) = 0;
if ( v37 )
{
qmemcpy(Buf1, "idle03", 6);
SpriteAnimationManager::overridePrio(a1->m_animationManager);
v39 = (_QWORD *)sub_14003BDB0((__int64)&Buf2, (__int64)Buf1);
SpriteAnimationManager::runAnimation((__int64)a1->m_animationManager, v39);
sub_14003A830((__int64)Buf1);
a1->m_looking = 1;
return;
}
qmemcpy(Buf1, "idle00", 6);
SpriteAnimationManager::overridePrio(a1->m_animationManager);
v40 = (_QWORD *)sub_14003BDB0((__int64)&Buf2, (__int64)Buf1);
SpriteAnimationManager::runAnimation((__int64)a1->m_animationManager, v40);
goto LABEL_79;
}
if ( (float)((float)rand() / 32767.0) <= 0.89999998 || a1->m_type == Diamond )
{
*(_OWORD *)Buf1 = 0;
v42 = 6;
v43 = 15;
strcpy((char *)Buf1, "idle02");
SpriteAnimationManager::overridePrio(a1->m_animationManager);
v31 = (_QWORD *)sub_14003BDB0((__int64)&Buf2, (__int64)Buf1);
SpriteAnimationManager::runAnimation((__int64)a1->m_animationManager, v31);
}
else
{
*(_OWORD *)Buf1 = 0;
v42 = 6;
v43 = 15;
strcpy((char *)Buf1, "idle01");
SpriteAnimationManager::overridePrio(a1->m_animationManager);
v30 = (_QWORD *)sub_14003BDB0((__int64)&Buf2, (__int64)Buf1);
SpriteAnimationManager::runAnimation((__int64)a1->m_animationManager, v30);
}
sub_14003A830((__int64)Buf1);
a1->m_idleInt1 = (int)(float)((float)((float)((float)rand() / 32767.0) * 3.0) + 2.0);
}