L L4D2node

CEnvWeaponfire::Spawn

0x008cc1b0 · 450 bytes · __thiscall

_ZN14CEnvWeaponfire5SpawnEv

Decompiled

undefined (1 param)

/* CEnvWeaponfire::Spawn() */

void __thiscall CEnvWeaponfire::Spawn(CEnvWeaponfire *this)

{
  CBaseEdict *this_00;
  int iVar1;
  CAmmoDef *pCVar2;
  undefined4 uVar3;
  undefined1 *puVar4;
  float fVar5;
  
  CPointEntity::Spawn((CPointEntity *)this);
  CCollisionProperty::SetSolid((CCollisionProperty *)(this + 0x194),0);
  CBaseEntity::AddEffects((CBaseEntity *)this,0x20);
  fVar5 = *(float *)(this + 0x448);
  if (fVar5 <= 1.0) {
    fVar5 = 1.0;
  }
  if (179.0 <= fVar5) {
    fVar5 = 179.0;
  }
  *(float *)(this + 0x448) = fVar5;
  if (((byte)this[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
  }
  *(undefined4 *)(this + 0x460) = *(undefined4 *)(this + 0x37c);
  *(undefined4 *)(this + 0x464) = *(undefined4 *)(this + 0x380);
  *(undefined4 *)(this + 0x468) = *(undefined4 *)(this + 900);
  AngleVectors((QAngle *)(this + 0x460),(Vector *)(this + 0x46c));
  iVar1 = *(int *)(this + 0x450);
  if (iVar1 != 1) {
    if (iVar1 == 2) {
      *(undefined4 *)(this + 0x478) = 6;
      pCVar2 = (CAmmoDef *)GetAmmoDef();
      uVar3 = CAmmoDef::Index(pCVar2,"AMMO_TYPE_HUNTINGRIFLE");
      *(undefined4 *)(this + 0x47c) = uVar3;
      goto LAB_008cc2f7;
    }
    if (iVar1 == 3) {
      *(undefined4 *)(this + 0x478) = 4;
      pCVar2 = (CAmmoDef *)GetAmmoDef();
      uVar3 = CAmmoDef::Index(pCVar2,"AMMO_TYPE_AUTOSHOTGUN");
      *(undefined4 *)(this + 0x47c) = uVar3;
      goto LAB_008cc2f7;
    }
    puVar4 = &DAT_00d539c2;
    if (*(undefined1 **)(this + 0x154) != (undefined1 *)0x0) {
      puVar4 = *(undefined1 **)(this + 0x154);
    }
    Warning("env_weaponfire %s has unknown weapon type %d\n",puVar4,iVar1);
    if (*(int *)(this + 0x450) != 1) {
      if (this[0x6c] == (CEnvWeaponfire)0x0) {
        this_00 = *(CBaseEdict **)(this + 0x30);
        if (this_00 != (CBaseEdict *)0x0) {
          *(uint *)this_00 = *(uint *)this_00 | 0x101;
          iVar1 = CBaseEdict::GetChangeAccessor(this_00);
          *(undefined2 *)(iVar1 + 2) = 0;
        }
        *(undefined4 *)(this + 0x450) = 1;
      }
      else {
        this[0x70] = (CEnvWeaponfire)((byte)this[0x70] | 1);
        *(undefined4 *)(this + 0x450) = 1;
      }
    }
  }
  *(undefined4 *)(this + 0x478) = 5;
  pCVar2 = (CAmmoDef *)GetAmmoDef();
  uVar3 = CAmmoDef::Index(pCVar2,"AMMO_TYPE_ASSAULTRIFLE");
  *(undefined4 *)(this + 0x47c) = uVar3;
LAB_008cc2f7:
  CBaseEntity::DispatchUpdateTransmitState((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)