L L4D2node

CGlobalEntityList::FindEntityClassNearestFacing

0x0067d410 · 368 bytes · __thiscall

_ZN17CGlobalEntityList28FindEntityClassNearestFacingERK6VectorS2_fPc

Decompiled

undefined (5 params)

/* CGlobalEntityList::FindEntityClassNearestFacing(Vector const&, Vector const&, float, char*) */

CBaseEntity * __thiscall
CGlobalEntityList::FindEntityClassNearestFacing
          (CGlobalEntityList *this,Vector *param_1,Vector *param_2,float param_3,char *param_4)

{
  CBaseEntity *this_00;
  char cVar1;
  char *pcVar2;
  undefined4 *puVar3;
  float fVar4;
  CBaseEntity *local_34;
  float local_28;
  float local_24;
  float local_20;
  
  local_34 = (CBaseEntity *)0x0;
  puVar3 = *(undefined4 **)(this + 0x10004);
  do {
    if (puVar3 == (undefined4 *)0x0) {
      return local_34;
    }
    while (this_00 = (CBaseEntity *)*puVar3, this_00 != (CBaseEntity *)0x0) {
      if (*(float *)(this_00 + 0x1b8) == 0.0) goto LAB_0067d4d8;
      if (((byte)this_00[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(this_00);
      }
      local_28 = *(float *)(this_00 + 0x2e0) - *(float *)param_1;
      local_24 = *(float *)(this_00 + 0x2e4) - *(float *)(param_1 + 4);
      local_20 = *(float *)(this_00 + 0x2e8) - *(float *)(param_1 + 8);
      VectorNormalize((Vector *)&local_28);
      fVar4 = local_24 * *(float *)(param_2 + 4) + local_28 * *(float *)param_2 +
              local_20 * *(float *)(param_2 + 8);
      if (fVar4 <= param_3) goto LAB_0067d4d8;
      pcVar2 = *(char **)(this_00 + 0x7c);
      if (param_4 != pcVar2) {
        cVar1 = CBaseEntity::ClassMatchesComplex(this_00,param_4);
        if (cVar1 == '\0') goto LAB_0067d4d8;
        pcVar2 = *(char **)(this_00 + 0x7c);
      }
      if ((((pcVar2 == "worldspawn") ||
           (cVar1 = CBaseEntity::ClassMatchesComplex(this_00,"worldspawn"), cVar1 != '\0')) ||
          (*(char **)(this_00 + 0x7c) == "soundent")) ||
         (cVar1 = CBaseEntity::ClassMatchesComplex(this_00,"soundent"), cVar1 != '\0'))
      goto LAB_0067d4d8;
      puVar3 = (undefined4 *)puVar3[3];
      param_3 = fVar4;
      local_34 = this_00;
      if (puVar3 == (undefined4 *)0x0) {
        return this_00;
      }
    }
    DevWarning("NULL entity in global entity list!\n");
LAB_0067d4d8:
    puVar3 = (undefined4 *)puVar3[3];
  } 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)