L L4D2node

CPointEntityFinder::FindByDistance

0x007db140 · 1062 bytes · __thiscall

_ZN18CPointEntityFinder14FindByDistanceEv

Decompiled

undefined (1 param)

/* CPointEntityFinder::FindByDistance() */

void __thiscall CPointEntityFinder::FindByDistance(CPointEntityFinder *this)

{
  CBaseEntity *this_00;
  char cVar1;
  CBaseEntity *this_01;
  int iVar2;
  undefined4 *puVar3;
  uint uVar4;
  char *pcVar5;
  undefined *puVar6;
  float fVar7;
  float fVar8;
  float fVar9;
  CBaseFilter *local_30;
  float local_20;
  
  puVar6 = g_pEntityList;
  local_30 = (CBaseFilter *)0x0;
  *(undefined4 *)(this + 0x440) = 0xffffffff;
  uVar4 = *(uint *)(this + 0x448);
  if (((uVar4 != 0xffffffff) &&
      (puVar6 = puVar6 + (uVar4 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar6 + 8) == uVar4 >> 0xc)) {
    local_30 = *(CBaseFilter **)(puVar6 + 4);
  }
  this_01 = (CBaseEntity *)
            CGlobalEntityList::NextEnt((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0);
  local_20 = 0.0;
  do {
    if (this_01 == (CBaseEntity *)0x0) {
      return;
    }
    pcVar5 = *(char **)(this_01 + 0x7c);
    if (pcVar5 == (char *)0x0) {
      pcVar5 = "";
LAB_007db1ce:
      iVar2 = _V_stricmp(pcVar5,"worldspawn");
      if (iVar2 != 0) {
        pcVar5 = *(char **)(this_01 + 0x7c);
        if (pcVar5 == (char *)0x0) {
          pcVar5 = "";
        }
        else if (pcVar5 == "soundent") goto LAB_007db460;
        iVar2 = _V_stricmp(pcVar5,"soundent");
        if (iVar2 != 0) {
          pcVar5 = *(char **)(this_01 + 0x7c);
          if (pcVar5 == (char *)0x0) {
            pcVar5 = "";
          }
          else if (pcVar5 == "player_manager") goto LAB_007db460;
          iVar2 = _V_stricmp(pcVar5,"player_manager");
          if (iVar2 != 0) {
            pcVar5 = *(char **)(this_01 + 0x7c);
            if (pcVar5 == (char *)0x0) {
              pcVar5 = "";
            }
            else if (pcVar5 == "bodyque") goto LAB_007db460;
            iVar2 = _V_stricmp(pcVar5,"bodyque");
            if (iVar2 != 0) {
              pcVar5 = *(char **)(this_01 + 0x7c);
              if (pcVar5 == (char *)0x0) {
                pcVar5 = "";
              }
              else if (pcVar5 == "ai_network") goto LAB_007db460;
              iVar2 = _V_stricmp(pcVar5,"ai_network");
              if (((iVar2 != 0) && (this != (CPointEntityFinder *)this_01)) &&
                 ((local_30 == (CBaseFilter *)0x0 ||
                  (cVar1 = CBaseFilter::PassesFilter(local_30,(CBaseEntity *)this,this_01),
                  cVar1 != '\0')))) {
                uVar4 = *(uint *)(this + 0x450);
                if (((uVar4 == 0xffffffff) ||
                    (puVar6 = g_pEntityList + (uVar4 & 0xfff) * 0x10,
                    puVar6 == (undefined *)0xfffffffc)) ||
                   ((*(uint *)(puVar6 + 8) != uVar4 >> 0xc ||
                    (this_00 = *(CBaseEntity **)(puVar6 + 4), this_00 == (CBaseEntity *)0x0)))) {
                  if (((byte)this[0x14d] & 8) != 0) {
                    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
                  }
                  fVar7 = *(float *)(this + 0x2e0);
                  fVar8 = *(float *)(this + 0x2e4);
                  fVar9 = *(float *)(this + 0x2e8);
                }
                else {
                  if (((byte)this_00[0x14d] & 8) != 0) {
                    CBaseEntity::CalcAbsolutePosition(this_00);
                  }
                  fVar7 = *(float *)(this_00 + 0x2e0);
                  fVar8 = *(float *)(this_00 + 0x2e4);
                  fVar9 = *(float *)(this_00 + 0x2e8);
                }
                uVar4 = *(uint *)(this + 0x440);
                if ((((uVar4 == 0xffffffff) ||
                     (puVar6 = g_pEntityList + (uVar4 & 0xfff) * 0x10,
                     puVar6 == (undefined *)0xfffffffc)) || (*(uint *)(puVar6 + 8) != uVar4 >> 0xc))
                   || (*(int *)(puVar6 + 4) == 0)) {
                  puVar3 = (undefined4 *)(**(code **)(*(int *)this_01 + 0xc))(this_01);
                  *(undefined4 *)(this + 0x440) = *puVar3;
                  uVar4 = 0;
                  if ((*(uint *)(this_01 + 0x14c) & 0x800) != 0) {
                    CBaseEntity::CalcAbsolutePosition(this_01);
                    uVar4 = *(uint *)(this_01 + 0x14c) & 0x800;
                  }
                  local_20 = (*(float *)(this_01 + 0x2e8) - fVar9) *
                             (*(float *)(this_01 + 0x2e8) - fVar9) +
                             (*(float *)(this_01 + 0x2e0) - fVar7) *
                             (*(float *)(this_01 + 0x2e0) - fVar7) +
                             (*(float *)(this_01 + 0x2e4) - fVar8) *
                             (*(float *)(this_01 + 0x2e4) - fVar8);
                }
                else {
                  uVar4 = *(uint *)(this_01 + 0x14c) & 0x800;
                }
                if (uVar4 != 0) {
                  CBaseEntity::CalcAbsolutePosition(this_01);
                }
                fVar7 = (*(float *)(this_01 + 0x2e4) - fVar8) *
                        (*(float *)(this_01 + 0x2e4) - fVar8) +
                        (*(float *)(this_01 + 0x2e0) - fVar7) *
                        (*(float *)(this_01 + 0x2e0) - fVar7) +
                        (*(float *)(this_01 + 0x2e8) - fVar9) *
                        (*(float *)(this_01 + 0x2e8) - fVar9);
                if (*(int *)(this + 0x454) == 0) {
                  if (fVar7 < local_20) goto LAB_007db441;
                }
                else if ((*(int *)(this + 0x454) == 1) && (local_20 < fVar7)) {
LAB_007db441:
                  puVar3 = (undefined4 *)(**(code **)(*(int *)this_01 + 0xc))(this_01);
                  *(undefined4 *)(this + 0x440) = *puVar3;
                  local_20 = fVar7;
                }
              }
            }
          }
        }
      }
    }
    else if (pcVar5 != "worldspawn") goto LAB_007db1ce;
LAB_007db460:
    this_01 = (CBaseEntity *)CGlobalEntityList::NextEnt((CGlobalEntityList *)gEntList,this_01);
  } while( true );
}

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)