L L4D2node

CBasePlayer::PhysicsSimulate

0x007bbc80 · 3143 bytes · __thiscall

_ZN11CBasePlayer15PhysicsSimulateEv

Decompiled

undefined (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CBasePlayer::PhysicsSimulate() */

void __thiscall CBasePlayer::PhysicsSimulate(CBasePlayer *this)

{
  undefined4 *puVar1;
  uint *puVar2;
  undefined4 uVar3;
  undefined4 uVar4;
  uint uVar5;
  CUserCmd *pCVar6;
  code *pcVar7;
  char cVar8;
  int iVar9;
  int iVar10;
  undefined4 uVar11;
  int iVar12;
  undefined4 *puVar13;
  CCommandContext *pCVar14;
  undefined *puVar15;
  int iVar16;
  int *piVar17;
  longdouble lVar18;
  int local_ac;
  int local_a8;
  float local_a4;
  undefined4 local_9c;
  undefined4 local_98;
  undefined4 local_94;
  undefined4 local_90;
  undefined4 local_8c;
  undefined4 local_88;
  int local_84;
  undefined4 local_80;
  undefined4 local_7c;
  int local_78;
  undefined **local_74;
  int local_70;
  undefined4 local_6c;
  int local_68;
  undefined **local_64;
  undefined4 local_60;
  undefined4 local_5c;
  undefined4 local_58;
  undefined4 local_54;
  undefined4 local_50;
  undefined1 local_4c;
  undefined4 local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined2 local_3c;
  undefined2 local_3a;
  undefined1 local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  local_9c = 0;
  local_98 = 0;
  if (_towlower == 0) {
    local_84 = 0;
  }
  else {
    (**(code **)(_towlower + 0x50))
              (_towlower,&local_9c,0,0,0,0,"/data/src/game/server/player.cpp",0xd1f,
               &PhysicsSimulate()::tm_fmt,"(%s)%s","Player","CBasePlayer::PhysicsSimulate");
    local_84 = _towlower;
  }
  iVar9 = _DAT_0105db00;
  local_8c = local_9c;
  local_88 = local_98;
                    /* try { // try from 007bbe96 to 007bbef6 has its CatchHandler @ 007bc950 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar10 = ThreadGetCurrentId(), iVar9 == iVar10)) {
    if ((char *)*_DAT_0105d15c != "CBasePlayer::PhysicsSimulate") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xcb8a5d,(char *)0x0,0xcf98a2);
    }
    puVar2 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
    *puVar2 = *puVar2 | 4;
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
  uVar5 = *(uint *)(this + 0x188);
  if (((uVar5 != 0xffffffff) &&
      (puVar15 = g_pEntityList + (uVar5 & 0xfff) * 0x10, puVar15 != (undefined *)0xfffffffc)) &&
     ((*(uint *)(puVar15 + 8) == uVar5 >> 0xc &&
      (piVar17 = *(int **)(puVar15 + 4), piVar17 != (int *)0x0)))) {
                    /* try { // try from 007bc81e to 007bc823 has its CatchHandler @ 007bc968 */
    (**(code **)(*piVar17 + 0x1c8))(piVar17);
  }
  if (*(int *)(this + 300) == gpGlobals[6]) {
LAB_007bbe26:
    iVar9 = _DAT_0105db00;
    if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
       (iVar10 = ThreadGetCurrentId(), iVar9 == iVar10)) {
      cVar8 = CVProfNode::ExitScope();
      if (cVar8 != '\0') {
        _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
      }
      DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
    }
    if (local_84 != 0) {
      (**(code **)(local_84 + 0x54))(local_84,local_8c,local_88,0,0,0);
    }
    return;
  }
  *(undefined4 *)(this + 300) = gpGlobals[6];
  if (*(int *)(this + 0x1dcc) == 0) {
                    /* try { // try from 007bbf0b to 007bc0a3 has its CatchHandler @ 007bc968 */
    lVar18 = (longdouble)IntervalTimer::Now();
    if (1.0 < (float)lVar18 - *(float *)(this + 0x1fec)) {
      local_74 = &PTR__CUserCmd_00c15058;
      local_70 = 0;
      local_6c = 0;
      local_68 = 0;
      local_64 = (undefined **)0x0;
      local_60 = 0;
      local_5c = 0;
      local_58 = 0;
      local_54 = 0;
      local_50 = 0;
      local_4c = 0;
      local_48 = 0;
      local_44 = 0;
      local_40 = 0;
      local_3c = 0;
      local_3a = 0;
      local_38 = 0;
      local_34 = 0;
      local_30 = 0;
      local_2c = 0;
      local_28 = 0;
      local_24 = 0;
      local_20 = 0;
      _V_memset(&local_74,0,0x58);
      local_5c = 0;
      local_58 = 0;
      local_54 = 0;
      local_50 = 0;
      local_4c = 0;
      local_70 = *(int *)(this + 0x1f90) + 1;
      puVar13 = (undefined4 *)(**(code **)(*(int *)this + 0x238))(this);
      local_68 = *puVar13;
      local_64 = (undefined **)puVar13[1];
      local_60 = puVar13[2];
      local_40 = (**(code **)(*random_valve + 8))(random_valve,0,0x7fffffff);
      (**(code **)(*(int *)this + 0x718))(this,&local_74,1,1,0,0);
    }
  }
  else {
                    /* try { // try from 007bbdb8 to 007bbe15 has its CatchHandler @ 007bc968 */
    lVar18 = (longdouble)IntervalTimer::Now();
    if ((float)lVar18 != *(float *)(this + 0x1fec)) {
                    /* try { // try from 007bc887 to 007bc889 has its CatchHandler @ 007bc968 */
      (**(code **)(*(int *)(this + 0x1fe8) + 4))(this + 0x1fe8,this + 0x1fec);
      *(float *)(this + 0x1fec) = (float)lVar18;
    }
  }
  iVar9 = DetermineSimulationTicks(this);
  if (0 < iVar9) {
    AdjustPlayerTimeBase(this,iVar9);
  }
  if (this[0x1ca4] != (CBasePlayer)0x0) {
    RunNullCommand(this);
    CUtlVector<CCommandContext,CUtlMemory<CCommandContext,int>>::RemoveAll
              ((CUtlVector<CCommandContext,CUtlMemory<CCommandContext,int>> *)(this + 0x1dc0));
    goto LAB_007bbe26;
  }
  local_ac = 0;
  local_a8 = 0;
  uVar3 = gpGlobals[3];
  uVar4 = gpGlobals[4];
  local_74 = (undefined **)0x0;
  local_70 = 0;
  local_6c = 0;
  iVar9 = *(int *)(this + 0x1dcc);
  local_68 = 0;
  local_64 = (undefined **)0x0;
  if (0 < iVar9) {
    do {
      if (local_a8 < *(int *)(this + 0x1dcc)) {
        piVar17 = (int *)(local_ac + *(int *)(this + 0x1dc0));
      }
      else {
        piVar17 = (int *)0x0;
      }
      if (piVar17[3] != 0) {
        iVar16 = piVar17[7];
        iVar12 = piVar17[6];
        iVar10 = piVar17[5];
        if (iVar16 < 0x18) {
          if (iVar12 - iVar10 < iVar16) {
            do {
              *(int *)(this + 0x1f94) = *(int *)(this + 0x1f94) + 1;
                    /* try { // try from 007bc194 to 007bc3a6 has its CatchHandler @ 007bc94c */
              CUtlVector<CUserCmd,CUtlMemory<CUserCmd,int>>::InsertBefore
                        ((CUtlVector<CUserCmd,CUtlMemory<CUserCmd,int>> *)&local_74,local_68,
                         (CUserCmd *)(this + 0x1f8c));
              iVar16 = iVar16 + -1;
            } while (iVar16 != iVar12 - iVar10);
            iVar10 = piVar17[5];
          }
          if (0 < iVar16) {
            do {
              CUtlVector<CUserCmd,CUtlMemory<CUserCmd,int>>::InsertBefore
                        ((CUtlVector<CUserCmd,CUtlMemory<CUserCmd,int>> *)&local_74,local_68,
                         (CUserCmd *)((iVar16 + -1 + iVar10) * 0x58 + *piVar17));
              iVar16 = iVar16 + -1;
              iVar10 = piVar17[5];
            } while (iVar16 != 0);
          }
        }
        iVar10 = iVar10 + -1;
        iVar16 = iVar10 * 0x58;
        if (-1 < iVar10) {
          do {
            CUtlVector<CUserCmd,CUtlMemory<CUserCmd,int>>::InsertBefore
                      ((CUtlVector<CUserCmd,CUtlMemory<CUserCmd,int>> *)&local_74,local_68,
                       (CUserCmd *)(*piVar17 + iVar16));
            iVar10 = iVar10 + -1;
            iVar16 = iVar16 + -0x58;
          } while (iVar10 != -1);
        }
        pCVar6 = (CUserCmd *)*piVar17;
        if (pCVar6 != (CUserCmd *)(this + 0x1f8c)) {
          *(undefined4 *)(this + 0x1f90) = *(undefined4 *)(pCVar6 + 4);
          *(undefined4 *)(this + 0x1f94) = *(undefined4 *)(pCVar6 + 8);
          *(undefined4 *)(this + 0x1f98) = *(undefined4 *)(pCVar6 + 0xc);
          *(undefined4 *)(this + 0x1f9c) = *(undefined4 *)(pCVar6 + 0x10);
          *(undefined4 *)(this + 0x1fa0) = *(undefined4 *)(pCVar6 + 0x14);
          *(undefined4 *)(this + 0x1fa4) = *(undefined4 *)(pCVar6 + 0x18);
          *(undefined4 *)(this + 0x1fa8) = *(undefined4 *)(pCVar6 + 0x1c);
          *(undefined4 *)(this + 0x1fac) = *(undefined4 *)(pCVar6 + 0x20);
          *(undefined4 *)(this + 0x1fb0) = *(undefined4 *)(pCVar6 + 0x24);
          *(CUserCmd *)(this + 0x1fb4) = pCVar6[0x28];
          *(undefined4 *)(this + 0x1fb8) = *(undefined4 *)(pCVar6 + 0x2c);
          *(undefined4 *)(this + 0x1fbc) = *(undefined4 *)(pCVar6 + 0x30);
          *(undefined4 *)(this + 0x1fc0) = *(undefined4 *)(pCVar6 + 0x34);
          *(undefined2 *)(this + 0x1fc4) = *(undefined2 *)(pCVar6 + 0x38);
          *(undefined2 *)(this + 0x1fc6) = *(undefined2 *)(pCVar6 + 0x3a);
          *(CUserCmd *)(this + 0x1fc8) = pCVar6[0x3c];
          *(undefined4 *)(this + 0x1fcc) = *(undefined4 *)(pCVar6 + 0x40);
          *(undefined4 *)(this + 0x1fd0) = *(undefined4 *)(pCVar6 + 0x44);
          *(undefined4 *)(this + 0x1fd4) = *(undefined4 *)(pCVar6 + 0x48);
          *(undefined4 *)(this + 0x1fd8) = *(undefined4 *)(pCVar6 + 0x4c);
          *(undefined4 *)(this + 0x1fdc) = *(undefined4 *)(pCVar6 + 0x50);
          *(undefined4 *)(this + 0x1fe0) = *(undefined4 *)(pCVar6 + 0x54);
        }
      }
      local_a8 = local_a8 + 1;
      local_ac = local_ac + 0x24;
    } while (local_a8 != iVar9);
  }
  cVar8 = CBaseEntity::IsSimulatingOnAlternateTicks();
  iVar10 = 2 - (uint)(cVar8 == '\0');
  iVar9 = local_68;
  if ((iVar10 <= (int)gpGlobals[9]) && (iVar10 < local_68)) {
    iVar10 = gpGlobals[9] + -1;
    if (local_68 < iVar10) {
      iVar10 = local_68;
    }
    iVar9 = local_68 - iVar10;
    if (0 < iVar10) {
                    /* try { // try from 007bc843 to 007bc86b has its CatchHandler @ 007bc94c */
      pCVar14 = (CCommandContext *)RemoveAllCommandContextsExceptNewest(this);
      ReplaceContextCommands(this,pCVar14,(CUserCmd *)(local_74 + iVar9 * 0x16),iVar10);
      goto LAB_007bc379;
    }
  }
  CUtlVector<CCommandContext,CUtlMemory<CCommandContext,int>>::RemoveAll
            ((CUtlVector<CCommandContext,CUtlMemory<CCommandContext,int>> *)(this + 0x1dc0));
LAB_007bc379:
  local_a4 = (float)gpGlobals[7];
  puVar13 = gpGlobals;
  if (0 < iVar9) {
    piVar17 = (int *)MoveHelperServer();
    (**(code **)(*piVar17 + 4))(piVar17,this);
    iVar10 = IPredictionSystem::g_pPredictionSystems;
    if (this[0x1cf5] != (CBasePlayer)0x0) {
      for (; iVar10 != 0; iVar10 = *(int *)(iVar10 + 4)) {
        *(CBasePlayer **)(iVar10 + 0xc) = this;
      }
    }
    iVar10 = 0;
    do {
      pcVar7 = *(code **)(*(int *)this + 0x71c);
                    /* try { // try from 007bc4a5 to 007bc554 has its CatchHandler @ 007bc94c */
      uVar11 = MoveHelperServer();
      (*pcVar7)(this,local_74 + iVar10 * 0x16,uVar11);
      if (*(int *)(this + 0x1dd4) != 0) {
        local_94 = 0;
        local_90 = 0;
        if (___atan2f_finite == 0) {
          local_78 = 0;
        }
        else {
          (**(code **)(___atan2f_finite + 0x50))
                    (___atan2f_finite,&local_94,0,0,0,0,"/data/src/game/server/player.cpp",0xdc8,
                     &PhysicsSimulate()::tm_fmt,"(%s)%s","Unaccounted",
                     "CBasePlayer::PhysicsSimulate-UpdateVPhysicsPosition");
          local_78 = ___atan2f_finite;
        }
        iVar16 = _DAT_0105db00;
        local_80 = local_94;
        local_7c = local_90;
                    /* try { // try from 007bc58c to 007bc5da has its CatchHandler @ 007bc978 */
        if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
           (iVar12 = ThreadGetCurrentId(), iVar16 == iVar12)) {
          if ((char *)*_DAT_0105d15c != "CBasePlayer::PhysicsSimulate-UpdateVPhysicsPosition") {
            _DAT_0105d15c =
                 (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xcb978c,(char *)0x1,0xbfafa1);
          }
          CVProfNode::EnterScope();
          DAT_0105d158 = '\0';
        }
                    /* try { // try from 007bc418 to 007bc41c has its CatchHandler @ 007bc8e1 */
        UpdateVPhysicsPosition(this,(Vector *)(this + 0x20d0),(Vector *)(this + 0x20dc),local_a4);
        iVar16 = _DAT_0105db00;
        local_a4 = local_a4 + (float)gpGlobals[7];
        if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
           (iVar12 = ThreadGetCurrentId(), iVar16 == iVar12)) {
          cVar8 = CVProfNode::ExitScope();
          if (cVar8 != '\0') {
            _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
          }
          DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
        }
        if (local_78 != 0) {
          (**(code **)(local_78 + 0x54))(local_78,local_80,local_7c,0,0,0);
        }
      }
      iVar10 = iVar10 + 1;
      iVar16 = IPredictionSystem::g_pPredictionSystems;
    } while (iVar10 != iVar9);
    for (; iVar16 != 0; iVar16 = *(int *)(iVar16 + 4)) {
      *(undefined4 *)(iVar16 + 0xc) = 0;
    }
                    /* try { // try from 007bc666 to 007bc67a has its CatchHandler @ 007bc94c */
    piVar17 = (int *)MoveHelperServer();
    (**(code **)(*piVar17 + 4))(piVar17,0);
    puVar13 = gpGlobals;
    if (*(short *)(this + 0x22fa) != 0) {
      puVar1 = (undefined4 *)(*(int *)(this + 0x22e8) + (uint)*(ushort *)(this + 0x22f6) * 0x28);
      *puVar1 = *gpGlobals;
      if (((byte)this[0x14d] & 8) != 0) {
                    /* try { // try from 007bc8cd to 007bc8d1 has its CatchHandler @ 007bc94c */
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      }
      puVar1[6] = *(undefined4 *)(this + 0x2e0);
      puVar1[7] = *(undefined4 *)(this + 0x2e4);
      puVar13 = gpGlobals;
      puVar1[8] = *(undefined4 *)(this + 0x2e8);
      uVar11 = puVar13[3];
      puVar1[1] = iVar9;
      puVar1[4] = uVar11;
    }
  }
  puVar13[3] = uVar3;
  puVar13[4] = uVar4;
  iVar9 = local_68 + -1;
  iVar10 = iVar9 * 0x58;
  if (-1 < iVar9) {
    do {
      iVar9 = iVar9 + -1;
      puVar13 = (undefined4 *)((int)local_74 + iVar10);
      iVar10 = iVar10 + -0x58;
      (**(code **)*puVar13)(puVar13);
    } while (iVar9 != -1);
  }
  local_68 = 0;
  CUtlMemory<CUserCmd,int>::Purge((CUtlMemory<CUserCmd,int> *)&local_74);
  local_64 = local_74;
  CUtlMemory<CUserCmd,int>::Purge((CUtlMemory<CUserCmd,int> *)&local_74);
  iVar9 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar10 = ThreadGetCurrentId(), iVar9 == iVar10)) {
    cVar8 = CVProfNode::ExitScope();
    if (cVar8 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (local_84 == 0) {
    return;
  }
  (**(code **)(local_84 + 0x54))(local_84,local_8c,local_88,0,0,0);
  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)