L L4D2node

CBaseGrenade::BounceTouch

0x00414be0 · 1634 bytes · __thiscall

_ZN12CBaseGrenade11BounceTouchEP11CBaseEntity

Decompiled

undefined (2 params)

/* CBaseGrenade::BounceTouch(CBaseEntity*) */

void __thiscall CBaseGrenade::BounceTouch(CBaseGrenade *this,CBaseEntity *param_1)

{
  CBaseEdict *pCVar1;
  CBaseEntity *pCVar2;
  undefined *puVar3;
  int iVar4;
  undefined4 *puVar5;
  uint uVar6;
  float fVar7;
  float fVar8;
  Vector local_dc [12];
  undefined4 local_d0;
  undefined4 local_cc;
  undefined4 local_c8;
  undefined4 local_c4;
  undefined4 local_c0;
  undefined4 local_bc;
  undefined4 local_b8;
  undefined4 local_b4;
  undefined4 local_b0;
  undefined4 local_ac;
  undefined1 local_a8;
  undefined1 local_a7;
  undefined2 local_a6;
  undefined4 local_a4;
  undefined4 local_a0;
  undefined2 local_9c;
  undefined1 local_9a;
  undefined1 local_99;
  undefined4 local_98;
  undefined4 local_94;
  undefined4 local_90;
  undefined4 local_8c;
  undefined2 local_88;
  undefined2 local_86;
  undefined4 local_84;
  undefined4 local_80;
  CTakeDamageInfo local_7c [108];
  
  if (((byte)param_1[0x1b4] & 0x28) != 0) {
    return;
  }
  pCVar2 = (CBaseEntity *)GetThrower(this);
  if (param_1 == pCVar2) {
    return;
  }
  if ((param_1[0x105] != (CBaseEntity)0x0) &&
     (*(float *)(this + 0x17dc) <= *(float *)(gpGlobals + 0xc) &&
      *(float *)(gpGlobals + 0xc) != *(float *)(this + 0x17dc))) {
    if (((byte)this[0x14d] & 0x10) != 0) {
      CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
    }
    if (100.0 < SQRT(*(float *)(this + 0x27c) * *(float *)(this + 0x27c) +
                     *(float *)(this + 0x278) * *(float *)(this + 0x278) +
                     *(float *)(this + 0x274) * *(float *)(this + 0x274))) {
      uVar6 = *(uint *)(this + 0x1a58);
      if ((((uVar6 != 0xffffffff) &&
           (puVar3 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar3 != (undefined *)0xfffffffc)) &&
          (*(uint *)(puVar3 + 8) == uVar6 >> 0xc)) && (*(int *)(puVar3 + 4) != 0)) {
        puVar5 = (undefined4 *)CBaseEntity::GetTouchTrace();
        local_d0 = *puVar5;
        local_a8 = *(undefined1 *)(puVar5 + 10);
        local_cc = puVar5[1];
        local_c8 = puVar5[2];
        local_c4 = puVar5[3];
        local_c0 = puVar5[4];
        local_bc = puVar5[5];
        local_b8 = puVar5[6];
        local_b4 = puVar5[7];
        local_b0 = puVar5[8];
        local_ac = puVar5[9];
        local_a7 = *(undefined1 *)((int)puVar5 + 0x29);
        local_a4 = puVar5[0xb];
        local_a6 = *(undefined2 *)((int)puVar5 + 0x2a);
        local_a0 = puVar5[0xc];
        local_9c = *(undefined2 *)(puVar5 + 0xd);
        local_9a = *(undefined1 *)((int)puVar5 + 0x36);
        local_99 = *(undefined1 *)((int)puVar5 + 0x37);
        local_98 = puVar5[0xe];
        local_94 = puVar5[0xf];
        local_90 = puVar5[0x10];
        local_8c = puVar5[0x11];
        local_88 = *(undefined2 *)(puVar5 + 0x12);
        local_86 = *(undefined2 *)((int)puVar5 + 0x4a);
        local_84 = puVar5[0x13];
        local_80 = puVar5[0x14];
        ClearMultiDamage();
        AngleVectors((QAngle *)(this + 0x3a8),local_dc,(Vector *)0x0,(Vector *)0x0);
        uVar6 = *(uint *)(this + 0x1a58);
        pCVar2 = (CBaseEntity *)0x0;
        if (((uVar6 != 0xffffffff) &&
            (puVar3 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar3 != (undefined *)0xfffffffc)) &&
           (*(uint *)(puVar3 + 8) == uVar6 >> 0xc)) {
          pCVar2 = *(CBaseEntity **)(puVar3 + 4);
        }
        CTakeDamageInfo::CTakeDamageInfo(local_7c,(CBaseEntity *)this,pCVar2,1.0,0x80,0);
        uVar6 = *(uint *)(this + 0x14c);
        if ((uVar6 & 0x800) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
          uVar6 = *(uint *)(this + 0x14c);
        }
        if ((uVar6 & 0x1000) != 0) {
          CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
        }
        CalculateMeleeDamageForce(local_7c,(Vector *)(this + 0x274),(Vector *)(this + 0x2e0),1.0);
        CBaseEntity::DispatchTraceAttack
                  ((CTakeDamageInfo *)param_1,(Vector *)local_7c,(CGameTrace *)local_dc);
        ApplyMultiDamage();
      }
      fVar7 = *(float *)(gpGlobals + 0xc) + 1.0;
      if (fVar7 != *(float *)(this + 0x17dc)) {
        if (this[0x6c] == (CBaseGrenade)0x0) {
          pCVar1 = *(CBaseEdict **)(this + 0x30);
          if (pCVar1 != (CBaseEdict *)0x0) {
            *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
            iVar4 = CBaseEdict::GetChangeAccessor(pCVar1);
            *(undefined2 *)(iVar4 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CBaseGrenade)((byte)this[0x70] | 1);
        }
        *(float *)(this + 0x17dc) = fVar7;
      }
    }
  }
  if (((byte)this[0x14d] & 0x10) != 0) {
    CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
  }
  if ((this[0x1a40] == (CBaseGrenade)0x0) &&
     (SQRT(*(float *)(this + 0x278) * *(float *)(this + 0x278) +
           *(float *)(this + 0x274) * *(float *)(this + 0x274) +
           *(float *)(this + 0x27c) * 0.45 * *(float *)(this + 0x27c) * 0.45) <= 60.0)) {
    fVar7 = *(float *)(this + 0x1a50);
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    CSoundEnt::InsertSound
              (8,(Vector *)(this + 0x2e0),(int)(fVar7 * 2.5),0.3,(CBaseEntity *)this,0,
               (CBaseEntity *)0x0);
    this[0x1a40] = (CBaseGrenade)0x1;
  }
  if (((byte)this[0x150] & 1) == 0) {
    (**(code **)(*(int *)this + 0x574))(this);
  }
  if (((byte)this[0x14d] & 0x10) != 0) {
    CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
  }
  fVar7 = *(float *)(this + 0x468);
  fVar8 = SQRT(*(float *)(this + 0x27c) * *(float *)(this + 0x27c) +
               *(float *)(this + 0x274) * *(float *)(this + 0x274) +
               *(float *)(this + 0x278) * *(float *)(this + 0x278)) * 0.005;
  if (fVar8 != fVar7) {
    if (this[0x6c] == (CBaseGrenade)0x0) {
      pCVar1 = *(CBaseEdict **)(this + 0x30);
      if (pCVar1 != (CBaseEdict *)0x0) {
        *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
        iVar4 = CBaseEdict::GetChangeAccessor(pCVar1);
        *(undefined2 *)(iVar4 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseGrenade)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x468) = fVar8;
    fVar7 = fVar8;
  }
  fVar8 = *(float *)(this + 0x528);
  if (fVar8 < 0.0) {
    fVar8 = fVar7;
    if (1.0 < fVar7) {
LAB_00414fb0:
      if (this[0x6c] == (CBaseGrenade)0x0) {
        pCVar1 = *(CBaseEdict **)(this + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar4 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar4 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CBaseGrenade)((byte)this[0x70] | 1);
      }
      *(undefined4 *)(this + 0x468) = 0x3f800000;
      return;
    }
  }
  else {
    if (1.0 < fVar8) goto LAB_00414eb3;
    fVar8 = (1.0 - fVar8) * fVar7;
    if (1.0 < fVar8) {
      if (fVar7 == 1.0) {
        return;
      }
      goto LAB_00414fb0;
    }
  }
  if (0.5 <= fVar8) {
    return;
  }
LAB_00414eb3:
  if (fVar7 != 0.0) {
    if (this[0x6c] == (CBaseGrenade)0x0) {
      pCVar1 = *(CBaseEdict **)(this + 0x30);
      if (pCVar1 != (CBaseEdict *)0x0) {
        *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
        iVar4 = CBaseEdict::GetChangeAccessor(pCVar1);
        *(undefined2 *)(iVar4 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseGrenade)((byte)this[0x70] | 1);
    }
    *(undefined4 *)(this + 0x468) = 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)