L L4D2node

Infected::UpdateNeighbors

0x00a12cd0 · 895 bytes · __thiscall

_ZN8Infected15UpdateNeighborsEv

Decompiled

undefined (1 param)

/* Infected::UpdateNeighbors() */

void __thiscall Infected::UpdateNeighbors(Infected *this)

{
  float fVar1;
  float fVar2;
  float fVar3;
  float fVar4;
  Infected IVar5;
  char cVar6;
  CBaseEntity *pCVar7;
  uint uVar8;
  int *piVar9;
  undefined4 *puVar10;
  undefined *puVar11;
  int iVar12;
  int iVar13;
  longdouble lVar14;
  undefined4 local_20 [4];
  
  if ((*(int *)(ZombieDebugNeighbors._28_4_ + 0x30) != 0) && (0 < *(int *)(this + 0x1d34))) {
    iVar13 = 0;
    do {
      while ((((uVar8 = *(uint *)(*(int *)(this + 0x1d28) + iVar13 * 4), uVar8 != 0xffffffff &&
               (puVar11 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc
               )) && (*(uint *)(puVar11 + 8) == uVar8 >> 0xc)) &&
             (pCVar7 = *(CBaseEntity **)(puVar11 + 4), pCVar7 != (CBaseEntity *)0x0))) {
        if (((byte)pCVar7[0x14d] & 8) == 0) {
          IVar5 = this[0x14d];
        }
        else {
          CBaseEntity::CalcAbsolutePosition(pCVar7);
          IVar5 = this[0x14d];
        }
        if (((byte)IVar5 & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
        }
        iVar13 = iVar13 + 1;
        NDebugOverlay::HorzArrow
                  ((Vector *)(this + 0x2e0),(Vector *)(pCVar7 + 0x2e0),3.0,0,0,0xff,0xff,true,0.1);
        if (*(int *)(this + 0x1d34) <= iVar13) goto LAB_00a12dc9;
      }
      iVar13 = iVar13 + 1;
    } while (iVar13 < *(int *)(this + 0x1d34));
  }
LAB_00a12dc9:
  lVar14 = (longdouble)CountdownTimer::Now();
  if (*(float *)(this + 0x1d44) <= (float)lVar14) {
    lVar14 = (longdouble)RandomFloat(0x3f000000,0x3f800000);
    fVar4 = (float)lVar14;
    lVar14 = (longdouble)CountdownTimer::Now();
    if ((float)lVar14 + fVar4 != *(float *)(this + 0x1d44)) {
      (**(code **)(*(int *)(this + 0x1d3c) + 4))(this + 0x1d3c,this + 0x1d44);
      *(float *)(this + 0x1d44) = (float)lVar14 + fVar4;
    }
    if (fVar4 != *(float *)(this + 0x1d40)) {
      (**(code **)(*(int *)(this + 0x1d3c) + 4))(this + 0x1d3c,this + 0x1d40);
      *(float *)(this + 0x1d40) = fVar4;
    }
    fVar4 = *(float *)(ZombieMaxNeighborRange._28_4_ + 0x2c);
    pCVar7 = (CBaseEntity *)(**(code **)(*(int *)this + 0x570))(this);
    if (((byte)pCVar7[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(pCVar7);
    }
    fVar1 = *(float *)(pCVar7 + 0x2e0);
    fVar2 = *(float *)(pCVar7 + 0x2e4);
    fVar3 = *(float *)(pCVar7 + 0x2e8);
    *(undefined4 *)(this + 0x1d34) = 0;
    iVar13 = TheNextBots();
    uVar8 = (uint)*(ushort *)(iVar13 + 0x10);
    if (uVar8 != 0xffff) {
      iVar12 = *(int *)(iVar13 + 4);
      do {
        piVar9 = *(int **)(iVar12 + uVar8 * 8);
        piVar9 = (int *)(**(code **)(*piVar9 + 0xb4))(piVar9);
        pCVar7 = (CBaseEntity *)(**(code **)(*piVar9 + 0x14c))(piVar9);
        if ((pCVar7 != (CBaseEntity *)0x0) &&
           (cVar6 = (**(code **)(*(int *)(this + 0x1a3c) + 0xe0))(this + 0x1a3c,pCVar7),
           cVar6 == '\0')) {
          if (((byte)pCVar7[0x14d] & 8) != 0) {
            CBaseEntity::CalcAbsolutePosition(pCVar7);
          }
          if ((*(float *)(pCVar7 + 0x2e0) - fVar1) * (*(float *)(pCVar7 + 0x2e0) - fVar1) +
              (*(float *)(pCVar7 + 0x2e4) - fVar2) * (*(float *)(pCVar7 + 0x2e4) - fVar2) +
              (*(float *)(pCVar7 + 0x2e8) - fVar3) * (*(float *)(pCVar7 + 0x2e8) - fVar3) <
              fVar4 * fVar4) {
            local_20[0] = 0xffffffff;
            puVar10 = (undefined4 *)(**(code **)(*(int *)pCVar7 + 0xc))(pCVar7);
            local_20[0] = *puVar10;
            CUtlVector<CHandle<Infected>,CUtlMemory<CHandle<Infected>,int>>::InsertBefore
                      ((CUtlVector<CHandle<Infected>,CUtlMemory<CHandle<Infected>,int>> *)
                       (this + 0x1d28),*(int *)(this + 0x1d34),(CHandle *)local_20);
          }
        }
        iVar12 = *(int *)(iVar13 + 4);
        uVar8 = (uint)*(ushort *)(iVar12 + 6 + uVar8 * 8);
      } while (uVar8 != 0xffff);
      return;
    }
  }
  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)