L L4D2node

CBaseCombatWeapon::SetWeaponVisible

0x00406e40 · 267 bytes · __thiscall

_ZN17CBaseCombatWeapon16SetWeaponVisibleEb

Decompiled

undefined (2 params)

/* CBaseCombatWeapon::SetWeaponVisible(bool) */

void __thiscall CBaseCombatWeapon::SetWeaponVisible(CBaseCombatWeapon *this,bool param_1)

{
  CBaseEdict *this_00;
  char cVar1;
  CBasePlayer *this_01;
  int iVar2;
  uint *puVar3;
  int *piVar4;
  uint uVar5;
  
  this_01 = (CBasePlayer *)GetOwner(this);
  if (this_01 != (CBasePlayer *)0x0) {
    cVar1 = (**(code **)(*(int *)this_01 + 0x16c))(this_01);
    if (cVar1 != '\0') {
      piVar4 = (int *)CBasePlayer::GetViewModel(this_01,*(int *)(this + 0x13f8));
      goto LAB_00406e72;
    }
  }
  piVar4 = (int *)0x0;
LAB_00406e72:
  if (param_1) {
    uVar5 = *(uint *)(this + 0xd4) & 0xffffffdf;
    if (*(uint *)(this + 0xd4) == uVar5) {
      puVar3 = *(uint **)(this + 0x30);
    }
    else {
      if (this[0x6c] == (CBaseCombatWeapon)0x0) {
        this_00 = *(CBaseEdict **)(this + 0x30);
        puVar3 = (uint *)0x0;
        if (this_00 != (CBaseEdict *)0x0) {
          *(uint *)this_00 = *(uint *)this_00 | 0x101;
          iVar2 = CBaseEdict::GetChangeAccessor(this_00);
          *(undefined2 *)(iVar2 + 2) = 0;
          puVar3 = *(uint **)(this + 0x30);
        }
      }
      else {
        this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
        puVar3 = *(uint **)(this + 0x30);
      }
      *(uint *)(this + 0xd4) = uVar5;
    }
    if (puVar3 != (uint *)0x0) {
      *puVar3 = *puVar3 | 0x80;
    }
    CBaseEntity::DispatchUpdateTransmitState((CBaseEntity *)this);
    if (piVar4 != (int *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x00406f42. Too many branches */
                    /* WARNING: Treating indirect jump as call */
      (**(code **)(*piVar4 + 0x3c0))();
      return;
    }
  }
  else {
    CBaseEntity::AddEffects((CBaseEntity *)this,0x20);
    if (piVar4 != (int *)0x0) {
                    /* WARNING: Could not recover jumptable at 0x00406eed. Too many branches */
                    /* WARNING: Treating indirect jump as call */
      (**(code **)(*piVar4 + 0x3bc))();
      return;
    }
  }
  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)