L L4D2node

CBaseCombatWeapon::SetActivity

0x00404f60 · 557 bytes · __thiscall

_ZN17CBaseCombatWeapon11SetActivityE8Activityf

Decompiled

undefined (3 params)

/* CBaseCombatWeapon::SetActivity(Activity, float) */

void __thiscall
CBaseCombatWeapon::SetActivity(CBaseCombatWeapon *this,undefined4 param_2,float param_3)

{
  CBaseEdict *pCVar1;
  int iVar2;
  int iVar3;
  CStudioHdr *pCVar4;
  CStudioHdr *pCVar5;
  longdouble lVar6;
  float fVar7;
  float fVar8;
  
  iVar2 = (**(code **)(*(int *)this + 0x340))(this,param_2);
  if ((iVar2 == -1) && (iVar2 = (**(code **)(*(int *)this + 0x340))(this,0xb7), iVar2 == -1)) {
    return;
  }
  CBaseAnimating::SetSequence((CBaseAnimating *)this,iVar2);
  *(undefined4 *)(this + 0x1448) = param_2;
  if (*(float *)(this + 0x490) != 0.0) {
    if (this[0x6c] == (CBaseCombatWeapon)0x0) {
      pCVar1 = *(CBaseEdict **)(this + 0x30);
      if (pCVar1 != (CBaseEdict *)0x0) {
        *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
        iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
        *(undefined2 *)(iVar3 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
    }
    *(undefined4 *)(this + 0x490) = 0;
  }
  CBaseAnimating::ResetSequenceInfo((CBaseAnimating *)this);
  if (param_3 <= 0.0) {
    if (*(float *)(this + 0x468) == 1.0) {
      return;
    }
    if (this[0x6c] == (CBaseCombatWeapon)0x0) {
      pCVar1 = *(CBaseEdict **)(this + 0x30);
      if (pCVar1 != (CBaseEdict *)0x0) {
        *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
        iVar2 = CBaseEdict::GetChangeAccessor(pCVar1);
        *(undefined2 *)(iVar2 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
    }
    *(undefined4 *)(this + 0x468) = 0x3f800000;
    return;
  }
  pCVar4 = *(CStudioHdr **)(this + 0x13e0);
  if (pCVar4 == (CStudioHdr *)0x0) {
    iVar3 = CBaseEntity::GetModel((CBaseEntity *)this);
    if (iVar3 == 0) {
      pCVar4 = *(CStudioHdr **)(this + 0x13e0);
    }
    else {
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)this);
      pCVar4 = *(CStudioHdr **)(this + 0x13e0);
    }
    pCVar5 = (CStudioHdr *)0x0;
    if (pCVar4 == (CStudioHdr *)0x0) goto LAB_00404fd7;
  }
  pCVar5 = (CStudioHdr *)0x0;
  if (*(int *)pCVar4 != 0) {
    pCVar5 = pCVar4;
  }
LAB_00404fd7:
  lVar6 = (longdouble)CBaseAnimating::SequenceDuration((CBaseAnimating *)this,pCVar5,iVar2);
  fVar7 = *(float *)(this + 0x468);
  param_3 = (float)lVar6 / param_3;
  if (param_3 != fVar7) {
    if (this[0x6c] == (CBaseCombatWeapon)0x0) {
      pCVar1 = *(CBaseEdict **)(this + 0x30);
      if (pCVar1 != (CBaseEdict *)0x0) {
        *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
        iVar2 = CBaseEdict::GetChangeAccessor(pCVar1);
        *(undefined2 *)(iVar2 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x468) = param_3;
    fVar7 = param_3;
  }
  fVar8 = 12.0;
  if (fVar7 <= 12.0) {
    fVar8 = fVar7;
  }
  if (fVar8 != fVar7) {
    if (this[0x6c] == (CBaseCombatWeapon)0x0) {
      pCVar1 = *(CBaseEdict **)(this + 0x30);
      if (pCVar1 != (CBaseEdict *)0x0) {
        *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
        iVar2 = CBaseEdict::GetChangeAccessor(pCVar1);
        *(undefined2 *)(iVar2 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x468) = fVar8;
  }
  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)