L L4D2node

CTerrorPlayer::GetRunTopSpeed

0x004f26b0 · 1289 bytes · __thiscall

_ZNK13CTerrorPlayer14GetRunTopSpeedEv

Decompiled

undefined (1 param)

/* CTerrorPlayer::GetRunTopSpeed() const */

longdouble __thiscall CTerrorPlayer::GetRunTopSpeed(CTerrorPlayer *this)

{
  uint uVar1;
  char cVar2;
  int iVar3;
  int iVar4;
  undefined4 uVar5;
  int *piVar6;
  undefined *puVar7;
  longdouble lVar8;
  longdouble lVar9;
  float fVar10;
  
  cVar2 = (**(code **)(*(int *)this + 0x558))(this);
  if (cVar2 != '\0') {
    return (longdouble)*(float *)(ZombieGhostSpeed._28_4_ + 0x2c);
  }
  if ((((byte)this[0x1d20] & 8) != 0) || (this[0x104] != (CTerrorPlayer)0x0)) {
    fVar10 = 900.0;
    goto LAB_004f26e0;
  }
  iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
  cVar2 = IsASurvivorTeam(iVar3);
  if (cVar2 != '\0') {
    uVar1 = *(uint *)(this + 0x33c4);
    if ((((uVar1 != 0xffffffff) &&
         (puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 != (undefined *)0xfffffffc)) &&
        (*(uint *)(puVar7 + 8) == uVar1 >> 0xc)) && (*(int *)(puVar7 + 4) != 0)) {
      fVar10 = *(float *)(TongueVictimMaxSpeed._28_4_ + 0x2c);
      goto LAB_004f26e0;
    }
    cVar2 = '\0';
    if (this[0x253] != (CTerrorPlayer)0x0) {
      cVar2 = *(char *)(g_pGameRules + 0x495);
    }
    uVar1 = *(uint *)(this + 0x3ee0);
    if (((uVar1 != 0xffffffff) &&
        (puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 != (undefined *)0xfffffffc)) &&
       ((*(uint *)(puVar7 + 8) == uVar1 >> 0xc && (*(int *)(puVar7 + 4) != 0)))) {
      fVar10 = 115.0;
      if (cVar2 == '\0') {
        iVar3 = *(int *)(this + 0x100);
        fVar10 = *(float *)(ZombieJockeyMinMountedSpeed._28_4_ + 0x2c);
        iVar4 = (**(code **)(*(int *)this + 0x1fc))(this);
        if (fVar10 <= (float)iVar3 / (float)iVar4) {
          iVar3 = *(int *)(this + 0x100);
          iVar4 = (**(code **)(*(int *)this + 0x1fc))(this);
          fVar10 = ((float)iVar3 / (float)iVar4) * 220.0;
        }
        else {
          fVar10 = *(float *)(ZombieJockeyMinMountedSpeed._28_4_ + 0x2c) * 220.0;
        }
      }
      goto LAB_004f26e0;
    }
    iVar3 = *(int *)(this + 0x100);
    lVar8 = (longdouble)(**(code **)(*(int *)this + 0x7e4))(this);
    fVar10 = *(float *)(SurvivorLimpHealth._28_4_ + 0x2c);
    if (this[0x3278] == (CTerrorPlayer)0x0) {
      if (((this[0x32fc] == (CTerrorPlayer)0x0) ||
          (lVar9 = (longdouble)(**(code **)(*(int *)this + 0x7e4))(this), 0.0 < (float)lVar9)) ||
         (1 < *(int *)(this + 0x100))) {
        if ((float)iVar3 + (float)lVar8 < fVar10) {
          if (cVar2 != '\0') {
            cVar2 = CTerrorGameRules::HasPlayerControlledZombies();
            fVar10 = 115.0;
            if (cVar2 == '\0') goto LAB_004f2800;
          }
          fVar10 = 150.0;
        }
        else {
          fVar10 = 220.0;
          if (cVar2 != '\0') {
            cVar2 = CTerrorGameRules::HasPlayerControlledZombies();
            fVar10 = 170.0;
            if (cVar2 == '\0') {
              fVar10 = 115.0;
            }
          }
        }
      }
      else {
        fVar10 = 85.0;
      }
    }
    else {
      fVar10 = *(float *)(arenaline_run_speed._28_4_ + 0x2c);
    }
LAB_004f2800:
    iVar3 = CBasePlayer::GetFOV((CBasePlayer *)this);
    iVar4 = CBasePlayer::GetDefaultFOV((CBasePlayer *)this);
    if ((iVar3 < iVar4) && (85.0 <= fVar10)) {
      fVar10 = 85.0;
    }
    uVar1 = *(uint *)(this + 0x2d64);
    if ((((uVar1 != 0xffffffff) &&
         (puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 != (undefined *)0xfffffffc)) &&
        (*(uint *)(puVar7 + 8) == uVar1 >> 0xc)) && (*(int *)(puVar7 + 4) != 0)) {
      fVar10 = fVar10 * *(float *)(SurvivorDragSpeedMultiplier._28_4_ + 0x2c);
    }
    goto LAB_004f26e0;
  }
  iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
  if (iVar3 == 3) {
    uVar5 = (**(code **)(*(int *)this + 0x544))(this);
    switch(uVar5) {
    case 1:
      uVar1 = *(uint *)(this + 0x30bc);
      if (((((uVar1 == 0xffffffff) ||
            (puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc)) ||
           (*(uint *)(puVar7 + 8) != uVar1 >> 0xc)) ||
          ((*(CTongue **)(puVar7 + 4) == (CTongue *)0x0 ||
           (cVar2 = CTongue::IsTongueActive(*(CTongue **)(puVar7 + 4)), cVar2 == '\0')))) &&
         (*(float *)(this + 0x2848) <= 2500.0)) {
        fVar10 = *(float *)(ZombieGasSpeed._28_4_ + 0x2c);
        break;
      }
      goto LAB_004f28b1;
    case 2:
      fVar10 = (float)(~-(uint)(2500.0 < *(float *)(this + 0x2848)) &
                       *(uint *)(ZombieExplodingSpeed._28_4_ + 0x2c) |
                      -(uint)(2500.0 < *(float *)(this + 0x2848)) & 0x3f800000);
      break;
    case 4:
      fVar10 = *(float *)(ZombieSpitterSpeed._28_4_ + 0x2c);
      break;
    case 5:
      fVar10 = *(float *)(ZombieJockeySpeed._28_4_ + 0x2c);
      break;
    case 6:
      cVar2 = IsPummeling(this);
      if (cVar2 != '\0') goto LAB_004f28b1;
    default:
      fVar10 = *(float *)(ZombieSpeed._28_4_ + 0x2c);
      break;
    case 8:
      uVar1 = *(uint *)(this + 0x30bc);
      if (((uVar1 != 0xffffffff) &&
          (puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 != (undefined *)0xfffffffc)) &&
         ((*(uint *)(puVar7 + 8) == uVar1 >> 0xc &&
          ((piVar6 = *(int **)(puVar7 + 4), piVar6 != (int *)0x0 &&
           (lVar8 = (longdouble)(**(code **)(*piVar6 + 0x36c))(piVar6), 0.0 <= (float)lVar8)))))) {
        uVar1 = *(uint *)(this + 0x30bc);
        if ((uVar1 == 0xffffffff) ||
           ((puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc ||
            (*(uint *)(puVar7 + 8) != uVar1 >> 0xc)))) {
          piVar6 = (int *)0x0;
        }
        else {
          piVar6 = *(int **)(puVar7 + 4);
        }
                    /* WARNING: Could not recover jumptable at 0x004f2bbc. Too many branches */
                    /* WARNING: Treating indirect jump as call */
        lVar8 = (longdouble)(**(code **)(*piVar6 + 0x36c))();
        return lVar8;
      }
      cVar2 = CTerrorGameRules::HasPlayerControlledZombies();
      if (cVar2 == '\0') {
        fVar10 = *(float *)(ZombieTankSpeed._28_4_ + 0x2c);
      }
      else {
        fVar10 = *(float *)(ZombieTankSpeedVs._28_4_ + 0x2c);
      }
    }
  }
  else {
LAB_004f28b1:
    fVar10 = 1.0;
  }
LAB_004f26e0:
  return (longdouble)fVar10;
}

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)