CTerrorGun::EquipSecondWeapon
0x00564a50 · 778 bytes · __thiscall
_ZN10CTerrorGun17EquipSecondWeaponEv
Decompiled
undefined (1 param)
/* CTerrorGun::EquipSecondWeapon() */
undefined1 __thiscall CTerrorGun::EquipSecondWeapon(CTerrorGun *this)
{
CBaseEdict *pCVar1;
code *pcVar2;
CTerrorGun CVar3;
char cVar4;
int iVar5;
CBaseCombatCharacter *this_00;
CTerrorGun *pCVar6;
undefined4 uVar7;
int iVar8;
int *piVar9;
CBasePlayer *pCVar10;
CBaseCombatCharacter *pCVar11;
undefined **local_3c [11];
if (this[0x17e1] != (CTerrorGun)0x0) {
return 0;
}
if (this[0x1459] != (CTerrorGun)0x0) {
return 0;
}
if (this[0x17e0] != (CTerrorGun)0x1) {
CVar3 = (CTerrorGun)0x0;
if (this[0x6c] == (CTerrorGun)0x0) {
pCVar1 = *(CBaseEdict **)(this + 0x30);
if (pCVar1 != (CBaseEdict *)0x0) {
*(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(pCVar1);
*(undefined2 *)(iVar5 + 2) = 0;
CVar3 = this[0x17e1];
}
}
else {
this[0x70] = (CTerrorGun)((byte)this[0x70] | 1);
}
this[0x17e0] = (CTerrorGun)0x1;
if (CVar3 == (CTerrorGun)0x1) goto LAB_00564ac0;
}
if (this[0x6c] == (CTerrorGun)0x0) {
pCVar1 = *(CBaseEdict **)(this + 0x30);
if (pCVar1 != (CBaseEdict *)0x0) {
*(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(pCVar1);
*(undefined2 *)(iVar5 + 2) = 0;
}
}
else {
this[0x70] = (CTerrorGun)((byte)this[0x70] | 1);
}
this[0x17e1] = (CTerrorGun)0x1;
LAB_00564ac0:
this_00 = (CBaseCombatCharacter *)CTerrorWeapon::GetPlayerOwner((CTerrorWeapon *)this);
if ((this_00 != (CBaseCombatCharacter *)0x0) &&
(pCVar6 = (CTerrorGun *)CBaseCombatCharacter::GetActiveWeapon(this_00), this == pCVar6)) {
(**(code **)(*(int *)this + 0x3fc))(this);
}
pcVar2 = *(code **)(*(int *)this + 0x70);
uVar7 = (**(code **)(*(int *)this + 0x504))(this,0);
(*pcVar2)(this,uVar7);
if (this[0x17e2] != (CTerrorGun)0x0) {
if (this[0x6c] == (CTerrorGun)0x0) {
pCVar1 = *(CBaseEdict **)(this + 0x30);
if (pCVar1 != (CBaseEdict *)0x0) {
*(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
iVar5 = CBaseEdict::GetChangeAccessor(pCVar1);
*(undefined2 *)(iVar5 + 2) = 0;
}
}
else {
this[0x70] = (CTerrorGun)((byte)this[0x70] | 1);
}
this[0x17e2] = (CTerrorGun)0x0;
}
iVar5 = (**(code **)(*(int *)this + 0x510))(this);
if (iVar5 != *(int *)(this + 0x1420)) {
if (this[0x6c] == (CTerrorGun)0x0) {
pCVar1 = *(CBaseEdict **)(this + 0x30);
if (pCVar1 != (CBaseEdict *)0x0) {
*(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
iVar8 = CBaseEdict::GetChangeAccessor(pCVar1);
*(undefined2 *)(iVar8 + 2) = 0;
}
}
else {
this[0x70] = (CTerrorGun)((byte)this[0x70] | 1);
}
*(int *)(this + 0x1420) = iVar5;
}
if (this_00 != (CBaseCombatCharacter *)0x0) {
pCVar6 = (CTerrorGun *)CBaseCombatCharacter::GetActiveWeapon(this_00);
if (this == pCVar6) {
if (this[0x17e2] != (CTerrorGun)0x0) {
(**(code **)(*(int *)this + 0x468))(this);
}
}
else {
iVar5 = CBaseCombatCharacter::GetActiveWeapon(this_00);
if (iVar5 != 0) {
piVar9 = (int *)CBaseCombatCharacter::GetActiveWeapon(this_00);
(**(code **)(*piVar9 + 0x428))(piVar9,0);
}
CBaseCombatCharacter::SetActiveWeapon(this_00,(CBaseCombatWeapon *)this);
(**(code **)(*(int *)this + 0x424))(this);
}
CRecipientFilter::CRecipientFilter((CRecipientFilter *)local_3c);
local_3c[0] = &PTR__CSingleUserRecipientFilter_00c08ea8;
/* try { // try from 00564bbc to 00564bc0 has its CatchHandler @ 00564d6a */
CRecipientFilter::AddRecipient((CRecipientFilter *)local_3c,(CBasePlayer *)this_00);
iVar5 = 0;
while (iVar5 < *(int *)(gpGlobals + 0x14)) {
iVar5 = iVar5 + 1;
/* try { // try from 00564bd8 to 00564c7c has its CatchHandler @ 00564d7f */
pCVar10 = (CBasePlayer *)UTIL_PlayerByIndex(iVar5);
if ((((pCVar10 != (CBasePlayer *)0x0) &&
(cVar4 = (**(code **)(*(int *)pCVar10 + 300))(pCVar10), cVar4 == '\0')) &&
(iVar8 = (**(code **)(*(int *)pCVar10 + 0x648))(pCVar10), iVar8 == 4)) &&
(pCVar11 = (CBaseCombatCharacter *)(**(code **)(*(int *)pCVar10 + 0x654))(pCVar10),
this_00 == pCVar11)) {
CRecipientFilter::AddRecipient((CRecipientFilter *)local_3c,pCVar10);
}
}
iVar5 = CRecipientFilter::GetRecipientCount((CRecipientFilter *)local_3c);
if (iVar5 != 0) {
if (*(int *)(this_00 + 0x30) == 0) {
iVar5 = 0;
}
else {
iVar5 = *(int *)(this_00 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
CBaseEntity::EmitSound
((IRecipientFilter *)local_3c,iVar5,"Player.PickupWeapon",(Vector *)0x0,0.0,
(float *)0x0);
}
local_3c[0] = &PTR__CSingleUserRecipientFilter_00c08ea8;
CRecipientFilter::~CRecipientFilter((CRecipientFilter *)local_3c);
}
return 1;
}
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.