L L4D2node

ComputeLightRadius

0x00116130 · 216 bytes · __cdecl

_Z18ComputeLightRadiusP13dworldlight_tb

Decompiled

undefined (2 params)

/* ComputeLightRadius(dworldlight_t*, bool) */

longdouble ComputeLightRadius(dworldlight_t *param_1,bool param_2)

{
  float fVar1;
  float fVar2;
  float fVar3;
  
  fVar2 = *(float *)(param_1 + 0x48);
  if (fVar2 == 0.0) {
    fVar2 = *(float *)(param_1 + 0x54);
    fVar3 = SQRT(*(float *)(param_1 + 0x10) * *(float *)(param_1 + 0x10) +
                 *(float *)(param_1 + 0xc) * *(float *)(param_1 + 0xc) +
                 *(float *)(param_1 + 0x14) * *(float *)(param_1 + 0x14));
    if (fVar2 == 0.0) {
      fVar2 = 2000.0;
      if (*(float *)(param_1 + 0x50) != 0.0) {
        return (longdouble)
               ((fVar3 * 33.333336 - *(float *)(param_1 + 0x4c)) / *(float *)(param_1 + 0x50));
      }
    }
    else {
      fVar1 = *(float *)(param_1 + 0x50);
      fVar3 = fVar1 * fVar1 - fVar2 * 4.0 * (*(float *)(param_1 + 0x4c) - fVar3 * 33.333336);
      if (fVar3 < 0.0) {
        fVar2 = 2000.0;
      }
      else {
        fVar2 = (SQRT(fVar3) - fVar1) / (fVar2 + fVar2);
        if (fVar2 <= 0.0) {
          fVar2 = 0.0;
        }
      }
    }
  }
  return (longdouble)fVar2;
}

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)