L L4D2node

CCSGameMovement::Duck

0x004312f0 · 1921 bytes · __thiscall

_ZN15CCSGameMovement4DuckEv

Decompiled

undefined (1 param)

/* CCSGameMovement::Duck() */

void __thiscall CCSGameMovement::Duck(CCSGameMovement *this)

{
  uint uVar1;
  uint uVar2;
  CBaseEdict *pCVar3;
  bool bVar4;
  bool bVar5;
  char cVar6;
  int iVar7;
  int iVar8;
  uint uVar9;
  undefined4 *puVar10;
  int iVar11;
  int iVar12;
  float fVar13;
  undefined4 local_70;
  undefined4 local_6c;
  float local_68;
  float local_44;
  
  uVar1 = *(uint *)(*(int *)(this + 8) + 0x28);
  uVar2 = *(uint *)(*(int *)(this + 8) + 0x24);
  iVar7 = CBaseEntity::GetGroundEntity(*(CBaseEntity **)(this + 4));
  iVar11 = *(int *)(this + 4);
  if ((iVar7 != 0) || (bVar4 = true, *(char *)(iVar11 + 0x186) == '\t')) {
    bVar4 = false;
  }
  uVar9 = *(uint *)(iVar11 + 0x150);
  iVar7 = *(int *)(iVar11 + 0x1a9c);
  iVar11 = *(int *)(iVar11 + 0x1a98);
  iVar12 = *(int *)(this + 8);
  if ((*(byte *)(iVar12 + 0x24) & 4) == 0) {
    *(uint *)(iVar12 + 0x28) = *(uint *)(iVar12 + 0x28) & 0xfffffffb;
    cVar6 = CGameMovement::IsDead((CGameMovement *)this);
  }
  else {
    *(uint *)(iVar12 + 0x28) = *(uint *)(iVar12 + 0x28) | 4;
    cVar6 = CGameMovement::IsDead((CGameMovement *)this);
  }
  if (cVar6 != '\0') {
    if ((*(byte *)(*(int *)(this + 4) + 0x150) & 2) == 0) {
      return;
    }
    goto LAB_004313e0;
  }
  (**(code **)(*(int *)this + 0xe4))(this);
  iVar12 = *(int *)(this + 0x7e0);
  if (*(char *)(iVar12 + 0x2898) == '\0') {
    if (bVar4) {
      return;
    }
  }
  else {
    if (bVar4) {
      if (0.0 < *(float *)(*(int *)(this + 8) + 0x48) ||
          *(float *)(*(int *)(this + 8) + 0x48) == 0.0) {
        return;
      }
      cVar6 = HandleFastDuck(this,false);
      if (cVar6 == '\0') {
        return;
      }
      iVar11 = *(int *)(this + 0x7e0);
      if (*(char *)(iVar11 + 0x2898) == '\0') {
        return;
      }
      if (*(char *)(iVar11 + 0x6c) == '\0') {
        pCVar3 = *(CBaseEdict **)(iVar11 + 0x30);
        if (pCVar3 != (CBaseEdict *)0x0) {
          *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
          iVar7 = CBaseEdict::GetChangeAccessor(pCVar3);
          *(undefined2 *)(iVar7 + 2) = 0;
        }
      }
      else {
        *(byte *)(iVar11 + 0x70) = *(byte *)(iVar11 + 0x70) | 1;
      }
      *(undefined1 *)(iVar11 + 0x2898) = 0;
      return;
    }
    if (*(char *)(iVar12 + 0x6c) == '\0') {
      pCVar3 = *(CBaseEdict **)(iVar12 + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar8 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar8 + 2) = 0;
      }
    }
    else {
      *(byte *)(iVar12 + 0x70) = *(byte *)(iVar12 + 0x70) | 1;
    }
    *(undefined1 *)(iVar12 + 0x2898) = 0;
  }
  uVar9 = uVar9 >> 1;
  iVar12 = *(int *)(this + 4);
  bVar4 = 0 < iVar7;
  bVar5 = iVar11 < 1;
  if ((*(byte *)(*(int *)(this + 8) + 0x24) & 4) == 0) {
    cVar6 = *(char *)(iVar12 + 0x1a91);
    if ((cVar6 == '\0') && ((uVar9 & 1) == 0)) {
      if (!bVar4) {
        if (*(char *)(iVar12 + 0x1a90) == '\0') {
          cVar6 = CGameMovement::IsDead((CGameMovement *)this);
          if (cVar6 != '\0') {
            return;
          }
          iVar11 = *(int *)(this + 4);
          if ((*(byte *)(iVar11 + 0x1d20) & 8) != 0) {
            return;
          }
          if (*(int *)(iVar11 + 0x1a98) != 0) {
            return;
          }
          puVar10 = (undefined4 *)
                    (**(code **)(*(int *)this + 0x24))(this,*(undefined1 *)(iVar11 + 0x1a90));
          local_70 = *puVar10;
          local_6c = puVar10[1];
          fVar13 = (float)puVar10[2];
          local_68 = fVar13;
          iVar11 = (**(code **)(**(int **)(this + 4) + 0x250))(*(int **)(this + 4));
          if (fVar13 == *(float *)(iVar11 + 8)) {
            return;
          }
          (**(code **)(**(int **)(this + 4) + 0x254))(*(int **)(this + 4),&local_70);
          return;
        }
LAB_004316c8:
        if (*(char *)(iVar12 + 0x1a92) != '\0') {
          cVar6 = CGameMovement::CanUnDuckJump((CGameMovement *)this,(CGameTrace *)&local_70);
          if ((cVar6 != '\0') &&
             (CGameMovement::FinishUnDuckJump((CGameMovement *)this,(CGameTrace *)&local_70),
             local_44 < 1.0)) {
            iVar11 = *(int *)(this + 4);
            iVar7 = (int)((1.0 - local_44) * 200.0 + 800.0);
            if (iVar7 != *(int *)(iVar11 + 0x1a98)) {
              (**(code **)(*(int *)(iVar11 + 0x1a40) + 4))(iVar11 + 0x1a40,iVar11 + 0x1a98);
              *(int *)(iVar11 + 0x1a98) = iVar7;
            }
          }
        }
        if (!bVar5) {
          return;
        }
        iVar11 = *(int *)(this + 4);
        if (((*(char *)(iVar11 + 0x1ad0) == '\0') && (*(char *)(iVar11 + 0x1a91) == '\0')) &&
           (*(char *)(iVar11 + 0x1a90) == '\0')) {
          return;
        }
        if ((uVar1 & 4 & (uVar2 ^ uVar1)) != 0) {
          if ((uVar9 & 1) == 0) {
            if ((*(char *)(iVar11 + 0x1a91) != '\0') && (*(char *)(iVar11 + 0x1a90) == '\0')) {
              fVar13 = (float)(1000 - *(int *)(iVar11 + 0x1a94)) * 0.0025;
              if (fVar13 <= 0.0) {
                fVar13 = 0.0;
              }
              if (1.0 <= fVar13) {
                fVar13 = 1.0;
              }
              iVar7 = (int)(fVar13 * 200.0) + 800;
              if (*(int *)(iVar11 + 0x1a94) != iVar7) {
                CPlayerLocalData::NetworkVar_m_nDuckTimeMsecs::NetworkStateChanged
                          ((void *)(iVar11 + 0x1a94));
                *(int *)(iVar11 + 0x1a94) = iVar7;
              }
            }
          }
          else if (*(int *)(iVar11 + 0x1a94) != 1000) {
            CPlayerLocalData::NetworkVar_m_nDuckTimeMsecs::NetworkStateChanged
                      ((void *)(iVar11 + 0x1a94));
            *(undefined4 *)(iVar11 + 0x1a94) = 1000;
          }
        }
        cVar6 = (**(code **)(*(int *)this + 0xf0))(this);
        iVar11 = *(int *)(this + 4);
        if (cVar6 == '\0') {
          if (*(int *)(iVar11 + 0x1a94) == 1000) {
            return;
          }
          CGameMovement::SetDuckedEyeOffset((CGameMovement *)this,1.0);
          iVar11 = *(int *)(this + 4);
          if (*(int *)(iVar11 + 0x1a94) != 1000) {
            (**(code **)(*(int *)(iVar11 + 0x1a40) + 4))(iVar11 + 0x1a40,iVar11 + 0x1a94);
            *(undefined4 *)(iVar11 + 0x1a94) = 1000;
            iVar11 = *(int *)(this + 4);
          }
          if (*(char *)(iVar11 + 0x1a90) != '\x01') {
            (**(code **)(*(int *)(iVar11 + 0x1a40) + 4))(iVar11 + 0x1a40,iVar11 + 0x1a90);
            *(undefined1 *)(iVar11 + 0x1a90) = 1;
            iVar11 = *(int *)(this + 4);
          }
          if (*(char *)(iVar11 + 0x1a91) == '\0') {
            return;
          }
          CPlayerLocalData::NetworkVar_m_bDucking::NetworkStateChanged((void *)(iVar11 + 0x1a91));
          *(undefined1 *)(iVar11 + 0x1a91) = 0;
          return;
        }
        if ((*(char *)(iVar11 + 0x1a91) == '\0') && (*(char *)(iVar11 + 0x1a90) == '\0')) {
          return;
        }
        iVar11 = 1000 - *(int *)(iVar11 + 0x1a94);
        if (iVar11 < 0) {
          iVar11 = 0;
        }
        else if (200 < iVar11) {
LAB_004313e0:
          (**(code **)(*(int *)this + 0xe8))(this);
          return;
        }
        fVar13 = (float)iVar11 * 0.005;
        if (fVar13 <= 0.0) {
          fVar13 = 0.0;
        }
        if (1.0 <= fVar13) {
          fVar13 = 1.0;
        }
        fVar13 = 1.0 - fVar13;
        CGameMovement::SetDuckedEyeOffset
                  ((CGameMovement *)this,fVar13 * fVar13 * 3.0 - (fVar13 + fVar13) * fVar13 * fVar13
                  );
        iVar11 = *(int *)(this + 4);
        if (*(char *)(iVar11 + 0x1a91) == '\x01') {
          return;
        }
        CPlayerLocalData::NetworkVar_m_bDucking::NetworkStateChanged((void *)(iVar11 + 0x1a91));
        *(undefined1 *)(iVar11 + 0x1a91) = 1;
        return;
      }
    }
    else if (!bVar4) goto LAB_004316c8;
LAB_004314b9:
    if (cVar6 == '\0') goto LAB_004314c1;
  }
  else if (*(char *)(iVar12 + 0x1a91) == '\0') {
    if ((*(byte *)(iVar12 + 0x150) & 2) != 0) goto LAB_004314c1;
    if (*(int *)(iVar12 + 0x1a94) == 1000) {
LAB_00431840:
      (**(code **)(*(int *)(iVar12 + 0x1a40) + 4))(iVar12 + 0x1a40,iVar12 + 0x1a91);
      *(undefined1 *)(iVar12 + 0x1a91) = 1;
    }
    else {
      (**(code **)(*(int *)(iVar12 + 0x1a40) + 4))(iVar12 + 0x1a40,iVar12 + 0x1a94);
      *(undefined4 *)(iVar12 + 0x1a94) = 1000;
      iVar12 = *(int *)(this + 4);
      if (*(char *)(iVar12 + 0x1a91) != '\x01') goto LAB_00431840;
    }
    (**(code **)(*(int *)this + 0x114))(this);
    iVar12 = *(int *)(this + 4);
    cVar6 = *(char *)(iVar12 + 0x1a91);
    goto LAB_004314b9;
  }
  if ((bVar5) && (!bVar4)) {
    iVar7 = 1000 - *(int *)(iVar12 + 0x1a94);
    iVar11 = 0;
    if (-1 < iVar7) {
      iVar11 = iVar7;
    }
    if ((iVar11 < 0x191) && ((uVar9 & 1) == 0)) {
      fVar13 = (float)iVar11 * 0.0025;
      if (fVar13 <= 0.0) {
        fVar13 = 0.0;
      }
      if (1.0 <= fVar13) {
        fVar13 = 1.0;
      }
      CGameMovement::SetDuckedEyeOffset
                ((CGameMovement *)this,fVar13 * fVar13 * 3.0 - (fVar13 + fVar13) * fVar13 * fVar13);
      return;
    }
    (**(code **)(*(int *)this + 0xec))(this);
    return;
  }
LAB_004314c1:
  if (bVar4) {
    if ((uVar9 & 1) == 0) {
      CGameMovement::StartUnDuckJump((CGameMovement *)this);
    }
    else if ((*(byte *)(*(int *)(this + 8) + 0x24) & 4) == 0) {
      cVar6 = CGameMovement::CanUnDuckJump((CGameMovement *)this,(CGameTrace *)&local_70);
      if (cVar6 != '\0') {
        CGameMovement::FinishUnDuckJump((CGameMovement *)this,(CGameTrace *)&local_70);
        iVar11 = *(int *)(this + 4);
        iVar7 = (int)((1.0 - local_44) * 200.0 + 800.0);
        if (iVar7 != *(int *)(iVar11 + 0x1a98)) {
          (**(code **)(*(int *)(iVar11 + 0x1a40) + 4))(iVar11 + 0x1a40,iVar11 + 0x1a98);
          *(int *)(iVar11 + 0x1a98) = iVar7;
        }
      }
    }
  }
  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)