L L4D2node

SurvivorBot::GetPace

0x00939ee0 · 718 bytes · __thiscall

_ZNK11SurvivorBot7GetPaceEv

Decompiled

undefined (1 param)

/* SurvivorBot::GetPace() const */

undefined4 __thiscall SurvivorBot::GetPace(SurvivorBot *this)

{
  SurvivorBot *pSVar1;
  uint uVar2;
  CTerrorPlayer *pCVar3;
  char cVar4;
  undefined4 uVar5;
  SurvivorTeamSituation *this_00;
  int *piVar6;
  int iVar7;
  float *pfVar8;
  float *pfVar9;
  undefined *puVar10;
  int *piVar11;
  longdouble lVar12;
  float fVar13;
  undefined4 local_24;
  undefined4 local_20;
  
  if (*(int *)(NextBotPlayerWalk._28_4_ + 0x30) != 0) {
    return 1;
  }
  pSVar1 = this + 0x4028;
  this_00 = (SurvivorTeamSituation *)GetTeamSituation(this);
  piVar6 = (int *)(**(code **)(*(int *)this + 0x9a8))(this);
  iVar7 = (**(code **)(*piVar6 + 0xb8))(piVar6,pSVar1);
  if (iVar7 == 1) {
    return 2;
  }
  cVar4 = CTerrorPlayer::IsStill((CTerrorPlayer *)this,1);
  if (cVar4 == '\0') {
    piVar6 = (int *)(**(code **)(*(int *)this + 0x9a4))(this);
    pfVar8 = (float *)(**(code **)(*piVar6 + 0xbc))(piVar6);
    piVar6 = (int *)(**(code **)(*(int *)this + 0x9a0))(this);
    pfVar9 = (float *)(**(code **)(*piVar6 + 0x108))(piVar6);
    local_20 = 1;
    if (pfVar8[1] * pfVar9[1] + *pfVar8 * *pfVar9 + pfVar8[2] * pfVar9[2] < 0.0) goto LAB_00939f6f;
  }
  local_20 = 2;
LAB_00939f6f:
  local_24 = 0;
  uVar2 = *(uint *)(this_00 + 0x50);
  if (((uVar2 != 0xffffffff) &&
      (puVar10 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar10 + 8) == uVar2 >> 0xc)) {
    local_24 = *(undefined4 *)(puVar10 + 4);
  }
  cVar4 = (**(code **)(*(int *)(this + 0x4028) + 0xe0))(pSVar1,local_24);
  uVar5 = local_20;
  if (cVar4 != '\0') {
    fVar13 = 0.0;
    if (0 < *(int *)(this + 0x1aa90)) {
      piVar11 = *(int **)(this + 0x1aa84);
      fVar13 = 0.0;
      piVar6 = piVar11 + *(int *)(this + 0x1aa90);
      do {
        iVar7 = *piVar11;
        piVar11 = piVar11 + 1;
        fVar13 = fVar13 + (*(float *)(iVar7 + 0x14) - *(float *)(iVar7 + 8)) *
                          (*(float *)(iVar7 + 0x10) - *(float *)(iVar7 + 4));
      } while (piVar11 != piVar6);
    }
    uVar5 = 1;
    if (fVar13 < *(float *)(SurvivorBotThreatExposureWalk._28_4_ + 0x2c) ||
        fVar13 == *(float *)(SurvivorBotThreatExposureWalk._28_4_ + 0x2c)) {
      uVar5 = local_20;
    }
  }
  local_20 = uVar5;
  uVar2 = *(uint *)(this_00 + 0x54);
  if (((uVar2 != 0xffffffff) &&
      (puVar10 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)) &&
     ((*(uint *)(puVar10 + 8) == uVar2 >> 0xc &&
      ((pCVar3 = *(CTerrorPlayer **)(puVar10 + 4), pCVar3 != (CTerrorPlayer *)0x0 &&
       (cVar4 = (**(code **)(*(int *)(this + 0x4028) + 0xe0))(pSVar1,pCVar3), cVar4 == '\0')))))) {
    lVar12 = (longdouble)SurvivorTeamSituation::GetDistanceToFriend(this_00,pCVar3);
    fVar13 = (float)lVar12;
    if (*(float *)(SurvivorBotSeparationDangerMinRange._28_4_ + 0x2c) <= fVar13 &&
        fVar13 != *(float *)(SurvivorBotSeparationDangerMinRange._28_4_ + 0x2c)) {
      return 2;
    }
    if (fVar13 < *(float *)(SurvivorBotSeparationRange._28_4_ + 0x2c)) {
      cVar4 = (**(code **)(*(int *)pCVar3 + 0x5c8))(pCVar3);
      if (cVar4 != '\0') {
        if (*(float *)(pCVar3 + 0x2ecc) <= 0.0) {
          fVar13 = 99999.9;
        }
        else {
          lVar12 = (longdouble)IntervalTimer::Now();
          fVar13 = (float)lVar12 - *(float *)(pCVar3 + 0x2ecc);
        }
        piVar6 = (int *)(**(code **)(*(int *)this + 0x9ac))(this);
        lVar12 = (longdouble)(**(code **)(*piVar6 + 0xcc))(piVar6);
        if ((float)lVar12 < fVar13) {
          return 2;
        }
      }
      uVar5 = 1;
      if (pCVar3[0x2edc] == (CTerrorPlayer)0x0) {
        uVar5 = local_20;
      }
      return uVar5;
    }
  }
  return local_20;
}

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)