L L4D2node

CBaseCombatWeapon::BaseForceFire

0x004051d0 · 879 bytes · __thiscall

_ZN17CBaseCombatWeapon13BaseForceFireEP20CBaseCombatCharacterP11CBaseEntity

Decompiled

undefined (3 params)

/* CBaseCombatWeapon::BaseForceFire(CBaseCombatCharacter*, CBaseEntity*) */

void __thiscall
CBaseCombatWeapon::BaseForceFire
          (CBaseCombatWeapon *this,CBaseCombatCharacter *param_1,CBaseEntity *param_2)

{
  CBaseEdict *pCVar1;
  code *pcVar2;
  char cVar3;
  int iVar4;
  undefined4 uVar5;
  int iVar6;
  float *pfVar7;
  longdouble lVar8;
  float fVar9;
  QAngle local_84 [12];
  undefined4 local_78;
  undefined4 local_74;
  undefined4 local_70;
  int local_6c;
  float local_68;
  float local_64;
  float local_60;
  float local_5c;
  float local_58;
  float local_54;
  undefined4 local_50;
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined1 local_20;
  
  iVar6 = *(int *)(this + 0x1420);
  if (this[0x6c] == (CBaseCombatWeapon)0x0) {
    pCVar1 = *(CBaseEdict **)(this + 0x30);
    if (pCVar1 != (CBaseEdict *)0x0) {
      *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
      iVar4 = CBaseEdict::GetChangeAccessor(pCVar1);
      *(undefined2 *)(iVar4 + 2) = 0;
    }
  }
  else {
    this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
  }
  *(int *)(this + 0x1420) = iVar6 + 1;
  cVar3 = (**(code **)(*(int *)this + 0x548))(this);
  if ((cVar3 != '\0') && (*(int *)(this + 0x1420) == 0)) {
    (**(code **)(*(int *)this + 0x468))(this);
    return;
  }
  (**(code **)(*(int *)param_1 + 0x518))(param_1);
  pcVar2 = *(code **)(*(int *)this + 0x3f0);
  uVar5 = (**(code **)(*(int *)this + 0x47c))(this);
  (*pcVar2)(this,uVar5);
  local_6c = 1;
  local_50 = 0;
  local_4c = 0;
  local_48 = 0;
  local_44 = 0x46000000;
  local_3c = 4;
  local_38 = 0;
  local_34 = 0;
  local_28 = 0;
  local_30 = 0;
  local_24 = 0;
  local_2c = 0x3f800000;
  local_20 = 1;
  iVar6 = CBaseAnimating::LookupAttachment((CBaseAnimating *)this,"muzzle");
  CBaseAnimating::GetAttachment((CBaseAnimating *)this,iVar6,(Vector *)&local_68,local_84);
  if (param_2 == (CBaseEntity *)0x0) {
    AngleVectors(local_84,(Vector *)&local_5c);
  }
  else {
    pfVar7 = (float *)(**(code **)(*(int *)param_2 + 0x288))(param_2);
    local_58 = pfVar7[1] - local_64;
    local_54 = pfVar7[2] - local_60;
    local_5c = *pfVar7 - local_68;
    VectorNormalize((Vector *)&local_5c);
  }
  local_6c = 0;
  lVar8 = (longdouble)(**(code **)(*(int *)this + 0x4a0))(this);
  do {
    fVar9 = *(float *)(this + 0x13fc);
    if (*(float *)(gpGlobals + 0xc) <= fVar9 && fVar9 != *(float *)(gpGlobals + 0xc)) break;
    (**(code **)(*(int *)this + 0x4b8))(this,1,fVar9);
    fVar9 = (float)lVar8 + *(float *)(this + 0x13fc);
    if (*(float *)(this + 0x13fc) != fVar9) {
      if (this[0x6c] == (CBaseCombatWeapon)0x0) {
        pCVar1 = *(CBaseEdict **)(this + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar6 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar6 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
      }
      *(float *)(this + 0x13fc) = fVar9;
    }
    local_6c = local_6c + 1;
  } while ((float)lVar8 != 0.0);
  cVar3 = (**(code **)(*(int *)this + 0x548))(this);
  iVar6 = local_6c;
  if (cVar3 == '\0') {
    iVar4 = CBaseCombatCharacter::GetAmmoCount(param_1,*(int *)(this + 0x1418));
    if (iVar4 <= iVar6) {
      local_6c = CBaseCombatCharacter::GetAmmoCount(param_1,*(int *)(this + 0x1418));
    }
    (**(code **)(*(int *)param_1 + 0x450))(param_1,local_6c,*(undefined4 *)(this + 0x1418));
  }
  else {
    iVar6 = *(int *)(this + 0x1420);
    if (iVar6 <= local_6c) {
      local_6c = iVar6;
    }
    iVar4 = iVar6 - local_6c;
    if (iVar6 != iVar4) {
      if (this[0x6c] == (CBaseCombatWeapon)0x0) {
        pCVar1 = *(CBaseEdict **)(this + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar6 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar6 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
      }
      *(int *)(this + 0x1420) = iVar4;
    }
  }
  local_40 = *(undefined4 *)(this + 0x1418);
  local_44 = 0x475db3d7;
  local_3c = 2;
  (**(code **)(*(int *)param_1 + 0x510))(&local_78,param_1,this,0);
  local_50 = local_78;
  local_4c = local_74;
  local_48 = local_70;
  (**(code **)(*(int *)param_1 + 0x1ec))(param_1,&local_6c);
  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)