CBaseCombatCharacter::Weapon_Switch
0x003fe0a0 · 449 bytes · __cdecl
_ZN20CBaseCombatCharacter13Weapon_SwitchEP17CBaseCombatWeaponi
Decompiled
undefined (2 params)
/* CBaseCombatCharacter::Weapon_Switch(CBaseCombatWeapon*, int) */
undefined4 CBaseCombatCharacter::Weapon_Switch(CBaseCombatWeapon *param_1,int param_2)
{
CBaseEdict *this;
int *piVar1;
char cVar2;
uint uVar3;
int iVar4;
undefined4 *puVar5;
undefined4 uVar6;
int *piVar7;
undefined *puVar8;
uint uVar9;
if (param_2 == 0) {
return 0;
}
uVar3 = *(uint *)(param_1 + 0x19d4);
if ((((uVar3 != 0xffffffff) &&
(puVar8 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar8 + 8) == uVar3 >> 0xc)) && (param_2 == *(int *)(puVar8 + 4))) {
cVar2 = (**(code **)(*(int *)param_2 + 0x434))(param_2);
if (cVar2 != '\0') {
return 0;
}
uVar3 = *(uint *)(param_1 + 0x19d4);
if (((uVar3 == 0xffffffff) ||
(puVar8 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar8 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar8 + 8) != uVar3 >> 0xc)) {
piVar7 = (int *)0x0;
}
else {
piVar7 = *(int **)(puVar8 + 4);
}
/* WARNING: Could not recover jumptable at 0x003fe1fd. Too many branches */
/* WARNING: Treating indirect jump as call */
uVar6 = (**(code **)(*piVar7 + 0x424))();
return uVar6;
}
cVar2 = (**(code **)(*(int *)param_1 + 0x47c))(param_1,param_2);
if (cVar2 == '\0') {
return 0;
}
uVar3 = *(uint *)(param_1 + 0x19d4);
if (uVar3 != 0xffffffff) {
uVar9 = uVar3 & 0xfff;
piVar7 = (int *)(g_pEntityList + uVar9 * 0x10 + 4);
if (piVar7 != (int *)0x0) {
if ((*(uint *)(g_pEntityList + uVar9 * 0x10 + 8) == uVar3 >> 0xc) &&
(piVar1 = *(int **)(g_pEntityList + uVar9 * 0x10 + 4), piVar1 != (int *)0x0)) {
cVar2 = (**(code **)(*piVar1 + 0x428))(piVar1,param_2);
if (cVar2 == '\0') {
return 0;
}
uVar3 = *(uint *)(param_1 + 0x19d4);
if ((uVar3 == 0xffffffff) ||
(piVar7 = (int *)(g_pEntityList + (uVar3 & 0xfff) * 0x10 + 4), piVar7 == (int *)0x0))
goto LAB_003fe13e;
}
if ((piVar7[1] == uVar3 >> 0xc) && (param_2 == *piVar7)) goto LAB_003fe173;
}
}
LAB_003fe13e:
if (param_1[0x6c] == (CBaseCombatWeapon)0x0) {
this = *(CBaseEdict **)(param_1 + 0x30);
if (this != (CBaseEdict *)0x0) {
*(uint *)this = *(uint *)this | 0x101;
iVar4 = CBaseEdict::GetChangeAccessor(this);
*(undefined2 *)(iVar4 + 2) = 0;
}
}
else {
param_1[0x70] = (CBaseCombatWeapon)((byte)param_1[0x70] | 1);
}
puVar5 = (undefined4 *)(**(code **)(*(int *)param_2 + 0xc))(param_2);
*(undefined4 *)(param_1 + 0x19d4) = *puVar5;
LAB_003fe173:
/* WARNING: Could not recover jumptable at 0x003fe185. Too many branches */
/* WARNING: Treating indirect jump as call */
uVar6 = (**(code **)(*(int *)param_2 + 0x424))();
return uVar6;
}
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.