L L4D2node

CPropMountedGun::FireThink

0x00550060 · 2456 bytes · __thiscall

_ZN15CPropMountedGun9FireThinkEv

Decompiled

undefined (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CPropMountedGun::FireThink() */

void __thiscall CPropMountedGun::FireThink(CPropMountedGun *this)

{
  float fVar1;
  float fVar2;
  CPropMountedGun CVar3;
  code *pcVar4;
  CBaseEdict *pCVar5;
  int iVar6;
  int iVar7;
  char cVar8;
  int iVar9;
  float *pfVar10;
  int iVar11;
  int iVar12;
  int *piVar13;
  int *piVar14;
  undefined *puVar15;
  uint uVar16;
  undefined4 *puVar17;
  CBasePlayer *this_00;
  longdouble lVar18;
  longdouble lVar19;
  Vector *local_70;
  float local_5c;
  float local_58;
  undefined1 local_54 [8];
  int local_4c;
  int local_48;
  Vector local_40 [12];
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  float local_28;
  float local_24;
  
  puVar17 = (undefined4 *)&stack0xffffff54;
  piVar14 = (int *)&stack0xffffff54;
  CVar3 = this[0x15dc];
  uVar16 = *(uint *)(this + 0x15cc);
  if (uVar16 == 0xffffffff) {
    uVar16 = 0xffffffff;
LAB_005500b0:
    this_00 = (CBasePlayer *)0x0;
  }
  else {
    puVar15 = g_pEntityList + (uVar16 & 0xfff) * 0x10;
    if (((puVar15 == (undefined *)0xfffffffc) || (*(uint *)(puVar15 + 8) != uVar16 >> 0xc)) ||
       (this_00 = *(CBasePlayer **)(puVar15 + 4), this_00 == (CBasePlayer *)0x0)) goto LAB_005500b0;
    cVar8 = (**(code **)(*(int *)this_00 + 0x16c))();
    uVar16 = *(uint *)(this + 0x15cc);
    if (cVar8 == '\0') goto LAB_005500b0;
  }
  if (((((uVar16 == 0xffffffff) ||
        (puVar15 = g_pEntityList + (uVar16 & 0xfff) * 0x10, puVar15 == (undefined *)0xfffffffc)) ||
       ((*(uint *)(puVar15 + 8) != uVar16 >> 0xc ||
        ((*(int *)(puVar15 + 4) == 0 ||
         (uVar16 = *(uint *)(*(int *)(puVar15 + 4) + 0x1d14), uVar16 == 0xffffffff)))))) ||
      (puVar15 = g_pEntityList + (uVar16 & 0xfff) * 0x10, puVar15 == (undefined *)0xfffffffc)) ||
     (((*(uint *)(puVar15 + 8) != uVar16 >> 0xc || (this != *(CPropMountedGun **)(puVar15 + 4))) ||
      (this_00 == (CBasePlayer *)0x0)))) {
    if (CVar3 != (CPropMountedGun)0x0) {
      OnFireStop(this);
    }
    if (this[0x15dc] != (CPropMountedGun)0x0) {
      if (this[0x6c] == (CPropMountedGun)0x0) {
        pCVar5 = *(CBaseEdict **)(this + 0x30);
        if (pCVar5 != (CBaseEdict *)0x0) {
          *(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
          iVar12 = CBaseEdict::GetChangeAccessor(pCVar5);
          *(undefined2 *)(iVar12 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CPropMountedGun)((byte)this[0x70] | 1);
      }
      this[0x15dc] = (CPropMountedGun)0x0;
    }
    uVar16 = *(uint *)(this + 0x15cc);
    if (uVar16 == 0xffffffff) {
      return;
    }
    puVar15 = g_pEntityList + (uVar16 & 0xfff) * 0x10;
    if (puVar15 == (undefined *)0xfffffffc) {
      return;
    }
    if (*(uint *)(puVar15 + 8) != uVar16 >> 0xc) {
      return;
    }
    if (*(int *)(puVar15 + 4) == 0) {
      return;
    }
    if (this[0x6c] == (CPropMountedGun)0x0) {
      pCVar5 = *(CBaseEdict **)(this + 0x30);
      if (pCVar5 != (CBaseEdict *)0x0) {
        *(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
        iVar12 = CBaseEdict::GetChangeAccessor(pCVar5);
        *(undefined2 *)(iVar12 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CPropMountedGun)((byte)this[0x70] | 1);
    }
    *(undefined4 *)(this + 0x15cc) = 0xffffffff;
    return;
  }
  local_4c = 0;
  local_48 = 0;
  if (___atan2f_finite == 0) {
    iVar12 = 0;
  }
  else {
    (**(code **)(___atan2f_finite + 0x50))();
    iVar12 = ___atan2f_finite;
  }
  iVar7 = local_48;
  iVar6 = local_4c;
  iVar11 = _DAT_0105db00;
                    /* try { // try from 00550282 to 00550286 has its CatchHandler @ 00550ad1 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar9 = ThreadGetCurrentId(), iVar11 == iVar9)) {
    if ((char *)*_DAT_0105d15c != "CPropMountedGun::FireThink") {
                    /* try { // try from 00550690 to 005506a1 has its CatchHandler @ 00550ad1 */
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc420e4,(char *)0x1,0xbfafa1);
    }
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
                    /* try { // try from 005502cc to 005503cc has its CatchHandler @ 00550acc */
  CBaseEntity::ThinkSet((_func_void *)local_54,(float)this,(char *)FireThink);
  pfVar10 = (float *)(**(code **)(*(int *)this_00 + 0x238))();
  fVar1 = *pfVar10;
  fVar2 = *(float *)(this + 0x15e4);
  AngleNormalize(pfVar10[1] - *(float *)(this + 0x15e8));
  AngleNormalize(fVar1 - fVar2);
  UpdatePoseParameters(this);
  if (((byte)this_00[0x1cb0] & 1) == 0) {
    if (this[0x15dc] != (CPropMountedGun)0x0) {
      if (this[0x6c] == (CPropMountedGun)0x0) {
        pCVar5 = *(CBaseEdict **)(this + 0x30);
        if (pCVar5 != (CBaseEdict *)0x0) {
          *(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
                    /* try { // try from 0055049b to 00550607 has its CatchHandler @ 00550acc */
          iVar11 = CBaseEdict::GetChangeAccessor(pCVar5);
          *(undefined2 *)(iVar11 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CPropMountedGun)((byte)this[0x70] | 1);
      }
      this[0x15dc] = (CPropMountedGun)0x0;
      if (((byte)this_00[0x1cb0] & 1) != 0) goto LAB_0055032f;
    }
LAB_005504c0:
    lVar18 = (longdouble)CountdownTimer::Now();
    if ((*(float *)(this + 0x162c) <= (float)lVar18) && ((*(uint *)(this_00 + 0x1cb0) & 0xe18) != 0)
       ) {
      uVar16 = *(uint *)(this_00 + 0x1d14);
      if ((((uVar16 != 0xffffffff) &&
           (puVar15 = g_pEntityList + (uVar16 & 0xfff) * 0x10, puVar15 != (undefined *)0xfffffffc))
          && (*(uint *)(puVar15 + 8) == uVar16 >> 0xc)) && (*(int *)(puVar15 + 4) != 0)) {
        if (this_00[0x6c] == (CBasePlayer)0x0) {
          pCVar5 = *(CBaseEdict **)(this_00 + 0x30);
          if (pCVar5 != (CBaseEdict *)0x0) {
            *(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
            iVar11 = CBaseEdict::GetChangeAccessor(pCVar5);
            *(undefined2 *)(iVar11 + 2) = 0;
          }
        }
        else {
          this_00[0x70] = (CBasePlayer)((byte)this_00[0x70] | 1);
        }
        *(undefined4 *)(this_00 + 0x1d14) = 0xffffffff;
      }
      (**(code **)(*(int *)this_00 + 0x76c))();
      CBasePlayer::RumbleEffect(this_00,'.','\0','\x01');
      uVar16 = *(uint *)(this + 0x15cc);
      if (((uVar16 != 0xffffffff) &&
          (puVar15 = g_pEntityList + (uVar16 & 0xfff) * 0x10, puVar15 != (undefined *)0xfffffffc))
         && ((*(uint *)(puVar15 + 8) == uVar16 >> 0xc && (*(int *)(puVar15 + 4) != 0)))) {
        if (this[0x6c] == (CPropMountedGun)0x0) {
          pCVar5 = *(CBaseEdict **)(this + 0x30);
          if (pCVar5 != (CBaseEdict *)0x0) {
            *(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
            iVar11 = CBaseEdict::GetChangeAccessor(pCVar5);
            *(undefined2 *)(iVar11 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CPropMountedGun)((byte)this[0x70] | 1);
        }
        *(undefined4 *)(this + 0x15cc) = 0xffffffff;
      }
      iVar11 = CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)this_00);
      if (iVar11 != 0) {
        uVar16 = *(uint *)(this_00 + 0x1a7c) & 0xfffffffe;
        if (*(uint *)(this_00 + 0x1a7c) != uVar16) {
          (**(code **)(*(int *)(this_00 + 0x1a40) + 4))();
          *(uint *)(this_00 + 0x1a7c) = uVar16;
        }
        piVar13 = (int *)CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)this_00);
        (**(code **)(*piVar13 + 0x424))();
      }
    }
    if (this[0x15dc] != (CPropMountedGun)0x0) {
      if (this[0x6c] == (CPropMountedGun)0x0) {
        pCVar5 = *(CBaseEdict **)(this + 0x30);
        if (pCVar5 != (CBaseEdict *)0x0) {
          *(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
                    /* try { // try from 00550976 to 00550a24 has its CatchHandler @ 00550acc */
          iVar11 = CBaseEdict::GetChangeAccessor(pCVar5);
          *(undefined2 *)(iVar11 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CPropMountedGun)((byte)this[0x70] | 1);
      }
      this[0x15dc] = (CPropMountedGun)0x0;
    }
    puVar17 = (undefined4 *)&stack0xffffff54;
    if (CVar3 == (CPropMountedGun)0x0) goto LAB_005503cd;
  }
  else {
LAB_0055032f:
    cVar8 = (**(code **)(*(int *)this_00 + 0x840))();
    if ((cVar8 == '\0') || (this[0x15dd] != (CPropMountedGun)0x0)) goto LAB_005504c0;
    if (this[0x15dc] != (CPropMountedGun)0x1) {
      if (this[0x6c] == (CPropMountedGun)0x0) {
        pCVar5 = *(CBaseEdict **)(this + 0x30);
        if (pCVar5 != (CBaseEdict *)0x0) {
          *(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
          iVar11 = CBaseEdict::GetChangeAccessor(pCVar5);
          *(undefined2 *)(iVar11 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CPropMountedGun)((byte)this[0x70] | 1);
      }
      this[0x15dc] = (CPropMountedGun)0x1;
    }
    if (1.0 / *(float *)(MountedGunRateOfFire._28_4_ + 0x2c) <=
        *(float *)(gpGlobals + 0xc) - *(float *)(this + 0x15fc)) {
                    /* try { // try from 005506d5 to 005508d4 has its CatchHandler @ 00550a40 */
      (**(code **)(*(int *)this_00 + 0x844))();
      *(undefined4 *)(this + 0x15fc) = *(undefined4 *)(gpGlobals + 0xc);
      if (((byte)this[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      }
      local_34 = *(undefined4 *)(this + 0x2e0);
      local_30 = *(undefined4 *)(this + 0x2e4);
      local_2c = *(undefined4 *)(this + 0x2e8);
      iVar11 = CBaseAnimating::LookupAttachment((CBaseAnimating *)this,"muzzle_flash");
      if (-1 < iVar11) {
        CBaseAnimating::GetAttachment
                  ((CBaseAnimating *)this,iVar11,(Vector *)&local_34,(QAngle *)&local_28);
        lVar18 = (longdouble)RandomFloat();
        lVar19 = (longdouble)RandomFloat();
        sincosf((float)lVar18,&local_58,&local_5c);
        local_28 = local_58 * (float)lVar19 + local_28;
        local_24 = local_5c * (float)lVar19 + local_24;
        AngleVectors((QAngle *)&local_28,local_40,(Vector *)0x0,(Vector *)0x0);
      }
      local_70 = (Vector *)&local_28;
      (**(code **)(*(int *)this_00 + 0x234))();
      piVar14 = (int *)(**(code **)(*gameeventmanager + 0x1c))();
      if (piVar14 != (int *)0x0) {
        pcVar4 = *(code **)(*piVar14 + 0x30);
        (**(code **)(*engine + 0x40))();
        (*pcVar4)();
        (**(code **)(*piVar14 + 0x3c))();
        (**(code **)(*piVar14 + 0x30))();
        (**(code **)(*gameeventmanager + 0x20))();
      }
      (**(code **)(*(int *)this_00 + 0x850))();
      for (iVar11 = IPredictionSystem::g_pPredictionSystems; iVar11 != 0;
          iVar11 = *(int *)(iVar11 + 4)) {
        *(int *)(iVar11 + 0x10) = *(int *)(iVar11 + 0x10) + 1;
      }
                    /* try { // try from 005508ee to 00550923 has its CatchHandler @ 00550ad5 */
      CBaseAnimating::DoMuzzleFlash((CBaseAnimating *)this);
      MountedGunFire((CTerrorPlayer *)this_00,this,local_70,(Vector *)&local_34,local_40,0.007453859
                     ,true);
      for (iVar11 = IPredictionSystem::g_pPredictionSystems;
          puVar17 = (undefined4 *)&stack0xffffff50, iVar11 != 0; iVar11 = *(int *)(iVar11 + 4)) {
        *(int *)(iVar11 + 0x10) = *(int *)(iVar11 + 0x10) + -1;
      }
    }
    piVar14 = puVar17;
    if (CVar3 == this[0x15dc]) goto LAB_005503cd;
    if (this[0x15dc] != (CPropMountedGun)0x0) {
      *puVar17 = this;
      puVar17[-1] = 0x5503cd;
      OnFireStart((CPropMountedGun *)*puVar17);
      goto LAB_005503cd;
    }
  }
  piVar14 = puVar17;
  *piVar14 = (int)this;
  piVar14[-1] = 0x550608;
  OnFireStop((CPropMountedGun *)*piVar14);
LAB_005503cd:
  iVar11 = _DAT_0105db00;
  if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
    piVar14[-1] = 0x5503eb;
    iVar9 = ThreadGetCurrentId();
    if (iVar11 == iVar9) {
      *piVar14 = (int)_DAT_0105d15c;
      piVar14[-1] = 0x55063d;
      cVar8 = CVProfNode::ExitScope();
      if (cVar8 != '\0') {
        _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
      }
      DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
    }
  }
  if (iVar12 == 0) {
    return;
  }
  *piVar14 = iVar12;
  piVar14[5] = 0;
  piVar14[4] = 0;
  piVar14[3] = 0;
  piVar14[1] = iVar6;
  piVar14[2] = iVar7;
  pcVar4 = *(code **)(iVar12 + 0x54);
  piVar14[-1] = 0x550427;
  (*pcVar4)();
  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)