L L4D2node

CFishPool::Spawn

0x006a6ba0 · 533 bytes · __thiscall

_ZN9CFishPool5SpawnEv

Decompiled

undefined (1 param)

/* CFishPool::Spawn() */

void __thiscall CFishPool::Spawn(CFishPool *this)

{
  int iVar1;
  undefined4 uVar2;
  CFish *this_00;
  undefined4 *puVar3;
  uint uVar4;
  longdouble lVar5;
  float fVar6;
  float fVar7;
  undefined1 local_34 [12];
  undefined4 local_28;
  float local_24;
  undefined4 local_20;
  
  CBaseEntity::ThinkSet((_func_void *)local_34,(float)this,(char *)Update);
  CBaseEntity::SetNextThink((CBaseEntity *)this,*(float *)(gpGlobals + 0xc),(char *)0x0);
  if (((byte)this[0x14d] & 8) == 0) {
    fVar6 = *(float *)(this + 0x2e8);
    fVar7 = fVar6 + 1000.0;
  }
  else {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    fVar6 = *(float *)(this + 0x2e8);
    fVar7 = fVar6 + 1000.0;
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      fVar6 = *(float *)(this + 0x2e8);
      if (((byte)this[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      }
    }
  }
  uVar4 = 0;
  lVar5 = (longdouble)UTIL_WaterLevel((Vector *)(this + 0x2e0),fVar6,fVar7);
  *(float *)(this + 0x458) = (float)lVar5;
  if (0 < *(int *)(this + 0x44c)) {
    do {
      lVar5 = (longdouble)RandomFloat(0,0x43b40000);
      local_28 = 0;
      local_24 = (float)lVar5;
      local_20 = 0;
      if (((byte)this[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      }
      this_00 = (CFish *)CBaseEntity::Create("fish",(Vector *)(this + 0x2e0),(QAngle *)&local_28,
                                             (CBaseEntity *)this);
      CFish::Initialize(this_00,this,uVar4);
      if (this_00 != (CFish *)0x0) {
        puVar3 = (undefined4 *)(**(code **)(*(int *)this_00 + 0xc))(this_00);
        iVar1 = *(int *)(this + 0x46c);
        uVar2 = *puVar3;
        CUtlVector<CHandle<CFish>,CUtlMemory<CHandle<CFish>,int>>::GrowVector
                  ((CUtlVector<CHandle<CFish>,CUtlMemory<CHandle<CFish>,int>> *)(this + 0x460),1);
        CUtlVector<CHandle<CFish>,CUtlMemory<CHandle<CFish>,int>>::ShiftElementsRight
                  ((CUtlVector<CHandle<CFish>,CUtlMemory<CHandle<CFish>,int>> *)(this + 0x460),iVar1
                   ,1);
        puVar3 = (undefined4 *)(*(int *)(this + 0x460) + iVar1 * 4);
        if (puVar3 != (undefined4 *)0x0) {
          *puVar3 = uVar2;
        }
      }
      uVar4 = uVar4 + 1;
    } while ((int)uVar4 < *(int *)(this + 0x44c));
  }
  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)