L L4D2node

L4D1SurvivorLegsBattleStations::FindBattleStation

0x0094e980 · 585 bytes · __thiscall

_ZN30L4D1SurvivorLegsBattleStations17FindBattleStationEP11SurvivorBotP13TerrorNavArea

Decompiled

undefined (3 params)

/* L4D1SurvivorLegsBattleStations::FindBattleStation(SurvivorBot*, TerrorNavArea*) */

TerrorNavArea * __thiscall
L4D1SurvivorLegsBattleStations::FindBattleStation
          (L4D1SurvivorLegsBattleStations *this,SurvivorBot *param_1,TerrorNavArea *param_2)

{
  L4D1SurvivorLegsBattleStations *pLVar1;
  float fVar2;
  CNavArea *pCVar3;
  Vector *pVVar4;
  int iVar5;
  longdouble lVar6;
  int local_30 [8];
  
  pCVar3 = (CNavArea *)(**(code **)(*(int *)param_1 + 0x52c))(param_1);
  if (pCVar3 != (CNavArea *)0x0) {
    pLVar1 = this + 0x4830;
    lVar6 = (longdouble)CountdownTimer::Now();
    if (*(float *)(this + 0x4838) <= (float)lVar6) {
      local_30[0] = 0;
      local_30[1] = 0;
      local_30[2] = 0;
      local_30[3] = 0;
      local_30[4] = 0;
                    /* try { // try from 0094e9ff to 0094ebc9 has its CatchHandler @ 0094ebd5 */
      pVVar4 = (Vector *)(**(code **)(*(int *)(param_1 + 0x4028) + 0xd4))(param_1 + 0x4028);
      SearchSurroundingAreas<FindL4D1BattlestationScan>
                (pCVar3,pVVar4,(FindL4D1BattlestationScan *)local_30,-1.0,0,-1);
      if (0 < local_30[3]) {
        iVar5 = RandomInt(0,local_30[3] + -1);
        param_2 = *(TerrorNavArea **)(local_30[0] + iVar5 * 4);
      }
      if (param_2 == (TerrorNavArea *)0x0) {
        lVar6 = (longdouble)RandomFloat(0x3f000000,0x40000000);
        fVar2 = (float)lVar6;
        lVar6 = (longdouble)CountdownTimer::Now();
        if ((float)lVar6 + fVar2 != *(float *)(this + 0x4838)) {
          (**(code **)(*(int *)(this + 0x4830) + 4))(pLVar1,this + 0x4838);
          *(float *)(this + 0x4838) = (float)lVar6 + fVar2;
        }
        if (fVar2 != *(float *)(this + 0x4834)) {
          (**(code **)(*(int *)(this + 0x4830) + 4))(pLVar1,this + 0x4834);
          *(float *)(this + 0x4834) = fVar2;
        }
      }
      else {
        lVar6 = (longdouble)RandomFloat(0x41200000,0x41700000);
        fVar2 = (float)lVar6;
        lVar6 = (longdouble)CountdownTimer::Now();
        if ((float)lVar6 + fVar2 != *(float *)(this + 0x4838)) {
          (**(code **)(*(int *)(this + 0x4830) + 4))(pLVar1,this + 0x4838);
          *(float *)(this + 0x4838) = (float)lVar6 + fVar2;
        }
        if (fVar2 != *(float *)(this + 0x4834)) {
          (**(code **)(*(int *)(this + 0x4830) + 4))(pLVar1,this + 0x4834);
          *(float *)(this + 0x4834) = fVar2;
        }
      }
      local_30[3] = 0;
      CUtlMemory<TerrorNavArea*,int>::Purge((CUtlMemory<TerrorNavArea*,int> *)local_30);
      local_30[4] = local_30[0];
      CUtlMemory<TerrorNavArea*,int>::Purge((CUtlMemory<TerrorNavArea*,int> *)local_30);
    }
  }
  return param_2;
}

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)