//
// GJBaseGameLayer::updateParticles from 0x48cd94 to 0x48ceec (344 bytes)
//
// 2 xrefs:
// > PlayLayer::updateVisibility @ 0x315d64
// > LevelEditorLayer::updateVisibility @ 0x3697b8
//
// 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 GJBaseGameLayer::updateParticles(GJBaseGameLayer *a1, float a2)
{
cocos2d::CCArray **p_m_temporaryParticles; // r7
int *p_m_particleCount; // r9
int *p_m_customParticlesUIDs; // r11
unsigned int v7; // r5
int v8; // r0
int *v9; // r8
int v10; // r0
int v11; // r3
cocos2d::CCArray **p_m_unclaimedParticles; // r8
unsigned int v13; // r7
cocos2d::CCObject *v14; // r5
unsigned int m_nLuaID; // r10
std::_Hashtable, std::allocator>, std::__detail::_Select1st, std::equal_to, std::hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits>::size_type v16; // r11
_DWORD **v17; // r0
cocos2d::CCArray *v18; // r0
_DWORD *v19; // r0
std::string v20[2]; // [sp+0h] [bp-Ch] BYREF
v20[0].m_data.m_data = (stl::StringData::Internal *)a1;
v20[1] = LODWORD(a2);
p_m_temporaryParticles = &a1->m_temporaryParticles;
p_m_particleCount = &a1->m_particleCount;
p_m_customParticlesUIDs = (int *)&a1->m_customParticlesUIDs;
v7 = 0;
a1->m_particleCount = 0;
while ( v7 < cocos2d::CCArray::count(*p_m_temporaryParticles) )
{
v8 = cocos2d::CCArray::objectAtIndex(*p_m_temporaryParticles, v7);
v9 = (int *)v8;
if ( *(_BYTE *)(v8 + 463) )
{
v20[0] = *(std::string *)(v8 + 4);
sub_48CCE8(p_m_customParticlesUIDs, v20);
cocos2d::CCArray::fastRemoveObjectAtIndex(*p_m_temporaryParticles, v7);
}
else
{
++v7;
v10 = (*(int (__fastcall **)(int))(*(_DWORD *)v8 + 740))(v8);
v11 = *v9;
*p_m_particleCount += v10;
(*(void (__fastcall **)(int *, _DWORD))(v11 + 20))(v9, LODWORD(a2));
}
}
p_m_unclaimedParticles = &a1->m_unclaimedParticles;
v13 = 0;
while ( v13 < cocos2d::CCArray::count(*p_m_unclaimedParticles) )
{
v14 = (cocos2d::CCObject *)cocos2d::CCArray::objectAtIndex(*p_m_unclaimedParticles, v13);
if ( ((int (__fastcall *)(cocos2d::CCObject *))v14->__vftable[11].~CCObject_0)(v14) )
{
++v13;
}
else
{
m_nLuaID = v14[13].m_nLuaID;
v16 = m_nLuaID % a1->m_particleCountToParticleString._M_h._M_bucket_count;
v17 = sub_46C90C(&a1->m_particleCountToParticleString._M_h._M_buckets, v16, &v14[13].m_nLuaID);
if ( !v17 || !*v17 )
{
v19 = (_DWORD *)operator new(0xCu);
*v19 = 0;
v19[1] = v14[13].m_nLuaID;
v19[2] = &unk_ACDDA8;
std::_Hashtable,std::allocator>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits>::_M_insert_unique_node(
(int)&a1->m_particleCountToParticleString,
v16,
m_nLuaID,
v19);
}
sub_775C20(v20);
v18 = (cocos2d::CCArray *)cocos2d::CCDictionary::objectForKey(a1->m_customParticles, v20);
if ( v18 )
cocos2d::CCArray::addObject(v18, v14);
cocos2d::CCArray::fastRemoveObjectAtIndex(*p_m_unclaimedParticles, v13);
sub_774008(v20);
}
}
}