L L4D2node

CTerrorWeapon::SetHelpingHandState

0x0053c980 · 812 bytes · __thiscall

_ZN13CTerrorWeapon19SetHelpingHandStateENS_16HelpingHandStateE

Decompiled

undefined (2 params)

/* CTerrorWeapon::SetHelpingHandState(CTerrorWeapon::HelpingHandState) */

void __thiscall CTerrorWeapon::SetHelpingHandState(CTerrorWeapon *this,int param_2)

{
  CBaseEdict *pCVar1;
  uint uVar2;
  int iVar3;
  CTerrorPlayer *this_00;
  CTerrorWeapon *pCVar4;
  int iVar5;
  CStudioHdr *pCVar6;
  undefined *puVar7;
  CStudioHdr *pCVar8;
  longdouble lVar9;
  undefined4 uVar10;
  
LAB_0053c99b:
  if (param_2 != *(int *)(this + 0x151c)) {
    if (this[0x6c] == (CTerrorWeapon)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] = (CTerrorWeapon)((byte)this[0x70] | 1);
    }
    *(int *)(this + 0x151c) = param_2;
  }
  lVar9 = (longdouble)IntervalTimer::Now();
  if ((float)lVar9 != *(float *)(this + 0x1518)) {
    (**(code **)(*(int *)(this + 0x1514) + 4))(this + 0x1514,this + 0x1518);
    *(float *)(this + 0x1518) = (float)lVar9;
  }
  this_00 = (CTerrorPlayer *)GetPlayerOwner(this);
  if (this_00 == (CTerrorPlayer *)0x0) {
    return;
  }
  if (*(int *)(this_00 + 0x30) == 0) {
    if (*(int *)(helping_hand_debug._28_4_ + 0x30) == 0) goto LAB_0053cc80;
  }
  else if (*(int *)(helping_hand_debug._28_4_ + 0x30) ==
           *(int *)(this_00 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4) {
LAB_0053cc80:
    Msg("server: new helping hand state: %d\n",param_2);
  }
  pCVar4 = (CTerrorWeapon *)CTerrorPlayer::GetActiveTerrorWeapon(this_00);
  if (pCVar4 != this) {
    return;
  }
  switch(*(undefined4 *)(this + 0x151c)) {
  case 0:
    goto switchD_0053ca64_caseD_0;
  default:
    return;
  case 2:
    this[0x1528] = (CTerrorWeapon)0x1;
    iVar3 = *(int *)this;
    uVar10 = 0x334;
    break;
  case 3:
    this[0x1528] = (CTerrorWeapon)0x1;
    (**(code **)(*(int *)this + 0x3f0))(this,0x336);
    this[0x1528] = (CTerrorWeapon)0x0;
    return;
  case 4:
    this[0x1528] = (CTerrorWeapon)0x1;
    iVar3 = *(int *)this;
    uVar10 = 0x33a;
    break;
  case 5:
    this[0x1528] = (CTerrorWeapon)0x1;
    (**(code **)(*(int *)this + 0x3f0))(this,0x33c);
    this[0x1528] = (CTerrorWeapon)0x0;
    return;
  case 6:
    this[0x1528] = (CTerrorWeapon)0x1;
    (**(code **)(*(int *)this + 0x3f0))(this,0x338);
    this[0x1528] = (CTerrorWeapon)0x0;
    goto LAB_0053cb11;
  case 7:
    this[0x1528] = (CTerrorWeapon)0x1;
    (**(code **)(*(int *)this + 0x3f0))(this,0x33e);
    this[0x1528] = (CTerrorWeapon)0x0;
LAB_0053cb11:
    param_2 = 0;
    goto LAB_0053c99b;
  }
  (**(code **)(iVar3 + 0x3f0))(this,uVar10);
  pCVar6 = *(CStudioHdr **)(this + 0x13e0);
  this[0x1528] = (CTerrorWeapon)0x0;
  iVar3 = *(int *)(this + 0x494);
  if (pCVar6 == (CStudioHdr *)0x0) {
    iVar5 = CBaseEntity::GetModel((CBaseEntity *)this);
    if (iVar5 == 0) {
      pCVar6 = *(CStudioHdr **)(this + 0x13e0);
    }
    else {
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)this);
      pCVar6 = *(CStudioHdr **)(this + 0x13e0);
    }
    pCVar8 = (CStudioHdr *)0x0;
    if (pCVar6 == (CStudioHdr *)0x0) goto LAB_0053cb86;
  }
  pCVar8 = (CStudioHdr *)0x0;
  if (*(int *)pCVar6 != 0) {
    pCVar8 = pCVar6;
  }
LAB_0053cb86:
  lVar9 = (longdouble)CBaseAnimating::SequenceDuration((CBaseAnimating *)this,pCVar8,iVar3);
  if ((float)lVar9 != *(float *)(this + 0x1524)) {
    if (this[0x6c] == (CTerrorWeapon)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] = (CTerrorWeapon)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x1524) = (float)lVar9;
    return;
  }
  return;
switchD_0053ca64_caseD_0:
  uVar2 = *(uint *)(this + 0x1520);
  if (uVar2 == 0xffffffff) {
    return;
  }
  puVar7 = g_pEntityList + (uVar2 & 0xfff) * 0x10;
  if (puVar7 == (undefined *)0xfffffffc) {
    return;
  }
  if (*(uint *)(puVar7 + 8) != uVar2 >> 0xc) {
    return;
  }
  if (*(int *)(puVar7 + 4) == 0) {
    return;
  }
  if (this[0x6c] == (CTerrorWeapon)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] = (CTerrorWeapon)((byte)this[0x70] | 1);
  }
  *(undefined4 *)(this + 0x1520) = 0xffffffff;
  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)