//
// cocos2d::CCParticleSystemQuad::setTotalParticles from 0x18006ad50 to 0x18006aee7 (407 bytes)
//
// 14 xrefs:
// > ??> @ 0x1800facc8
// > ??> @ 0x1800fb338
// > ??> @ 0x1800fb9a8
// > ??> @ 0x1800fc018
// > ??> @ 0x1800fc688
// > ??> @ 0x1800fccf8
// > ??> @ 0x1800fd368
// > ??> @ 0x1800fd9d8
// > ??> @ 0x1800fe048
// > ??> @ 0x1800fe6b8
// > ??> @ 0x1800fed28
// > ??> @ 0x180100010
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b3d80
//
// 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 cocos2d::CCParticleSystemQuad::setTotalParticles(cocos2d::CCParticleSystemQuad *this, unsigned int a2)
{
__int64 v3; // rdi
cocos2d::tCCParticle *v4; // rbp
cocos2d::ccV3F_C4B_T2F_Quad *v5; // rsi
GLushort *v6; // rax
bool v7; // zf
unsigned int v8; // edx
v3 = a2;
if ( a2 <= this->m_uAllocatedParticles )
{
this->m_uTotalParticles = a2;
LABEL_16:
cocos2d::CCParticleSystem::resetSystem(this);
return;
}
v4 = (cocos2d::tCCParticle *)realloc(this->m_pParticles, 148LL * a2);
v5 = (cocos2d::ccV3F_C4B_T2F_Quad *)realloc(this->m_pQuads, 96 * v3);
v6 = (GLushort *)realloc(this->m_pIndices, 12 * v3);
if ( v4 )
{
if ( v5 && v6 )
{
this->m_pParticles = v4;
this->m_pQuads = v5;
this->m_pIndices = v6;
memset(v4, 0, 148 * v3);
memset(this->m_pQuads, 0, 96 * v3);
memset(this->m_pIndices, 0, 12 * v3);
v7 = this->m_pBatchNode == nullptr;
this->m_uAllocatedParticles = v3;
this->m_uTotalParticles = v3;
if ( !v7 )
{
v8 = 0;
if ( (_DWORD)v3 )
{
do
{
*((_DWORD *)&this->m_pParticles->cocos2d::CCParticleSystem::modeA.dir.x + 37 * v8) = v8;
++v8;
}
while ( v8 < this->m_uTotalParticles );
}
}
cocos2d::CCParticleSystemQuad::initIndices(this);
cocos2d::CCParticleSystemQuad::setupVBO(this);
if ( this->m_pTexture )
cocos2d::CCParticleSystemQuad::initTexCoordsWithRect(this, &this->m_tTextureRect);
goto LABEL_16;
}
this->m_pParticles = v4;
}
if ( v5 )
this->m_pQuads = v5;
if ( v6 )
this->m_pIndices = v6;
}