L L4D2node

CParticleCollection::RandomVectorInUnitSphere

0x00bcc820 · 305 bytes · __thiscall

_ZN19CParticleCollection24RandomVectorInUnitSphereEiP6Vector

Decompiled

undefined (3 params)

/* CParticleCollection::RandomVectorInUnitSphere(int, Vector*) */

longdouble __thiscall
CParticleCollection::RandomVectorInUnitSphere(CParticleCollection *this,int param_1,Vector *param_2)

{
  int iVar1;
  longdouble lVar2;
  longdouble lVar3;
  longdouble lVar4;
  longdouble lVar5;
  float fVar6;
  
  iVar1 = *(int *)(this + 0x348);
  fVar6 = *(float *)(s_pRandomFloats + (iVar1 + 2 + param_1 & 0xfffU) * 4);
  lVar3 = (longdouble)
          __acosf_finite(1.0 - (*(float *)(s_pRandomFloats + (iVar1 + param_1 & 0xfffU) * 4) +
                               *(float *)(s_pRandomFloats + (iVar1 + param_1 & 0xfffU) * 4)));
  fVar6 = cbrtf(fVar6 * 0.99999 + 1e-05);
  lVar2 = (longdouble)fcos((longdouble)(float)lVar3);
  lVar4 = (longdouble)fsin((longdouble)(float)lVar3);
  lVar3 = (longdouble)
          fcos((longdouble)
               (*(float *)(s_pRandomFloats + (iVar1 + 1 + param_1 & 0xfffU) * 4) * 6.2831855));
  lVar5 = (longdouble)
          fsin((longdouble)
               (*(float *)(s_pRandomFloats + (iVar1 + 1 + param_1 & 0xfffU) * 4) * 6.2831855));
  *(float *)param_2 = (float)lVar3 * (float)lVar4 * fVar6;
  *(float *)(param_2 + 4) = (float)lVar5 * (float)lVar4 * fVar6;
  *(float *)(param_2 + 8) = (float)lVar2 * fVar6;
  return (longdouble)fVar6;
}

SourceMod gamedata

paste into addons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)

Just a Signatures{} block, ready to drop into a gamedata file. Wire it up in your plugin however you like - SDKCall, DHooks, raw memory ops, or anything else.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)