CBaseCombatWeapon::PrimaryAttack
0x00406f60 · 1060 bytes · __thiscall
_ZN17CBaseCombatWeapon13PrimaryAttackEv
Decompiled
undefined (1 param)
/* CBaseCombatWeapon::PrimaryAttack() */
void __thiscall CBaseCombatWeapon::PrimaryAttack(CBaseCombatWeapon *this)
{
code *pcVar1;
CBaseEdict *pCVar2;
char cVar3;
CBaseCombatCharacter *this_00;
undefined4 uVar4;
int iVar5;
int iVar6;
longdouble lVar7;
float fVar8;
float fVar9;
float fVar10;
undefined4 local_78;
undefined4 local_74;
undefined4 local_70;
int local_6c;
undefined4 local_68;
undefined4 local_64;
undefined4 local_60;
undefined4 local_5c;
undefined4 local_58;
undefined4 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;
cVar3 = (**(code **)(*(int *)this + 0x548))(this);
if ((cVar3 != '\0') && (*(int *)(this + 0x1420) == 0)) {
(**(code **)(*(int *)this + 0x468))(this);
return;
}
this_00 = (CBaseCombatCharacter *)GetOwner(this);
if ((this_00 != (CBaseCombatCharacter *)0x0) &&
(cVar3 = (**(code **)(*(int *)this_00 + 0x16c))(this_00), cVar3 != '\0')) {
(**(code **)(*(int *)this_00 + 0x518))(this_00);
pcVar1 = *(code **)(*(int *)this + 0x3f0);
uVar4 = (**(code **)(*(int *)this + 0x47c))(this);
(*pcVar1)(this,uVar4);
(**(code **)(*(int *)this_00 + 0x620))(this_00,5);
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;
(**(code **)(*(int *)this_00 + 0x478))(&local_78,this_00);
local_68 = local_78;
local_64 = local_74;
local_60 = local_70;
(**(code **)(*(int *)this_00 + 0x700))(&local_78,this_00,0x3f800000);
local_6c = 0;
local_5c = local_78;
local_58 = local_74;
local_54 = local_70;
lVar7 = (longdouble)(**(code **)(*(int *)this + 0x4a0))(this);
iVar5 = gpGlobals;
fVar8 = *(float *)(this + 0x13fc);
fVar9 = *(float *)(gpGlobals + 0xc);
if ((*(float *)(this + 0x1444) < fVar9 - fVar8) &&
(fVar10 = fVar9 - *(float *)(this + 0x1444), fVar8 != fVar10)) {
if (this[0x6c] == (CBaseCombatWeapon)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar5 + 2) = 0;
iVar5 = gpGlobals;
}
}
else {
this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
}
*(float *)(this + 0x13fc) = fVar10;
fVar9 = *(float *)(iVar5 + 0xc);
fVar8 = fVar10;
}
while (fVar8 <= fVar9) {
(**(code **)(*(int *)this + 0x4b8))(this,1,fVar8);
fVar9 = (float)lVar7 + *(float *)(this + 0x13fc);
if (*(float *)(this + 0x13fc) != fVar9) {
if (this[0x6c] == (CBaseCombatWeapon)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar5 + 2) = 0;
}
}
else {
this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
}
*(float *)(this + 0x13fc) = fVar9;
}
local_6c = local_6c + 1;
if ((float)lVar7 == 0.0) break;
fVar9 = *(float *)(gpGlobals + 0xc);
fVar8 = *(float *)(this + 0x13fc);
}
cVar3 = (**(code **)(*(int *)this + 0x548))(this);
iVar5 = local_6c;
if (cVar3 == '\0') {
iVar6 = CBaseCombatCharacter::GetAmmoCount(this_00,*(int *)(this + 0x1418));
if (iVar6 <= iVar5) {
local_6c = CBaseCombatCharacter::GetAmmoCount(this_00,*(int *)(this + 0x1418));
}
(**(code **)(*(int *)this_00 + 0x450))(this_00,local_6c,*(undefined4 *)(this + 0x1418));
}
else {
iVar5 = *(int *)(this + 0x1420);
if (iVar5 <= local_6c) {
local_6c = iVar5;
}
iVar6 = iVar5 - local_6c;
if (iVar5 != iVar6) {
if (this[0x6c] == (CBaseCombatWeapon)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar5 + 2) = 0;
}
}
else {
this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
}
*(int *)(this + 0x1420) = iVar6;
}
}
local_40 = *(undefined4 *)(this + 0x1418);
local_44 = 0x475db3d7;
local_3c = 2;
(**(code **)(*(int *)this_00 + 0x510))(&local_78,this_00,this,0);
local_50 = local_78;
local_4c = local_74;
local_48 = local_70;
(**(code **)(*(int *)this_00 + 0x1ec))(this_00,&local_6c);
if ((*(int *)(this + 0x1420) == 0) &&
(iVar5 = CBaseCombatCharacter::GetAmmoCount(this_00,*(int *)(this + 0x1418)), iVar5 < 1)) {
CBasePlayer::SetSuitUpdate((CBasePlayer *)this_00,"!HEV_AMO0",0,0);
}
(**(code **)(*(int *)this + 0x4dc))(this);
}
return;
}
SourceMod gamedata
paste intoaddons/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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.