L L4D2node

CSceneFindNearestMarkFilter::ShouldFindEntity

0x0081a4e0 · 1361 bytes · __thiscall

_ZN27CSceneFindNearestMarkFilter16ShouldFindEntityEP11CBaseEntity

Decompiled

undefined (2 params)

/* CSceneFindNearestMarkFilter::ShouldFindEntity(CBaseEntity*) */

undefined4 __thiscall
CSceneFindNearestMarkFilter::ShouldFindEntity
          (CSceneFindNearestMarkFilter *this,CBaseEntity *param_1)

{
  float *pfVar1;
  float *pfVar2;
  uint uVar3;
  undefined4 *puVar4;
  undefined *puVar5;
  undefined *puVar6;
  int iVar7;
  float fVar8;
  float fVar9;
  float fVar10;
  float fVar11;
  IHandleEntity *local_ec;
  float local_e8;
  float local_e4;
  float local_e0;
  CTraceFilterSimple local_dc [16];
  float local_cc;
  float local_c8;
  float local_c4;
  undefined4 local_bc;
  undefined4 local_b8;
  undefined4 local_b4;
  float local_ac;
  float local_a8;
  float local_a4;
  float local_9c;
  float local_98;
  float local_94;
  undefined4 local_8c;
  undefined1 local_88;
  undefined1 local_87;
  Vector local_70 [12];
  Vector local_64 [43];
  char local_39;
  int local_24;
  
  puVar5 = g_pEntityList;
  uVar3 = *(uint *)(this + 4);
  if ((((uVar3 == 0xffffffff) ||
       (puVar6 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar6 == (undefined *)0xfffffffc)) ||
      (*(uint *)(puVar6 + 8) != uVar3 >> 0xc)) || (*(int *)(puVar6 + 4) == 0)) {
    return 1;
  }
  if (*(int *)(this + 0x30) == 0) {
    *(CBaseEntity **)(this + 0x30) = param_1;
  }
  if (((byte)param_1[0x14d] & 8) == 0) {
    puVar4 = (undefined4 *)(puVar5 + (uVar3 & 0xfff) * 0x10 + 4);
    local_e4 = *(float *)(param_1 + 0x2e0);
    local_e8 = *(float *)(param_1 + 0x2e4);
    local_e0 = *(float *)(param_1 + 0x2e8);
  }
  else {
    CBaseEntity::CalcAbsolutePosition(param_1);
    local_ec = (IHandleEntity *)0x0;
    uVar3 = *(uint *)(this + 4);
    local_e4 = *(float *)(param_1 + 0x2e0);
    local_e8 = *(float *)(param_1 + 0x2e4);
    local_e0 = *(float *)(param_1 + 0x2e8);
    if (uVar3 == 0xffffffff) goto LAB_0081a5ac;
    puVar4 = (undefined4 *)(g_pEntityList + (uVar3 & 0xfff) * 0x10 + 4);
    if (puVar4 == (undefined4 *)0x0) {
      local_ec = (IHandleEntity *)0x0;
      goto LAB_0081a5ac;
    }
  }
  if (puVar4[1] == uVar3 >> 0xc) {
    local_ec = (IHandleEntity *)*puVar4;
  }
  else {
    local_ec = (IHandleEntity *)0x0;
  }
LAB_0081a5ac:
  pfVar1 = (float *)(**(code **)(*(int *)(local_ec + 0x194) + 8))(local_ec + 0x194);
  iVar7 = 0;
  uVar3 = *(uint *)(this + 4);
  if (((uVar3 != 0xffffffff) &&
      (puVar5 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar5 + 8) == uVar3 >> 0xc)) {
    iVar7 = *(int *)(puVar5 + 4);
  }
  pfVar2 = (float *)(**(code **)(*(int *)(iVar7 + 0x194) + 4))(iVar7 + 0x194);
  local_87 = 0;
  local_bc = 0;
  local_b8 = 0;
  local_b4 = 0;
  local_8c = 0;
  local_9c = (*pfVar1 - *pfVar2) * 0.5;
  local_98 = (pfVar1[1] - pfVar2[1]) * 0.5;
  local_94 = (pfVar1[2] - pfVar2[2]) * 0.5;
  local_88 = local_98 * local_98 + local_9c * local_9c + local_94 * local_94 < 1e-06;
  local_ac = (*pfVar1 + *pfVar2) * 0.5;
  local_a8 = (pfVar1[1] + pfVar2[1]) * 0.5;
  local_a4 = (pfVar1[2] + pfVar2[2]) * 0.5;
  local_cc = local_e4 + local_ac;
  local_c8 = local_e8 + local_a8;
  local_c4 = local_e0 + local_a4;
  local_ac = -local_ac;
  local_a8 = -local_a8;
  local_a4 = -local_a4;
  CTraceFilterSimple::CTraceFilterSimple
            (local_dc,local_ec,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
  (**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,0x200400b,local_dc,local_70);
  if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
    DebugDrawLine(local_70,local_64,0xff,0xff,0,true,-1.0);
  }
  if (local_39 != '\0') {
    uVar3 = *(uint *)(this + 4);
    iVar7 = 0;
    if (((uVar3 != 0xffffffff) &&
        (puVar5 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar5 + 8) == uVar3 >> 0xc)) {
      iVar7 = *(int *)(puVar5 + 4);
    }
    if (local_24 != iVar7) {
      return 0;
    }
  }
  uVar3 = 0;
  if ((*(uint *)(param_1 + 0x14c) & 0x800) != 0) {
    CBaseEntity::CalcAbsolutePosition(param_1);
    uVar3 = *(uint *)(param_1 + 0x14c) & 0x800;
  }
  fVar9 = *(float *)(param_1 + 0x2e0);
  fVar10 = *(float *)(param_1 + 0x2e4);
  fVar11 = *(float *)(param_1 + 0x2e8);
  fVar8 = SQRT((*(float *)(this + 0xc) - fVar10) * (*(float *)(this + 0xc) - fVar10) +
               (*(float *)(this + 8) - fVar9) * (*(float *)(this + 8) - fVar9) +
               (*(float *)(this + 0x10) - fVar11) * (*(float *)(this + 0x10) - fVar11));
  if (uVar3 != 0) {
    CBaseEntity::CalcAbsolutePosition(param_1);
    fVar9 = *(float *)(param_1 + 0x2e0);
    fVar10 = *(float *)(param_1 + 0x2e4);
    fVar11 = *(float *)(param_1 + 0x2e8);
  }
  fVar9 = SQRT((*(float *)(this + 0x18) - fVar10) * (*(float *)(this + 0x18) - fVar10) +
               (*(float *)(this + 0x14) - fVar9) * (*(float *)(this + 0x14) - fVar9) +
               (*(float *)(this + 0x1c) - fVar11) * (*(float *)(this + 0x1c) - fVar11));
  if (fVar8 < *(float *)(this + 0x2c) || fVar8 == *(float *)(this + 0x2c)) {
    *(float *)(this + 0x2c) = fVar9;
    *(CBaseEntity **)(this + 0x30) = param_1;
  }
  if (((fVar8 <= *(float *)(this + 0x20)) && (fVar9 <= *(float *)(this + 0x20))) &&
     (fVar9 < *(float *)(this + 0x24))) {
    *(float *)(this + 0x24) = fVar9;
    *(CBaseEntity **)(this + 0x28) = param_1;
  }
  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)