L L4D2node

CBasePlayer::SetViewEntity

0x007b80c0 · 291 bytes · __thiscall

_ZN11CBasePlayer13SetViewEntityEP11CBaseEntity

Decompiled

undefined (2 params)

/* CBasePlayer::SetViewEntity(CBaseEntity*) */

void __thiscall CBasePlayer::SetViewEntity(CBasePlayer *this,CBaseEntity *param_1)

{
  CBaseEdict *this_00;
  int iVar1;
  uint *puVar2;
  uint uVar3;
  CBaseEntity *pCVar4;
  undefined *puVar5;
  
  pCVar4 = (CBaseEntity *)0x0;
  uVar3 = *(uint *)(this + 0x2088);
  if (((uVar3 != 0xffffffff) &&
      (puVar5 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar5 + 8) == uVar3 >> 0xc)) {
    pCVar4 = *(CBaseEntity **)(puVar5 + 4);
  }
  puVar5 = g_pEntityList;
  if (param_1 != pCVar4) {
    if (this[0x6c] == (CBasePlayer)0x0) {
      this_00 = *(CBaseEdict **)(this + 0x30);
      if (this_00 != (CBaseEdict *)0x0) {
        *(uint *)this_00 = *(uint *)this_00 | 0x101;
        iVar1 = CBaseEdict::GetChangeAccessor(this_00);
        *(undefined2 *)(iVar1 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBasePlayer)((byte)this[0x70] | 1);
    }
    if (param_1 == (CBaseEntity *)0x0) {
      *(undefined4 *)(this + 0x2088) = 0xffffffff;
      goto LAB_007b816f;
    }
    puVar2 = (uint *)(**(code **)(*(int *)param_1 + 0xc))(param_1);
    puVar5 = g_pEntityList;
    uVar3 = *puVar2;
    *(uint *)(this + 0x2088) = uVar3;
  }
  if (((uVar3 != 0xffffffff) &&
      (puVar5 = puVar5 + (uVar3 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc)) &&
     ((*(uint *)(puVar5 + 8) == uVar3 >> 0xc && (*(int *)(puVar5 + 4) != 0)))) {
    (**(code **)(*engine + 0xc4))
              (engine,*(undefined4 *)(this + 0x30),*(undefined4 *)(*(int *)(puVar5 + 4) + 0x30));
    return;
  }
LAB_007b816f:
  (**(code **)(*engine + 0xc4))(engine,*(undefined4 *)(this + 0x30),*(undefined4 *)(this + 0x30));
  return;
}

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)