@@ -239,3 +239,93 @@ void CFxSA::TriggerFootSplash(CVector& vecPosition)
239239 call dwFunc
240240 }
241241}
242+
243+ void CFxSA::AddParticle (eFxParticleSystems eFxParticle, const CVector& vecPosition, const CVector& vecDirection, float fR , float fG , float fB , float fA , bool bRandomizeColors, std::uint32_t iCount, float fBrightness , float fSize , bool bRandomizeSizes, float fLife )
244+ {
245+ // Init our own FxPrtMult struct
246+ FxPrtMult_c fxPrt{{fR ,fG ,fB ,fA }, fSize , 0 , fLife };
247+ CVector newDirection;
248+
249+ FxSystem_c* fxParticleSystem;
250+
251+ switch (eFxParticle)
252+ {
253+ case eFxParticleSystems::PRT_BLOOD:
254+ fxParticleSystem = m_pInterface->m_fxSysBlood ;
255+ break ;
256+ case eFxParticleSystems::PRT_BOATSPLASH:
257+ fxParticleSystem = m_pInterface->m_fxSysBoatSplash ;
258+ break ;
259+ case eFxParticleSystems::PRT_BUBBLE:
260+ fxParticleSystem = m_pInterface->m_fxSysBubble ;
261+ break ;
262+ case eFxParticleSystems::PRT_DEBRIS:
263+ fxParticleSystem = m_pInterface->m_fxSysDebris ;
264+ break ;
265+ case eFxParticleSystems::PRT_GUNSHELL:
266+ fxParticleSystem = m_pInterface->m_fxSysGunshell ;
267+ break ;
268+ case eFxParticleSystems::PRT_SAND:
269+ fxParticleSystem = m_pInterface->m_fxSysSand ;
270+ break ;
271+ case eFxParticleSystems::PRT_SAND2:
272+ fxParticleSystem = m_pInterface->m_fxSysSand2 ;
273+ break ;
274+ case eFxParticleSystems::PRT_SMOKE:
275+ fxParticleSystem = m_pInterface->m_fxSysSmoke ;
276+ break ;
277+ case eFxParticleSystems::PRT_SMOKEHUGE:
278+ fxParticleSystem = m_pInterface->m_fxSysSmokeHuge ;
279+ break ;
280+ case eFxParticleSystems::PRT_SMOKE2:
281+ fxParticleSystem = m_pInterface->m_fxSysSmoke2 ;
282+ break ;
283+ case eFxParticleSystems::PRT_SPARK:
284+ fxParticleSystem = m_pInterface->m_fxSysSpark ;
285+ break ;
286+ case eFxParticleSystems::PRT_SPARK2:
287+ fxParticleSystem = m_pInterface->m_fxSysSpark2 ;
288+ break ;
289+ case eFxParticleSystems::PRT_SPLASH:
290+ fxParticleSystem = m_pInterface->m_fxSysSplash ;
291+ break ;
292+ case eFxParticleSystems::PRT_WAKE:
293+ fxParticleSystem = m_pInterface->m_fxSysWake ;
294+ break ;
295+ case eFxParticleSystems::PRT_WATERSPLASH:
296+ fxParticleSystem = m_pInterface->m_fxSysWaterSplash ;
297+ break ;
298+ case eFxParticleSystems::PRT_WHEELDIRT:
299+ fxParticleSystem = m_pInterface->m_fxSysWheelDirt ;
300+ break ;
301+ case eFxParticleSystems::PRT_GLASS:
302+ fxParticleSystem = m_pInterface->m_fxSysGlass ;
303+ break ;
304+ default :
305+ fxParticleSystem = m_pInterface->m_fxSysBlood ;
306+ }
307+
308+ for (size_t i = 0 ; i < iCount; i++)
309+ {
310+ if (bRandomizeColors)
311+ {
312+ // 0x49EECB
313+ fxPrt.m_color .red = (rand () % 10000 ) * 0 .0001f * fR + 0 .13f ;
314+ fxPrt.m_color .green = (rand () % 10000 ) * 0 .0001f * fG + 0 .12f ;
315+ fxPrt.m_color .blue = (rand () % 10000 ) * 0 .0001f * fB + 0 .04f ;
316+ }
317+
318+ if (bRandomizeSizes)
319+ // 0x49EF21 - Calculate random size for each particle
320+ fxPrt.m_fSize = (rand () % 10000 ) * 0 .0001f * fSize + 0 .3f ;
321+
322+ // 0x49EF4C - Calculate random direction for each particle
323+ newDirection = CVector (vecDirection.fX * 4 , vecDirection.fY * 4 , vecDirection.fZ * 4 );
324+ newDirection.fX = (rand () % 10000 ) * 0 .0001f * 4 - 2 + newDirection.fX ;
325+ newDirection.fY = (rand () % 10000 ) * 0 .0001f * 4 - 2 + newDirection.fY ;
326+ newDirection.fZ = (rand () % 10000 ) * 0 .0001f * 4 - 2 + newDirection.fZ ;
327+
328+ // Call FxSystem_c::AddParticle
329+ ((int (__thiscall*)(FxSystem_c*, const CVector*, const CVector*, float , FxPrtMult_c*, float , float , float , int ))FUNC_FXSystem_c_AddParticle)(fxParticleSystem, &vecPosition, &newDirection, 0 , &fxPrt, -1 .0f , fBrightness , 0 , 0 );
330+ }
331+ }
0 commit comments