CTerrorGun::Use
0x00564d90 · 417 bytes · __cdecl
_ZN10CTerrorGun3UseEP11CBaseEntityS1_8USE_TYPEf
Decompiled
undefined (4 params)
/* CTerrorGun::Use(CBaseEntity*, CBaseEntity*, USE_TYPE, float) */
void CTerrorGun::Use(CBaseEntity *param_1,CCSPlayer *param_2)
{
code *pcVar1;
CBaseEdict *this;
char cVar2;
int iVar3;
int *piVar4;
int iVar5;
undefined4 *puVar6;
undefined4 uVar7;
int iVar8;
int iVar9;
if (((param_2 != (CCSPlayer *)0x0) &&
(cVar2 = (**(code **)(*(int *)param_2 + 0x16c))(param_2), cVar2 != '\0')) &&
(cVar2 = (**(code **)(*(int *)param_2 + 0x464))(param_2,param_1), cVar2 != '\0')) {
cVar2 = (**(code **)(*(int *)param_1 + 0x70c))(param_1);
if (cVar2 != '\0') {
iVar3 = (**(code **)(*(int *)param_1 + 0x638))(param_1);
piVar4 = (int *)CCSPlayer::GetCSWeapon(param_2,iVar3);
if (((piVar4 != (int *)0x0) &&
(piVar4 = (int *)(**(code **)(*piVar4 + 0x500))(piVar4), piVar4 != (int *)0x0)) &&
(*(char *)((int)piVar4 + 0x17e1) == '\0')) {
cVar2 = (**(code **)(*piVar4 + 0x71c))(piVar4);
if (cVar2 == '\0') {
return;
}
UTIL_Remove(param_1);
return;
}
}
(**(code **)(*(int *)param_2 + 0x468))(param_2,param_1);
iVar3 = *(int *)(param_1 + 0x14fc);
if ((iVar3 != 0) && (iVar5 = (**(code **)(*(int *)param_1 + 0x55c))(param_1), iVar5 != -1)) {
if (*(int *)(param_1 + 0x14fc) != 0) {
if (param_1[0x6c] == (CBaseEntity)0x0) {
this = *(CBaseEdict **)(param_1 + 0x30);
if (this != (CBaseEdict *)0x0) {
*(uint *)this = *(uint *)this | 0x101;
iVar8 = CBaseEdict::GetChangeAccessor(this);
*(undefined2 *)(iVar8 + 2) = 0;
}
}
else {
param_1[0x70] = (CBaseEntity)((byte)param_1[0x70] | 1);
}
*(undefined4 *)(param_1 + 0x14fc) = 0;
}
puVar6 = (undefined4 *)GetAmmoDef();
pcVar1 = *(code **)*puVar6;
uVar7 = (**(code **)(*(int *)param_1 + 0x55c))(param_1);
iVar8 = (*pcVar1)(puVar6,uVar7,param_2);
iVar9 = (**(code **)(*(int *)param_1 + 0x510))(param_1);
iVar8 = (iVar8 + iVar9) - *(int *)(param_1 + 0x1420);
if (-1 < iVar8) {
iVar9 = (**(code **)(*(int *)param_1 + 0x55c))(param_1);
iVar9 = CBaseCombatCharacter::GetAmmoCount((CBaseCombatCharacter *)param_2,iVar9);
iVar3 = iVar3 + iVar9;
if (iVar8 < iVar3) {
iVar3 = iVar8;
}
CBaseCombatCharacter::SetAmmoCount((CBaseCombatCharacter *)param_2,iVar3,iVar5);
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.