CTerrorPlayer::GiveActiveWeapon
0x009c63c0 · 904 bytes · __thiscall
_ZN13CTerrorPlayer16GiveActiveWeaponEPS_
Decompiled
undefined (2 params)
/* CTerrorPlayer::GiveActiveWeapon(CTerrorPlayer*) */
void __thiscall CTerrorPlayer::GiveActiveWeapon(CTerrorPlayer *this,CTerrorPlayer *param_1)
{
code *pcVar1;
code *pcVar2;
char cVar3;
int iVar4;
int *piVar5;
QAngle *pQVar6;
int iVar7;
int *piVar8;
int *piVar9;
CTerrorPlayer *pCVar10;
longdouble lVar11;
uint uVar12;
float fVar13;
undefined1 auStackY_f4 [40];
float local_a4;
float local_90;
float local_8c;
float local_88;
float local_84;
float local_80;
float local_7c;
float local_78;
float local_74;
float local_70;
float local_6c;
float local_68;
float local_64;
undefined **local_60;
CTerrorPlayer *local_5c;
Vector local_58 [12];
undefined4 local_4c;
undefined4 local_48;
undefined4 local_44;
undefined4 local_40;
undefined4 local_3c;
undefined1 local_38;
undefined4 local_34;
int local_30 [8];
piVar8 = (int *)&stack0xffffff34;
iVar4 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
if ((((iVar4 == 2) && (cVar3 = (**(code **)(*(int *)this + 300))(), cVar3 != '\0')) &&
(cVar3 = (**(code **)(*(int *)this + 0x7e8))(), cVar3 == '\0')) &&
((piVar5 = (int *)GetActiveTerrorWeapon(this), piVar5 != (int *)0x0 &&
(iVar4 = (**(code **)(*piVar5 + 0x530))(), iVar4 == 4)))) {
local_60 = &PTR_operator___00c22340;
local_30[0] = 0;
local_30[1] = 0;
local_30[2] = 0;
local_30[3] = 0;
local_30[4] = 0;
local_5c = this;
/* try { // try from 009c6460 to 009c6474 has its CatchHandler @ 009c6774 */
pQVar6 = (QAngle *)(**(code **)(*(int *)this + 0x238))();
AngleVectors(pQVar6,local_58);
local_4c = 2;
local_48 = 0x3f333333;
local_44 = 0x3f333333;
local_40 = 0x43800000;
local_34 = 0;
local_3c = 0x42480000;
local_38 = 0;
local_60 = &PTR_operator___00d1b060;
/* try { // try from 009c64b0 to 009c654f has its CatchHandler @ 009c6772 */
ForEachSurvivor<TargetScanNotOccluded<CTerrorPlayer>>((TargetScanNotOccluded *)&local_60);
CBasePlayer::EyeVectors((CBasePlayer *)this,(Vector *)&local_90,(Vector *)0x0,(Vector *)0x0);
if (0 < local_30[3]) {
iVar4 = 0;
local_a4 = 16384.0;
piVar9 = (int *)&stack0xffffff34;
do {
pCVar10 = *(CTerrorPlayer **)(local_30[0] + iVar4 * 4);
iVar7 = *(int *)pCVar10;
piVar9[1] = 4;
*piVar9 = (int)pCVar10;
pcVar1 = *(code **)(iVar7 + 0x484);
piVar9[-1] = 0x9c6525;
iVar7 = (*pcVar1)();
piVar8 = piVar9;
if (iVar7 == 0) {
iVar7 = *(int *)this;
piVar9[1] = (int)this;
*piVar9 = (int)&local_6c;
pcVar1 = *(code **)(iVar7 + 0x234);
piVar9[-1] = 0x9c653b;
(*pcVar1)();
iVar7 = *(int *)pCVar10;
*piVar9 = (int)pCVar10;
piVar9[-1] = (int)&local_78;
pcVar1 = *(code **)(iVar7 + 0x234);
piVar9[-2] = 0x9c6550;
(*pcVar1)();
piVar8 = piVar9 + -2;
fVar13 = (local_78 - local_6c) * (local_78 - local_6c) +
(local_70 - local_64) * (local_70 - local_64) +
(local_74 - local_68) * (local_74 - local_68);
if (fVar13 < local_a4) {
iVar7 = *(int *)this;
piVar9[-1] = (int)this;
piVar9[-2] = (int)&local_84;
/* try { // try from 009c65ad to 009c6631 has its CatchHandler @ 009c6756 */
pcVar1 = *(code **)(iVar7 + 0x234);
piVar9[-3] = 0x9c65b3;
(*pcVar1)();
local_74 = local_8c * 256.0 + local_80;
local_70 = local_88 * 256.0 + local_7c;
local_78 = local_90 * 256.0 + local_84;
iVar7 = *(int *)pCVar10;
piVar9[-2] = (int)pCVar10;
piVar9[-3] = (int)&local_6c;
pcVar1 = *(code **)(iVar7 + 0x234);
piVar9[-4] = 0x9c660e;
(*pcVar1)();
piVar8 = piVar9 + -4;
piVar9[-2] = (int)&local_78;
piVar9[-3] = (int)&local_84;
piVar9[-1] = 0;
piVar9[-4] = (int)&local_6c;
piVar9[-5] = 0x9c6632;
lVar11 = (longdouble)
CalcDistanceSqrToLine
((Vector *)piVar9[-4],(Vector *)piVar9[-3],(Vector *)piVar9[-2],
(float *)piVar9[-1]);
uVar12 = -(uint)(1024.0 < (float)lVar11);
if (1024.0 < (float)lVar11) {
pCVar10 = param_1;
}
local_a4 = (float)(~uVar12 & (uint)fVar13 | (uint)local_a4 & uVar12);
param_1 = pCVar10;
}
}
iVar4 = iVar4 + 1;
piVar9 = piVar8;
} while (iVar4 < local_30[3]);
}
if (param_1 != (CTerrorPlayer *)0x0) {
pcVar1 = *(code **)(*(int *)param_1 + 0x484);
iVar4 = *piVar5;
*piVar8 = (int)piVar5;
/* try { // try from 009c669d to 009c673e has its CatchHandler @ 009c6772 */
pcVar2 = *(code **)(iVar4 + 0x530);
piVar8[-1] = 0x9c66a3;
iVar4 = (*pcVar2)();
piVar8[1] = iVar4;
*piVar8 = (int)param_1;
piVar8[-1] = 0x9c66af;
iVar4 = (*pcVar1)();
if (iVar4 == 0) {
piVar8[5] = 0;
piVar8[4] = 0;
piVar8[3] = 0x44000000;
*piVar8 = (int)this;
piVar8[2] = (int)param_1;
piVar8[1] = (int)piVar5;
piVar8[-1] = 0x9c6710;
ThrowWeapon((CTerrorPlayer *)*piVar8,(CTerrorWeapon *)piVar8[1],(CTerrorPlayer *)piVar8[2],
(float)piVar8[3],(char *)piVar8[4],(char *)piVar8[5]);
piVar8[1] = (int)this;
*piVar8 = (int)piVar5;
piVar8[2] = (int)param_1;
piVar8[-1] = 0x9c6723;
CTerrorWeapon::OnDropped
((CTerrorWeapon *)*piVar8,(CTerrorPlayer *)piVar8[1],(CTerrorPlayer *)piVar8[2]);
piVar8[3] = 0;
piVar8[2] = 0;
piVar8[1] = (int)piVar5;
*piVar8 = (int)this;
piVar8[-1] = 0x9c673f;
OnOfferVocalized((CTerrorWeapon *)*piVar8,(CTerrorPlayer *)piVar8[1],SUB41(piVar8[2],0));
local_60 = &PTR_operator___00c22340;
*piVar8 = (int)local_30;
piVar8[-1] = 0x9c6751;
CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>>::~CUtlVector
((CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>> *)*piVar8);
return;
}
}
local_60 = &PTR_operator___00c22340;
*piVar8 = (int)local_30;
local_30[3] = 0;
piVar8[-1] = 0x9c66cc;
CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)*piVar8);
iVar4 = local_30[0];
*piVar8 = (int)local_30;
local_30[4] = iVar4;
piVar8[-1] = 0x9c66da;
CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)*piVar8);
}
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.