CBaseCombatCharacter::Weapon_Equip
0x005f6860 · 1456 bytes · __thiscall
_ZN20CBaseCombatCharacter12Weapon_EquipEP17CBaseCombatWeapon
Decompiled
undefined (2 params)
/* CBaseCombatCharacter::Weapon_Equip(CBaseCombatWeapon*) */
void __thiscall
CBaseCombatCharacter::Weapon_Equip(CBaseCombatCharacter *this,CBaseCombatWeapon *param_1)
{
code *pcVar1;
CBaseEdict *pCVar2;
int *piVar3;
char cVar4;
undefined4 *puVar5;
int iVar6;
undefined4 uVar7;
uint *puVar8;
undefined4 uVar9;
undefined *puVar10;
undefined *puVar11;
undefined1 *puVar12;
CBaseEntity *pCVar13;
CBaseCombatCharacter *__s1;
int iVar14;
uint uVar15;
undefined1 *puVar16;
undefined4 local_20 [4];
iVar14 = 0;
__s1 = this + 0x18f4;
while ((((uVar15 = *(uint *)__s1, uVar15 != 0xffffffff &&
(puVar11 = g_pEntityList + (uVar15 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar11 + 8) == uVar15 >> 0xc)) && (*(int *)(puVar11 + 4) != 0))) {
iVar14 = iVar14 + 1;
__s1 = __s1 + 4;
if (iVar14 == 0x38) {
LAB_005f68f7:
pcVar1 = *(code **)(*(int *)param_1 + 0x194);
uVar7 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
(*pcVar1)(param_1,uVar7);
iVar14 = (**(code **)(*(int *)param_1 + 0x510))(param_1);
if (iVar14 == -1) {
uVar7 = *(undefined4 *)(param_1 + 0x1418);
pcVar1 = *(code **)(*(int *)this + 0x44c);
uVar9 = (**(code **)(*(int *)param_1 + 0x518))(param_1);
(*pcVar1)(this,uVar9,uVar7,0);
}
else {
iVar14 = (**(code **)(*(int *)param_1 + 0x518))(param_1);
iVar6 = (**(code **)(*(int *)param_1 + 0x510))(param_1);
if (iVar6 < iVar14) {
iVar14 = (**(code **)(*(int *)param_1 + 0x510))(param_1);
if (iVar14 != *(int *)(param_1 + 0x1420)) {
if (param_1[0x6c] == (CBaseCombatWeapon)0x0) {
pCVar2 = *(CBaseEdict **)(param_1 + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
param_1[0x70] = (CBaseCombatWeapon)((byte)param_1[0x70] | 1);
}
*(int *)(param_1 + 0x1420) = iVar14;
}
uVar7 = *(undefined4 *)(param_1 + 0x1418);
pcVar1 = *(code **)(*(int *)this + 0x44c);
iVar14 = (**(code **)(*(int *)param_1 + 0x518))(param_1);
iVar6 = (**(code **)(*(int *)param_1 + 0x510))(param_1);
(*pcVar1)(this,iVar14 - iVar6,uVar7,0);
}
}
iVar14 = (**(code **)(*(int *)param_1 + 0x514))(param_1);
if (iVar14 == -1) {
uVar7 = *(undefined4 *)(param_1 + 0x141c);
pcVar1 = *(code **)(*(int *)this + 0x44c);
uVar9 = (**(code **)(*(int *)param_1 + 0x51c))(param_1);
(*pcVar1)(this,uVar9,uVar7,0);
}
else {
iVar14 = (**(code **)(*(int *)param_1 + 0x51c))(param_1);
iVar6 = (**(code **)(*(int *)param_1 + 0x514))(param_1);
if (iVar6 < iVar14) {
iVar14 = (**(code **)(*(int *)param_1 + 0x514))(param_1);
if (iVar14 != *(int *)(param_1 + 0x1424)) {
if (param_1[0x6c] == (CBaseCombatWeapon)0x0) {
pCVar2 = *(CBaseEdict **)(param_1 + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
param_1[0x70] = (CBaseCombatWeapon)((byte)param_1[0x70] | 1);
}
*(int *)(param_1 + 0x1424) = iVar14;
}
uVar7 = *(undefined4 *)(param_1 + 0x141c);
pcVar1 = *(code **)(*(int *)this + 0x44c);
iVar14 = (**(code **)(*(int *)param_1 + 0x51c))(param_1);
iVar6 = (**(code **)(*(int *)param_1 + 0x514))(param_1);
(*pcVar1)(this,iVar14 - iVar6,uVar7,0);
}
}
(**(code **)(*(int *)param_1 + 0x3b0))(param_1,this);
cVar4 = (**(code **)(*(int *)this + 0x16c))(this);
if (cVar4 == '\0') {
uVar15 = *(uint *)(this + 0x19d4);
if (((uVar15 != 0xffffffff) &&
(puVar11 = g_pEntityList + (uVar15 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc))
&& ((*(uint *)(puVar11 + 8) == uVar15 >> 0xc &&
(piVar3 = *(int **)(puVar11 + 4), piVar3 != (int *)0x0)))) {
(**(code **)(*piVar3 + 0x428))(piVar3,0);
pCVar13 = (CBaseEntity *)0x0;
uVar15 = *(uint *)(this + 0x19d4);
if (((uVar15 != 0xffffffff) &&
(puVar11 = g_pEntityList + (uVar15 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc
)) && (*(uint *)(puVar11 + 8) == uVar15 >> 0xc)) {
pCVar13 = *(CBaseEntity **)(puVar11 + 4);
}
CBaseEntity::AddEffects(pCVar13,0x20);
}
pCVar13 = (CBaseEntity *)0x0;
SetActiveWeapon(this,param_1);
uVar15 = *(uint *)(this + 0x19d4);
if (((uVar15 != 0xffffffff) &&
(puVar11 = g_pEntityList + (uVar15 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar11 + 8) == uVar15 >> 0xc)) {
pCVar13 = *(CBaseEntity **)(puVar11 + 4);
}
uVar15 = *(uint *)(pCVar13 + 0xd4) & 0xffffffdf;
if (*(uint *)(pCVar13 + 0xd4) == uVar15) {
puVar8 = *(uint **)(pCVar13 + 0x30);
}
else {
if (pCVar13[0x6c] == (CBaseEntity)0x0) {
pCVar2 = *(CBaseEdict **)(pCVar13 + 0x30);
puVar8 = (uint *)0x0;
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar14 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar14 + 2) = 0;
puVar8 = *(uint **)(pCVar13 + 0x30);
}
}
else {
pCVar13[0x70] = (CBaseEntity)((byte)pCVar13[0x70] | 1);
puVar8 = *(uint **)(pCVar13 + 0x30);
}
*(uint *)(pCVar13 + 0xd4) = uVar15;
}
if (puVar8 != (uint *)0x0) {
*puVar8 = *puVar8 | 0x80;
}
CBaseEntity::DispatchUpdateTransmitState(pCVar13);
}
cVar4 = (**(code **)(*(int *)this + 0x16c))(this);
puVar11 = g_pEntityList;
if ((cVar4 == '\0') && (((byte)this[0x149] & 1) != 0)) {
uVar15 = *(uint *)(this + 0x19d4);
iVar14 = 0;
if ((uVar15 != 0xffffffff) &&
((puVar10 = g_pEntityList + (uVar15 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc
&& (*(uint *)(puVar10 + 8) == uVar15 >> 0xc)))) {
iVar14 = *(int *)(puVar10 + 4);
}
*(undefined4 *)(iVar14 + 0x143c) = 0x4e6e6b28;
iVar14 = 0;
uVar15 = *(uint *)(this + 0x19d4);
if (((uVar15 != 0xffffffff) &&
(puVar11 = puVar11 + (uVar15 & 0xfff) * 0x10, puVar11 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar11 + 8) == uVar15 >> 0xc)) {
iVar14 = *(int *)(puVar11 + 4);
}
*(undefined4 *)(iVar14 + 0x1440) = 0x4e6e6b28;
}
uVar7 = (**(code **)(*(int *)this + 0x50c))(this,param_1);
if (*(int *)(weapon_showproficiency._28_4_ + 0x30) != 0) {
uVar9 = GetWeaponProficiencyName(uVar7);
puVar16 = *(undefined1 **)(param_1 + 0x7c);
if (puVar16 == (undefined1 *)0x0) {
puVar16 = &DAT_00d539c2;
}
puVar12 = &DAT_00d539c2;
if (*(undefined1 **)(this + 0x7c) != (undefined1 *)0x0) {
puVar12 = *(undefined1 **)(this + 0x7c);
}
Msg("%s equipped with %s, proficiency is %s\n",puVar12,puVar16,uVar9);
}
*(undefined4 *)(this + 0x1844) = uVar7;
return;
}
}
local_20[0] = 0xffffffff;
if (param_1 != (CBaseCombatWeapon *)0x0) {
puVar5 = (undefined4 *)(**(code **)(*(int *)param_1 + 0xc))(param_1);
local_20[0] = *puVar5;
}
iVar6 = memcmp(__s1,local_20,4);
if (iVar6 != 0) {
if (this[0x6c] == (CBaseCombatCharacter)0x0) {
pCVar2 = *(CBaseEdict **)(this + 0x30);
if (pCVar2 != (CBaseEdict *)0x0) {
*(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
*(undefined2 *)(iVar6 + 2) = 0;
}
}
else {
this[0x70] = (CBaseCombatCharacter)((byte)this[0x70] | 1);
}
*(undefined4 *)(this + iVar14 * 4 + 0x18f4) = local_20[0];
}
iVar6 = (**(code **)(*(int *)param_1 + 0x638))(param_1);
this[iVar6 + 0x1800] = (CBaseCombatCharacter)((char)iVar14 + '\x01');
goto LAB_005f68f7;
}
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.