L L4D2node

CBaseViewModel::SetWeaponModel

0x0041cf00 · 573 bytes · __thiscall

_ZN14CBaseViewModel14SetWeaponModelEPKcP17CBaseCombatWeapon

Decompiled

undefined (3 params)

/* CBaseViewModel::SetWeaponModel(char const*, CBaseCombatWeapon*) */

void __thiscall
CBaseViewModel::SetWeaponModel(CBaseViewModel *this,char *param_1,CBaseCombatWeapon *param_2)

{
  uint uVar1;
  CBaseEdict *pCVar2;
  int *piVar3;
  undefined1 uVar4;
  uint *puVar5;
  undefined *puVar6;
  int iVar7;
  char *pcVar8;
  int *piVar9;
  undefined4 uVar10;
  uint local_28;
  undefined *local_24;
  int local_20;
  
  if (*(int *)(this + 0x458) == 0) {
    if (param_2 == (CBaseCombatWeapon *)0x0) goto LAB_0041d0a7;
LAB_0041cf28:
    puVar5 = (uint *)(**(code **)(*(int *)param_2 + 0xc))(param_2);
    local_28 = *puVar5;
    local_24 = g_pEntityList;
    if (((local_28 == 0xffffffff) ||
        (puVar6 = g_pEntityList + (local_28 & 0xfff) * 0x10, puVar6 == (undefined *)0xfffffffc)) ||
       (*(uint *)(puVar6 + 8) != local_28 >> 0xc)) {
      local_20 = 0;
    }
    else {
      local_20 = *(int *)(puVar6 + 4);
    }
  }
  else {
    if (this[0x6c] == (CBaseViewModel)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar7 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar7 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseViewModel)((byte)this[0x70] | 1);
    }
    *(undefined4 *)(this + 0x458) = 0;
    if (param_2 != (CBaseCombatWeapon *)0x0) goto LAB_0041cf28;
LAB_0041d0a7:
    local_24 = g_pEntityList;
    local_28 = 0xffffffff;
    local_20 = 0;
  }
  uVar1 = *(uint *)(this + 0x1618);
  if (((uVar1 == 0xffffffff) ||
      (puVar6 = local_24 + (uVar1 & 0xfff) * 0x10, puVar6 == (undefined *)0xfffffffc)) ||
     (*(uint *)(puVar6 + 8) != uVar1 >> 0xc)) {
    iVar7 = 0;
  }
  else {
    iVar7 = *(int *)(puVar6 + 4);
  }
  g_pEntityList = local_24;
  if (local_20 != iVar7) {
    if (this[0x6c] == (CBaseViewModel)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar7 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar7 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseViewModel)((byte)this[0x70] | 1);
    }
    *(uint *)(this + 0x1618) = local_28;
  }
  if ((param_1 != (char *)0x0) && (*param_1 == '\0')) {
    param_1 = (char *)0x0;
  }
  if (param_1 == *(char **)(this + 0x1628)) {
    return;
  }
  *(char **)(this + 0x1628) = param_1;
  pcVar8 = "";
  if (param_1 != (char *)0x0) {
    pcVar8 = param_1;
  }
  (**(code **)(*(int *)this + 0x70))(this,pcVar8);
  SpawnControlPanels(this);
  uVar4 = false;
  if (param_2 != (CBaseCombatWeapon *)0x0) {
    uVar4 = (**(code **)(*(int *)param_2 + 0x4f8))(param_2);
  }
  SetControlPanelsActive(this,(bool)uVar4);
  piVar3 = mdlcache;
  (**(code **)(*mdlcache + 0x68))(mdlcache);
  piVar9 = *(int **)(this + 0x13e0);
  if (piVar9 == (int *)0x0) {
                    /* try { // try from 0041d153 to 0041d163 has its CatchHandler @ 0041d177 */
    iVar7 = CBaseEntity::GetModel((CBaseEntity *)this);
    if (iVar7 != 0) {
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)this);
    }
    piVar9 = *(int **)(this + 0x13e0);
    if (piVar9 == (int *)0x0) goto LAB_0041d05a;
  }
  if (*piVar9 != 0) {
    uVar10 = 0xb7;
    if (param_2 != (CBaseCombatWeapon *)0x0) {
                    /* try { // try from 0041d03c to 0041d059 has its CatchHandler @ 0041d177 */
      uVar10 = (**(code **)(*(int *)param_2 + 0x6bc))(param_2,0xb7);
    }
    iVar7 = CBaseAnimating::SelectHeaviestSequence((CBaseAnimating *)this,uVar10);
    CBaseAnimating::SetSequence((CBaseAnimating *)this,iVar7);
  }
LAB_0041d05a:
                    /* WARNING: Could not recover jumptable at 0x0041d069. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (**(code **)(*piVar3 + 0x6c))();
  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)