L L4D2node

CBaseCombatCharacter::SetActiveWeapon

0x005f5310 · 238 bytes · __thiscall

_ZN20CBaseCombatCharacter15SetActiveWeaponEP17CBaseCombatWeapon

Decompiled

undefined (2 params)

/* CBaseCombatCharacter::SetActiveWeapon(CBaseCombatWeapon*) */

void __thiscall
CBaseCombatCharacter::SetActiveWeapon(CBaseCombatCharacter *this,CBaseCombatWeapon *param_1)

{
  uint uVar1;
  CBaseEdict *this_00;
  CBaseCombatWeapon *pCVar2;
  int iVar3;
  undefined4 *puVar4;
  undefined *puVar5;
  CBaseCombatWeapon *pCVar6;
  
  uVar1 = *(uint *)(this + 0x19d4);
  if (uVar1 == 0xffffffff) {
    pCVar6 = (CBaseCombatWeapon *)0x0;
    if (param_1 == (CBaseCombatWeapon *)0x0) {
      return;
    }
  }
  else {
    puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10;
    if (puVar5 == (undefined *)0xfffffffc) {
      pCVar6 = (CBaseCombatWeapon *)0x0;
      if (param_1 == (CBaseCombatWeapon *)0x0) {
        return;
      }
LAB_005f536c:
      pCVar2 = (CBaseCombatWeapon *)0x0;
    }
    else {
      if (*(uint *)(puVar5 + 8) == uVar1 >> 0xc) {
        pCVar6 = *(CBaseCombatWeapon **)(puVar5 + 4);
      }
      else {
        pCVar6 = (CBaseCombatWeapon *)0x0;
      }
      if (param_1 == pCVar6) {
        return;
      }
      if (*(uint *)(puVar5 + 8) != uVar1 >> 0xc) goto LAB_005f536c;
      pCVar2 = *(CBaseCombatWeapon **)(puVar5 + 4);
    }
    if (param_1 == pCVar2) goto LAB_005f53a7;
  }
  if (this[0x6c] == (CBaseCombatCharacter)0x0) {
    this_00 = *(CBaseEdict **)(this + 0x30);
    if (this_00 != (CBaseEdict *)0x0) {
      *(uint *)this_00 = *(uint *)this_00 | 0x101;
      iVar3 = CBaseEdict::GetChangeAccessor(this_00);
      *(undefined2 *)(iVar3 + 2) = 0;
    }
  }
  else {
    this[0x70] = (CBaseCombatCharacter)((byte)this[0x70] | 1);
  }
  if (param_1 == (CBaseCombatWeapon *)0x0) {
    *(undefined4 *)(this + 0x19d4) = 0xffffffff;
  }
  else {
    puVar4 = (undefined4 *)(**(code **)(*(int *)param_1 + 0xc))(param_1);
    *(undefined4 *)(this + 0x19d4) = *puVar4;
  }
LAB_005f53a7:
  (**(code **)(*(int *)this + 0x528))(this,pCVar6,param_1);
  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)