L L4D2node

CBasePlayer::StartObserverMode

0x007aec10 · 723 bytes · __thiscall

_ZN11CBasePlayer17StartObserverModeEi

Decompiled

undefined (2 params)

/* CBasePlayer::StartObserverMode(int) */

undefined4 __thiscall CBasePlayer::StartObserverMode(CBasePlayer *this,int param_1)

{
  code *pcVar1;
  undefined1 uVar2;
  uint uVar3;
  int iVar4;
  int *piVar5;
  float *pfVar6;
  undefined *puVar7;
  float local_28;
  float local_24;
  float local_20;
  
  uVar3 = *(uint *)(this + 0x1d20);
  if ((uVar3 & 8) == 0) {
    pfVar6 = (float *)(**(code **)(*(int *)this + 0x250))(this);
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    local_28 = *pfVar6 + *(float *)(this + 0x2e0);
    local_24 = pfVar6[1] + *(float *)(this + 0x2e4);
    local_20 = pfVar6[2] + *(float *)(this + 0x2e8);
    CBaseEntity::SetAbsOrigin((CBaseEntity *)this,(Vector *)&local_28);
    (**(code **)(*(int *)this + 0x254))(this,&vec3_origin);
    uVar3 = *(uint *)(this + 0x1d20);
  }
  *(uint *)(this + 0x1d20) = uVar3 | 8;
  iVar4 = CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)this);
  if (iVar4 != 0) {
    piVar5 = (int *)CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)this);
    (**(code **)(*piVar5 + 0x428))(piVar5,0);
  }
  SetSuitUpdate(this,(char *)0x0,0,0);
  CBaseEntity::SetGroundEntity((CBaseEntity *)this,(CBaseEntity *)0x0);
  CBaseEntity::RemoveFlag((CBaseEntity *)this,2);
  CCollisionProperty::SetSolidFlags
            ((CCollisionProperty *)(this + 0x194),(uint)(*(ushort *)(this + 0x1b4) | 4));
  (**(code **)(*(int *)this + 0x644))(this,param_1);
  if ((*(int *)(gpGlobals + 0x48) != 3) &&
     ((((uVar3 = *(uint *)(this + 0x2088), uVar3 == 0xffffffff ||
        (puVar7 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc)) ||
       (*(uint *)(puVar7 + 8) != uVar3 >> 0xc)) ||
      ((*(CBasePlayer **)(puVar7 + 4) == this || (*(int *)(puVar7 + 4) == 0)))))) {
    pcVar1 = *(code **)(*(int *)this + 0x580);
    uVar2 = (**(code **)(*(int *)this + 0x640))(this,param_1);
    (*pcVar1)(this,"specgui",uVar2,0);
  }
  if (*(int *)(this + 0x1a7c) != 8) {
    (**(code **)(*(int *)(this + 0x1a40) + 4))(this + 0x1a40,this + 0x1a7c);
    *(undefined4 *)(this + 0x1a7c) = 8;
  }
  if (this[0x105] != (CBasePlayer)0x0) {
    (**(code **)(*(int *)this + 0x224))(this,this + 0x105);
    this[0x105] = (CBasePlayer)0x0;
  }
  CBaseEntity::AddEffects((CBaseEntity *)this,0x20);
  if (*(int *)(this + 0x100) != 1) {
    (**(code **)(*(int *)this + 0x214))(this,this + 0x100);
    *(undefined4 *)(this + 0x100) = 1;
  }
  if (this[0x104] != (CBasePlayer)0x2) {
    (**(code **)(*(int *)this + 0x21c))(this,this + 0x104);
    this[0x104] = (CBasePlayer)0x2;
  }
  *(undefined4 *)(this + 0x1d60) = *(undefined4 *)(gpGlobals + 0xc);
  if (this[0x1c80] != (CBasePlayer)0x1) {
    (**(code **)(*(int *)(this + 0x1c7c) + 4))(this + 0x1c7c,this + 0x1c80);
    this[0x1c80] = (CBasePlayer)0x1;
  }
  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)