CWeaponAmmoSpawn::Use
0x008dced0 · 401 bytes · __cdecl
_ZN16CWeaponAmmoSpawn3UseEP11CBaseEntityS1_8USE_TYPEf
Decompiled
undefined (4 params)
/* CWeaponAmmoSpawn::Use(CBaseEntity*, CBaseEntity*, USE_TYPE, float) */
void CWeaponAmmoSpawn::Use(undefined4 param_1,CBaseCombatCharacter *param_2)
{
code *pcVar1;
char cVar2;
CBaseCombatWeapon *this;
int iVar3;
CAmmoDef *this_00;
int iVar4;
undefined4 *puVar5;
int iVar6;
int iVar7;
int *piVar8;
undefined4 uVar9;
if (((param_2 != (CBaseCombatCharacter *)0x0) &&
(cVar2 = (**(code **)(*(int *)param_2 + 0x16c))(param_2), cVar2 != '\0')) &&
(this = (CBaseCombatWeapon *)(**(code **)(*(int *)param_2 + 0x484))(param_2,0),
this != (CBaseCombatWeapon *)0x0)) {
iVar3 = (**(code **)(*(int *)this + 0x638))(this);
if ((iVar3 == 0x15) || (iVar3 = (**(code **)(*(int *)this + 0x638))(this), iVar3 == 0x25)) {
piVar8 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"ammo_pile_weapon_cant_use_ammo",0,0);
if (piVar8 != (int *)0x0) {
pcVar1 = *(code **)(*piVar8 + 0x30);
uVar9 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(param_2 + 0x30));
(*pcVar1)(piVar8,"userid",uVar9);
/* WARNING: Could not recover jumptable at 0x008dd043. Too many branches */
/* WARNING: Treating indirect jump as call */
(**(code **)(*gameeventmanager + 0x20))();
return;
}
}
else {
cVar2 = CBaseCombatWeapon::UsesPrimaryAmmo(this);
if (cVar2 != '\0') {
iVar3 = (**(code **)(*(int *)this + 0x55c))(this);
this_00 = (CAmmoDef *)GetAmmoDef();
iVar4 = CAmmoDef::GetAmmoOfIndex(this_00,iVar3);
if (iVar4 != 0) {
puVar5 = (undefined4 *)GetAmmoDef();
iVar4 = (**(code **)*puVar5)(puVar5,iVar3,param_2);
iVar6 = (**(code **)(*(int *)this + 0x510))(this);
iVar7 = CBaseCombatCharacter::GetAmmoCount(param_2,iVar3);
if ((int)(iVar7 + (*(int *)(this + 0x1420) - (uint)(byte)this[0x1790])) < iVar6 + iVar4) {
CBaseCombatCharacter::SetAmmoCount
(param_2,(iVar6 + iVar4) -
(*(int *)(this + 0x1420) - (uint)(byte)this[0x1790]),iVar3);
CTerrorPlayer::OnAmmoPickedUp((CTerrorPlayer *)param_2);
return;
}
}
}
}
}
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.