CCSGameRules::GetNextBestWeapon
0x00434250 · 488 bytes · __thiscall
_ZN12CCSGameRules17GetNextBestWeaponEP20CBaseCombatCharacterP17CBaseCombatWeapon
Decompiled
undefined (3 params)
/* CCSGameRules::GetNextBestWeapon(CBaseCombatCharacter*, CBaseCombatWeapon*) */
CBaseCombatWeapon * __thiscall
CCSGameRules::GetNextBestWeapon
(CCSGameRules *this,CBaseCombatCharacter *param_1,CBaseCombatWeapon *param_2)
{
uint uVar1;
CBaseCombatWeapon *this_00;
CBaseCombatWeapon *pCVar2;
char cVar3;
int iVar4;
int iVar5;
undefined *puVar6;
int iVar7;
CBaseCombatWeapon *local_20;
iVar7 = 0;
local_20 = (CBaseCombatWeapon *)0x0;
do {
uVar1 = *(uint *)(param_1 + iVar7 * 4 + 0x18f4);
pCVar2 = local_20;
if ((((uVar1 != 0xffffffff) &&
(puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar6 + 8) == uVar1 >> 0xc)) &&
(((this_00 = *(CBaseCombatWeapon **)(puVar6 + 4), this_00 != (CBaseCombatWeapon *)0x0 &&
(cVar3 = (**(code **)(*(int *)this_00 + 0x3c0))(this_00), cVar3 != '\0')) &&
(param_2 != this_00)))) {
iVar4 = (**(code **)(*(int *)this_00 + 0x530))(this_00);
if (iVar4 == 0) {
cVar3 = CBaseCombatWeapon::UsesPrimaryAmmo(this_00);
}
else {
iVar4 = (**(code **)(*(int *)this_00 + 0x530))(this_00);
if (iVar4 != 1) goto joined_r0x00434276;
cVar3 = CBaseCombatWeapon::UsesPrimaryAmmo(this_00);
}
if (((cVar3 == '\0') ||
(cVar3 = (**(code **)(*(int *)this_00 + 0x40c))(this_00), cVar3 != '\0')) &&
(pCVar2 = this_00, local_20 != (CBaseCombatWeapon *)0x0)) {
iVar4 = (**(code **)(*(int *)this_00 + 0x530))(this_00);
iVar5 = (**(code **)(*(int *)local_20 + 0x530))(local_20);
if (iVar5 <= iVar4) {
iVar4 = (**(code **)(*(int *)this_00 + 0x530))(this_00);
iVar5 = (**(code **)(*(int *)local_20 + 0x530))(local_20);
pCVar2 = local_20;
if (iVar4 == iVar5) {
iVar4 = (**(code **)(*(int *)this_00 + 0x534))(this_00);
iVar5 = (**(code **)(*(int *)local_20 + 0x534))(local_20);
pCVar2 = this_00;
if (iVar5 <= iVar4) {
pCVar2 = local_20;
}
}
}
}
}
joined_r0x00434276:
local_20 = pCVar2;
iVar7 = iVar7 + 1;
if (iVar7 == 0x38) {
if ((local_20 == (CBaseCombatWeapon *)0x0) && (param_2 == (CBaseCombatWeapon *)0x0)) {
iVar7 = 0;
while ((((uVar1 = *(uint *)(param_1 + iVar7 * 4 + 0x18f4), uVar1 == 0xffffffff ||
(puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar6 == (undefined *)0xfffffffc
)) || (*(uint *)(puVar6 + 8) != uVar1 >> 0xc)) ||
((pCVar2 = *(CBaseCombatWeapon **)(puVar6 + 4), pCVar2 == (CBaseCombatWeapon *)0x0 ||
(cVar3 = (**(code **)(*(int *)pCVar2 + 0x3c0))(pCVar2), cVar3 == '\0'))))) {
iVar7 = iVar7 + 1;
if (iVar7 == 0x38) {
return (CBaseCombatWeapon *)0x0;
}
}
return pCVar2;
}
return local_20;
}
} while( true );
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
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.
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.