L L4D2node

CDirectorTacticalServices::GetSurvivorAbleToReachEntityFirst<SurvivorHasItemFilter>

0x009476f0 · 551 bytes · __thiscall

_ZNK25CDirectorTacticalServices33GetSurvivorAbleToReachEntityFirstI21SurvivorHasItemFilterEEP13CTerrorPlayerP11CBaseEntityRKT_Pf

Decompiled

CTerrorPlayer * (4 params)

/* CTerrorPlayer*
   CDirectorTacticalServices::GetSurvivorAbleToReachEntityFirst<SurvivorHasItemFilter>(CBaseEntity*,
   SurvivorHasItemFilter const&, float*) const */

CTerrorPlayer * __thiscall
CDirectorTacticalServices::GetSurvivorAbleToReachEntityFirst<SurvivorHasItemFilter>
          (CDirectorTacticalServices *this,CBaseEntity *param_1,SurvivorHasItemFilter *param_2,
          float *param_3)

{
  CTerrorPlayer *this_00;
  char cVar1;
  int iVar2;
  int *piVar3;
  CNavArea *pCVar4;
  CNavArea *pCVar5;
  int iVar6;
  int iVar7;
  float fVar8;
  CTerrorPlayer *local_58;
  float local_54;
  ShortestPathCost local_41;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  int local_30 [8];
  
  local_30[0] = 0;
  local_30[1] = 0;
  local_30[2] = 0;
  local_30[3] = 0;
  local_30[4] = 0;
  local_40 = 2;
  local_3c = 2;
  local_38 = 3;
  local_34 = 9;
                    /* try { // try from 00947741 to 0094790c has its CatchHandler @ 0094792b */
  ForEachSurvivor<PlayerCollector>((PlayerCollector *)&local_40);
  if (local_30[3] < 1) {
    local_58 = (CTerrorPlayer *)0x0;
    local_54 = 3.4028235e+38;
  }
  else {
    iVar7 = 0;
    local_58 = (CTerrorPlayer *)0x0;
    local_54 = 3.4028235e+38;
LAB_009477c7:
    do {
      this_00 = *(CTerrorPlayer **)(local_30[0] + iVar7 * 4);
      if (*(int *)(this_00 + 0x30) == 0) {
        iVar2 = *(int *)(param_1 + 0x30);
        iVar6 = 0;
        if (iVar2 != 0) goto LAB_0094778a;
LAB_009477e0:
        iVar2 = 0;
      }
      else {
        iVar2 = *(int *)(param_1 + 0x30);
        iVar6 = *(int *)(this_00 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
        if (iVar2 == 0) goto LAB_009477e0;
LAB_0094778a:
        iVar2 = iVar2 - *(int *)(gpGlobals + 0x58) >> 4;
      }
      if (((iVar6 != iVar2) &&
          (iVar2 = CTerrorPlayer::GetTerrorWeapon(this_00,*(undefined4 *)param_2), iVar2 != 0)) &&
         (cVar1 = CTerrorPlayer::IsAbleToMove(this_00), cVar1 != '\0')) {
        iVar2 = (**(code **)(*(int *)param_1 + 0x144))(param_1);
        if (iVar2 == 0) {
          if (((byte)param_1[0x14d] & 8) != 0) {
            CBaseEntity::CalcAbsolutePosition(param_1);
          }
          pCVar4 = (CNavArea *)
                   CNavMesh::GetNearestNavArea
                             (TheNavMesh,(Vector *)(param_1 + 0x2e0),false,10000.0,false,true,false)
          ;
        }
        else {
          piVar3 = (int *)(**(code **)(*(int *)param_1 + 0x144))(param_1);
          pCVar4 = (CNavArea *)(**(code **)(*piVar3 + 0x52c))(piVar3);
        }
        pCVar5 = (CNavArea *)(**(code **)(*(int *)this_00 + 0x52c))(this_00);
        fVar8 = NavAreaTravelDistance<ShortestPathCost>(pCVar5,pCVar4,&local_41,0.0);
        fVar8 = fVar8 + (float)*(int *)(this_00 + 0x2ba0);
        if (fVar8 < local_54) {
          iVar7 = iVar7 + 1;
          local_58 = this_00;
          local_54 = fVar8;
          if (local_30[3] <= iVar7) break;
          goto LAB_009477c7;
        }
      }
      iVar7 = iVar7 + 1;
    } while (iVar7 < local_30[3]);
  }
  if (param_3 != (float *)0x0) {
    *param_3 = local_54;
  }
  local_30[3] = 0;
  CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_30);
  local_30[4] = local_30[0];
  CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_30);
  return local_58;
}

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)