//
// ParticleGameObject::applyParticleSettings from 0x1001b1d60 to 0x1001b2035 (725 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::spawnParticleTrigger @ 0x100128fce
// > ParticleGameObject::claimParticle @ 0x1001b1d47
//
// 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 ParticleGameObject::applyParticleSettings(ParticleGameObject *a1, cocos2d::CCParticleSystemQuad *a2)
{
__int64 v2; // xmm0_8
__m128 v3; // xmm1
__m128 v4; // xmm2
int v6; // eax
__int64 v7; // rax
float v8; // xmm0_4
__int64 v9; // rax
cocos2d::CCSprite *v10; // rdi
__m128 *v11; // rax
__int64 v12; // rax
cocos2d::CCSprite *m_colorSprite; // rdi
unsigned __int16 *v14; // rax
int v15; // r15d
__m128 v16; // xmm1
bool m_shouldBlendDetail; // al
int v18; // ecx
unsigned int v19; // eax
__m128 v20; // xmm2
signed __int32 v21; // [rsp+10h] [rbp-50h]
__m128 v22; // [rsp+30h] [rbp-30h] BYREF
unsigned __int16 v23; // [rsp+44h] [rbp-1Ch] BYREF
unsigned __int8 v24; // [rsp+46h] [rbp-1Ah]
v6 = ((__int64 (__fastcall *)(cocos2d::CCParticleSystemQuad *))a2->getPositionType)(a2);
a1->m_isParticleSpriteLocked = v6 != 2;
a1->m_particleLocked = v6 != 2;
if ( v6 == 2 )
{
((void (__fastcall *)(ParticleGameObject *))a1->getScaleX)(a1);
((void (__fastcall *)(cocos2d::CCParticleSystemQuad *))a2->setScaleX)(a2);
((void (__fastcall *)(ParticleGameObject *))a1->getScaleY)(a1);
v7 = 144;
}
else
{
v2 = 1065353216;
v7 = 160;
}
(*(void (__fastcall **)(cocos2d::CCParticleSystemQuad *, double))((char *)&a2->copyWithZone + v7))(a2, *(double *)&v2);
if ( a1->m_particleLocked )
{
((void (__fastcall *)(cocos2d::CCParticleSystemQuad *, double))a2->setRotation)(a2, 0.0);
v8 = ((float (__fastcall *)(ParticleGameObject *))a1->getRotation)(a1);
ParticleGameObject::updateParticleAngle(a1, v8, a2);
if ( !a1->m_particleUseObjectColor )
goto LABEL_6;
LABEL_10:
v12 = ((__int64 (__fastcall *)(ParticleGameObject *))a1->getColor)(a1);
v24 = *(_BYTE *)(v12 + 2);
v23 = *(_WORD *)v12;
m_colorSprite = a1->m_colorSprite;
if ( m_colorSprite )
v14 = (unsigned __int16 *)((__int64 (__fastcall *)(cocos2d::CCSprite *))m_colorSprite->getColor)(m_colorSprite);
else
v14 = &v23;
v15 = *((unsigned __int8 *)v14 + 2);
v21 = *v14;
v3.f32[0] = (float)v24 / 255.0;
v22 = _mm_movelh_ps(
_mm_div_ps(_mm_cvtepi32_ps(_mm_cvtepu8_epi32(_mm_cvtsi32_si128(v23))), (__m128)xmmword_100815DB0),
_mm_insert_ps(
v3,
(__m128)*(unsigned int *)(((__int64 (__fastcall *)(cocos2d::CCParticleSystemQuad *))a2->getStartColor)(a2)
+ 12),
16));
((void (__fastcall *)(cocos2d::CCParticleSystemQuad *, __m128 *))a2->setStartColor)(a2, &v22);
v16 = 0;
v16.f32[0] = (float)v15 / 255.0;
v22 = _mm_movelh_ps(
_mm_div_ps(_mm_cvtepi32_ps(_mm_cvtepu8_epi32(v21)), (__m128)xmmword_100815DB0),
_mm_insert_ps(
v16,
(__m128)*(unsigned int *)(((__int64 (__fastcall *)(cocos2d::CCParticleSystemQuad *))a2->getEndColor)(a2)
+ 12),
16));
((void (__fastcall *)(cocos2d::CCParticleSystemQuad *, __m128 *))a2->setEndColor)(a2, &v22);
m_shouldBlendDetail = 1;
if ( a1->m_shouldBlendBase )
goto LABEL_15;
goto LABEL_14;
}
((void (__fastcall *)(ParticleGameObject *))a1->getRotation)(a1);
((void (__fastcall *)(cocos2d::CCParticleSystemQuad *))a2->setRotation)(a2);
if ( a1->m_particleUseObjectColor )
goto LABEL_10;
LABEL_6:
if ( !a1->m_hasUniformObjectColor )
return;
v9 = ((__int64 (__fastcall *)(ParticleGameObject *))a1->getColor)(a1);
v22.i8[2] = *(_BYTE *)(v9 + 2);
v22.i16[0] = *(_WORD *)v9;
v10 = a1->m_colorSprite;
if ( v10 )
v11 = (__m128 *)((__int64 (__fastcall *)(cocos2d::CCSprite *))v10->getColor)(v10);
else
v11 = &v22;
v18 = v11->u8[2];
v4.f32[0] = (float)v22.u8[2] / 255.0;
v19 = v11->u16[0];
a2->m_tUniformColor = (cocos2d::ccColor4F)_mm_movelh_ps(
_mm_div_ps(
_mm_cvtepi32_ps(_mm_cvtepu8_epi32(_mm_cvtsi32_si128(v22.u16[0]))),
(__m128)xmmword_100815DB0),
_mm_blend_ps(v4, (__m128)xmmword_1008150D0, 14));
v20 = 0;
v20.f32[0] = (float)v18 / 255.0;
a2->m_tUniformDeltaColor = (cocos2d::ccColor4F)_mm_movelh_ps(
_mm_div_ps(
_mm_cvtepi32_ps(_mm_cvtepu8_epi32(_mm_cvtsi32_si128(v19))),
(__m128)xmmword_100815DB0),
_mm_blend_ps(v20, (__m128)xmmword_1008150D0, 14));
m_shouldBlendDetail = 1;
if ( !a1->m_shouldBlendBase )
LABEL_14:
m_shouldBlendDetail = a1->m_shouldBlendDetail;
LABEL_15:
((void (__fastcall *)(cocos2d::CCParticleSystemQuad *, bool))a2->setBlendAdditive)(a2, m_shouldBlendDetail);
}