L L4D2node

CEnvWeaponfire::IsValidTarget

0x008cc810 · 1000 bytes · __thiscall

_ZN14CEnvWeaponfire13IsValidTargetEP11CBaseEntity

Decompiled

undefined (2 params)

/* CEnvWeaponfire::IsValidTarget(CBaseEntity*) */

bool __thiscall CEnvWeaponfire::IsValidTarget(CEnvWeaponfire *this,CBaseEntity *param_1)

{
  float fVar1;
  float fVar2;
  float fVar3;
  uint uVar4;
  char cVar5;
  char cVar6;
  int iVar7;
  float *pfVar8;
  undefined *puVar9;
  longdouble lVar10;
  float fVar11;
  float fVar12;
  float fVar13;
  float fVar14;
  float fVar15;
  CTraceFilterSimple local_dc [16];
  float local_cc;
  float local_c8;
  float local_c4;
  float local_bc;
  float local_b8;
  float local_b4;
  undefined4 local_ac;
  undefined4 local_a8;
  undefined4 local_a4;
  undefined4 local_9c;
  undefined4 local_98;
  undefined4 local_94;
  undefined4 local_8c;
  undefined1 local_88;
  undefined1 local_87;
  Vector local_70 [12];
  Vector local_64 [32];
  float local_44;
  char local_3a;
  char local_39;
  CBaseEntity *local_24;
  
  if (((param_1 != (CBaseEntity *)0x0) &&
      (cVar5 = (**(code **)(*(int *)param_1 + 300))(param_1), cVar5 != '\0')) &&
     ((cVar6 = (**(code **)(*(int *)param_1 + 0x16c))(param_1), cVar6 == '\0' ||
      ((cVar6 = (**(code **)(*(int *)param_1 + 0x558))(param_1), cVar6 == '\0' &&
       ((this[0x441] == (CEnvWeaponfire)0x0 ||
        (cVar6 = (**(code **)(*(int *)param_1 + 0x5a8))(param_1), cVar6 != '\0')))))))) {
    iVar7 = CBaseEntity::GetTeamNumber(param_1);
    if ((iVar7 == *(int *)(this + 0x444)) || (*(int *)(this + 0x444) == -1)) {
      if (((byte)this[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      }
      fVar1 = *(float *)(this + 0x2e0);
      fVar2 = *(float *)(this + 0x2e4);
      fVar3 = *(float *)(this + 0x2e8);
      pfVar8 = (float *)(**(code **)(*(int *)param_1 + 0x288))(param_1);
      fVar12 = *pfVar8 - fVar1;
      fVar13 = pfVar8[1] - fVar2;
      fVar14 = pfVar8[2] - fVar3;
      fVar11 = fVar13 * fVar13 + fVar12 * fVar12 + fVar14 * fVar14;
      fVar15 = SQRT(fVar11);
      if (((fVar15 < *(float *)(this + 0x44c) || fVar15 == *(float *)(this + 0x44c)) &&
          (lVar10 = (longdouble)
                    __acosf_finite((fVar13 * *(float *)(this + 0x470) +
                                    fVar12 * *(float *)(this + 0x46c) +
                                   fVar14 * *(float *)(this + 0x474)) / fVar15),
          (float)lVar10 * 57.295776 < *(float *)(this + 0x448) ||
          (float)lVar10 * 57.295776 == *(float *)(this + 0x448))) &&
         (((uVar4 = *(uint *)(this + 0x494), uVar4 == 0xffffffff ||
           (((puVar9 = g_pEntityList + (uVar4 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc ||
             (*(uint *)(puVar9 + 8) != uVar4 >> 0xc)) ||
            (*(CBaseFilter **)(puVar9 + 4) == (CBaseFilter *)0x0)))) ||
          (cVar6 = CBaseFilter::PassesFilter
                             (*(CBaseFilter **)(puVar9 + 4),(CBaseEntity *)this,param_1),
          cVar6 != '\0')))) {
        local_88 = 1;
        local_87 = fVar11 != 0.0;
        local_94 = 0;
        local_98 = 0;
        local_9c = 0;
        local_a4 = 0;
        local_a8 = 0;
        local_ac = 0;
        local_8c = 0;
        local_cc = fVar1;
        local_c8 = fVar2;
        local_c4 = fVar3;
        local_bc = fVar12;
        local_b8 = fVar13;
        local_b4 = fVar14;
        CTraceFilterSimple::CTraceFilterSimple
                  (local_dc,(IHandleEntity *)this,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
        (**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,0x6004003,local_dc,local_70);
        if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
          DebugDrawLine(local_70,local_64,0xff,0,0,true,-1.0);
        }
        if (((1.0 <= local_44) && (local_3a == '\0')) && (local_39 == '\0')) {
          return (bool)cVar5;
        }
        return param_1 == local_24;
      }
    }
  }
  return false;
}

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)