L L4D2node

CVersusRandom::PickNewRandom

0x006ebdc0 · 167 bytes · __thiscall

_ZN13CVersusRandom13PickNewRandomEbR11inputdata_t

Decompiled

undefined (3 params)

/* CVersusRandom::PickNewRandom(bool, inputdata_t&) */

void __thiscall CVersusRandom::PickNewRandom(CVersusRandom *this,bool param_1,inputdata_t *param_2)

{
  undefined1 *puVar1;
  int iVar2;
  int local_10;
  
  if (*(int *)(this + 0x600) == 0) {
    puVar1 = &DAT_00d539c2;
    if (*(undefined1 **)(this + 0x154) != (undefined1 *)0x0) {
      puVar1 = *(undefined1 **)(this + 0x154);
    }
    DevWarning("logic_versus_random entity %s being asked to pick random number but has no outputs!\n"
               ,puVar1);
  }
  else {
    iVar2 = RandomInt(0,*(int *)(this + 0x600) + -1);
    local_10 = *(int *)(this + iVar2 * 4 + 0x5c0);
    COutputEvent::FireOutput
              ((COutputEvent *)(this + local_10 * 0x18 + 0x440),*(CBaseEntity **)param_2,
               (CBaseEntity *)this,0.0);
    if (param_1) {
      CUtlVector<int,CUtlMemory<int,int>>::InsertBefore
                ((CUtlVector<int,CUtlMemory<int,int>> *)(this + 0x604),*(int *)(this + 0x610),
                 &local_10);
    }
  }
  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)