L L4D2node

CTerrorGameMovement::PlayerMove

0x005014d0 · 1632 bytes · __thiscall

_ZN19CTerrorGameMovement10PlayerMoveEv

Decompiled

undefined (1 param)

/* CTerrorGameMovement::PlayerMove() */

void __thiscall CTerrorGameMovement::PlayerMove(CTerrorGameMovement *this)

{
  uint uVar1;
  CBaseEntity *this_00;
  CBaseEdict *pCVar2;
  int *piVar3;
  char cVar4;
  Vector *pVVar5;
  int *piVar6;
  int iVar7;
  int iVar8;
  undefined *puVar9;
  CTerrorPlayer *pCVar10;
  CTerrorPlayer *this_01;
  longdouble lVar11;
  float fVar12;
  float fVar13;
  float local_4c;
  float local_48;
  undefined4 local_44;
  float local_40;
  float local_3c;
  float local_34;
  float local_30;
  uint local_2c;
  float local_28;
  float local_24;
  uint local_20;
  
  piVar3 = mdlcache;
  (**(code **)(*mdlcache + 0x68))(mdlcache);
                    /* try { // try from 005014ed to 0050174a has its CatchHandler @ 00501b6c */
  UpdateMinGroundNormalZ(this);
  cVar4 = (**(code **)(**(int **)(this + 0x810) + 0x790))(*(int **)(this + 0x810));
  if (cVar4 != '\0') {
    *(uint *)(*(int *)(this + 8) + 0x24) = *(uint *)(*(int *)(this + 8) + 0x24) | 4;
  }
  cVar4 = (**(code **)(**(int **)(this + 0x810) + 0x804))(*(int **)(this + 0x810));
  pCVar10 = *(CTerrorPlayer **)(this + 0x810);
  if ((cVar4 == '\0') ||
     ((((uVar1 = *(uint *)(pCVar10 + 0x3edc), uVar1 != 0xffffffff &&
        (puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar9 + 8) == uVar1 >> 0xc)) && (*(int *)(puVar9 + 4) != 0)))) {
LAB_00501786:
    uVar1 = *(uint *)(pCVar10 + 0x3ee0);
    puVar9 = g_pEntityList;
  }
  else {
    *(undefined4 *)(*(int *)(this + 8) + 0x30) = 0;
    *(undefined4 *)(*(int *)(this + 8) + 0x34) = 0;
    *(uint *)(*(int *)(this + 8) + 0x24) = *(uint *)(*(int *)(this + 8) + 0x24) & 0xfffff9ed;
    cVar4 = (**(code **)(**(int **)(this + 0x810) + 0x7e8))(*(int **)(this + 0x810));
                    /* try { // try from 00501769 to 00501ab7 has its CatchHandler @ 00501b6c */
    if ((cVar4 != '\0') && (cVar4 = CTerrorPlayer::CanCrawl(), cVar4 != '\0')) {
      pCVar10 = *(CTerrorPlayer **)(this + 0x810);
      goto LAB_00501786;
    }
    puVar9 = g_pEntityList;
    *(undefined4 *)(*(int *)(this + 8) + 0x2c) = 0;
    *(uint *)(*(int *)(this + 8) + 0x24) = *(uint *)(*(int *)(this + 8) + 0x24) & 0xfffffff7;
    pCVar10 = *(CTerrorPlayer **)(this + 0x810);
    uVar1 = *(uint *)(pCVar10 + 0x3ee0);
  }
  if (((uVar1 != 0xffffffff) &&
      (puVar9 = puVar9 + (uVar1 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
     ((*(uint *)(puVar9 + 8) == uVar1 >> 0xc && (*(int *)(puVar9 + 4) != 0)))) {
    CTerrorPlayer::AddJockeyContribution
              (pCVar10,(float *)(*(int *)(this + 8) + 0x2c),(float *)(*(int *)(this + 8) + 0x30));
    pCVar10 = *(CTerrorPlayer **)(this + 0x810);
    this_01 = (CTerrorPlayer *)0x0;
    if (pCVar10 == (CTerrorPlayer *)0x0) goto LAB_00501610;
  }
  cVar4 = (**(code **)(*(int *)pCVar10 + 300))(pCVar10);
  pCVar10 = *(CTerrorPlayer **)(this + 0x810);
  if (cVar4 == '\0') {
LAB_005015e1:
    this_01 = (CTerrorPlayer *)0x0;
    if (pCVar10 == (CTerrorPlayer *)0x0) goto LAB_00501610;
  }
  else {
    lVar11 = (longdouble)CountdownTimer::Now();
    if ((float)lVar11 < *(float *)(pCVar10 + 0x32dc)) {
      *(uint *)(*(int *)(this + 8) + 0x24) = *(uint *)(*(int *)(this + 8) + 0x24) & 0xfffff9e3;
      iVar7 = CBaseEntity::GetTeamNumber(*(CBaseEntity **)(this + 0x810));
      if (iVar7 == 3) {
        *(uint *)(*(int *)(this + 8) + 0x24) = *(uint *)(*(int *)(this + 8) + 0x24) & 0xfffff7fe;
      }
      if (*(char *)(*(int *)(this + 0x810) + 0x1a90) != '\0') {
        *(uint *)(*(int *)(this + 8) + 0x24) = *(uint *)(*(int *)(this + 8) + 0x24) | 4;
      }
      *(undefined4 *)(*(int *)(this + 8) + 0x2c) = 0;
      *(undefined4 *)(*(int *)(this + 8) + 0x30) = 0;
      *(undefined4 *)(*(int *)(this + 8) + 0x34) = 0;
    }
    pCVar10 = *(CTerrorPlayer **)(this + 0x810);
    if (*(CBaseEntity *)(pCVar10 + 0x33a0) != (CBaseEntity)0x0) {
      iVar7 = CBaseEntity::GetGroundEntity((CBaseEntity *)pCVar10);
      if (iVar7 == 0) {
        *(uint *)(*(int *)(this + 8) + 0x24) = *(uint *)(*(int *)(this + 8) + 0x24) & 0xfffff9e3;
        *(undefined4 *)(*(int *)(this + 8) + 0x2c) = 0;
        *(undefined4 *)(*(int *)(this + 8) + 0x30) = 0;
        *(undefined4 *)(*(int *)(this + 8) + 0x34) = 0;
        pCVar10 = *(CTerrorPlayer **)(this + 0x810);
      }
      else {
        pCVar10 = *(CTerrorPlayer **)(this + 0x810);
        if (pCVar10[0x33a0] == (CTerrorPlayer)0x0) goto LAB_005015e5;
        if (pCVar10[0x6c] == (CTerrorPlayer)0x0) {
          pCVar2 = *(CBaseEdict **)(pCVar10 + 0x30);
          if (pCVar2 != (CBaseEdict *)0x0) {
            *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
            iVar7 = CBaseEdict::GetChangeAccessor(pCVar2);
            *(undefined2 *)(iVar7 + 2) = 0;
          }
        }
        else {
          pCVar10[0x70] = (CTerrorPlayer)((byte)pCVar10[0x70] | 1);
        }
        pCVar10[0x33a0] = (CTerrorPlayer)0x0;
        pCVar10 = *(CTerrorPlayer **)(this + 0x810);
      }
      goto LAB_005015e1;
    }
  }
LAB_005015e5:
  pVVar5 = (Vector *)CTerrorPlayer::GetStaggerDir(pCVar10);
  if (pVVar5 != (Vector *)0x0) {
    ComputeMoveTowardVector(*(CTerrorPlayer **)(this + 0x810),pVVar5,*(CMoveData **)(this + 8));
  }
  this_01 = *(CTerrorPlayer **)(this + 0x810);
LAB_00501610:
  uVar1 = *(uint *)(this_01 + 0x33ac);
  if ((((uVar1 != 0xffffffff) &&
       (puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
      (*(uint *)(puVar9 + 8) == uVar1 >> 0xc)) && (iVar7 = *(int *)(puVar9 + 4), iVar7 != 0)) {
    *(uint *)(*(int *)(this + 8) + 0x24) = *(uint *)(*(int *)(this + 8) + 0x24) | 0x20000;
    iVar8 = *(int *)(this + 8);
    local_4c = *(float *)(iVar8 + 0x9c);
    local_48 = *(float *)(iVar8 + 0xa0);
    local_44 = *(undefined4 *)(iVar8 + 0xa4);
    CCollisionProperty::CalcNearestPoint
              ((CCollisionProperty *)(iVar7 + 0x194),(Vector *)&local_4c,(Vector *)&local_40);
    local_2c = 0;
    local_34 = local_40 - local_4c;
    local_30 = local_3c - local_48;
    fVar12 = *(float *)(*(CTerrorPlayer **)(this + 0x810) + 0x33b0);
    lVar11 = (longdouble)CTerrorPlayer::GetCurrentPushDistance(*(CTerrorPlayer **)(this + 0x810));
    if (fVar12 + 4.0 < (float)lVar11) {
      ComputeMoveTowardVector
                (*(CTerrorPlayer **)(this + 0x810),(Vector *)&local_34,*(CMoveData **)(this + 8));
    }
    else if ((float)lVar11 < fVar12 - 4.0) {
      local_20 = local_2c ^ 0x80000000;
      local_24 = -local_30;
      local_28 = -local_34;
      ComputeMoveTowardVector
                (*(CTerrorPlayer **)(this + 0x810),(Vector *)&local_28,*(CMoveData **)(this + 8));
    }
    else {
      *(undefined4 *)(*(CMoveData **)(this + 8) + 0x2c) = 0;
    }
    this_01 = *(CTerrorPlayer **)(this + 0x810);
  }
  piVar6 = (int *)CTerrorPlayer::GetMountedWeapon(this_01);
  if (piVar6 != (int *)0x0) {
    *(uint *)(*(int *)(this + 8) + 0x24) = *(uint *)(*(int *)(this + 8) + 0x24) & 0xfffdffff;
    fVar12 = *(float *)(*(int *)(this + 8) + 0x9c);
    fVar13 = *(float *)(*(int *)(this + 8) + 0xa0);
    (**(code **)(*piVar6 + 0x474))(piVar6,&local_34);
    local_20 = 0;
    local_28 = local_34 - fVar12;
    local_24 = local_30 - fVar13;
    ComputeMoveTowardVector
              (*(CTerrorPlayer **)(this + 0x810),(Vector *)&local_28,*(CMoveData **)(this + 8));
  }
  this_00 = *(CBaseEntity **)(this + 0x810);
  if (((this_00 == (CBaseEntity *)0x0) || (uVar1 = *(uint *)(this_00 + 0x33a4), uVar1 == 0xffffffff)
      ) || ((puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc ||
            ((*(uint *)(puVar9 + 8) != uVar1 >> 0xc ||
             (*(CBaseEntity **)(puVar9 + 4) == (CBaseEntity *)0x0)))))) {
    CGameMovement::PlayerMove((CGameMovement *)this);
  }
  else {
    CBaseEntity::SetGroundEntity(this_00,*(CBaseEntity **)(puVar9 + 4));
  }
  iVar7 = *(int *)(this + 0x810);
  if ((iVar7 != 0) && ((*(byte *)(iVar7 + 0x150) & 1) != 0)) {
    fVar12 = *(float *)(iVar7 + 0x2854);
    if ((fVar12 < 1.0) &&
       (fVar13 = *(float *)(gpGlobals + 0x10) * 0.33333334 + fVar12, fVar12 != fVar13)) {
      if (*(char *)(iVar7 + 0x6c) == '\0') {
        pCVar2 = *(CBaseEdict **)(iVar7 + 0x30);
        if (pCVar2 != (CBaseEdict *)0x0) {
          *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
          iVar8 = CBaseEdict::GetChangeAccessor(pCVar2);
          *(undefined2 *)(iVar8 + 2) = 0;
        }
      }
      else {
        *(byte *)(iVar7 + 0x70) = *(byte *)(iVar7 + 0x70) | 1;
      }
      *(float *)(iVar7 + 0x2854) = fVar13;
      iVar7 = *(int *)(this + 0x810);
      fVar12 = *(float *)(iVar7 + 0x2854);
    }
    if (1.0 < fVar12) {
      if (*(char *)(iVar7 + 0x6c) == '\0') {
        pCVar2 = *(CBaseEdict **)(iVar7 + 0x30);
        if (pCVar2 != (CBaseEdict *)0x0) {
          *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
          iVar8 = CBaseEdict::GetChangeAccessor(pCVar2);
          *(undefined2 *)(iVar8 + 2) = 0;
        }
      }
      else {
        *(byte *)(iVar7 + 0x70) = *(byte *)(iVar7 + 0x70) | 1;
      }
      *(undefined4 *)(iVar7 + 0x2854) = 0x3f800000;
    }
  }
  UpdateViewOffset(this);
  (**(code **)(*piVar3 + 0x6c))(piVar3);
  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)