L L4D2node

CTerrorPlayer::IsValidObserverTarget

0x009b7440 · 503 bytes · __thiscall

_ZN13CTerrorPlayer21IsValidObserverTargetEP11CBaseEntity

Decompiled

undefined (2 params)

/* CTerrorPlayer::IsValidObserverTarget(CBaseEntity*) */

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

{
  char cVar1;
  int iVar2;
  int iVar3;
  CTerrorPlayer *pCVar4;
  CTerrorPlayer *local_28;
  CTerrorPlayer *local_24;
  CTerrorPlayer *local_20;
  
  if (param_1 == (CBaseEntity *)0x0) {
    return false;
  }
  cVar1 = (**(code **)(*(int *)param_1 + 0x16c))(param_1);
  if (cVar1 == '\0') {
    iVar2 = __dynamic_cast(param_1,&CBaseEntity::typeinfo,&CTransitioningPlayer::typeinfo,0);
    return iVar2 != 0;
  }
  cVar1 = (**(code **)(*(int *)param_1 + 0x16c))(param_1);
  pCVar4 = (CTerrorPlayer *)0x0;
  if (cVar1 != '\0') {
    pCVar4 = (CTerrorPlayer *)param_1;
  }
  if ((((this != pCVar4) && (((byte)pCVar4[0xd4] & 0x20) == 0)) &&
      (pCVar4[0x104] != (CTerrorPlayer)0x3)) &&
     ((1 < (byte)((char)pCVar4[0x104] - 1U) || (*(int *)(pCVar4 + 0x23bc) == 4)))) {
    iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
    if (iVar2 != 1) {
      if (*(int *)(mp_forcecamera._28_4_ + 0x30) == 1) {
        iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
        iVar3 = CBaseEntity::GetTeamNumber(param_1);
        if (iVar2 != iVar3) {
          return false;
        }
      }
      else if (*(int *)(mp_forcecamera._28_4_ + 0x30) == 2) {
        return false;
      }
    }
    iVar2 = CBaseEntity::GetTeamNumber(param_1);
    if ((iVar2 != 4) &&
       ((((iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)this), iVar2 != 2 ||
          (iVar2 = CBaseEntity::GetTeamNumber(param_1), iVar2 != 3)) ||
         (*(int *)(DirectorSpectateSpecials._28_4_ + 0x30) != 0)) &&
        ((((cVar1 = CTerrorGameRules::HasPlayerControlledZombies(), cVar1 != '\0' ||
           (*(int *)(DirectorSpectateSpecials._28_4_ + 0x30) != 0)) ||
          (iVar2 = CBaseEntity::GetTeamNumber(param_1), iVar2 != 3)) &&
         (cVar1 = (**(code **)(*(int *)this + 0x660))(this,pCVar4), cVar1 != '\0')))))) {
      iVar2 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
      if (iVar2 != 1) {
        return (bool)cVar1;
      }
      local_28 = (CTerrorPlayer *)0x0;
      local_24 = (CTerrorPlayer *)0x0;
      local_20 = this;
      ForEachTerrorPlayer<FindBotSpectator>((FindBotSpectator *)&local_28);
      if ((local_28 == (CTerrorPlayer *)0x0) &&
         (local_28 = local_24, local_24 == (CTerrorPlayer *)0x0)) {
        return (bool)cVar1;
      }
      return pCVar4 == local_28;
    }
  }
  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)