L L4D2node

CBaseCSGrenade::ThrowGrenade

0x0043d220 · 1589 bytes · __thiscall

_ZN14CBaseCSGrenade12ThrowGrenadeEv

Decompiled

undefined (1 param)

/* CBaseCSGrenade::ThrowGrenade() */

void __thiscall CBaseCSGrenade::ThrowGrenade(CBaseCSGrenade *this)

{
  uint *puVar1;
  code *pcVar2;
  CBaseEdict *this_00;
  char cVar3;
  CBasePlayer *this_01;
  int iVar4;
  float *pfVar5;
  undefined4 *puVar6;
  float local_f4;
  float local_f0;
  float local_ec;
  float local_e8;
  float local_e4;
  float local_e0;
  float local_dc;
  float local_d8;
  float local_d4;
  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;
  undefined4 local_70;
  undefined4 local_6c;
  undefined4 local_68;
  undefined4 local_64;
  undefined4 local_60;
  float local_5c;
  
  puVar6 = (undefined4 *)&stack0xfffffec4;
  this_01 = (CBasePlayer *)CBaseCombatWeapon::GetOwner((CBaseCombatWeapon *)this);
  if (this_01 != (CBasePlayer *)0x0) {
    cVar3 = (**(code **)(*(int *)this_01 + 0x16c))();
    if (cVar3 != '\0') {
      if (this[0x17e4] == (CBaseCSGrenade)0x0) {
        CBasePlayer::EyeVectors(this_01,(Vector *)&local_f4,(Vector *)0x0,(Vector *)0x0);
        pfVar5 = (float *)(**(code **)(*(int *)this_01 + 0x250))();
        if (((byte)this_01[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this_01);
        }
        local_bc = local_f4 * 16.0;
        local_b8 = local_f0 * 16.0;
        local_b4 = local_ec * 16.0;
        local_e8 = *pfVar5 + *(float *)(this_01 + 0x2e0);
        local_e4 = pfVar5[1] + *(float *)(this_01 + 0x2e4);
        local_e0 = pfVar5[2] + *(float *)(this_01 + 0x2e8);
        local_ac = 0;
        local_a8 = 0;
        local_87 = local_b8 * local_b8 + local_bc * local_bc + local_b4 * local_b4 != 0.0;
        local_a4 = 0;
        local_8c = 0;
        local_9c = 0x40000000;
        local_98 = 0x40000000;
        local_94 = 0x40000000;
        local_88 = 0;
        local_cc = local_e8;
        local_c8 = local_e4;
        local_c4 = local_e0;
        CTraceFilterSimple::CTraceFilterSimple
                  ((CTraceFilterSimple *)&local_dc,(IHandleEntity *)this_01,0,
                   (_func_bool_IHandleEntity_ptr_int *)0x0);
        (**(code **)(*enginetrace + 0x14))();
        if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
          DebugDrawLine((Vector *)&local_70,(Vector *)&local_64,0xff,0xff,0,true,-1.0);
        }
        local_e8 = (float)local_64;
        local_e4 = (float)local_60;
        local_e0 = local_5c;
        if (((byte)this_01[0x14d] & 0x10) != 0) {
          CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this_01);
        }
        local_dc = local_f4 * 750.0 + *(float *)(this_01 + 0x274);
        local_d8 = local_f0 * 750.0 + *(float *)(this_01 + 0x278);
        local_d4 = local_ec * 750.0 + *(float *)(this_01 + 0x27c);
        pcVar2 = *(code **)(*(int *)this + 0x714);
        iVar4 = (**(code **)(*random_valve + 8))();
        local_c8 = (float)iVar4;
        local_cc = 600.0;
        local_c4 = 0.0;
        (*pcVar2)();
      }
      else {
        if (((byte)this_01[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this_01);
        }
        local_e8 = *(float *)(this_01 + 0x2e0);
        local_e4 = *(float *)(this_01 + 0x2e4);
        local_e0 = *(float *)(this_01 + 0x2e8) + 36.0;
        (**(code **)(*(int *)this_01 + 0x3e4))();
        AngleVectors((QAngle *)&local_70,(Vector *)&local_dc);
        if (((byte)this_01[0x14d] & 0x10) != 0) {
          CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this_01);
        }
        local_cc = local_dc * 500.0 + *(float *)(this_01 + 0x274);
        local_c8 = local_d8 * 500.0 + *(float *)(this_01 + 0x278);
        local_c4 = local_d4 * 500.0 + *(float *)(this_01 + 0x27c);
        local_70 = 0;
        local_6c = 0;
        local_68 = 0;
        (**(code **)(*(int *)this + 0x714))();
        puVar6 = (undefined4 *)&stack0xfffffec0;
        if (this[0x17e4] != (CBaseCSGrenade)0x0) {
          if (this[0x6c] == (CBaseCSGrenade)0x0) {
            this_00 = *(CBaseEdict **)(this + 0x30);
            if (this_00 != (CBaseEdict *)0x0) {
              *(uint *)this_00 = *(uint *)this_00 | 0x101;
              iVar4 = CBaseEdict::GetChangeAccessor(this_00);
              *(undefined2 *)(iVar4 + 2) = 0;
            }
          }
          else {
            this[0x70] = (CBaseCSGrenade)((byte)this[0x70] | 1);
          }
          this[0x17e4] = (CBaseCSGrenade)0x0;
          puVar6 = (undefined4 *)&stack0xfffffec0;
        }
      }
      if (this[0x17dc] != (CBaseCSGrenade)0x1) {
        if (this[0x6c] == (CBaseCSGrenade)0x0) {
          puVar1 = *(uint **)(this + 0x30);
          if (puVar1 != (uint *)0x0) {
            *puVar1 = *puVar1 | 0x101;
            *puVar6 = puVar1;
            puVar6[-1] = 0x43d40a;
            iVar4 = CBaseEdict::GetChangeAccessor((CBaseEdict *)*puVar6);
            *(undefined2 *)(iVar4 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CBaseCSGrenade)((byte)this[0x70] | 1);
        }
        this[0x17dc] = (CBaseCSGrenade)0x1;
      }
      if (*(float *)(this + 0x17e0) != 0.0) {
        if (this[0x6c] == (CBaseCSGrenade)0x0) {
          puVar1 = *(uint **)(this + 0x30);
          if (puVar1 != (uint *)0x0) {
            *puVar1 = *puVar1 | 0x101;
            *puVar6 = puVar1;
            puVar6[-1] = 0x43d447;
            iVar4 = CBaseEdict::GetChangeAccessor((CBaseEdict *)*puVar6);
            *(undefined2 *)(iVar4 + 2) = 0;
          }
          *(undefined4 *)(this + 0x17e0) = 0;
        }
        else {
          this[0x70] = (CBaseCSGrenade)((byte)this[0x70] | 1);
          *(undefined4 *)(this + 0x17e0) = 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)