L L4D2node

IVision::GetClosestRecognized

0x0075b740 · 465 bytes · __thiscall

_ZNK7IVision20GetClosestRecognizedEi

Decompiled

undefined (2 params)

/* IVision::GetClosestRecognized(int) const */

undefined4 __thiscall IVision::GetClosestRecognized(IVision *this,int param_1)

{
  uint uVar1;
  int *piVar2;
  float *pfVar3;
  int iVar4;
  CBaseEntity *this_00;
  undefined4 *puVar5;
  uint uVar6;
  undefined *puVar7;
  int iVar8;
  float fVar9;
  undefined4 local_28;
  float local_20;
  
  piVar2 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
  pfVar3 = (float *)(**(code **)(*piVar2 + 0xd4))(piVar2);
  if (0 < *(int *)(this + 0x38)) {
    iVar8 = 0;
    local_28 = 0;
    local_20 = (float)0x4e6e6b28;
    do {
      while (uVar1 = *(uint *)(*(int *)(this + 0x2c) + iVar8 * 0x14), uVar1 == 0xffffffff) {
LAB_0075b790:
        iVar8 = iVar8 + 1;
        if (*(int *)(this + 0x38) <= iVar8) {
          return local_28;
        }
      }
      uVar6 = uVar1 & 0xfff;
      puVar5 = (undefined4 *)(g_pEntityList + uVar6 * 0x10 + 4);
      if (((puVar5 == (undefined4 *)0x0) ||
          (*(uint *)(g_pEntityList + uVar6 * 0x10 + 8) != uVar1 >> 0xc)) ||
         (*(CBaseEntity **)(g_pEntityList + uVar6 * 0x10 + 4) == (CBaseEntity *)0x0))
      goto LAB_0075b790;
      if (param_1 == -1) {
LAB_0075b900:
        this_00 = (CBaseEntity *)*puVar5;
      }
      else {
        iVar4 = CBaseEntity::GetTeamNumber(*(CBaseEntity **)(g_pEntityList + uVar6 * 0x10 + 4));
        if (param_1 != iVar4) goto LAB_0075b790;
        uVar1 = *(uint *)(*(int *)(this + 0x2c) + iVar8 * 0x14);
        this_00 = (CBaseEntity *)0x0;
        if (((uVar1 != 0xffffffff) &&
            (puVar5 = (undefined4 *)(g_pEntityList + (uVar1 & 0xfff) * 0x10 + 4),
            puVar5 != (undefined4 *)0x0)) && (puVar5[1] == uVar1 >> 0xc)) goto LAB_0075b900;
      }
      if (((byte)this_00[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(this_00);
      }
      fVar9 = (*(float *)(this_00 + 0x2e4) - pfVar3[1]) * (*(float *)(this_00 + 0x2e4) - pfVar3[1])
              + (*(float *)(this_00 + 0x2e0) - *pfVar3) * (*(float *)(this_00 + 0x2e0) - *pfVar3) +
              (*(float *)(this_00 + 0x2e8) - pfVar3[2]) * (*(float *)(this_00 + 0x2e8) - pfVar3[2]);
      if (local_20 <= fVar9) goto LAB_0075b790;
      uVar1 = *(uint *)(*(int *)(this + 0x2c) + iVar8 * 0x14);
      local_20 = fVar9;
      if (((uVar1 != 0xffffffff) &&
          (puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 != (undefined *)0xfffffffc)) &&
         (*(uint *)(puVar7 + 8) == uVar1 >> 0xc)) {
        local_28 = *(undefined4 *)(puVar7 + 4);
        goto LAB_0075b790;
      }
      iVar8 = iVar8 + 1;
      local_28 = 0;
    } while (iVar8 < *(int *)(this + 0x38));
  }
  return 0;
}

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)