L L4D2node

CTerrorPlayer::SetObserverTarget

0x009999a0 · 1271 bytes · __thiscall

_ZN13CTerrorPlayer17SetObserverTargetEP11CBaseEntity

Decompiled

undefined (2 params)

/* CTerrorPlayer::SetObserverTarget(CBaseEntity*) */

undefined4 __thiscall CTerrorPlayer::SetObserverTarget(CTerrorPlayer *this,CBaseEntity *param_1)

{
  CBaseEdict *this_00;
  code *pcVar1;
  int *piVar2;
  char cVar3;
  undefined4 uVar4;
  undefined *puVar5;
  int iVar6;
  undefined4 *puVar7;
  char *__nptr;
  long lVar8;
  QAngle *pQVar9;
  uint uVar10;
  CBaseEntity *pCVar11;
  float local_f4;
  float local_f0;
  float local_ec;
  undefined4 local_e8;
  undefined4 local_e4;
  undefined4 local_e0;
  float local_dc;
  float local_d8;
  float local_d4;
  undefined4 local_cc;
  undefined4 local_c8;
  undefined4 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];
  float local_64;
  float local_60;
  float local_5c;
  
  if (param_1 == (CBaseEntity *)0x0) {
    uVar10 = *(uint *)(this + 0x1d7c);
    if (uVar10 == 0xffffffff) goto LAB_00999b4d;
LAB_009999e2:
    puVar5 = g_pEntityList + (uVar10 & 0xfff) * 0x10;
    if (puVar5 == (undefined *)0xfffffffc) {
      if (param_1 == (CBaseEntity *)0x0) goto LAB_00999b4d;
LAB_00999a1d:
      pCVar11 = (CBaseEntity *)0x0;
    }
    else {
      if (*(uint *)(puVar5 + 8) == uVar10 >> 0xc) {
        pCVar11 = *(CBaseEntity **)(puVar5 + 4);
      }
      else {
        pCVar11 = (CBaseEntity *)0x0;
      }
      if (param_1 == pCVar11) {
LAB_00999b4d:
        CBasePlayer::SetFOV((CBasePlayer *)this,(CBaseEntity *)this,0,0.0,0);
        *(undefined4 *)(this + 0x3320) = 0;
        if (*(float *)(this + 0x331c) == -1.0) {
          return 1;
        }
        (**(code **)(*(int *)(this + 0x3314) + 4))(this + 0x3314,this + 0x331c);
        *(undefined4 *)(this + 0x331c) = 0xbf800000;
        return 1;
      }
      if (*(uint *)(puVar5 + 8) != uVar10 >> 0xc) goto LAB_00999a1d;
      pCVar11 = *(CBaseEntity **)(puVar5 + 4);
    }
    if (param_1 == pCVar11) goto LAB_00999a60;
  }
  else {
    uVar4 = (**(code **)(*(int *)this + 0x664))(this,param_1);
    if ((char)uVar4 == '\0') {
      return uVar4;
    }
    uVar10 = *(uint *)(this + 0x1d7c);
    if (uVar10 != 0xffffffff) goto LAB_009999e2;
  }
  if (this[0x6c] == (CTerrorPlayer)0x0) {
    this_00 = *(CBaseEdict **)(this + 0x30);
    if (this_00 != (CBaseEdict *)0x0) {
      *(uint *)this_00 = *(uint *)this_00 | 0x101;
      iVar6 = CBaseEdict::GetChangeAccessor(this_00);
      *(undefined2 *)(iVar6 + 2) = 0;
    }
  }
  else {
    this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
  }
  if (param_1 == (CBaseEntity *)0x0) {
    *(undefined4 *)(this + 0x1d7c) = 0xffffffff;
  }
  else {
    puVar7 = (undefined4 *)(**(code **)(*(int *)param_1 + 0xc))(param_1);
    *(undefined4 *)(this + 0x1d7c) = *puVar7;
  }
LAB_00999a60:
  CBasePlayer::SetFOV((CBasePlayer *)this,(CBaseEntity *)this,0,0.0,0);
  *(undefined4 *)(this + 0x3320) = 0;
  if (*(float *)(this + 0x331c) != -1.0) {
    (**(code **)(*(int *)(this + 0x3314) + 4))(this + 0x3314,this + 0x331c);
    *(undefined4 *)(this + 0x331c) = 0xbf800000;
  }
  if (((param_1 != (CBaseEntity *)0x0) && (*(int *)(this + 0x1d64) == 6)) &&
     (cVar3 = (**(code **)(*(int *)this + 0x5a8))(this), cVar3 == '\0')) {
    if (*(int *)(this + 0x30) == 0) {
      iVar6 = 0;
    }
    else {
      iVar6 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
    }
    __nptr = (char *)(**(code **)(*engine + 0xe0))(engine,iVar6,"spec_cinematic");
    if ((__nptr == (char *)0x0) || (lVar8 = strtol(__nptr,(char **)0x0,10), lVar8 == 0)) {
      (**(code **)(*(int *)param_1 + 0x234))(&local_e8,param_1);
      pQVar9 = (QAngle *)(**(code **)(*(int *)param_1 + 0x238))(param_1);
      AngleVectors(pQVar9,(Vector *)&local_f4);
      VectorNormalize((Vector *)&local_f4);
      piVar2 = mdlcache;
      local_8c = 0;
      local_88 = 0;
      local_9c = 0x41000000;
      local_bc = local_f4 * -64.0;
      local_98 = 0x41000000;
      local_94 = 0x41000000;
      local_b8 = local_f0 * -64.0;
      local_b4 = local_ec * -64.0;
      local_ac = 0;
      local_a8 = 0;
      local_a4 = 0;
      local_87 = local_b8 * local_b8 + local_bc * local_bc + local_b4 * local_b4 != 0.0;
      local_cc = local_e8;
      local_c8 = local_e4;
      local_c4 = local_e0;
      (**(code **)(*mdlcache + 0x68))(mdlcache);
                    /* try { // try from 00999d6f to 00999e55 has its CatchHandler @ 00999eae */
      uVar4 = (**(code **)(*(int *)this + 0x7a0))(this,0);
      CTraceFilterSimple::CTraceFilterSimple
                ((CTraceFilterSimple *)&local_dc,(IHandleEntity *)param_1,8,
                 (_func_bool_IHandleEntity_ptr_int *)0x0);
      (**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,uVar4,&local_dc,local_70);
      if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
                    /* try { // try from 00999e9d to 00999ea1 has its CatchHandler @ 00999eae */
        DebugDrawLine(local_70,(Vector *)&local_64,0xff,0,0,true,-1.0);
      }
      pcVar1 = *(code **)(*(int *)this + 0x66c);
      uVar4 = (**(code **)(*(int *)param_1 + 0x238))(param_1);
      iVar6 = (**(code **)(*g_pGameRules + 0x7c))(g_pGameRules);
      local_dc = local_64 - *(float *)(iVar6 + 0x60);
      local_d8 = local_60 - *(float *)(iVar6 + 100);
      local_d4 = local_5c - *(float *)(iVar6 + 0x68);
      (*pcVar1)(this,&local_dc,uVar4);
      (**(code **)(*piVar2 + 0x6c))(piVar2);
    }
  }
  return 1;
}

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)