L L4D2node

FindGhostSpawnPosition

0x009ab670 · 305 bytes · __cdecl

_Z22FindGhostSpawnPositionP13CTerrorPlayerS0_f

Decompiled

undefined (3 params)

/* FindGhostSpawnPosition(CTerrorPlayer*, CTerrorPlayer*, float) */

CTerrorPlayer * FindGhostSpawnPosition(CTerrorPlayer *param_1,CTerrorPlayer *param_2,float param_3)

{
  char cVar1;
  TerrorNavArea *this;
  TerrorNavArea *pTVar2;
  undefined4 uVar3;
  int iVar4;
  TerrorNavArea *pTVar5;
  float in_stack_00000010;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  cVar1 = CTerrorGameRules::IsVersusMode();
  if ((cVar1 == '\0') &&
     (this = (TerrorNavArea *)(**(code **)(*(int *)param_2 + 0x52c))(param_2),
     this != (TerrorNavArea *)0x0)) {
    iVar4 = CNavArea::m_masterMarker + 1;
    CNavArea::m_masterMarker = 1;
    if (iVar4 != 0) {
      CNavArea::m_masterMarker = iVar4;
    }
    pTVar5 = (TerrorNavArea *)0x0;
    pTVar2 = this;
    if (*(float *)(this + 0x154) <= in_stack_00000010 &&
        in_stack_00000010 != *(float *)(this + 0x154)) {
      do {
        pTVar2 = this;
        if (*(int *)(this + 0x3c) == CNavArea::m_masterMarker) break;
        *(int *)(this + 0x3c) = CNavArea::m_masterMarker;
        pTVar2 = (TerrorNavArea *)TerrorNavArea::GetNextEscapeStep(this,(NavTraverseType *)0x0);
        if (pTVar2 == (TerrorNavArea *)0x0) goto LAB_009ab688;
        pTVar5 = this;
        this = pTVar2;
      } while (*(float *)(pTVar2 + 0x154) <= in_stack_00000010 &&
               in_stack_00000010 != *(float *)(pTVar2 + 0x154));
    }
    if (pTVar5 != pTVar2) {
      local_28 = *(undefined4 *)(pTVar2 + 0x2c);
      local_24 = *(undefined4 *)(pTVar2 + 0x30);
      local_20 = *(undefined4 *)(pTVar2 + 0x34);
      uVar3 = (**(code **)(*(int *)param_3 + 0x544))(param_3);
      cVar1 = ZombieManager::CanZombieSpawnHere(TheZombieManager,&local_28,pTVar2,uVar3,0,param_3);
      if (cVar1 != '\0') {
        *(undefined4 *)param_1 = local_28;
        *(undefined4 *)(param_1 + 4) = local_24;
        *(undefined4 *)(param_1 + 8) = local_20;
        return param_1;
      }
    }
  }
LAB_009ab688:
  if (((byte)param_2[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_2);
  }
  *(undefined4 *)param_1 = *(undefined4 *)(param_2 + 0x2e0);
  *(undefined4 *)(param_1 + 4) = *(undefined4 *)(param_2 + 0x2e4);
  *(undefined4 *)(param_1 + 8) = *(undefined4 *)(param_2 + 0x2e8);
  return param_1;
}

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)