L L4D2node

CTerrorWeapon::HelpingHandPrimaryAttack

0x0053cd00 · 924 bytes · __thiscall

_ZN13CTerrorWeapon24HelpingHandPrimaryAttackEv

Decompiled

undefined (1 param)

/* CTerrorWeapon::HelpingHandPrimaryAttack() */

CTerrorWeapon __thiscall CTerrorWeapon::HelpingHandPrimaryAttack(CTerrorWeapon *this)

{
  CTerrorWeapon CVar1;
  uint uVar2;
  int *piVar3;
  CBaseEdict *pCVar4;
  char cVar5;
  int *piVar6;
  int iVar7;
  undefined *puVar8;
  CTerrorPlayer *this_00;
  float fVar9;
  float fVar10;
  undefined4 local_30 [3];
  undefined4 local_24;
  undefined4 local_20;
  
  if (*(int *)(allow_weapon_fire_to_use._28_4_ + 0x30) != 0) {
    piVar6 = (int *)GetPlayerOwner(this);
    if (piVar6 == (int *)0x0) {
      SetHelpingHandState(this,0);
    }
    else {
      cVar5 = (**(code **)(*piVar6 + 0x778))(piVar6);
      if (cVar5 == '\0') {
        CVar1 = this[0x1531];
        if (CVar1 == (CTerrorWeapon)0x0) {
          return (CTerrorWeapon)0x1;
        }
        if (*(int *)(this + 0x151c) == 0) {
          uVar2 = piVar6[0xb8a];
          if (((uVar2 != 0xffffffff) &&
              (puVar8 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc))
             && (*(uint *)(puVar8 + 8) == uVar2 >> 0xc)) {
            return (CTerrorWeapon)(*(int *)(puVar8 + 4) != 0);
          }
        }
        else {
          iVar7 = CWeaponCSBase::GetCSWpnData((CWeaponCSBase *)this);
          if (*(int *)(iVar7 + 0x894) != 0xd) {
            uVar2 = *(uint *)(this + 0x1520);
            if ((((uVar2 == 0xffffffff) ||
                 (puVar8 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar8 == (undefined *)0xfffffffc
                 )) || (*(uint *)(puVar8 + 8) != uVar2 >> 0xc)) ||
               ((this_00 = *(CTerrorPlayer **)(puVar8 + 4), this_00 == (CTerrorPlayer *)0x0 ||
                (cVar5 = (**(code **)(*(int *)this_00 + 0x16c))(this_00), cVar5 == '\0')))) {
              this_00 = (CTerrorPlayer *)0x0;
            }
            else {
              iVar7 = CBaseEntity::GetTeamNumber((CBaseEntity *)this_00);
              cVar5 = IsASurvivorTeam(iVar7);
              if (((cVar5 != '\0') &&
                  (iVar7 = (**(code **)(*(int *)this + 0x638))(this), iVar7 == 0xc)) &&
                 ((cVar5 = (**(code **)(*(int *)this_00 + 0x7e8))(this_00), cVar5 == '\0' &&
                  (((cVar5 = CTerrorPlayer::IsActionBeingPerformedOnMe(this_00,1), cVar5 == '\0' &&
                    (cVar5 = CTerrorPlayer::IsPerformingActionOnSelf(this_00,1), cVar5 == '\0')) &&
                   (*(int *)(this_00 + 0x100) < 99)))))) {
                return (CTerrorWeapon)0x0;
              }
            }
            if (this[0x1532] != (CTerrorWeapon)0x0) {
              return (CTerrorWeapon)0x1;
            }
            fVar9 = *(float *)(gpGlobals + 0xc) + 0.5;
            fVar10 = *(float *)(this + 0x1400);
            if (fVar9 != *(float *)(this + 0x1400)) {
              if (this[0x6c] == (CTerrorWeapon)0x0) {
                pCVar4 = *(CBaseEdict **)(this + 0x30);
                if (pCVar4 != (CBaseEdict *)0x0) {
                  *(uint *)pCVar4 = *(uint *)pCVar4 | 0x101;
                  iVar7 = CBaseEdict::GetChangeAccessor(pCVar4);
                  *(undefined2 *)(iVar7 + 2) = 0;
                }
              }
              else {
                this[0x70] = (CTerrorWeapon)((byte)this[0x70] | 1);
              }
              *(float *)(this + 0x1400) = fVar9;
              fVar10 = fVar9;
            }
            if (fVar10 != *(float *)(this + 0x13fc)) {
              if (this[0x6c] == (CTerrorWeapon)0x0) {
                pCVar4 = *(CBaseEdict **)(this + 0x30);
                if (pCVar4 != (CBaseEdict *)0x0) {
                  *(uint *)pCVar4 = *(uint *)pCVar4 | 0x101;
                  iVar7 = CBaseEdict::GetChangeAccessor(pCVar4);
                  *(undefined2 *)(iVar7 + 2) = 0;
                }
              }
              else {
                this[0x70] = (CTerrorWeapon)((byte)this[0x70] | 1);
              }
              *(float *)(this + 0x13fc) = fVar10;
            }
            if (this[0x1531] != (CTerrorWeapon)0x0) {
              if (this[0x6c] == (CTerrorWeapon)0x0) {
                pCVar4 = *(CBaseEdict **)(this + 0x30);
                if (pCVar4 != (CBaseEdict *)0x0) {
                  *(uint *)pCVar4 = *(uint *)pCVar4 | 0x101;
                  iVar7 = CBaseEdict::GetChangeAccessor(pCVar4);
                  *(undefined2 *)(iVar7 + 2) = 0;
                }
              }
              else {
                this[0x70] = (CTerrorWeapon)((byte)this[0x70] | 1);
              }
              this[0x1531] = (CTerrorWeapon)0x0;
            }
            if (this_00 != (CTerrorPlayer *)0x0) {
              CTerrorPlayer::OnPlayerUse(this_00,piVar6,piVar6,1,0);
              return CVar1;
            }
            uVar2 = *(uint *)(this + 0x1520);
            if (uVar2 == 0xffffffff) {
              return (CTerrorWeapon)0x1;
            }
            puVar8 = g_pEntityList + (uVar2 & 0xfff) * 0x10;
            if (puVar8 == (undefined *)0xfffffffc) {
              return (CTerrorWeapon)0x1;
            }
            if (*(uint *)(puVar8 + 8) != uVar2 >> 0xc) {
              return (CTerrorWeapon)0x1;
            }
            piVar3 = *(int **)(puVar8 + 4);
            if (piVar3 == (int *)0x0) {
              return (CTerrorWeapon)0x1;
            }
            local_30[0] = 0;
            local_24 = 0xffffffff;
            local_20 = 0;
            (**(code **)(*piVar3 + 0xb4))(piVar3,"Use",piVar6,piVar6,local_30,3);
            (**(code **)(*piVar6 + 0x6e8))(piVar6,piVar3,3);
            return CVar1;
          }
        }
      }
    }
  }
  return (CTerrorWeapon)0x0;
}

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)