//
// cocos2d::CCParticleSystem::getParticleDrawCost from 0x180065c70 to 0x180065ded (381 bytes)
//
// 2 xrefs:
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b3bb8
//
// 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
//
__int64 __fastcall cocos2d::CCParticleSystem::getParticleDrawCost(cocos2d::CCParticleSystem *this)
{
unsigned int m_uParticleCount; // r8d
unsigned int v4; // r10d
float v5; // xmm2_4
float *p_r; // rcx
unsigned int v7; // eax
__int64 v8; // rdx
__int64 v9; // rax
float *v10; // rdx
__int64 v11; // rax
if ( !this->m_bIsActive )
return 0;
m_uParticleCount = this->m_uParticleCount;
v4 = 0;
v5 = 0.0;
if ( m_uParticleCount >= 4 )
{
p_r = &this->m_pParticles[3].deltaColor.r;
v7 = ((m_uParticleCount - 4) >> 2) + 1;
v8 = v7;
v4 = 4 * v7;
v9 = 4LL * v7;
do
{
if ( *(p_r - 70) > 0.0 )
v5 = v5 + (float)((float)((float)(*(p_r - 74) * 0.5) * (float)(*(p_r - 74) * 0.5)) * 3.1415927);
if ( *(p_r - 33) > 0.0 )
v5 = v5 + (float)((float)((float)(*(p_r - 37) * 0.5) * (float)(*(p_r - 37) * 0.5)) * 3.1415927);
if ( p_r[4] > 0.0 )
v5 = v5 + (float)((float)((float)(*p_r * 0.5) * (float)(*p_r * 0.5)) * 3.1415927);
if ( p_r[41] > 0.0 )
v5 = v5 + (float)((float)((float)(p_r[37] * 0.5) * (float)(p_r[37] * 0.5)) * 3.1415927);
p_r += 148;
--v8;
}
while ( v8 );
if ( v4 >= m_uParticleCount )
return (unsigned int)(int)roundf(v5 / 10.0);
goto LABEL_18;
}
if ( m_uParticleCount )
{
v9 = 0;
LABEL_18:
v10 = &this->m_pParticles->size + 37 * v9;
v11 = m_uParticleCount - v4;
do
{
if ( v10[4] > 0.0 )
v5 = v5 + (float)((float)((float)(*v10 * 0.5) * (float)(*v10 * 0.5)) * 3.1415927);
v10 += 37;
--v11;
}
while ( v11 );
}
return (unsigned int)(int)roundf(v5 / 10.0);
}