L L4D2node

RandomVectorInUnitSphere

0x000aa3d0 · 270 bytes · __cdecl

_Z24RandomVectorInUnitSphereP6Vector

Decompiled

undefined (1 param)

/* RandomVectorInUnitSphere(Vector*) */

longdouble RandomVectorInUnitSphere(Vector *param_1)

{
  longdouble lVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  longdouble lVar5;
  longdouble lVar6;
  longdouble lVar7;
  float fVar8;
  
  iVar2 = rand();
  iVar3 = rand();
  iVar4 = rand();
  lVar5 = (longdouble)__acosf_finite(1.0 - (float)iVar2 * 6.103702e-05);
  fVar8 = cbrtf((float)iVar4 * 3.051851e-05);
  lVar1 = (longdouble)fcos((longdouble)(float)lVar5);
  lVar6 = (longdouble)fsin((longdouble)(float)lVar5);
  lVar7 = (longdouble)((float)iVar3 * 3.051851e-05 * 6.2831855);
  lVar5 = (longdouble)fcos(lVar7);
  lVar7 = (longdouble)fsin(lVar7);
  *(float *)param_1 = (float)lVar5 * (float)lVar6 * fVar8;
  *(float *)(param_1 + 4) = (float)lVar7 * (float)lVar6 * fVar8;
  *(float *)(param_1 + 8) = (float)lVar1 * fVar8;
  return (longdouble)fVar8;
}

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)