L L4D2node

CTerrorPlayer::PassesObserverFilter

0x009b7820 · 834 bytes · __thiscall

_ZN13CTerrorPlayer20PassesObserverFilterEPK11CBaseEntity

Decompiled

undefined (2 params)

/* CTerrorPlayer::PassesObserverFilter(CBaseEntity const*) */

bool __thiscall CTerrorPlayer::PassesObserverFilter(CTerrorPlayer *this,CBaseEntity *param_1)

{
  char cVar1;
  undefined1 uVar2;
  byte bVar3;
  int iVar4;
  char *pcVar5;
  CBaseEntity *this_00;
  undefined4 local_34;
  undefined1 local_30;
  int local_2c;
  undefined4 local_28;
  undefined1 local_24;
  int local_20;
  
  if (this[0x104] == (CTerrorPlayer)0x3) {
    return false;
  }
  if ((param_1 == (CBaseEntity *)0x0) ||
     (cVar1 = (**(code **)(*(int *)param_1 + 0x16c))(param_1), cVar1 == '\0')) {
    this_00 = (CBaseEntity *)0x0;
  }
  else {
    cVar1 = (**(code **)(*(int *)param_1 + 0x558))(param_1);
    this_00 = param_1;
    if (cVar1 != '\0') {
      return false;
    }
  }
  cVar1 = (**(code **)(*(int *)this + 0x170))(this);
  if (cVar1 == '\0') {
    return true;
  }
  iVar4 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
  if (iVar4 == 3) {
    if ((spec_filter_infected[0x15] & 0x10) == 0) {
      pcVar5 = *(char **)(spec_filter_infected._28_4_ + 0x24);
      if (pcVar5 == (char *)0x0) {
        pcVar5 = "";
      }
      goto LAB_009b79a6;
    }
LAB_009b78b4:
    if (param_1 == (CBaseEntity *)0x0) {
      return true;
    }
    iVar4 = _V_stricmp("FCVAR_NEVER_AS_STRING","human");
    if (iVar4 == 0) {
LAB_009b7ae8:
      local_28 = 0xffffffff;
      local_24 = 0;
      local_20 = 0;
      ForEachPlayer<LivePlayerCounter>((LivePlayerCounter *)&local_28);
      if (local_20 == 0) {
        return (bool)cVar1;
      }
      if (this_00 != (CBaseEntity *)0x0) {
        bVar3 = (**(code **)(*(int *)this_00 + 0x778))(this_00);
        return (bool)(bVar3 ^ 1);
      }
      return false;
    }
    pcVar5 = "FCVAR_NEVER_AS_STRING";
    iVar4 = _V_stricmp("FCVAR_NEVER_AS_STRING","bot");
    if (iVar4 == 0) {
LAB_009b7900:
      local_34 = 0xffffffff;
      local_30 = 1;
      local_2c = 0;
      local_28 = 0xffffffff;
      local_24 = 0;
      local_20 = 0;
      ForEachPlayer<LivePlayerCounter>((LivePlayerCounter *)&local_34);
      ForEachPlayer<LivePlayerCounter>((LivePlayerCounter *)&local_28);
      if (local_20 == local_2c) {
        return (bool)cVar1;
      }
      if (this_00 != (CBaseEntity *)0x0) {
        uVar2 = (**(code **)(*(int *)this_00 + 0x778))(this_00);
        return (bool)uVar2;
      }
      return false;
    }
  }
  else {
    iVar4 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
    if (iVar4 == 2) {
      if ((spec_filter_survivors[0x15] & 0x10) == 0) {
        pcVar5 = *(char **)(spec_filter_survivors._28_4_ + 0x24);
        if (pcVar5 == (char *)0x0) {
          pcVar5 = "";
        }
        goto LAB_009b79a6;
      }
      goto LAB_009b78b4;
    }
    if ((spec_filter[0x15] & 0x10) != 0) goto LAB_009b78b4;
    pcVar5 = *(char **)(spec_filter._28_4_ + 0x24);
    if (pcVar5 == (char *)0x0) {
      pcVar5 = "";
    }
LAB_009b79a6:
    if (param_1 == (CBaseEntity *)0x0) {
      return true;
    }
    if ((pcVar5 == "human") || (iVar4 = _V_stricmp(pcVar5,"human"), iVar4 == 0)) goto LAB_009b7ae8;
    if ((pcVar5 == "bot") || (iVar4 = _V_stricmp(pcVar5,"bot"), iVar4 == 0)) goto LAB_009b7900;
    if (pcVar5 == "survivor") goto LAB_009b7b38;
  }
  iVar4 = _V_stricmp(pcVar5,"survivor");
  if (iVar4 != 0) {
    if ((pcVar5 != "infected") && (iVar4 = _V_stricmp(pcVar5,"infected"), iVar4 != 0)) {
      return true;
    }
    local_28 = 3;
    local_24 = 1;
    local_20 = 0;
    ForEachPlayer<LivePlayerCounter>((LivePlayerCounter *)&local_28);
    if (local_20 == 0) {
      return (bool)cVar1;
    }
    if (this_00 != (CBaseEntity *)0x0) {
      iVar4 = CBaseEntity::GetTeamNumber(this_00);
      return iVar4 == 3;
    }
    return false;
  }
LAB_009b7b38:
  local_28 = 2;
  local_24 = 1;
  local_20 = 0;
  ForEachPlayer<LivePlayerCounter>((LivePlayerCounter *)&local_28);
  if (local_20 == 0) {
    return (bool)cVar1;
  }
  if (this_00 != (CBaseEntity *)0x0) {
    iVar4 = CBaseEntity::GetTeamNumber(this_00);
    return iVar4 == 2;
  }
  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)