L L4D2node

CTerrorPlayer::OnShovedByLunge

0x009b9d50 · 2247 bytes · __thiscall

_ZN13CTerrorPlayer15OnShovedByLungeEPS_b

Decompiled

undefined (3 params)

/* CTerrorPlayer::OnShovedByLunge(CTerrorPlayer*, bool) */

void __thiscall
CTerrorPlayer::OnShovedByLunge(CTerrorPlayer *this,CTerrorPlayer *param_1,bool param_2)

{
  float fVar1;
  code *pcVar2;
  uint uVar3;
  CBaseEdict *pCVar4;
  char cVar5;
  char cVar6;
  int iVar7;
  int *piVar8;
  undefined4 uVar9;
  CTerrorWeapon *this_00;
  undefined4 *puVar10;
  undefined *puVar11;
  longdouble lVar12;
  float fVar13;
  float local_40;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  cVar5 = IsPlayingDeathAnim(this);
  if (((cVar5 == '\0') && (param_1 != (CTerrorPlayer *)0x0)) &&
     (cVar5 = IsLunging(param_1), cVar5 != '\0')) {
    iVar7 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_1);
    if (((iVar7 == 3) && (iVar7 = (**(code **)(*(int *)param_1 + 0x544))(param_1), iVar7 == 3)) &&
       (cVar5 = CTerrorGameRules::HasPlayerControlledZombies(), cVar5 != '\0')) {
      if (param_1[0x3e78] == (CTerrorPlayer)0x0) {
        pcVar2 = *(code **)(*(int *)this + 0x420);
        fVar13 = cosf(*(float *)(versus_shove_hunter_fov._28_4_ + 0x2c) * 0.008726646);
        uVar9 = (**(code **)(*(int *)param_1 + 0x288))(param_1);
        cVar5 = (*pcVar2)(this,uVar9,fVar13);
      }
      else {
        fVar13 = cosf(*(float *)(versus_shove_hunter_fov_pouncing._28_4_ + 0x2c) * 0.008726646);
        cVar5 = (**(code **)(*(int *)this + 0x41c))(this,param_1,fVar13);
      }
    }
    else {
      cVar5 = (**(code **)(*(int *)this + 0x424))(this,param_1);
    }
    cVar6 = IsShoving(this);
    puVar11 = &DAT_00d539c2;
    if (cVar6 == '\0') {
      puVar11 = &DAT_00d132ff;
    }
    if (cVar5 == '\0') {
      DevMsg(2,"Survivor was lunged while %sfacing the hunter and %sbashing\n",&DAT_00d132ff,puVar11
            );
    }
    else {
      DevMsg(2,"Survivor was lunged while %sfacing the hunter and %sbashing\n",&DAT_00d539c2,puVar11
            );
      if (cVar6 != '\0') {
        piVar8 = (int *)(**(code **)(*gameeventmanager + 0x1c))
                                  (gameeventmanager,"player_shoved",0,0);
        if (piVar8 != (int *)0x0) {
          pcVar2 = *(code **)(*piVar8 + 0x30);
          uVar9 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(param_1 + 0x30));
          (*pcVar2)(piVar8,"userid",uVar9);
          pcVar2 = *(code **)(*piVar8 + 0x30);
          uVar9 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
          (*pcVar2)(piVar8,"attacker",uVar9);
          (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar8,0);
        }
        if (((byte)param_1[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
        }
        if (((byte)this[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
        }
        local_28 = *(float *)(this + 0x2e0) - *(float *)(param_1 + 0x2e0);
        local_24 = *(float *)(this + 0x2e4) - *(float *)(param_1 + 0x2e4);
        local_20 = *(float *)(this + 0x2e8) - *(float *)(param_1 + 0x2e8);
        VectorNormalize((Vector *)&local_28);
        OnShovedBySurvivor(param_1,this,(Vector *)&local_28);
        return;
      }
    }
    StopUseActions(this);
    StopBeingRevived(this,true);
    StopRevivingSomeone(this,true);
    CBasePlayer::ClearUseEntity((CBasePlayer *)this);
    SetPushEntity(this,(CBaseEntity *)0x0);
    iVar7 = GetActiveTerrorWeapon(this);
    if (iVar7 != 0) {
      this_00 = (CTerrorWeapon *)GetActiveTerrorWeapon(this);
      CTerrorWeapon::SuppressHelpingHands(this_00,0.0);
    }
    uVar3 = *(uint *)(this + 0x31e0);
    if (((uVar3 == 0xffffffff) ||
        (puVar11 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc)) ||
       ((*(uint *)(puVar11 + 8) != uVar3 >> 0xc || (*(int *)(puVar11 + 4) == 0)))) {
      pcVar2 = *(code **)(*(int *)this + 0x7b4);
      CAI_Concept::CAI_Concept((CAI_Concept *)&local_28,"PlayerShoved");
      (*pcVar2)(this,(CAI_Concept *)&local_28,1,0,0,0,0);
      iVar7 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
      cVar5 = IsASurvivorTeam(iVar7);
      if ((cVar5 != '\0') && (param_1[0x3e78] == (CTerrorPlayer)0x0)) {
        OnLungedSurvivor(param_1,*(undefined4 *)(this + 0x2ba0));
      }
    }
    puVar10 = (undefined4 *)(**(code **)(*(int *)param_1 + 0xc))(param_1);
    *(undefined4 *)(this + 0x31e0) = *puVar10;
    lVar12 = (longdouble)CountdownTimer::Now();
    if ((float)lVar12 + 3.0 != *(float *)(this + 0x31dc)) {
      (**(code **)(*(int *)(this + 0x31d4) + 4))(this + 0x31d4,this + 0x31dc);
      *(float *)(this + 0x31dc) = (float)lVar12 + 3.0;
    }
    if (*(float *)(this + 0x31d8) != 3.0) {
      (**(code **)(*(int *)(this + 0x31d4) + 4))(this + 0x31d4,this + 0x31d8);
      *(undefined4 *)(this + 0x31d8) = 0x40400000;
    }
    if (param_2) {
      fVar13 = *(float *)(SurvivorMinLungeStaggerSpeed._28_4_ + 0x2c);
      fVar1 = *(float *)(SurvivorMaxLungeStaggerSpeed._28_4_ + 0x2c);
      if (((byte)param_1[0x14d] & 0x10) != 0) {
        CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)param_1);
      }
      local_40 = SQRT(*(float *)(param_1 + 0x27c) * *(float *)(param_1 + 0x27c) +
                      *(float *)(param_1 + 0x274) * *(float *)(param_1 + 0x274) +
                      *(float *)(param_1 + 0x278) * *(float *)(param_1 + 0x278));
      if (fVar13 < local_40) {
        if (fVar1 <= fVar13) {
          local_40 = 1.0;
        }
        else {
          if (fVar1 <= local_40) {
            local_40 = fVar1;
          }
          local_40 = local_40 / (fVar1 - fVar13);
        }
        OnKnockedDown(this,1);
        if (((byte)param_1[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
        }
        if (((byte)this[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
        }
        local_34 = *(float *)(this + 0x2e0) - *(float *)(param_1 + 0x2e0);
        local_30 = *(float *)(this + 0x2e4) - *(float *)(param_1 + 0x2e4);
        local_2c = *(float *)(this + 0x2e8) - *(float *)(param_1 + 0x2e8);
        VectorNormalize((Vector *)&local_34);
        local_2c = local_2c - 0.1;
        VectorNormalize((Vector *)&local_34);
        if (((local_34 != *(float *)(this + 0x3208)) || (local_30 != *(float *)(this + 0x320c))) ||
           (local_2c != *(float *)(this + 0x3210))) {
          if (this[0x6c] == (CTerrorPlayer)0x0) {
            pCVar4 = *(CBaseEdict **)(this + 0x30);
            if (pCVar4 != (CBaseEdict *)0x0) {
              *(uint *)pCVar4 = *(uint *)pCVar4 | 0x101;
              iVar7 = CBaseEdict::GetChangeAccessor(pCVar4);
              *(undefined2 *)(iVar7 + 2) = 0;
            }
          }
          else {
            this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
          }
          *(float *)(this + 0x3208) = local_34;
          *(float *)(this + 0x320c) = local_30;
          *(float *)(this + 0x3210) = local_2c;
        }
        local_40 = local_40 * *(float *)(SurvivorMaxLungeStaggerDistance._28_4_ + 0x2c);
        if (local_40 != *(float *)(this + 0x3214)) {
          if (this[0x6c] == (CTerrorPlayer)0x0) {
            pCVar4 = *(CBaseEdict **)(this + 0x30);
            if (pCVar4 != (CBaseEdict *)0x0) {
              *(uint *)pCVar4 = *(uint *)pCVar4 | 0x101;
              iVar7 = CBaseEdict::GetChangeAccessor(pCVar4);
              *(undefined2 *)(iVar7 + 2) = 0;
            }
          }
          else {
            this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
          }
          *(float *)(this + 0x3214) = local_40;
        }
        if (((byte)this[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
        }
        fVar13 = *(float *)(this + 0x2e0);
        if (((fVar13 != *(float *)(this + 0x31fc)) ||
            (*(float *)(this + 0x2e4) != *(float *)(this + 0x3200))) ||
           (*(float *)(this + 0x2e8) != *(float *)(this + 0x3204))) {
          if (this[0x6c] == (CTerrorPlayer)0x0) {
            pCVar4 = *(CBaseEdict **)(this + 0x30);
            if (pCVar4 != (CBaseEdict *)0x0) {
              *(uint *)pCVar4 = *(uint *)pCVar4 | 0x101;
              iVar7 = CBaseEdict::GetChangeAccessor(pCVar4);
              *(undefined2 *)(iVar7 + 2) = 0;
              fVar13 = *(float *)(this + 0x2e0);
            }
          }
          else {
            this[0x70] = (CTerrorPlayer)((byte)this[0x70] | 1);
          }
          *(float *)(this + 0x31fc) = fVar13;
          *(undefined4 *)(this + 0x3200) = *(undefined4 *)(this + 0x2e4);
          *(undefined4 *)(this + 0x3204) = *(undefined4 *)(this + 0x2e8);
        }
        local_28 = *(float *)(this + 0x3214);
        local_24 = *(float *)(this + 0x320c) * -1.5 * local_28;
        local_20 = *(float *)(this + 0x3210) * -1.5 * local_28;
        local_28 = *(float *)(this + 0x3208) * -1.5 * local_28;
        SetShoveForce(param_1,(Vector *)&local_28);
        SetResponsibleForAirMovement(param_1,(CBaseCombatCharacter *)this);
        CBaseEntity::SetGroundEntity((CBaseEntity *)param_1,(CBaseEntity *)0x0);
      }
    }
    piVar8 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"lunge_shove",0,0);
    if (piVar8 != (int *)0x0) {
      pcVar2 = *(code **)(*piVar8 + 0x30);
      uVar9 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(param_1 + 0x30));
      (*pcVar2)(piVar8,"userid",uVar9);
      pcVar2 = *(code **)(*piVar8 + 0x30);
      uVar9 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
      (*pcVar2)(piVar8,"victim",uVar9);
      (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar8,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)