L L4D2node

LightDesc_t::SetupNewStyleAttenuation

0x00271880 · 309 bytes · __thiscall

_ZN11LightDesc_t24SetupNewStyleAttenuationEff

Decompiled

undefined (3 params)

/* LightDesc_t::SetupNewStyleAttenuation(float, float) */

void __thiscall LightDesc_t::SetupNewStyleAttenuation(LightDesc_t *this,float param_1,float param_2)

{
  char cVar1;
  float fVar2;
  float local_18;
  float local_14;
  float local_10 [2];
  
  if (param_2 < param_1) {
    Warning("light has _fifty_percent_distance of %f but no zero_percent_distance\n",(double)param_1
           );
    param_2 = param_1 + param_1;
  }
  local_18 = 0.0;
  local_14 = 1.0;
  local_10[0] = 0.0;
  cVar1 = SolveInverseQuadraticMonotonic
                    (0.0,1.0,param_1,2.0,param_2,256.0,&local_18,&local_14,local_10);
  if (cVar1 == '\0') {
    Warning("can\'t solve quadratic for light %f %f\n",(double)param_1,(double)param_2);
  }
  fVar2 = 2.0 / ((param_1 * local_18 + local_14) * param_1 + local_10[0]);
  *(float *)(this + 0x38) = local_18 * fVar2;
  *(float *)(this + 0x34) = local_14 * fVar2;
  *(float *)(this + 0x30) = fVar2 * local_10[0];
  return;
}

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)