L L4D2node

CCharge::HandleCustomCollision

0x004d49c0 · 2762 bytes · __cdecl

_ZN7CCharge21HandleCustomCollisionEP11CBaseEntityRK6VectorS4_P10CGameTraceP9CMoveData

Decompiled

undefined (5 params)

/* CCharge::HandleCustomCollision(CBaseEntity*, Vector const&, Vector const&, CGameTrace*,
   CMoveData*) */

undefined4
CCharge::HandleCustomCollision
          (CBaseEntity *param_1,Vector *param_2,Vector *param_3,CGameTrace *param_4,
          CMoveData *param_5)

{
  float fVar1;
  float fVar2;
  float fVar3;
  float fVar4;
  float fVar5;
  uint uVar6;
  CBaseEntity *this;
  CBaseEdict *this_00;
  code *pcVar7;
  char cVar8;
  int iVar9;
  undefined4 uVar10;
  int iVar11;
  undefined4 uVar12;
  float *pfVar13;
  char *pcVar14;
  int *piVar15;
  undefined *puVar16;
  CTerrorPlayer *this_01;
  longdouble lVar17;
  float fVar18;
  char *local_e0;
  CTraceFilterSimple local_dc [16];
  float local_cc;
  float local_c8;
  float local_c4;
  float local_bc;
  float local_b8;
  float local_b4;
  undefined4 local_ac;
  undefined4 local_a8;
  undefined4 local_a4;
  undefined4 local_9c;
  undefined4 local_98;
  undefined4 local_94;
  undefined4 local_8c;
  undefined1 local_88;
  undefined1 local_87;
  Vector local_7c [12];
  Vector local_70 [32];
  float local_50;
  
  uVar6 = *(uint *)(param_1 + 0x44c);
  if ((((uVar6 != 0xffffffff) &&
       (puVar16 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar16 != (undefined *)0xfffffffc)) &&
      (*(uint *)(puVar16 + 8) == uVar6 >> 0xc)) &&
     ((this = *(CBaseEntity **)(puVar16 + 4), this != (CBaseEntity *)0x0 &&
      (param_1[0x464] != (CBaseEntity)0x0)))) {
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(this);
    }
    fVar1 = *(float *)(param_1 + 0x46c);
    fVar2 = *(float *)(this + 0x2e0);
    fVar18 = *(float *)(param_1 + 0x470);
    fVar3 = *(float *)(this + 0x2e4);
    fVar4 = *(float *)(param_1 + 0x474);
    fVar5 = *(float *)(this + 0x2e8);
    iVar9 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_2);
    cVar8 = IsASurvivorTeam(iVar9);
    if (cVar8 == '\0') {
      iVar9 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_2);
      if (iVar9 != 3) {
        DoImpactProbe((CCharge *)param_1);
        lVar17 = (longdouble)CountdownTimer::Now();
        if (*(float *)(param_1 + 0x48c) <= (float)lVar17) {
          lVar17 = (longdouble)CountdownTimer::Now();
          if ((float)lVar17 + 0.25 != *(float *)(param_1 + 0x48c)) {
            (**(code **)(*(int *)(param_1 + 0x484) + 4))(param_1 + 0x484,param_1 + 0x48c);
            *(float *)(param_1 + 0x48c) = (float)lVar17 + 0.25;
          }
          if (*(float *)(param_1 + 0x488) != 0.25) {
            (**(code **)(*(int *)(param_1 + 0x484) + 4))(param_1 + 0x484,param_1 + 0x488);
            *(undefined4 *)(param_1 + 0x488) = 0x3e800000;
          }
        }
        if (param_2 != g_WorldEntity) {
          iVar9 = IPredictionSystem::g_pPredictionSystems;
          if ((*(char **)(param_2 + 0x7c) == "prop_door_rotating") ||
             (cVar8 = CBaseEntity::ClassMatchesComplex((CBaseEntity *)param_2,"prop_door_rotating"),
             iVar9 = IPredictionSystem::g_pPredictionSystems, cVar8 != '\0')) {
            for (; iVar9 != 0; iVar9 = *(int *)(iVar9 + 4)) {
              *(int *)(iVar9 + 0x10) = *(int *)(iVar9 + 0x10) + 1;
            }
                    /* try { // try from 004d5201 to 004d5267 has its CatchHandler @ 004d54b0 */
            CTakeDamageInfo::CTakeDamageInfo((CTakeDamageInfo *)local_7c,this,this,1000.0,0x80,0);
            if (((byte)this[0x14d] & 8) != 0) {
              CBaseEntity::CalcAbsolutePosition(this);
            }
            (**(code **)(*(int *)this + 0x3fc))((Vector *)&local_cc,this);
            CalculateMeleeDamageForce
                      ((CTakeDamageInfo *)local_7c,(Vector *)&local_cc,(Vector *)(this + 0x2e0),0.01
                      );
            CBaseEntity::TakeDamage((CBaseEntity *)param_2,(CTakeDamageInfo *)local_7c);
            for (iVar9 = IPredictionSystem::g_pPredictionSystems; iVar9 != 0;
                iVar9 = *(int *)(iVar9 + 4)) {
              *(int *)(iVar9 + 0x10) = *(int *)(iVar9 + 0x10) + -1;
            }
          }
          else if (((*(char **)(param_2 + 0x7c) == "prop_physics") ||
                   (cVar8 = CBaseEntity::ClassMatchesComplex((CBaseEntity *)param_2,"prop_physics"),
                   cVar8 != '\0')) && (*(int *)(param_2 + 0x238) != 0)) {
            if (((byte)this[0x14d] & 8) != 0) {
              CBaseEntity::CalcAbsolutePosition(this);
            }
            pfVar13 = (float *)(**(code **)(*(int *)param_2 + 0x288))(param_2);
            local_cc = *pfVar13 - *(float *)(this + 0x2e0);
            local_c8 = pfVar13[1] - *(float *)(this + 0x2e4);
            local_c4 = pfVar13[2] - *(float *)(this + 0x2e8);
            VectorNormalize((Vector *)&local_cc);
            fVar1 = *(float *)(z_charger_max_prop_force._28_4_ + 0x2c);
            local_cc = local_cc * fVar1;
            local_c8 = local_c8 * fVar1;
            local_c4 = fVar1 * local_c4;
            for (iVar9 = IPredictionSystem::g_pPredictionSystems; iVar9 != 0;
                iVar9 = *(int *)(iVar9 + 4)) {
              *(int *)(iVar9 + 0x10) = *(int *)(iVar9 + 0x10) + 1;
            }
            fVar1 = *(float *)(z_charge_prop_damage._28_4_ + 0x2c);
            if (((byte)this[0x14d] & 8) != 0) {
                    /* try { // try from 004d50ef to 004d513f has its CatchHandler @ 004d54c3 */
              CBaseEntity::CalcAbsolutePosition(this);
            }
            CTakeDamageInfo::CTakeDamageInfo
                      ((CTakeDamageInfo *)local_7c,this,this,(Vector *)&local_cc,
                       (Vector *)(this + 0x2e0),fVar1,0x80,0,(Vector *)0x0);
            CBaseEntity::TakeDamage((CBaseEntity *)param_2,(CTakeDamageInfo *)local_7c);
            uVar6 = *(uint *)(this + 0x2a48);
            iVar9 = IPredictionSystem::g_pPredictionSystems;
            if (((uVar6 != 0xffffffff) &&
                (puVar16 = g_pEntityList + (uVar6 & 0xfff) * 0x10,
                puVar16 != (undefined *)0xfffffffc)) &&
               ((*(uint *)(puVar16 + 8) == uVar6 >> 0xc && (*(int *)(puVar16 + 4) != 0)))) {
              pcVar14 = "";
              if (*(char **)(gpGlobals + 0x3c) != (char *)0x0) {
                pcVar14 = *(char **)(gpGlobals + 0x3c);
              }
                    /* try { // try from 004d53e9 to 004d54aa has its CatchHandler @ 004d54c3 */
              iVar11 = _V_strcmp(pcVar14,"c6m1_riverbank");
              iVar9 = IPredictionSystem::g_pPredictionSystems;
              if (iVar11 == 0) {
                (**(code **)(*(int *)param_2 + 0x20))(&local_e0,param_2);
                pcVar14 = "";
                if (local_e0 != (char *)0x0) {
                  pcVar14 = local_e0;
                }
                iVar11 = _V_strcmp(pcVar14,"models/props_urban/plastic_chair001_debris.mdl");
                iVar9 = IPredictionSystem::g_pPredictionSystems;
                if ((iVar11 == 0) &&
                   (piVar15 = (int *)(**(code **)(*gameeventmanager + 0x1c))
                                               (gameeventmanager,"chair_charged",0,0),
                   iVar9 = IPredictionSystem::g_pPredictionSystems, piVar15 != (int *)0x0)) {
                  pcVar7 = *(code **)(*piVar15 + 0x30);
                  uVar10 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
                  (*pcVar7)(piVar15,"userid",uVar10);
                  (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar15,0);
                  iVar9 = IPredictionSystem::g_pPredictionSystems;
                }
              }
            }
            for (; iVar9 != 0; iVar9 = *(int *)(iVar9 + 4)) {
              *(int *)(iVar9 + 0x10) = *(int *)(iVar9 + 0x10) + -1;
            }
          }
        }
      }
      return 1;
    }
    if ((((param_2 != (Vector *)0x0) &&
         (uVar10 = (**(code **)(*(int *)param_2 + 0x16c))(param_2), (char)uVar10 != '\0')) &&
        (cVar8 = (**(code **)(*(int *)param_2 + 0x7e8))(param_2), cVar8 == '\0')) &&
       (param_1[*(int *)(param_2 + 0x2ba0) + 0x49c] == (CBaseEntity)0x0)) {
      param_1[*(int *)(param_2 + 0x2ba0) + 0x49c] = (CBaseEntity)0x1;
      if ((fVar1 - fVar2) * (fVar1 - fVar2) + (fVar18 - fVar3) * (fVar18 - fVar3) +
          (fVar4 - fVar5) * (fVar4 - fVar5) <
          *(float *)(z_charge_tooshort._28_4_ + 0x2c) * *(float *)(z_charge_tooshort._28_4_ + 0x2c))
      {
        EndCharge((CCharge *)param_1);
        CTerrorPlayer::OnStaggered((CTerrorPlayer *)this,(CBaseEntity *)param_2,(Vector *)0x0);
        cVar8 = (**(code **)(*(int *)param_2 + 0x16c))(param_2);
        this_01 = (CTerrorPlayer *)0x0;
        if (cVar8 != '\0') {
          this_01 = (CTerrorPlayer *)param_2;
        }
        CTerrorPlayer::OnStaggered(this_01,this,(Vector *)0x0);
        CBaseEntity::EmitSound(this,"Zombie.Punch",0.0,(float *)0x0);
        CBaseAbility::StartActivationTimer
                  ((CBaseAbility *)param_1,*(float *)(z_charge_interval._28_4_ + 0x2c) * 0.5,0.0);
        return uVar10;
      }
      (**(code **)(*(int *)(param_2 + 0x3ab4) + 0xec))(param_2 + 0x3ab4);
      fVar1 = *(float *)(param_1 + 0x460);
      fVar2 = *(float *)(gpGlobals + 0xc);
      fVar18 = *(float *)(z_charge_duration._28_4_ + 0x2c);
      CBaseEntity::EmitSound(this,"ChargerZombie.HitPerson",0.0,(float *)0x0);
      iVar9 = *(int *)(this + 0x39dc);
      if (this[0x6c] == (CBaseEntity)0x0) {
        this_00 = *(CBaseEdict **)(this + 0x30);
        if (this_00 != (CBaseEdict *)0x0) {
          *(uint *)this_00 = *(uint *)this_00 | 0x101;
          iVar11 = CBaseEdict::GetChangeAccessor(this_00);
          *(undefined2 *)(iVar11 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CBaseEntity)((byte)this[0x70] | 1);
      }
      uVar6 = *(uint *)(this + 0x2a48);
      *(int *)(this + 0x39dc) = iVar9 + 1;
      if (((uVar6 != 0xffffffff) &&
          (puVar16 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar16 != (undefined *)0xfffffffc)) &&
         ((*(uint *)(puVar16 + 8) == uVar6 >> 0xc && (*(int *)(puVar16 + 4) != 0)))) {
        fVar18 = (fVar2 - fVar1) / fVar18;
        if (1.0 <= fVar18) {
          fVar18 = 1.0;
        }
        if (fVar18 <= 0.5) {
          fVar18 = 0.5;
        }
        ThrowImpactedSurvivor((CTerrorPlayer *)this,(CTerrorPlayer *)param_2,fVar18,true);
        return uVar10;
      }
      uVar12 = (**(code **)(*(int *)this + 0x7a0))(this,0);
      fVar1 = *(float *)param_4;
      fVar2 = *(float *)(param_4 + 4);
      fVar18 = *(float *)(param_4 + 8);
      pfVar13 = (float *)(**(code **)(*(int *)param_2 + 0x288))(param_2);
      fVar3 = *pfVar13;
      fVar4 = pfVar13[1];
      fVar5 = pfVar13[2];
      pfVar13 = (float *)(**(code **)(*(int *)param_2 + 0x288))(param_2);
      local_bc = (fVar1 * 34.0 - *pfVar13) + fVar3;
      local_b8 = (fVar2 * 34.0 - pfVar13[1]) + fVar4;
      local_88 = 0;
      local_8c = 0;
      local_9c = 0x41500000;
      local_b4 = (fVar18 * 34.0 - pfVar13[2]) + fVar5;
      local_98 = 0x41500000;
      local_94 = 0x41c00000;
      local_ac = 0;
      local_a8 = 0;
      local_a4 = 0;
      local_87 = local_bc * local_bc + local_b4 * local_b4 + local_b8 * local_b8 != 0.0;
      local_cc = *pfVar13;
      local_c8 = pfVar13[1];
      local_c4 = pfVar13[2];
      CTraceFilterSimple::CTraceFilterSimple
                (local_dc,(IHandleEntity *)param_2,8,(_func_bool_IHandleEntity_ptr_int *)0x0);
      (**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,uVar12,local_dc,local_7c);
      if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
        DebugDrawLine(local_7c,local_70,0xff,0xff,0,true,-1.0);
      }
      if (1.0 <= local_50) {
        CTerrorPlayer::OnStartCarryingVictim((CTerrorPlayer *)this,(CTerrorPlayer *)param_2);
        if (((byte)this[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition(this);
        }
        *(undefined4 *)(param_1 + 0x4a8) = *(undefined4 *)(this + 0x2e0);
        *(undefined4 *)(param_1 + 0x4ac) = *(undefined4 *)(this + 0x2e4);
        *(undefined4 *)(param_1 + 0x4b0) = *(undefined4 *)(this + 0x2e8);
        return uVar10;
      }
      CTerrorPlayer::OnSlammedSurvivor((CTerrorPlayer *)this,(CTerrorPlayer *)param_2,true,false);
      return uVar10;
    }
  }
  return 0;
}

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)