L L4D2node

CGameMovement::CheckStuck

0x00459840 · 2241 bytes · __thiscall

_ZN13CGameMovement10CheckStuckEv

Decompiled

undefined (1 param)

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

undefined4 __thiscall CGameMovement::CheckStuck(CGameMovement *this)

{
  uint *puVar1;
  float fVar2;
  float fVar3;
  code *pcVar4;
  uint uVar5;
  int *piVar6;
  char cVar7;
  int iVar8;
  int *piVar9;
  undefined4 *puVar10;
  undefined *puVar11;
  int *piVar12;
  int iVar13;
  int iVar14;
  int *piVar15;
  int *piVar16;
  undefined4 uVar17;
  longdouble lVar18;
  float fVar19;
  float fVar20;
  int aiStack_108 [2];
  int *local_bc;
  float local_b8;
  int local_a0;
  int local_9c;
  int local_98;
  int local_94;
  int local_90;
  int local_88;
  int local_84;
  int local_80;
  float local_7c;
  float local_78;
  float local_74;
  undefined1 local_70 [96];
  
  local_94 = 0;
  local_90 = 0;
  if (_towlower == 0) {
    local_80 = 0;
  }
  else {
    (**(code **)(_towlower + 0x50))();
    local_80 = _towlower;
  }
  iVar8 = _DAT_0105db00;
  local_88 = local_94;
  local_84 = local_90;
                    /* try { // try from 00459bce to 00459c2e has its CatchHandler @ 0045a135 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar14 = ThreadGetCurrentId(), iVar8 == iVar14)) {
    if ((char *)*_DAT_0105d15c != "CheckStuck()") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc138e3,(char *)0x0,0xc138f0);
    }
    puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
    *puVar1 = *puVar1 | 4;
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
  local_a0 = -1;
  *(undefined4 *)(*(int *)(this + 4) + 0x2338) = 0xffffffff;
  this[0x63e] = (CGameMovement)0x1;
                    /* try { // try from 00459951 to 00459b50 has its CatchHandler @ 0045a14d */
  (**(code **)(*(int *)this + 0xf8))();
  piVar9 = (int *)&stack0xffffff00;
  piVar16 = (int *)&stack0xffffff00;
  this[0x63e] = (CGameMovement)0x0;
  local_a0 = local_9c;
  if (local_9c == -1) {
    *(undefined4 *)(*(int *)(this + 4) + 0x1a3c) = 0;
    iVar8 = *(int *)(*(int *)(this + 4) + 0x30);
    piVar16 = (int *)&stack0xffffff00;
joined_r0x00459c55:
    if (iVar8 == 0) {
      iVar8 = 0;
      piVar16 = piVar9;
    }
    else {
      iVar8 = iVar8 - *(int *)(gpGlobals + 0x58) >> 4;
    }
    *(undefined4 *)(this + iVar8 * 4 + 0x748) = 0;
    uVar17 = 0;
    goto LAB_00459c74;
  }
  lVar18 = (longdouble)Plat_FloatTime();
  fVar20 = (float)lVar18;
  if (*(int *)(*(int *)(this + 4) + 0x30) == 0) {
    if (*(float *)(this + 0x748) == 0.0) {
      iVar8 = 0;
      goto LAB_004599c0;
    }
  }
  else {
    iVar8 = *(int *)(*(int *)(this + 4) + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
    if (*(float *)(this + iVar8 * 4 + 0x748) == 0.0) {
LAB_004599c0:
      *(float *)(this + iVar8 * 4 + 0x748) = fVar20;
    }
  }
  piVar9 = (int *)CBaseEntity::Instance((CBaseHandle *)&local_a0);
  if (piVar9 != (int *)0x0) {
    piVar9 = (int *)(**(code **)(*piVar9 + 0x144))();
    iVar8 = *(int *)(this + 4);
    if (piVar9 == (int *)0x0) {
      *(undefined4 *)(iVar8 + 0x2338) = 0xffffffff;
    }
    else {
      puVar10 = (undefined4 *)(**(code **)(*piVar9 + 0xc))();
      *(undefined4 *)(iVar8 + 0x2338) = *puVar10;
    }
  }
  iVar8 = *(int *)(this + 8);
  fVar19 = *(float *)(iVar8 + 0x9c);
  fVar2 = *(float *)(iVar8 + 0xa0);
  fVar3 = *(float *)(iVar8 + 0xa4);
  if (*(int *)(*(int *)(this + 4) + 0x30) == 0) {
    iVar8 = 0;
    if (fVar20 - 0.05 <= *(float *)(this + 0x640)) goto LAB_00459d48;
  }
  else {
    iVar8 = *(int *)(*(int *)(this + 4) + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
    if (fVar20 - 0.05 <= *(float *)(this + iVar8 * 8 + 0x640)) {
LAB_00459d48:
      uVar17 = 1;
      goto LAB_00459c74;
    }
  }
  *(float *)(this + iVar8 * 8 + 0x640) = fVar20;
  (**(code **)(*IMoveHelper::sm_pSingleton + 0xc))();
  this[0x63e] = (CGameMovement)0x1;
  iVar8 = 0x1b;
  piVar9 = (int *)&stack0xffffff00;
  do {
    piVar15 = piVar9;
    iVar14 = *(int *)(*(int *)(this + 4) + 0x1a3c);
    *(int *)(*(int *)(this + 4) + 0x1a3c) = iVar14 + 1;
    iVar14 = iVar14 % 0x36;
    local_7c = fVar19 + *(float *)(rgv3tStuckTable + iVar14 * 0xc);
    iVar14 = iVar14 * 0xc;
    local_78 = *(float *)(rgv3tStuckTable + iVar14 + 4);
    local_74 = *(float *)(rgv3tStuckTable + iVar14 + 8);
    iVar14 = *(int *)this;
    piVar15[2] = (int)&local_7c;
    local_78 = local_78 + fVar2;
    local_74 = local_74 + fVar3;
    piVar15[4] = (int)local_70;
    piVar15[3] = 8;
    piVar15[1] = (int)this;
    *piVar15 = (int)&local_98;
    pcVar4 = *(code **)(iVar14 + 0xf8);
    piVar15[-1] = 0x459b51;
    (*pcVar4)();
    piVar9 = piVar15 + -1;
    piVar16 = piVar15 + -1;
    if (local_98 == -1) {
      this[0x63e] = (CGameMovement)0x0;
      *(undefined4 *)(*(int *)(this + 4) + 0x1a3c) = 0;
      iVar8 = *(int *)(this + 8);
      *(float *)(iVar8 + 0x9c) = local_7c;
      *(float *)(iVar8 + 0xa0) = local_78;
      *(float *)(iVar8 + 0xa4) = local_74;
      iVar8 = *(int *)(*(int *)(this + 4) + 0x30);
      piVar16 = piVar15 + -1;
      goto joined_r0x00459c55;
    }
    iVar8 = iVar8 + -1;
    piVar9 = piVar15 + -1;
  } while (iVar8 != 0);
  if (*(int *)(sv_player_stuck_tolerance._28_4_ + 0x30) != 0) {
    piVar9 = *(int **)(this + 4);
    if (piVar9[0xc] == 0) {
      iVar8 = 0;
    }
    else {
      iVar8 = piVar9[0xc] - *(int *)(gpGlobals + 0x58) >> 4;
    }
    if (*(float *)(sv_player_stuck_tolerance._28_4_ + 0x2c) <=
        fVar20 - *(float *)(this + iVar8 * 4 + 0x748) &&
        fVar20 - *(float *)(this + iVar8 * 4 + 0x748) !=
        *(float *)(sv_player_stuck_tolerance._28_4_ + 0x2c)) {
      iVar8 = *piVar9;
      piVar15[-1] = (int)piVar9;
                    /* try { // try from 00459deb to 0045a105 has its CatchHandler @ 0045a14d */
      pcVar4 = *(code **)(iVar8 + 0x778);
      piVar15[-2] = 0x459df1;
      cVar7 = (*pcVar4)();
      if (cVar7 == '\0') {
        iVar8 = *(int *)this;
        piVar15[-1] = (int)this;
        pcVar4 = *(code **)(iVar8 + 0xc0);
        piVar15[-2] = 0x459e04;
        cVar7 = (*pcVar4)();
        if ((cVar7 != '\0') &&
           (((uVar5 = piVar9[0xcf1], uVar5 == 0xffffffff ||
             (puVar11 = g_pEntityList + (uVar5 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc))
            || ((*(uint *)(puVar11 + 8) != uVar5 >> 0xc || (*(int *)(puVar11 + 4) == 0)))))) {
          if (0 < *(int *)(gpGlobals + 0x14)) {
            iVar8 = 1;
            local_bc = (int *)0x0;
            local_b8 = 3.4028235e+38;
            do {
              piVar15[-1] = iVar8;
              piVar15[-2] = 0x459e80;
              piVar12 = (int *)UTIL_PlayerByIndex(piVar15[-1]);
              if (((piVar9 == piVar12) || (piVar12 == (int *)0x0)) || (piVar12[0xc] == 0)) {
LAB_00459ee8:
                piVar6 = local_bc;
                fVar19 = local_b8;
              }
              else {
                piVar6 = local_bc;
                fVar19 = local_b8;
                if (piVar12[0xc] - *(int *)(gpGlobals + 0x58) >> 4 != 0) {
                  iVar14 = *piVar12;
                  piVar15[-1] = (int)piVar12;
                  pcVar4 = *(code **)(iVar14 + 0x16c);
                  piVar15[-2] = 0x459eaf;
                  cVar7 = (*pcVar4)();
                  if ((cVar7 != '\0') && (piVar12[0x7db] != 2)) {
                    piVar15[-1] = (int)piVar12;
                    piVar15[-2] = 0x459ec4;
                    iVar14 = CBaseEntity::GetTeamNumber((CBaseEntity *)piVar15[-1]);
                    piVar15[-1] = *(undefined4 *)(this + 4);
                    piVar15[-2] = 0x459ed5;
                    iVar13 = CBaseEntity::GetTeamNumber((CBaseEntity *)piVar15[-1]);
                    if (iVar14 == iVar13) {
                      iVar14 = *piVar12;
                      piVar15[-1] = (int)piVar12;
                      pcVar4 = *(code **)(iVar14 + 300);
                      piVar15[-2] = 0x45a041;
                      cVar7 = (*pcVar4)();
                      if (cVar7 != '\0') {
                        if ((*(byte *)((int)piVar12 + 0x14d) & 8) != 0) {
                          piVar15[-1] = (int)piVar12;
                          piVar15[-2] = 0x45a0ee;
                          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)piVar15[-1]);
                        }
                        if ((*(byte *)((int)piVar9 + 0x14d) & 8) != 0) {
                          piVar15[-1] = (int)piVar9;
                          piVar15[-2] = 0x45a106;
                          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)piVar15[-1]);
                        }
                        fVar19 = ((float)piVar9[0xb8] - (float)piVar12[0xb8]) *
                                 ((float)piVar9[0xb8] - (float)piVar12[0xb8]) +
                                 ((float)piVar9[0xb9] - (float)piVar12[0xb9]) *
                                 ((float)piVar9[0xb9] - (float)piVar12[0xb9]) +
                                 ((float)piVar9[0xba] - (float)piVar12[0xba]) *
                                 ((float)piVar9[0xba] - (float)piVar12[0xba]);
                        piVar6 = piVar12;
                        if (fVar19 < local_b8) goto LAB_00459eed;
                      }
                    }
                  }
                  goto LAB_00459ee8;
                }
              }
LAB_00459eed:
              local_b8 = fVar19;
              local_bc = piVar6;
              iVar8 = iVar8 + 1;
            } while (iVar8 <= *(int *)(gpGlobals + 0x14));
            if (local_bc != (int *)0x0) {
              piVar15[-1] = (int)"Teleported stuck player\n";
              piVar15[-2] = 0x459f0f;
              DevMsg((char *)piVar15[-1]);
              if (*(int *)(*(int *)(this + 4) + 0x30) == 0) {
                iVar8 = 0;
              }
              else {
                iVar8 = *(int *)(*(int *)(this + 4) + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
              }
              *(undefined4 *)(this + iVar8 * 4 + 0x748) = 0;
              if ((*(byte *)((int)local_bc + 0x14d) & 8) != 0) {
                piVar15[-1] = (int)local_bc;
                piVar15[-2] = 0x45a031;
                CBaseEntity::CalcAbsolutePosition((CBaseEntity *)piVar15[-1]);
              }
              uVar17 = 0;
              iVar8 = *(int *)(this + 8);
              *(int *)(iVar8 + 0x9c) = local_bc[0xb8];
              *(int *)(iVar8 + 0xa0) = local_bc[0xb9];
              *(int *)(iVar8 + 0xa4) = local_bc[0xba];
              this[0x63e] = (CGameMovement)0x0;
              piVar16 = piVar15 + -1;
              goto LAB_00459c74;
            }
          }
          if (*(int *)(*(int *)(this + 4) + 0x30) == 0) {
            iVar8 = 0;
          }
          else {
            iVar8 = *(int *)(*(int *)(this + 4) + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
          }
          if (15.0 < fVar20 - *(float *)(this + iVar8 * 4 + 0x748)) {
            piVar15[-1] = (int)"Killed stuck player\n";
            piVar15[-2] = 0x459fce;
            DevMsg((char *)piVar15[-1]);
            piVar9 = *(int **)(this + 4);
            if (piVar9[0xc] == 0) {
              iVar8 = 0;
            }
            else {
              iVar8 = piVar9[0xc] - *(int *)(gpGlobals + 0x58) >> 4;
            }
            *(undefined4 *)(this + iVar8 * 4 + 0x748) = 0;
            iVar8 = *piVar9;
            piVar15[1] = 0;
            *piVar15 = 0;
            piVar15[-1] = (int)piVar9;
            pcVar4 = *(code **)(iVar8 + 0x770);
            piVar15[-2] = 0x45a00e;
            (*pcVar4)();
            this[0x63e] = (CGameMovement)0x0;
            uVar17 = 0;
            goto LAB_00459c74;
          }
        }
      }
    }
  }
  this[0x63e] = (CGameMovement)0x0;
  uVar17 = 1;
  piVar16 = piVar15 + -1;
LAB_00459c74:
  iVar8 = _DAT_0105db00;
  if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
    piVar16[-1] = 0x459c92;
    iVar14 = ThreadGetCurrentId();
    if (iVar8 == iVar14) {
      *piVar16 = (int)_DAT_0105d15c;
      piVar16[-1] = 0x459cfd;
      cVar7 = CVProfNode::ExitScope();
      if (cVar7 != '\0') {
        _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
      }
      DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
    }
  }
  iVar14 = local_80;
  iVar8 = local_88;
  if (local_80 != 0) {
    piVar16[5] = 0;
    iVar13 = local_84;
    piVar16[4] = 0;
    piVar16[3] = 0;
    *piVar16 = iVar14;
    piVar16[1] = iVar8;
    piVar16[2] = iVar13;
    pcVar4 = *(code **)(iVar14 + 0x54);
    piVar16[-1] = 0x459ccc;
    (*pcVar4)();
  }
  return uVar17;
}

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)