L L4D2node

CBaseCSGrenadeProjectile::ResolveFlyCollisionCustom

0x0042c860 · 1845 bytes · __thiscall

_ZN24CBaseCSGrenadeProjectile25ResolveFlyCollisionCustomER10CGameTraceR6Vector

Decompiled

undefined (3 params)

/* CBaseCSGrenadeProjectile::ResolveFlyCollisionCustom(CGameTrace&, Vector&) */

void __thiscall
CBaseCSGrenadeProjectile::ResolveFlyCollisionCustom
          (CBaseCSGrenadeProjectile *this,CGameTrace *param_1,Vector *param_2)

{
  code *pcVar1;
  char cVar2;
  int *piVar3;
  int *piVar4;
  undefined4 uVar5;
  CBaseEntity *pCVar6;
  int iVar7;
  longdouble lVar8;
  float fVar9;
  float fVar10;
  float fVar11;
  float fVar12;
  float fVar13;
  CGameTrace *local_94;
  float local_90;
  float local_88;
  float local_84;
  float local_80;
  float local_7c;
  float local_78;
  float local_74;
  
  piVar3 = *(int **)(param_1 + 0x4c);
  pCVar6 = (CBaseEntity *)0x0;
  if (piVar3 == (int *)0x0) {
LAB_0042c88f:
    local_90 = 1.0;
  }
  else {
    cVar2 = (**(code **)(*piVar3 + 0x16c))(piVar3);
    pCVar6 = *(CBaseEntity **)(param_1 + 0x4c);
    if (cVar2 == '\0') goto LAB_0042c88f;
    local_90 = 0.3;
  }
  if (pCVar6 != (CBaseEntity *)0x0) {
    if ((((*(char **)(pCVar6 + 0x7c) != "func_breakable") &&
         (cVar2 = CBaseEntity::ClassMatchesComplex(pCVar6,"func_breakable"), cVar2 == '\0')) &&
        (*(char **)(*(CBaseEntity **)(param_1 + 0x4c) + 0x7c) != "func_breakable_surf")) &&
       (cVar2 = CBaseEntity::ClassMatchesComplex
                          (*(CBaseEntity **)(param_1 + 0x4c),"func_breakable_surf"), cVar2 == '\0'))
    {
      pCVar6 = *(CBaseEntity **)(param_1 + 0x4c);
      if (*(char **)(pCVar6 + 0x7c) != "prop_physics") {
        cVar2 = CBaseEntity::ClassMatchesComplex(pCVar6,"prop_physics");
        if (cVar2 == '\0') goto LAB_0042c91e;
        pCVar6 = *(CBaseEntity **)(param_1 + 0x4c);
      }
      iVar7 = (**(code **)(*(int *)pCVar6 + 0x1fc))(pCVar6);
      if ((10 < iVar7) || (*(char *)(*(int *)(param_1 + 0x4c) + 0x105) != '\x02'))
      goto LAB_0042c91e;
    }
    CTakeDamageInfo::CTakeDamageInfo
              ((CTakeDamageInfo *)&local_7c,(CBaseEntity *)this,(CBaseEntity *)this,10.0,0x80,0);
    if (((byte)this[0x14d] & 0x10) != 0) {
      CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
    }
    CalculateMeleeDamageForce
              ((CTakeDamageInfo *)&local_7c,(Vector *)(this + 0x274),(Vector *)param_1,1.0);
    ClearMultiDamage();
    if (((byte)this[0x14d] & 0x10) != 0) {
      CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
    }
    local_94 = (CGameTrace *)(this + 0x274);
    CBaseEntity::DispatchTraceAttack
              (*(CTakeDamageInfo **)(param_1 + 0x4c),(Vector *)&local_7c,local_94);
    ApplyMultiDamage();
    if (*(int *)(*(int *)(param_1 + 0x4c) + 0x100) < 1) {
      if (((byte)this[0x14d] & 0x10) != 0) {
        CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
      }
      local_88 = *(float *)(this + 0x274) * 0.4;
      local_84 = *(float *)(this + 0x278) * 0.4;
      local_80 = *(float *)(this + 0x27c) * 0.4;
      CBaseEntity::SetAbsVelocity((CBaseEntity *)this,(Vector *)&local_88);
      return;
    }
  }
LAB_0042c91e:
  local_90 = local_90 * *(float *)(this + 0x2c8);
  if (local_90 <= 0.0) {
    local_90 = 0.0;
  }
  if (0.9 <= local_90) {
    local_90 = 0.9;
  }
  if (((byte)this[0x14d] & 0x10) != 0) {
    CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
  }
  CBaseEntity::PhysicsClipVelocity
            ((CBaseEntity *)this,(Vector *)(this + 0x274),(Vector *)(param_1 + 0x18),
             (Vector *)&local_88,2.0);
  local_88 = local_88 * local_90;
  local_84 = local_84 * local_90;
  local_80 = local_90 * local_80;
  if (150.0 < local_80) {
    local_80 = 150.0;
  }
  fVar12 = local_88 + *(float *)(this + 0x268);
  *(float *)param_2 = fVar12;
  fVar10 = local_84 + *(float *)(this + 0x26c);
  *(float *)(param_2 + 4) = fVar10;
  fVar9 = local_80 + *(float *)(this + 0x270);
  *(float *)(param_2 + 8) = fVar9;
  fVar9 = fVar10 * fVar10 + fVar12 * fVar12 + fVar9 * fVar9;
  if (0.7 < *(float *)(param_1 + 0x20)) {
    pCVar6 = *(CBaseEntity **)(param_1 + 0x4c);
    CBaseEntity::SetAbsVelocity((CBaseEntity *)this,(Vector *)&local_88);
    if (900.0 <= fVar9) {
      local_7c = *(float *)(this + 0x268);
      local_78 = *(float *)(this + 0x26c);
      fVar12 = *(float *)(this + 0x268) - local_88;
      fVar10 = *(float *)(this + 0x26c) - local_84;
      fVar9 = *(float *)(this + 0x270) - local_80;
      local_74 = *(float *)(this + 0x270);
      VectorNormalize((Vector *)&local_7c);
      fVar11 = fVar10 * local_78 + fVar12 * local_7c + fVar9 * local_74;
      fVar12 = (1.0 - *(float *)(param_1 + 0x2c)) * *(float *)(gpGlobals + 0x10);
      *(float *)param_2 = local_88 * fVar12;
      *(float *)(param_2 + 4) = local_84 * fVar12;
      *(float *)(param_2 + 8) = local_80 * fVar12;
      fVar9 = *(float *)(this + 0x26c);
      fVar10 = *(float *)(this + 0x270);
      fVar13 = (1.0 - *(float *)(param_1 + 0x2c)) * *(float *)(gpGlobals + 0x10);
      *(float *)param_2 = *(float *)(this + 0x268) * fVar13 * fVar11 + local_88 * fVar12;
      *(float *)(param_2 + 4) = fVar9 * fVar13 * fVar11 + local_84 * fVar12;
      *(float *)(param_2 + 8) = fVar10 * fVar13 * fVar11 + local_80 * fVar12;
      CBaseEntity::PhysicsPushEntity((CBaseEntity *)this,param_2,param_1);
    }
    else {
      cVar2 = CBaseEntity::IsStandable(pCVar6);
      if (cVar2 != '\0') {
        CBaseEntity::SetGroundEntity((CBaseEntity *)this,pCVar6);
      }
      CBaseEntity::SetAbsVelocity((CBaseEntity *)this,(Vector *)&vec3_origin);
      CBaseEntity::SetLocalAngularVelocity((CBaseEntity *)this,(QAngle *)&vec3_angle);
      VectorAngles((Vector *)(param_1 + 0x18),(QAngle *)&local_7c);
      lVar8 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0,0x43b40000);
      local_78 = (float)lVar8;
      CBaseEntity::SetAbsAngles((CBaseEntity *)this,(QAngle *)&local_7c);
    }
  }
  else if (900.0 <= fVar9) {
    CBaseEntity::SetAbsVelocity((CBaseEntity *)this,(Vector *)&local_88);
  }
  else {
    CBaseEntity::SetAbsVelocity((CBaseEntity *)this,(Vector *)&vec3_origin);
    CBaseEntity::SetLocalAngularVelocity((CBaseEntity *)this,(QAngle *)&vec3_angle);
  }
  (**(code **)(*(int *)this + 0x574))(this);
  piVar3 = (int *)CBaseGrenade::GetThrower((CBaseGrenade *)this);
  if (((piVar3 != (int *)0x0) && (cVar2 = (**(code **)(*piVar3 + 0x16c))(piVar3), cVar2 != '\0')) &&
     (piVar4 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"grenade_bounce",0,0)
     , piVar4 != (int *)0x0)) {
    pcVar1 = *(code **)(*piVar4 + 0x30);
    uVar5 = (**(code **)(*engine + 0x40))(engine,piVar3[0xc]);
    (*pcVar1)(piVar4,"userid",uVar5);
    pcVar1 = *(code **)(*piVar4 + 0x38);
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    (*pcVar1)(piVar4,&DAT_00c147b6,*(undefined4 *)(this + 0x2e0));
    pcVar1 = *(code **)(*piVar4 + 0x38);
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    (*pcVar1)(piVar4,&DAT_00ca1f7c,*(undefined4 *)(this + 0x2e4));
    pcVar1 = *(code **)(*piVar4 + 0x38);
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    (*pcVar1)(piVar4,&DAT_00ca1f82,*(undefined4 *)(this + 0x2e8));
    (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar4,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)