L L4D2node

CBaseCombatCharacter::Weapon_CanSwitchTo

0x003fe280 · 197 bytes · __thiscall

_ZN20CBaseCombatCharacter18Weapon_CanSwitchToEP17CBaseCombatWeapon

Decompiled

undefined (2 params)

/* CBaseCombatCharacter::Weapon_CanSwitchTo(CBaseCombatWeapon*) */

undefined4 __thiscall
CBaseCombatCharacter::Weapon_CanSwitchTo(CBaseCombatCharacter *this,CBaseCombatWeapon *param_1)

{
  uint uVar1;
  char cVar2;
  int iVar3;
  undefined4 uVar4;
  undefined *puVar5;
  CBaseCombatWeapon *this_00;
  int in_stack_ffffffd8;
  
  cVar2 = (**(code **)(*(int *)this + 0x16c))(this);
  if (((cVar2 == '\0') || (iVar3 = (**(code **)(*(int *)this + 0x500))(this), iVar3 == 0)) ||
     (cVar2 = CBasePlayer::UsingStandardWeaponsInVehicle((CBasePlayer *)this), cVar2 != '\0')) {
    this_00 = param_1;
    uVar4 = (**(code **)(*(int *)param_1 + 0x40c))();
    if ((char)uVar4 == '\0') {
      if (*(int *)(param_1 + 0x1418) == -1) {
        return uVar4;
      }
      iVar3 = GetAmmoCount((CBaseCombatCharacter *)this_00,in_stack_ffffffd8);
      if (iVar3 == 0) {
        return uVar4;
      }
    }
    uVar4 = (**(code **)(*(int *)param_1 + 0x420))(param_1);
    if ((char)uVar4 != '\0') {
      uVar1 = *(uint *)(this + 0x19d4);
      if (uVar1 == 0xffffffff) {
        return uVar4;
      }
      puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10;
      if (puVar5 == (undefined *)0xfffffffc) {
        return uVar4;
      }
      if (*(uint *)(puVar5 + 8) != uVar1 >> 0xc) {
        return uVar4;
      }
      if (*(int **)(puVar5 + 4) == (int *)0x0) {
        return uVar4;
      }
                    /* WARNING: Could not recover jumptable at 0x003fe346. Too many branches */
                    /* WARNING: Treating indirect jump as call */
      uVar4 = (**(code **)(**(int **)(puVar5 + 4) + 0x418))();
      return uVar4;
    }
  }
  return 0;
}

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)