L L4D2node

SurvivorTeamSituation::FindOrphan

0x00967aa0 · 947 bytes · __thiscall

_ZN21SurvivorTeamSituation10FindOrphanEv

Decompiled

undefined (1 param)

/* SurvivorTeamSituation::FindOrphan() */

void __thiscall SurvivorTeamSituation::FindOrphan(SurvivorTeamSituation *this)

{
  float *pfVar1;
  float *pfVar2;
  float *pfVar3;
  uint uVar4;
  bool bVar5;
  int *piVar6;
  CNavArea *pCVar7;
  CNavArea *pCVar8;
  int iVar9;
  undefined4 *puVar10;
  undefined *puVar11;
  int iVar12;
  CTerrorPlayer *pCVar13;
  longdouble lVar14;
  float fVar15;
  float fVar16;
  float fVar17;
  float fVar18;
  float fVar19;
  float local_38;
  int local_34;
  undefined **local_2c;
  int *local_28;
  undefined4 local_24;
  undefined1 local_20;
  undefined1 local_1f;
  
  lVar14 = (longdouble)CountdownTimer::Now();
  if (*(float *)(this + 0xd71c) <= (float)lVar14) {
    lVar14 = (longdouble)RandomFloat(0x3f800000,0x40000000);
    fVar15 = (float)lVar14;
    lVar14 = (longdouble)CountdownTimer::Now();
    if ((float)lVar14 + fVar15 != *(float *)(this + 0xd71c)) {
      (**(code **)(*(int *)(this + 0xd714) + 4))(this + 0xd714,this + 0xd71c);
      *(float *)(this + 0xd71c) = (float)lVar14 + fVar15;
    }
    if (fVar15 != *(float *)(this + 0xd718)) {
      (**(code **)(*(int *)(this + 0xd714) + 4))(this + 0xd714,this + 0xd718);
      *(float *)(this + 0xd718) = fVar15;
    }
    local_2c = &PTR_operator___00d09770;
    *(undefined4 *)(this + 0xd710) = 0xffffffff;
    local_28 = (int *)0x0;
    if (*(int *)(this + 4) != 0) {
      local_28 = (int *)(*(int *)(this + 4) + 0x4028);
    }
    local_24 = (**(code **)(*local_28 + 0xc0))(local_28);
    local_20 = 0;
    local_1f = 1;
    local_34 = 0;
    local_38 = 3.4028235e+38;
    if (0 < *(int *)(this + 0xc4)) {
      do {
        pCVar13 = (CTerrorPlayer *)0x0;
        uVar4 = *(uint *)(this + local_34 * 4 + 0x88);
        if (((uVar4 != 0xffffffff) &&
            (puVar11 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc))
           && (*(uint *)(puVar11 + 8) == uVar4 >> 0xc)) {
          pCVar13 = *(CTerrorPlayer **)(puVar11 + 4);
        }
        fVar15 = 99999.9;
        if (0.0 < *(float *)(pCVar13 + 0x2f64)) {
          lVar14 = (longdouble)IntervalTimer::Now();
          fVar15 = (float)lVar14 - *(float *)(pCVar13 + 0x2f64);
        }
        if ((*(float *)(SurvivorBotMinOrphanTimeToCover._28_4_ + 0x2c) <= fVar15 &&
             fVar15 != *(float *)(SurvivorBotMinOrphanTimeToCover._28_4_ + 0x2c)) &&
           (piVar6 = (int *)GetPathToFriend(this,pCVar13), piVar6 != (int *)0x0)) {
          lVar14 = (longdouble)(**(code **)(*piVar6 + 8))(piVar6);
          fVar15 = (float)*(int *)(*(int *)(this + 4) + 0x2ba0) + (float)lVar14;
          if (fVar15 <= local_38) {
            iVar12 = 0;
            if (0 < *(int *)(this + 0xc4)) {
              do {
                if (local_34 != iVar12) {
                  piVar6 = (int *)0x0;
                  uVar4 = *(uint *)(this + iVar12 * 4 + 0x88);
                  if (((uVar4 != 0xffffffff) &&
                      (puVar11 = g_pEntityList + (uVar4 & 0xfff) * 0x10,
                      puVar11 != (undefined *)0xfffffffc)) &&
                     (*(uint *)(puVar11 + 8) == uVar4 >> 0xc)) {
                    piVar6 = *(int **)(puVar11 + 4);
                  }
                  pCVar7 = (CNavArea *)(**(code **)(*(int *)pCVar13 + 0x52c))(pCVar13);
                  pCVar8 = (CNavArea *)(**(code **)(*piVar6 + 0x52c))(piVar6);
                  if ((pCVar8 != (CNavArea *)0x0) && (pCVar7 != (CNavArea *)0x0)) {
                    if (pCVar7 == pCVar8) {
LAB_00967df8:
                      fVar19 = 0.0;
                    }
                    else {
                      bVar5 = NavAreaBuildPath<SurvivorBotPathCost>
                                        (pCVar8,pCVar7,(Vector *)0x0,(Vector *)0x0,
                                         (SurvivorBotPathCost *)&local_2c,(CNavArea **)0x0,2000.0,-1
                                         ,false);
                      if (!bVar5) goto LAB_00967dbb;
                      iVar9 = *(int *)(pCVar7 + 0x78);
                      if (iVar9 == 0) goto LAB_00967df8;
                      fVar19 = 0.0;
                      fVar16 = *(float *)(pCVar7 + 0x34);
                      fVar17 = *(float *)(pCVar7 + 0x2c);
                      fVar18 = *(float *)(pCVar7 + 0x30);
                      do {
                        pfVar1 = (float *)(iVar9 + 0x30);
                        pfVar2 = (float *)(iVar9 + 0x34);
                        fVar18 = fVar18 - *pfVar1;
                        pfVar3 = (float *)(iVar9 + 0x2c);
                        fVar16 = fVar16 - *pfVar2;
                        iVar9 = *(int *)(iVar9 + 0x78);
                        fVar17 = fVar17 - *pfVar3;
                        fVar19 = fVar19 + SQRT(fVar16 * fVar16 + fVar18 * fVar18 + fVar17 * fVar17);
                        fVar16 = *pfVar2;
                        fVar17 = *pfVar3;
                        fVar18 = *pfVar1;
                      } while (iVar9 != 0);
                      if (fVar19 < 0.0) goto LAB_00967dbb;
                    }
                    if ((float)piVar6[0xae8] + fVar19 < fVar15) {
                      return;
                    }
                  }
                }
LAB_00967dbb:
                iVar12 = iVar12 + 1;
              } while (iVar12 < *(int *)(this + 0xc4));
            }
            puVar10 = (undefined4 *)(**(code **)(*(int *)pCVar13 + 0xc))(pCVar13);
            *(undefined4 *)(this + 0xd710) = *puVar10;
            local_38 = fVar15;
          }
        }
        local_34 = local_34 + 1;
      } while (local_34 < *(int *)(this + 0xc4));
    }
  }
  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)