L L4D2node

CBaseCombatWeapon::SetIdealActivity

0x00409a00 · 626 bytes · __thiscall

_ZN17CBaseCombatWeapon16SetIdealActivityE8Activity

Decompiled

undefined (2 params)

/* CBaseCombatWeapon::SetIdealActivity(Activity) */

undefined4 __thiscall CBaseCombatWeapon::SetIdealActivity(CBaseCombatWeapon *this,int param_2)

{
  CBaseEdict *pCVar1;
  code *pcVar2;
  int *piVar3;
  char cVar4;
  int iVar5;
  CStudioHdr *pCVar6;
  int iVar7;
  CStudioHdr *pCVar8;
  undefined4 uVar9;
  longdouble lVar10;
  float local_20;
  
  piVar3 = mdlcache;
  (**(code **)(*mdlcache + 0x68))(mdlcache);
                    /* try { // try from 00409a26 to 00409bbb has its CatchHandler @ 00409ca6 */
  iVar5 = (**(code **)(*(int *)this + 0x340))(this,param_2);
  if (iVar5 == -1) {
    uVar9 = 0;
    goto LAB_00409bc1;
  }
  *(int *)(this + 0x1460) = iVar5;
  *(int *)(this + 0x1464) = param_2;
  iVar5 = CBaseAnimating::FindTransitionSequence
                    ((CBaseAnimating *)this,*(int *)(this + 0x494),iVar5,(int *)0x0);
  if (param_2 == 0xb5) {
    iVar7 = *(int *)(this + 0x1460);
LAB_00409ab6:
    *(undefined4 *)(this + 0x1448) = *(undefined4 *)(this + 0x1464);
    CBaseAnimating::SetSequence((CBaseAnimating *)this,iVar7);
    (**(code **)(*(int *)this + 0x3f4))(this,*(undefined4 *)(this + 0x1460));
    if (*(float *)(this + 0x468) != 1.0) {
      if (this[0x6c] == (CBaseCombatWeapon)0x0) {
        pCVar1 = *(CBaseEdict **)(this + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar5 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar5 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
      }
      *(undefined4 *)(this + 0x468) = 0x3f800000;
    }
  }
  else {
    cVar4 = (**(code **)(*(int *)this + 0x434))(this);
    iVar7 = *(int *)(this + 0x1460);
    if ((cVar4 == '\0') || (iVar5 == iVar7)) goto LAB_00409ab6;
    *(undefined4 *)(this + 0x1448) = 2;
    CBaseAnimating::SetSequence((CBaseAnimating *)this,iVar5);
    (**(code **)(*(int *)this + 0x3f4))(this,iVar5);
  }
  CBaseAnimating::ResetSequenceInfo((CBaseAnimating *)this);
  if (*(float *)(this + 0x490) != 0.0) {
    if (this[0x6c] == (CBaseCombatWeapon)0x0) {
      pCVar1 = *(CBaseEdict **)(this + 0x30);
      if (pCVar1 != (CBaseEdict *)0x0) {
        *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
                    /* try { // try from 00409bee to 00409c83 has its CatchHandler @ 00409ca6 */
        iVar5 = CBaseEdict::GetChangeAccessor(pCVar1);
        *(undefined2 *)(iVar5 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
    }
    *(undefined4 *)(this + 0x490) = 0;
  }
  iVar5 = gpGlobals;
  local_20 = *(float *)(gpGlobals + 0xc);
  if (local_20 != *(float *)(this + 0x90)) {
    if (this[0x6c] == (CBaseCombatWeapon)0x0) {
      pCVar1 = *(CBaseEdict **)(this + 0x30);
      if (pCVar1 != (CBaseEdict *)0x0) {
        *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(pCVar1);
        *(undefined2 *)(iVar5 + 2) = 0;
        iVar5 = gpGlobals;
      }
    }
    else {
      this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x90) = local_20;
    local_20 = *(float *)(iVar5 + 0xc);
  }
  iVar5 = *(int *)(this + 0x494);
  pcVar2 = *(code **)(*(int *)this + 0x404);
  pCVar6 = *(CStudioHdr **)(this + 0x13e0);
  if (pCVar6 == (CStudioHdr *)0x0) {
    iVar7 = CBaseEntity::GetModel((CBaseEntity *)this);
    if (iVar7 != 0) {
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)this);
    }
    pCVar6 = *(CStudioHdr **)(this + 0x13e0);
    pCVar8 = (CStudioHdr *)0x0;
    if (pCVar6 != (CStudioHdr *)0x0) goto LAB_00409b88;
  }
  else {
LAB_00409b88:
    pCVar8 = (CStudioHdr *)0x0;
    if (*(int *)pCVar6 != 0) {
      pCVar8 = pCVar6;
    }
  }
  lVar10 = (longdouble)CBaseAnimating::SequenceDuration((CBaseAnimating *)this,pCVar8,iVar5);
  (*pcVar2)(this,(float)lVar10 + local_20);
  uVar9 = 1;
LAB_00409bc1:
  (**(code **)(*piVar3 + 0x6c))(piVar3);
  return uVar9;
}

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)