//
// GJBaseGameLayer::spawnParticleTrigger from 0x59c5d0 to 0x59c81e (590 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::spawnParticleTrigger @ 0x59c972
// > GJBaseGameLayer::destroyObject @ 0x5a49f4
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:53:13 +0000
//
unsigned int __fastcall GJBaseGameLayer::spawnParticleTrigger(GJBaseGameLayer *a1, int a2, int a3, float a4, float a5)
{
float v8; // s16
cocos2d::CCObject *Group; // r8
int MainObject; // r0
int v11; // r3
int v12; // r0
unsigned int v13; // r7
unsigned int result; // r0
int v15; // r0
GameObject *v16; // r4
int (__fastcall *v17)(GJBaseGameLayer *, int *, char *, int, int, _DWORD, int); // r9
int ObjectZLayer; // r10
int ObjectZOrder; // r0
cocos2d::CCParticleSystemQuad *v20; // r9
const cocos2d::CCPoint *v21; // r0
void (__fastcall *v22)(cocos2d::CCParticleSystemQuad *, _DWORD); // r10
float v23; // r0
void (__fastcall *v24)(cocos2d::CCParticleSystemQuad *, _DWORD); // r10
float v25; // r0
void (__fastcall *v26)(cocos2d::CCParticleSystemQuad *, _DWORD); // r10
float v27; // r0
int v28; // [sp+10h] [bp-4Ch]
_BYTE v30[8]; // [sp+20h] [bp-3Ch] BYREF
float v31[2]; // [sp+28h] [bp-34h] BYREF
_BYTE v32[8]; // [sp+30h] [bp-2Ch] BYREF
_BYTE v33[8]; // [sp+38h] [bp-24h] BYREF
float v34[2]; // [sp+40h] [bp-1Ch] BYREF
int v35[3]; // [sp+48h] [bp-14h] BYREF
v8 = a5;
if ( a5 == 0.0 )
v8 = 1.0;
Group = GJBaseGameLayer::getGroup(a1, a2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v30);
MainObject = GJBaseGameLayer::tryGetMainObject((cocos2d::CCDictionary **)a1, a2);
v11 = MainObject;
if ( MainObject )
{
v12 = (*(int (__fastcall **)(int))(*(_DWORD *)MainObject + 96))(MainObject);
cocos2d::CCPoint::operator=(v30, v12);
v11 = 1;
}
v13 = 0;
v28 = v11;
while ( 1 )
{
result = cocos2d::CCArray::count(Group);
if ( v13 >= result )
break;
v15 = cocos2d::CCArray::objectAtIndex(Group, v13);
v16 = (GameObject *)v15;
if ( *(_DWORD *)(v15 + 892) == 2065 )
{
ParticleGameObject::updateParticleStruct(v15);
v17 = *(int (__fastcall **)(GJBaseGameLayer *, int *, char *, int, int, _DWORD, int))(*(_DWORD *)a1 + 752);
std::string::basic_string(v35, (int)v16 + 1268);
ObjectZLayer = GameObject::getObjectZLayer(v16);
ObjectZOrder = GameObject::getObjectZOrder(v16);
v20 = (cocos2d::CCParticleSystemQuad *)v17(a1, v35, (char *)v16 + 1284, ObjectZLayer, ObjectZOrder, 0, 1);
std::string::~string((int)v35);
if ( v20 )
{
if ( v28 )
{
v21 = (const cocos2d::CCPoint *)(*(int (__fastcall **)(GameObject *))(*(_DWORD *)v16 + 96))(v16);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v31, v21);
if ( a4 != 0.0 )
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v34, (const cocos2d::CCPoint *)v30);
rotateCCPoint(v31, -a4, v34);
}
cocos2d::CCPoint::operator-(v32, v31, v30);
cocos2d::CCPoint::operator*(v33, v32, LODWORD(v8));
cocos2d::CCPoint::operator+(v34, a3, v33);
cocos2d::CCPoint::operator=(v31, v34);
(*(void (__fastcall **)(cocos2d::CCParticleSystemQuad *, float *))(*(_DWORD *)v20 + 92))(v20, v31);
}
else
{
(*(void (__fastcall **)(cocos2d::CCParticleSystemQuad *, int))(*(_DWORD *)v20 + 92))(v20, a3);
}
if ( *((_BYTE *)v16 + 677) || *((_BYTE *)v16 + 1560) )
(*(void (__fastcall **)(GJBaseGameLayer *, GameObject *))(*(_DWORD *)a1 + 744))(a1, v16);
ParticleGameObject::applyParticleSettings(v16, v20);
if ( (*(float (__fastcall **)(cocos2d::CCParticleSystemQuad *))(*(_DWORD *)v20 + 460))(v20) < 0.0 )
(*(void (__fastcall **)(cocos2d::CCParticleSystemQuad *, _DWORD))(*(_DWORD *)v20 + 464))(v20, 0);
v22 = *(void (__fastcall **)(cocos2d::CCParticleSystemQuad *, _DWORD))(*(_DWORD *)v20 + 180);
v23 = COERCE_FLOAT((*(int (__fastcall **)(GameObject *))(*(_DWORD *)v16 + 184))(v16));
v22(v20, v23 + a4);
v24 = *(void (__fastcall **)(cocos2d::CCParticleSystemQuad *, _DWORD))(*(_DWORD *)v20 + 64);
v25 = COERCE_FLOAT((*(int (__fastcall **)(GameObject *))(*(_DWORD *)v16 + 68))(v16));
v24(v20, v25 * v8);
v26 = *(void (__fastcall **)(cocos2d::CCParticleSystemQuad *, _DWORD))(*(_DWORD *)v20 + 72);
v27 = COERCE_FLOAT((*(int (__fastcall **)(GameObject *))(*(_DWORD *)v16 + 76))(v16));
v26(v20, v27 * v8);
(*(void (__fastcall **)(GameObject *, int))(*(_DWORD *)v16 + 172))(v16, 1);
cocos2d::CCParticleSystem::resumeSystem(v20);
}
}
++v13;
}
return result;
}