//
// SecretLayer5::incrementChatIdx from 0x10047bfe0 to 0x10047c101 (289 bytes)
//
// 0 xrefs:
//
// 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 SecretLayer5::incrementChatIdx(SecretLayer5 *a1)
{
__int64 m_chatIndex; // rax
std::__vector_base::pointer begin; // r13
std::__vector_base::pointer end; // r14
__int64 v4; // r12
__int64 v5; // r15
unsigned int v6; // eax
std::__vector_base::pointer i; // r14
__int64 v8; // rax
int v9; // ecx
_QWORD v10[2]; // [rsp+0h] [rbp-50h] BYREF
_QWORD v11[2]; // [rsp+10h] [rbp-40h] BYREF
unsigned int v12; // [rsp+20h] [rbp-30h] BYREF
int v13; // [rsp+24h] [rbp-2Ch]
m_chatIndex = a1->m_chatIndex;
a1->m_chatIndex = m_chatIndex + 1;
begin = a1->m_soundEffects.__begin_;
end = a1->m_soundEffects.__end_;
v4 = end - begin;
v5 = v4 - 1;
if ( v4 - 1 < (unsigned __int64)(m_chatIndex + 1) )
{
v13 = begin[m_chatIndex];
v6 = rand();
v12 = v6
+ (v6 + ((v6 / 0x7FFFFFFF) | ((v6 / 0x7FFFFFFF) << 31)) == 0)
+ ((v6 / 0x7FFFFFFF) | ((v6 / 0x7FFFFFFF) << 31));
if ( v4 >= 2 )
{
v10[0] = 0;
v10[1] = 0x7FFFFFFFFFFFFFFFLL;
for ( i = end - 1; begin < i; --v5 )
{
v11[0] = 0;
v11[1] = v5;
v8 = sub_100480CE0(v10, &v12, v11);
if ( v8 )
{
v9 = *begin;
*begin = begin[v8];
begin[v8] = v9;
}
++begin;
}
}
a1->m_chatIndex = 0;
a1->m_chatIndex = *a1->m_soundEffects.__begin_ == v13;
}
}