RandomVectorInUnitSphere
0x00bc4fc0 · 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 intoaddons/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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.