L L4D2node

SurvivorBotPathCost::operator()

0x0092cec0 · 1693 bytes · __thiscall

_ZNK19SurvivorBotPathCostclEP8CNavAreaS1_PK10CNavLadderPK13CFuncElevatorf

Decompiled

undefined (6 params)

/* SurvivorBotPathCost::TEMPNAMEPLACEHOLDERVALUE(CNavArea*, CNavArea*, CNavLadder const*,
   CFuncElevator const*, float) const */

longdouble __thiscall
SurvivorBotPathCost::operator()
          (SurvivorBotPathCost *this,CNavArea *param_1,CNavArea *param_2,CNavLadder *param_3,
          CFuncElevator *param_4,float param_5)

{
  float fVar1;
  float fVar2;
  char cVar3;
  SurvivorBotPathCost SVar4;
  uint uVar5;
  SurvivorBot *this_00;
  int iVar6;
  int iVar7;
  undefined *puVar8;
  int *piVar9;
  int iVar10;
  longdouble lVar11;
  longdouble lVar12;
  float fVar13;
  float local_30;
  float local_2c;
  float local_28;
  float local_20;
  
  cVar3 = (**(code **)(**(int **)(this + 8) + 0x150))(*(int **)(this + 8),param_1);
  fVar13 = -1.0;
  if ((cVar3 == '\0') ||
     (((SVar4 = this[0xd], SVar4 == (SurvivorBotPathCost)0x0 &&
       (*(int *)(gpGlobals + 0x18) <= *(int *)(param_1 + 0x70))) &&
      (this[0xc] == (SurvivorBotPathCost)0x0)))) goto LAB_0092cf18;
  if (param_2 == (CNavArea *)0x0) {
    fVar13 = 0.0;
    goto LAB_0092cf18;
  }
  if (param_3 != (CNavLadder *)0x0) {
    uVar5 = *(uint *)(param_3 + 0x38);
    if (((uVar5 != 0xffffffff) &&
        (puVar8 = g_pEntityList + (uVar5 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc)) &&
       ((*(uint *)(puVar8 + 8) == uVar5 >> 0xc &&
        ((*(CBaseEntity **)(puVar8 + 4) != (CBaseEntity *)0x0 &&
         (uVar5 = CBaseEntity::GetTeamNumber(*(CBaseEntity **)(puVar8 + 4)),
         (uVar5 & 0xfffffffd) != 0)))))) goto LAB_0092cfe4;
    fVar13 = *(float *)(param_3 + 0x1c) + *(float *)(param_3 + 0x1c);
    goto LAB_0092cf77;
  }
  if (param_5 <= 0.0) {
    param_5 = SQRT((*(float *)(param_1 + 0x34) - *(float *)(param_2 + 0x34)) *
                   (*(float *)(param_1 + 0x34) - *(float *)(param_2 + 0x34)) +
                   (*(float *)(param_1 + 0x2c) - *(float *)(param_2 + 0x2c)) *
                   (*(float *)(param_1 + 0x2c) - *(float *)(param_2 + 0x2c)) +
                   (*(float *)(param_1 + 0x30) - *(float *)(param_2 + 0x30)) *
                   (*(float *)(param_1 + 0x30) - *(float *)(param_2 + 0x30)));
  }
  if (param_4 == (CFuncElevator *)0x0) {
    lVar11 = (longdouble)CNavArea::GetZDeltaAtEdgeToArea(param_2,param_1);
    fVar13 = (float)lVar11;
    lVar11 = (longdouble)(**(code **)(**(int **)(this + 8) + 0x134))(*(int **)(this + 8));
    lVar12 = (longdouble)(**(code **)(**(int **)(this + 8) + 0x130))(*(int **)(this + 8));
    if ((float)lVar12 + (float)lVar11 < fVar13) {
LAB_0092cfe4:
      return (longdouble)-1.0;
    }
    lVar11 = (longdouble)(**(code **)(**(int **)(this + 8) + 0x138))(*(int **)(this + 8));
    if ((float)lVar11 < -fVar13) goto LAB_0092cfe4;
    if (this[0xd] == (SurvivorBotPathCost)0x0) {
      lVar11 = (longdouble)(**(code **)(**(int **)(this + 8) + 0x130))(*(int **)(this + 8));
      iVar7 = **(int **)(this + 8);
      if (fVar13 <= (float)lVar11) {
        lVar11 = (longdouble)(**(code **)(iVar7 + 0x130))(*(int **)(this + 8));
        if (fVar13 < -(float)lVar11) {
          lVar11 = (longdouble)(**(code **)(**(int **)(this + 8) + 0x130))(*(int **)(this + 8));
          lVar12 = (longdouble)(**(code **)(**(int **)(this + 8) + 0x130))(*(int **)(this + 8));
          param_5 = ((-fVar13 - (float)lVar11) / (100.0 - (float)lVar12) + 1.0) * param_5;
        }
        SVar4 = this[0xd];
      }
      else {
        lVar11 = (longdouble)(**(code **)(iVar7 + 0x134))();
        if (fVar13 <= (float)lVar11) {
          param_5 = param_5 + param_5;
          SVar4 = this[0xd];
        }
        else {
          param_5 = param_5 * 100.0;
          SVar4 = this[0xd];
        }
      }
      goto LAB_0092cfb0;
    }
  }
  else {
LAB_0092cfb0:
    if (SVar4 == (SurvivorBotPathCost)0x0) {
      lVar11 = (longdouble)CNavArea::GetAverageLightIntensity(param_1);
      if (0.4 <= (float)lVar11) {
        local_30 = 1.0;
      }
      else {
        local_30 = (0.4 - (float)lVar11) * 5.0 + 1.0;
      }
      local_20 = 1.0;
      local_28 = 1.0;
      if (*(int *)(gpGlobals + 0x18) <= *(int *)(param_1 + 0x70)) {
        local_28 = 100.0;
      }
      if (param_1[0x3a] == (CNavArea)0x0) {
        local_2c = 1.0;
      }
      else {
        fVar13 = (float)(byte)param_1[0x3a] + 0.0;
        if (fVar13 <= 18.0) {
          local_2c = 1.0;
        }
        else {
          lVar11 = (longdouble)(**(code **)(**(int **)(this + 8) + 0x134))(*(int **)(this + 8));
          local_2c = 100.0;
          if (fVar13 < (float)lVar11) {
            lVar11 = (longdouble)(**(code **)(**(int **)(this + 8) + 0x134))(*(int **)(this + 8));
            fVar1 = (float)lVar11;
            lVar11 = (longdouble)(**(code **)(**(int **)(this + 8) + 0x130))(*(int **)(this + 8));
            fVar2 = (float)lVar11;
            if (fVar1 == fVar2) {
              local_2c = (float)(~-(uint)(fVar1 <= fVar13) & 0x41200000 |
                                -(uint)(fVar1 <= fVar13) & 0x41a00000);
            }
            else {
              local_2c = ((fVar13 - fVar2) * 10.0) / (fVar1 - fVar2) + 10.0;
            }
          }
        }
      }
      iVar10 = 0;
      this_00 = (SurvivorBot *)(**(code **)(**(int **)(this + 4) + 0xb4))(*(int **)(this + 4));
      iVar6 = SurvivorBot::GetTeamSituation(this_00);
      iVar7 = *(int *)(iVar6 + 0xc4);
      if (0 < iVar7) {
        do {
          uVar5 = *(uint *)(iVar6 + 0x88 + iVar10 * 4);
          piVar9 = (int *)0x0;
          if (((uVar5 != 0xffffffff) &&
              (puVar8 = g_pEntityList + (uVar5 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc))
             && (*(uint *)(puVar8 + 8) == uVar5 >> 0xc)) {
            piVar9 = *(int **)(puVar8 + 4);
          }
          cVar3 = (**(code **)(*piVar9 + 0x5a8))(piVar9);
          if (cVar3 == '\0') {
            uVar5 = *(uint *)(iVar6 + 0x88 + iVar10 * 4);
            iVar7 = 0;
            if (((uVar5 != 0xffffffff) &&
                (puVar8 = g_pEntityList + (uVar5 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc)
                ) && (*(uint *)(puVar8 + 8) == uVar5 >> 0xc)) {
              iVar7 = *(int *)(puVar8 + 4);
            }
            if (((byte)param_1[0x7e] >> (*(uint *)(iVar7 + 0x2ba0) & 0x1f) & 1) != 0) {
              iVar7 = *(int *)(iVar6 + 0xc4);
              break;
            }
          }
          iVar7 = *(int *)(iVar6 + 0xc4);
          iVar10 = iVar10 + 1;
        } while (iVar10 < iVar7);
      }
      if ((iVar7 != 0) && (local_20 = 10.0, iVar7 != iVar10)) {
        local_20 = 1.0;
      }
      if (local_28 <= local_30) {
        local_28 = local_30;
      }
      if (local_28 <= local_2c) {
        local_28 = local_2c;
      }
      if (local_28 <= local_20) {
        local_28 = local_20;
      }
      iVar7 = (**(code **)(**(int **)(this + 4) + 0xb4))(*(int **)(this + 4));
      fVar13 = 0.0;
      if (*(int *)(iVar7 + 0x30) != 0) {
        fVar13 = (float)(*(int *)(iVar7 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4);
      }
      lVar11 = (longdouble)
               FastCos(((float)(*(uint *)(param_1 + 0x8c) >> 0x10) * 65536.0 +
                       (float)(*(uint *)(param_1 + 0x8c) & 0xffff)) * fVar13);
      fVar13 = (((float)lVar11 + 1.0) * 10.0 + local_28) * param_5;
LAB_0092cf77:
      return (longdouble)(fVar13 + *(float *)(param_2 + 0x44));
    }
  }
  fVar13 = param_5 + *(float *)(param_2 + 0x44);
LAB_0092cf18:
  return (longdouble)fVar13;
}

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)