L L4D2node

CBaseGrenade::DangerSoundThink

0x004126a0 · 604 bytes · __thiscall

_ZN12CBaseGrenade16DangerSoundThinkEv

Decompiled

undefined (1 param)

/* CBaseGrenade::DangerSoundThink() */

void __thiscall CBaseGrenade::DangerSoundThink(CBaseGrenade *this)

{
  char cVar1;
  uint uVar2;
  int iVar3;
  float fVar4;
  float fVar5;
  float fVar6;
  float local_18;
  float local_14;
  float local_10;
  
  cVar1 = CBaseEntity::IsInWorld((CBaseEntity *)this);
  if (cVar1 != '\0') {
    uVar2 = *(uint *)(this + 0x14c);
    if ((uVar2 & 0x1000) == 0) {
      fVar6 = *(float *)(this + 0x274);
      fVar5 = *(float *)(this + 0x278);
      fVar4 = *(float *)(this + 0x27c);
      iVar3 = (int)SQRT(fVar5 * fVar5 + fVar6 * fVar6 + fVar4 * fVar4);
    }
    else {
      CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
      fVar6 = *(float *)(this + 0x274);
      fVar4 = *(float *)(this + 0x27c);
      fVar5 = *(float *)(this + 0x278);
      uVar2 = *(uint *)(this + 0x14c);
      iVar3 = (int)SQRT(fVar6 * fVar6 + fVar4 * fVar4 + fVar5 * fVar5);
      if ((uVar2 & 0x1000) != 0) {
        CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
        fVar6 = *(float *)(this + 0x274);
        fVar5 = *(float *)(this + 0x278);
        fVar4 = *(float *)(this + 0x27c);
        uVar2 = *(uint *)(this + 0x14c);
      }
    }
    if ((uVar2 & 0x800) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    local_18 = fVar6 * 0.5 + *(float *)(this + 0x2e0);
    local_14 = fVar5 * 0.5 + *(float *)(this + 0x2e4);
    local_10 = fVar4 * 0.5 + *(float *)(this + 0x2e8);
    CSoundEnt::InsertSound(8,(Vector *)&local_18,iVar3,0.2,(CBaseEntity *)this,0,(CBaseEntity *)0x0)
    ;
    CBaseEntity::SetNextThink((CBaseEntity *)this,*(float *)(gpGlobals + 0xc) + 0.2,(char *)0x0);
    if (this[0x253] != (CBaseGrenade)0x0) {
      if (((byte)this[0x14d] & 0x10) != 0) {
        CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)this);
      }
      local_18 = *(float *)(this + 0x274) * 0.5;
      local_14 = *(float *)(this + 0x278) * 0.5;
      local_10 = *(float *)(this + 0x27c) * 0.5;
      CBaseEntity::SetAbsVelocity((CBaseEntity *)this,(Vector *)&local_18);
    }
    return;
  }
  CBaseEntity::Remove((CBaseEntity *)this);
  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)