L L4D2node

CBasePlayer::VPhysicsShadowUpdate

0x007baf40 · 2838 bytes · __thiscall

_ZN11CBasePlayer20VPhysicsShadowUpdateEP14IPhysicsObject

Decompiled

undefined (2 params)

/* CBasePlayer::VPhysicsShadowUpdate(IPhysicsObject*) */

void __thiscall CBasePlayer::VPhysicsShadowUpdate(CBasePlayer *this,IPhysicsObject *param_1)

{
  CBasePlayer *pCVar1;
  bool bVar2;
  char cVar3;
  int iVar4;
  uint uVar5;
  IPhysicsObject *pIVar6;
  int *piVar7;
  Vector *pVVar8;
  Vector *pVVar9;
  int iVar10;
  int iVar11;
  bool bVar12;
  longdouble lVar13;
  float fVar14;
  float fVar15;
  float fVar16;
  float fVar17;
  float fVar18;
  float fVar19;
  float local_b0;
  float local_a8;
  CGameTrace *local_a4;
  Vector *local_a0;
  float local_94;
  float local_90;
  float local_8c;
  float local_88;
  float local_84;
  float local_80;
  float local_7c;
  float local_78;
  float local_74;
  float local_70;
  float local_6c;
  float local_68;
  int local_64;
  float local_60;
  char local_3a;
  char local_39;
  int *local_24;
  
  iVar4 = (**(code **)(**(int **)(this + 0x1dd4) + 0x1c))(*(int **)(this + 0x1dd4),&local_94,0);
  uVar5 = (**(code **)(*(int *)param_1 + 0x50))(param_1);
  if ((uVar5 & 0x40) != 0) {
    local_70 = 0.0;
    local_6c = 0.0;
    local_68 = 0.0;
    local_64 = 0;
    local_60 = 0.0;
                    /* try { // try from 007bb273 to 007bb2a6 has its CatchHandler @ 007bba79 */
    PhysGetListOfPenetratingEntities((CBaseEntity *)this,(CUtlVector *)&local_70);
    iVar10 = local_64 + -1;
    iVar11 = iVar10 * 4;
    if (-1 < iVar10) {
      do {
        if (*(char *)(*(int *)((int)local_70 + iVar11) + 0x186) == '\x06') {
          this[0x1df8] = (CBasePlayer)0x1;
        }
        piVar7 = (int *)CBaseEntity::MyNPCPointer();
        if (piVar7 != (int *)0x0) {
          (**(code **)(*piVar7 + 0x5d8))(piVar7);
        }
        iVar10 = iVar10 + -1;
        iVar11 = iVar11 + -4;
      } while (iVar10 != -1);
    }
    local_64 = 0;
    CUtlMemory<CBaseEntity*,int>::Purge((CUtlMemory<CBaseEntity*,int> *)&local_70);
    local_60 = local_70;
    CUtlMemory<CBaseEntity*,int>::Purge((CUtlMemory<CBaseEntity*,int> *)&local_70);
  }
  bVar12 = (*(uint *)(this + 0x1d20) & 0x20) != 0;
  if (bVar12) {
    *(uint *)(this + 0x1d20) = *(uint *)(this + 0x1d20) & 0xffffffdf;
  }
  cVar3 = (**(code **)(**(int **)(this + 0x1dd4) + 0x10))(*(int **)(this + 0x1dd4));
  if ((cVar3 != '\0') || (((byte)this[0x1d20] & 0x10) != 0)) {
    this[0x1df8] = (CBasePlayer)0x1;
  }
  cVar3 = (**(code **)(*(int *)this + 0x740))(this);
  if (cVar3 != '\0') {
    this[0x1df8] = (CBasePlayer)0x1;
  }
  if ((this[0x186] == (CBasePlayer)0x8) || (this[0x1c80] != (CBasePlayer)0x0)) {
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    *(undefined4 *)(this + 0x1de0) = *(undefined4 *)(this + 0x2e0);
    *(undefined4 *)(this + 0x1de4) = *(undefined4 *)(this + 0x2e4);
    *(undefined4 *)(this + 0x1de8) = *(undefined4 *)(this + 0x2e8);
    return;
  }
  if (*(float *)(phys_timescale._28_4_ + 0x2c) == 0.0) {
    return;
  }
  if (iVar4 < 1) {
    return;
  }
  pIVar6 = (IPhysicsObject *)GetGroundVPhysics(this);
  (**(code **)(*(int *)param_1 + 0xc4))(param_1,&local_94,0);
  (**(code **)(**(int **)(this + 0x1dd4) + 0x28))(*(int **)(this + 0x1dd4),&local_88);
  local_7c = local_94;
  local_78 = local_90;
  local_74 = local_8c;
  if (*(int *)(physicsshadowupdate_render._28_4_ + 0x30) != 0) {
    pCVar1 = this + 0x194;
    pVVar8 = (Vector *)(**(code **)(*(int *)(this + 0x194) + 8))(pCVar1);
    pVVar9 = (Vector *)(**(code **)(*(int *)(this + 0x194) + 4))(pCVar1);
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    NDebugOverlay::Box((Vector *)(this + 0x2e0),pVVar9,pVVar8,0xff,0,0,0x18,15.0);
    pVVar8 = (Vector *)(**(code **)(*(int *)(this + 0x194) + 8))(pCVar1);
    pVVar9 = (Vector *)(**(code **)(*(int *)(this + 0x194) + 4))(pCVar1);
    NDebugOverlay::Box((Vector *)&local_94,pVVar9,pVVar8,0,0,0xff,0x18,15.0);
  }
  uVar5 = *(uint *)(this + 0x14c);
  if ((uVar5 & 0x800) != 0) {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    uVar5 = *(uint *)(this + 0x14c);
  }
  fVar18 = *(float *)(this + 0x2e0);
  fVar17 = *(float *)(this + 0x2e4);
  fVar14 = *(float *)(this + 0x2e8) - local_8c;
  if ((this[0x1df8] == (CBasePlayer)0x0) && (((byte)this[0x150] & 1) == 0)) {
    fVar14 = fVar14 * 0.5;
  }
  if ((uVar5 & 0x1000) != 0) {
    CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
  }
  fVar19 = local_84 - *(float *)(this + 0x278);
  fVar15 = local_80 - *(float *)(this + 0x27c);
  fVar16 = local_88 - *(float *)(this + 0x274);
  cVar3 = IsRideablePhysics(this,pIVar6);
  if (cVar3 == '\0') {
    local_a8 = 100.0;
    local_b0 = 4.0;
  }
  else {
    local_a8 = 25.0;
    local_b0 = 1.0;
  }
  cVar3 = (**(code **)(**(int **)(this + 0x1dd4) + 0x44))(*(int **)(this + 0x1dd4));
  if (cVar3 != '\0') {
    this[0x1df9] = (CBasePlayer)0x1;
    uVar5 = (**(code **)(*(int *)this + 0x7a0))(this,0);
    pVVar8 = (Vector *)(this + 0x2e0);
    if ((((byte)this[0x14d] & 8) != 0) &&
       (CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this), ((byte)this[0x14d] & 8) != 0)) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    UTIL_TraceEntity((CBaseEntity *)this,pVVar8,pVVar8,uVar5,(IHandleEntity *)this,8,
                     (CGameTrace *)&local_70);
    if (local_39 == '\0') {
      return;
    }
    uVar5 = (**(code **)(*(int *)this + 0x7a0))(this,0);
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    UTIL_TraceEntity((CBaseEntity *)this,(Vector *)&local_94,pVVar8,uVar5,(IHandleEntity *)this,8,
                     (CGameTrace *)&local_70);
    if (local_39 == '\0') {
      CBaseEntity::SetAbsOrigin((CBaseEntity *)this,(Vector *)&local_64);
      UpdateVPhysicsPosition(this,(Vector *)&local_64,(Vector *)&vec3_origin,0.0);
      return;
    }
  }
  bVar2 = local_a8 <= fVar15 * fVar15 + fVar19 * fVar19 + fVar16 * fVar16;
  if ((bVar2) ||
     (local_b0 <=
      fVar14 * fVar14 +
      (fVar17 - local_90) * (fVar17 - local_90) + (fVar18 - local_94) * (fVar18 - local_94))) {
    if ((this[0x1df8] != (CBasePlayer)0x0) || (pIVar6 != (IPhysicsObject *)0x0)) {
      if ((bVar2) && (this[0x1df9] == (CBasePlayer)0x0)) {
        if (((byte)this[0x14d] & 0x10) != 0) {
          CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
        }
        local_70 = *(float *)(this + 0x274);
        local_6c = *(float *)(this + 0x278);
        local_68 = *(float *)(this + 0x27c);
        lVar13 = (longdouble)VectorNormalize((Vector *)&local_70);
        fVar18 = (float)lVar13;
        fVar14 = local_84 * local_6c + local_70 * local_88 + local_80 * local_68;
        fVar17 = fVar18;
        if ((fVar14 <= fVar18) && (fVar17 = -fVar18, -fVar18 <= fVar14)) {
          fVar17 = fVar14;
        }
        fVar14 = -fVar17;
        local_88 = fVar14 * local_70 + local_88;
        local_84 = fVar14 * local_6c + local_84;
        local_80 = fVar14 * local_68 + local_80;
        if (((byte)this[0x1d20] & 0x10) != 0) {
          fVar18 = (fVar17 - fVar18) * 0.1;
          local_88 = local_70 * fVar18 + local_88;
          local_84 = local_6c * fVar18 + local_84;
          local_80 = fVar18 * local_68 + local_80;
        }
        cVar3 = IsRideablePhysics(this,pIVar6);
        if (cVar3 == '\0') {
          if ((((byte)this[0x1d20] & 0x10) == 0) &&
             (cVar3 = CBaseEntity::IsSimulatingOnAlternateTicks(), cVar3 != '\0')) {
            local_88 = local_88 * 0.5;
            local_84 = local_84 * 0.5;
            local_80 = local_80 * 0.5;
          }
          CBaseEntity::ApplyAbsVelocityImpulse((CBaseEntity *)this,(Vector *)&local_88);
        }
      }
LAB_007bb489:
      local_a4 = (CGameTrace *)&local_70;
      uVar5 = (**(code **)(*(int *)this + 0x7a0))(this,0);
      UTIL_TraceEntity((CBaseEntity *)this,(Vector *)&local_94,(Vector *)&local_94,uVar5,
                       (IHandleEntity *)this,8,local_a4);
      if ((local_3a == '\0') && (local_39 == '\0')) {
        CBaseEntity::SetAbsOrigin((CBaseEntity *)this,(Vector *)&local_94);
      }
      goto LAB_007bb4d6;
    }
  }
  else {
    if (pIVar6 == (IPhysicsObject *)0x0) {
      if (this[0x1df8] == (CBasePlayer)0x0) goto LAB_007bb4d6;
    }
    else if (this[0x1df8] == (CBasePlayer)0x0) goto LAB_007bb489;
    uVar5 = (**(code **)(*(int *)this + 0x7a0))(this,0);
    if ((((byte)this[0x14d] & 8) != 0) &&
       (CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this), ((byte)this[0x14d] & 8) != 0)) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    local_a0 = (Vector *)(this + 0x2e0);
    UTIL_TraceEntity((CBaseEntity *)this,local_a0,local_a0,uVar5,(IHandleEntity *)this,8,
                     (CGameTrace *)&local_70);
    if ((local_3a == '\0') && (local_39 == '\0')) {
LAB_007bb4d6:
      if (!bVar12) goto LAB_007bb4e0;
    }
    else {
      local_7c = *(float *)(this + 0x1de0);
      local_78 = *(float *)(this + 0x1de4);
      local_74 = *(float *)(this + 0x1de8);
      CBaseEntity::SetAbsOrigin((CBaseEntity *)this,(Vector *)&local_94);
    }
  }
  local_a0 = (Vector *)(this + 0x2e0);
  local_a4 = (CGameTrace *)&local_70;
  uVar5 = (**(code **)(*(int *)this + 0x7a0))(this,0);
  if ((((byte)this[0x14d] & 8) != 0) &&
     (CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this), ((byte)this[0x14d] & 8) != 0)) {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
  }
  UTIL_TraceEntity((CBaseEntity *)this,local_a0,local_a0,uVar5,(IHandleEntity *)this,8,local_a4);
  if (((local_3a != '\0') || (local_39 != '\0')) &&
     ((local_24 == (int *)0x0 || (cVar3 = (**(code **)(*local_24 + 0x16c))(local_24), cVar3 == '\0')
      ))) {
    CBaseEntity::SetAbsOrigin((CBaseEntity *)this,(Vector *)&local_7c);
  }
LAB_007bb4e0:
  if (((byte)this[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
  }
  this[0x1df9] = (CBasePlayer)0x0;
  *(undefined4 *)(this + 0x1de0) = *(undefined4 *)(this + 0x2e0);
  *(undefined4 *)(this + 0x1de4) = *(undefined4 *)(this + 0x2e4);
  *(undefined4 *)(this + 0x1de8) = *(undefined4 *)(this + 0x2e8);
  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)