L L4D2node

CMD_SolveItemDensity

0x008a35e0 · 240 bytes · __cdecl

_Z20CMD_SolveItemDensityRK8CCommand

Decompiled

undefined (1 param)

/* CMD_SolveItemDensity(CCommand const&) */

void CMD_SolveItemDensity(CCommand *param_1)

{
  int iVar1;
  int *piVar2;
  longdouble lVar3;
  double dVar4;
  float fVar5;
  
  if (1 < *(int *)param_1) {
    lVar3 = (longdouble)V_atof(*(char **)(param_1 + 0x40c));
    dVar4 = 0.0;
    fVar5 = 0.0;
    if (0 < DAT_00fe6000) {
      fVar5 = 0.0;
      piVar2 = TheNavAreas;
      do {
        iVar1 = *piVar2;
        if ((0.0 < *(float *)(iVar1 + 0x154) || *(float *)(iVar1 + 0x154) == 0.0) &&
           ((*(byte *)(iVar1 + 300) & 0x40) == 0)) {
          fVar5 = fVar5 + (*(float *)(iVar1 + 0x14) - *(float *)(iVar1 + 8)) *
                          (*(float *)(iVar1 + 0x10) - *(float *)(iVar1 + 4));
        }
        piVar2 = piVar2 + 1;
      } while (piVar2 != TheNavAreas + DAT_00fe6000);
      fVar5 = fVar5 * 7.716049e-08;
      dVar4 = (double)fVar5;
    }
    Msg("Map covers %6.4f square 100 yards\n",dVar4,fVar5);
    Msg("Set your map density for this item to %4.3f\n",(double)(((float)lVar3 / fVar5) * 1.1));
    return;
  }
  Msg();
  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)