L L4D2node

CBaseCombatWeapon::Holster

0x00408960 · 601 bytes · __cdecl

_ZN17CBaseCombatWeapon7HolsterEPS_

Decompiled

undefined (1 param)

/* CBaseCombatWeapon::Holster(CBaseCombatWeapon*) */

undefined4 CBaseCombatWeapon::Holster(CBaseCombatWeapon *param_1)

{
  CBaseEdict *pCVar1;
  int *piVar2;
  int iVar3;
  int iVar4;
  CStudioHdr *pCVar5;
  int iVar6;
  CStudioHdr *pCVar7;
  longdouble lVar8;
  float fVar9;
  CBaseCombatWeapon *pCVar10;
  undefined4 uVar11;
  float fVar12;
  char *pcVar13;
  float local_28;
  undefined1 local_24 [20];
  
  piVar2 = mdlcache;
  (**(code **)(*mdlcache + 0x68))(mdlcache);
  if (param_1[0x1459] != (CBaseCombatWeapon)0x0) {
    if (param_1[0x6c] == (CBaseCombatWeapon)0x0) {
      pCVar1 = *(CBaseEdict **)(param_1 + 0x30);
      if (pCVar1 != (CBaseEdict *)0x0) {
        *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
                    /* try { // try from 0040899d to 00408a6a has its CatchHandler @ 00408bd9 */
        iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
        *(undefined2 *)(iVar3 + 2) = 0;
      }
    }
    else {
      param_1[0x70] = (CBaseCombatWeapon)((byte)param_1[0x70] | 1);
    }
    param_1[0x1459] = (CBaseCombatWeapon)0x0;
  }
  QueueAttack(param_1,0);
  pcVar13 = (char *)0x0;
  fVar12 = 0.0;
  iVar3 = 0;
  uVar11 = 0;
  CBaseEntity::ThinkSet((_func_void *)local_24,(float)param_1,(char *)0x0);
  (**(code **)(*(int *)param_1 + 0x3f0))(param_1,0xb6,iVar3,uVar11,fVar12,pcVar13);
  local_28 = 0.0;
  if (*(int *)(param_1 + 0x1448) != 0xb6) goto LAB_00408a1c;
  pCVar5 = *(CStudioHdr **)(param_1 + 0x13e0);
  iVar3 = *(int *)(param_1 + 0x494);
  if (pCVar5 == (CStudioHdr *)0x0) {
    iVar4 = CBaseEntity::GetModel((CBaseEntity *)param_1);
    if (iVar4 != 0) {
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)param_1);
    }
    pCVar5 = *(CStudioHdr **)(param_1 + 0x13e0);
    pCVar7 = (CStudioHdr *)0x0;
    if (pCVar5 != (CStudioHdr *)0x0) goto LAB_00408b14;
  }
  else {
LAB_00408b14:
    pCVar7 = (CStudioHdr *)0x0;
    if (*(int *)pCVar5 != 0) {
      pCVar7 = pCVar5;
    }
  }
  lVar8 = (longdouble)CBaseAnimating::SequenceDuration((CBaseAnimating *)param_1,pCVar7,iVar3);
  local_28 = (float)lVar8;
LAB_00408a1c:
  iVar4 = GetOwner(param_1);
  if ((iVar4 != 0) &&
     (fVar9 = local_28 + *(float *)(gpGlobals + 0xc), fVar9 != *(float *)(iVar4 + 0x17dc))) {
    if (*(char *)(iVar4 + 0x6c) == '\0') {
      pCVar1 = *(CBaseEdict **)(iVar4 + 0x30);
      if (pCVar1 != (CBaseEdict *)0x0) {
        *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
        iVar6 = CBaseEdict::GetChangeAccessor(pCVar1);
        *(undefined2 *)(iVar6 + 2) = 0;
      }
    }
    else {
      *(byte *)(iVar4 + 0x70) = *(byte *)(iVar4 + 0x70) | 1;
    }
    *(float *)(iVar4 + 0x17dc) = fVar9;
  }
  if (local_28 == 0.0) {
    pCVar10 = (CBaseCombatWeapon *)0x0;
    (**(code **)(*(int *)param_1 + 0x430))(param_1,0);
  }
  else {
    fVar12 = local_28 + *(float *)(gpGlobals + 0xc);
    pcVar13 = "BaseCombatWeapon_HideThink";
    iVar3 = 0x5f1;
    uVar11 = 0;
    pCVar10 = param_1;
                    /* try { // try from 00408aef to 00408bc3 has its CatchHandler @ 00408bd9 */
    CBaseEntity::ThinkSet((_func_void *)local_24,(float)param_1,(char *)0x5f1);
  }
  fVar9 = *(float *)(param_1 + 0x148c);
  if ((fVar9 != 0.0) &&
     (*(float *)(gpGlobals + 0xc) <= fVar9 && fVar9 != *(float *)(gpGlobals + 0xc))) {
    if (param_1[0x1484] != (CBaseCombatWeapon)0x0) {
      (**(code **)(*(int *)param_1 + 0x3dc))(param_1,pCVar10,iVar3,uVar11,fVar12,pcVar13);
    }
    if (param_1[0x1485] != (CBaseCombatWeapon)0x0) {
      (**(code **)(*(int *)param_1 + 1000))(param_1);
    }
  }
  (**(code **)(*piVar2 + 0x6c))(piVar2);
  return 1;
}

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)