L L4D2node

CPoseController::RandomizeFMod

0x004960f0 · 568 bytes · __thiscall

_ZN15CPoseController13RandomizeFModEf

Decompiled

undefined (2 params)

/* CPoseController::RandomizeFMod(float) */

void __thiscall CPoseController::RandomizeFMod(CPoseController *this,float param_1)

{
  CBaseEdict *pCVar1;
  uint uVar2;
  int iVar3;
  longdouble lVar4;
  float fVar5;
  float fVar6;
  
  fVar6 = 0.0;
  if (0.0 <= param_1) {
    fVar6 = param_1;
  }
  if (1.0 <= fVar6) {
    fVar6 = 1.0;
  }
  uVar2 = RandomInt(1,5);
  if ((uVar2 < 6) && (uVar2 != *(uint *)(this + 0x470))) {
    if (this[0x6c] == (CPoseController)0x0) {
      pCVar1 = *(CBaseEdict **)(this + 0x30);
      if (pCVar1 != (CBaseEdict *)0x0) {
        *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
        iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
        *(undefined2 *)(iVar3 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CPoseController)((byte)this[0x70] | 1);
    }
    *(uint *)(this + 0x470) = uVar2;
  }
  lVar4 = (longdouble)RandomFloat(0xbf800000,0x3f800000,fVar6);
  fVar5 = (float)lVar4;
  if (fVar5 <= -1.0) {
    fVar5 = -1.0;
  }
  if (1.0 <= fVar5) {
    fVar5 = 1.0;
  }
  if (fVar5 != *(float *)(this + 0x474)) {
    if (this[0x6c] == (CPoseController)0x0) {
      pCVar1 = *(CBaseEdict **)(this + 0x30);
      if (pCVar1 != (CBaseEdict *)0x0) {
        *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
        iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
        *(undefined2 *)(iVar3 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CPoseController)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x474) = fVar5;
  }
  fVar5 = fVar6 * 10.0;
  lVar4 = (longdouble)RandomFloat(fVar6 * -10.0,fVar5,fVar5);
  fVar6 = (float)lVar4;
  if (fVar6 <= -10.0) {
    fVar6 = -10.0;
  }
  if (10.0 <= fVar6) {
    fVar6 = 10.0;
  }
  if (fVar6 != *(float *)(this + 0x478)) {
    if (this[0x6c] == (CPoseController)0x0) {
      pCVar1 = *(CBaseEdict **)(this + 0x30);
      if (pCVar1 != (CBaseEdict *)0x0) {
        *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
        iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
        *(undefined2 *)(iVar3 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CPoseController)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x478) = fVar6;
  }
  lVar4 = (longdouble)RandomFloat(0,fVar5);
  fVar6 = (float)lVar4;
  if (fVar6 <= 0.0) {
    fVar6 = 0.0;
  }
  if (10.0 <= fVar6) {
    fVar6 = 10.0;
  }
  if (fVar6 == *(float *)(this + 0x47c)) {
    return;
  }
  if (this[0x6c] == (CPoseController)0x0) {
    pCVar1 = *(CBaseEdict **)(this + 0x30);
    if (pCVar1 != (CBaseEdict *)0x0) {
      *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
      iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
      *(undefined2 *)(iVar3 + 2) = 0;
    }
    *(float *)(this + 0x47c) = fVar6;
  }
  else {
    this[0x70] = (CPoseController)((byte)this[0x70] | 1);
    *(float *)(this + 0x47c) = fVar6;
  }
  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)