L L4D2node

CTerrorMeleeWeapon::Spawn

0x00568570 · 521 bytes · __thiscall

_ZN18CTerrorMeleeWeapon5SpawnEv

Decompiled

undefined (1 param)

/* CTerrorMeleeWeapon::Spawn() */

void __thiscall CTerrorMeleeWeapon::Spawn(CTerrorMeleeWeapon *this)

{
  CBaseEdict *pCVar1;
  ushort uVar2;
  char *pcVar3;
  int iVar4;
  undefined4 uVar5;
  int iVar6;
  
  pcVar3 = "";
  if (*(char **)(this + 0x7c) != (char *)0x0) {
    pcVar3 = *(char **)(this + 0x7c);
  }
  uVar2 = LookupWeaponInfoSlot(pcVar3);
  iVar4 = GetFileWeaponInfoFromHandle(uVar2);
  if (iVar4 == 0) {
    uVar5 = 0;
  }
  else {
    uVar5 = __dynamic_cast(iVar4,&FileWeaponInfo_t::typeinfo,&CTerrorWeaponInfo::typeinfo,0);
  }
  *(undefined4 *)(this + 0x17dc) = uVar5;
  (**(code **)(*(int *)this + 0x6c))(this);
  if (*(int *)(this + 0x1420) != -1) {
    if (this[0x6c] == (CTerrorMeleeWeapon)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] = (CTerrorMeleeWeapon)((byte)this[0x70] | 1);
    }
    *(undefined4 *)(this + 0x1420) = 0xffffffff;
  }
  if (*(char **)(this + 0x17e4) != (char *)0x0) {
    iVar4 = CMeleeWeaponInfoStore::GetInfoHandle
                      ((CMeleeWeaponInfoStore *)g_MeleeWeaponInfoStore,*(char **)(this + 0x17e4));
    iVar6 = CMeleeWeaponInfoStore::GetInvalidHandle();
    if ((iVar4 != iVar6) && (iVar4 != *(int *)(this + 0x17e0))) {
      if (this[0x6c] == (CTerrorMeleeWeapon)0x0) {
        pCVar1 = *(CBaseEdict **)(this + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar6 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar6 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CTerrorMeleeWeapon)((byte)this[0x70] | 1);
      }
      *(int *)(this + 0x17e0) = iVar4;
    }
  }
  if (*(int *)(this + 0x17fc) != 0) {
    if (this[0x6c] == (CTerrorMeleeWeapon)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] = (CTerrorMeleeWeapon)((byte)this[0x70] | 1);
    }
    *(undefined4 *)(this + 0x17fc) = 0;
  }
  if (*(int *)(this + 0x1800) != 0) {
    if (this[0x6c] == (CTerrorMeleeWeapon)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] = (CTerrorMeleeWeapon)((byte)this[0x70] | 1);
    }
    *(undefined4 *)(this + 0x1800) = 0;
  }
  if (*(int *)(this + 0x1804) != 0) {
    if (this[0x6c] == (CTerrorMeleeWeapon)0x0) {
      pCVar1 = *(CBaseEdict **)(this + 0x30);
      if (pCVar1 != (CBaseEdict *)0x0) {
        *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
        iVar4 = CBaseEdict::GetChangeAccessor(pCVar1);
        *(undefined2 *)(iVar4 + 2) = 0;
      }
      *(undefined4 *)(this + 0x1804) = 0;
    }
    else {
      this[0x70] = (CTerrorMeleeWeapon)((byte)this[0x70] | 1);
      *(undefined4 *)(this + 0x1804) = 0;
    }
  }
  *(undefined4 *)(this + 0x1824) = 0;
  *(undefined4 *)(this + 0x1828) = 0;
  CTerrorWeapon::Spawn((CTerrorWeapon *)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)