CTerrorPlayer::ThrowWeapon
0x009ac850 · 2756 bytes · __thiscall
_ZN13CTerrorPlayer11ThrowWeaponEP13CTerrorWeaponPS_fPKcS4_
Decompiled
undefined (6 params)
/* CTerrorPlayer::ThrowWeapon(CTerrorWeapon*, CTerrorPlayer*, float, char const*, char const*) */
char __thiscall
CTerrorPlayer::ThrowWeapon
(CTerrorPlayer *this,CTerrorWeapon *param_1,CTerrorPlayer *param_2,float param_3,
char *param_4,char *param_5)
{
float fVar1;
float fVar2;
float fVar3;
float fVar4;
CBaseEdict *pCVar5;
code *pcVar6;
uint uVar7;
CTerrorWeapon *pCVar8;
int *piVar9;
char cVar10;
char cVar11;
QAngle *pQVar12;
int iVar13;
int iVar14;
int *piVar15;
undefined *puVar16;
int iVar17;
int *piVar18;
int *piVar19;
undefined4 uStackY_180;
int *local_158;
int local_154;
float local_148;
float local_144;
float local_140;
float local_13c;
float local_138;
float local_134;
float local_130;
float local_12c;
float local_128;
float local_124 [3];
float local_118;
float local_114;
float local_110;
undefined1 local_10c [12];
undefined1 local_100 [12];
undefined4 local_f4;
undefined4 local_f0;
undefined4 local_ec;
float local_e8;
float local_e4;
float local_e0;
matrix3x4_t local_dc [48];
matrix3x4_t local_ac [48];
matrix3x4_t local_7c [48];
undefined4 local_4c;
undefined4 local_48;
undefined4 local_44;
float local_40;
float local_30;
float local_20;
piVar18 = (int *)&stack0xfffffe84;
piVar19 = (int *)&stack0xfffffe84;
if (param_1 == (CTerrorWeapon *)0x0) {
return '\0';
}
uStackY_180 = 0x9ac871;
cVar10 = (**(code **)(*(int *)param_1 + 0x668))();
if (cVar10 == '\0') {
return '\0';
}
uStackY_180 = 0x9ac8a3;
pQVar12 = (QAngle *)(**(code **)(*(int *)this + 0x238))();
uStackY_180 = 0x9ac8c5;
AngleVectors(pQVar12,(Vector *)&local_148,(Vector *)0x0,(Vector *)0x0);
if (((byte)this[0x14d] & 8) != 0) {
uStackY_180 = 0x9ad130;
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
fVar1 = *(float *)(this + 0x2e0);
fVar2 = *(float *)(this + 0x2e4);
fVar3 = *(float *)(this + 0x2e8);
uStackY_180 = 0x9ac90d;
iVar13 = (**(code **)(*(int *)this + 0x250))();
local_138 = param_3 * local_144 + fVar2;
local_13c = param_3 * local_148 + fVar1;
local_134 = *(float *)(iVar13 + 8) + -12.0 + param_3 * local_140 + fVar3;
uStackY_180 = 0x9ac996;
(**(code **)(*(int *)this + 0x470))();
uStackY_180 = 0x9ac9ac;
CCollisionProperty::SetSolidFlags((CCollisionProperty *)(param_1 + 0x194),0x98);
if (param_1[0x187] != (CTerrorWeapon)0x1) {
if (param_1[0x6c] == (CTerrorWeapon)0x0) {
pCVar5 = *(CBaseEdict **)(param_1 + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
uStackY_180 = 0x9ac9d6;
iVar13 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar13 + 2) = 0;
}
}
else {
param_1[0x70] = (CTerrorWeapon)((byte)param_1[0x70] | 1);
}
param_1[0x187] = (CTerrorWeapon)0x1;
}
pcVar6 = *(code **)(*(int *)param_1 + 0x640);
uStackY_180 = 0x9ac9f1;
CWeaponCSBase::GetCSWpnData((CWeaponCSBase *)param_1);
uStackY_180 = 0x9ac9ff;
(*pcVar6)();
uStackY_180 = 0x9aca0a;
iVar13 = (**(code **)(*(int *)param_1 + 0x55c))();
if (iVar13 != -1) {
uStackY_180 = 0x9aca24;
cVar11 = (**(code **)(*(int *)this + 300))();
if ((cVar11 != '\0') && (0 < *(int *)(this + 0x100))) {
iVar17 = 0;
do {
uVar7 = *(uint *)(this + iVar17 * 4 + 0x18f4);
if ((((uVar7 != 0xffffffff) &&
(puVar16 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar16 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar16 + 8) == uVar7 >> 0xc)) &&
((pCVar8 = *(CTerrorWeapon **)(puVar16 + 4), param_1 != pCVar8 &&
(pCVar8 != (CTerrorWeapon *)0x0)))) {
uStackY_180 = 0x9aca90;
iVar14 = (**(code **)(*(int *)pCVar8 + 0x55c))();
if (iVar13 == iVar14) goto LAB_009acaa0;
}
iVar17 = iVar17 + 1;
} while (iVar17 != 0x38);
}
uStackY_180 = 0x9acff2;
iVar17 = CBaseCombatCharacter::GetAmmoCount((CBaseCombatCharacter *)this,iVar13);
if (iVar17 != *(int *)(param_1 + 0x14fc)) {
if (param_1[0x6c] == (CTerrorWeapon)0x0) {
pCVar5 = *(CBaseEdict **)(param_1 + 0x30);
if (pCVar5 != (CBaseEdict *)0x0) {
*(uint *)pCVar5 = *(uint *)pCVar5 | 0x101;
uStackY_180 = 0x9ad01b;
iVar14 = CBaseEdict::GetChangeAccessor(pCVar5);
*(undefined2 *)(iVar14 + 2) = 0;
}
}
else {
param_1[0x70] = (CTerrorWeapon)((byte)param_1[0x70] | 1);
}
*(int *)(param_1 + 0x14fc) = iVar17;
}
uStackY_180 = 0x9ad041;
CBaseCombatCharacter::SetAmmoCount((CBaseCombatCharacter *)this,0,iVar13);
}
LAB_009acaa0:
piVar9 = mdlcache;
uStackY_180 = 0x9acab5;
(**(code **)(*mdlcache + 0x68))();
local_158 = *(int **)(param_1 + 0x13e0);
if (local_158 == (int *)0x0) {
uStackY_180 = 0x9ad2a8;
iVar13 = CBaseEntity::GetModel((CBaseEntity *)param_1);
if (iVar13 != 0) {
uStackY_180 = 0x9ad2b4;
CBaseAnimating::LockStudioHdr((CBaseAnimating *)param_1);
}
local_158 = *(int **)(param_1 + 0x13e0);
if (local_158 != (int *)0x0) goto LAB_009acac9;
LAB_009ad2ce:
if (param_4 == (char *)0x0) {
LAB_009ad2d8:
uStackY_180 = 0x9ad2e8;
local_154 = CBaseAnimating::LookupBone((CBaseAnimating *)this,"ValveBiped.Bip01_R_Hand");
}
else {
LAB_009acadf:
if (param_5 == (char *)0x0) {
param_5 = param_4;
}
/* try { // try from 009acaf8 to 009acb11 has its CatchHandler @ 009ad358 */
uStackY_180 = 0x9acafd;
local_154 = CBaseAnimating::LookupBone((CBaseAnimating *)this,param_4);
uStackY_180 = 0x9acb12;
CBaseAnimating::LookupBone((CBaseAnimating *)param_1,param_5);
}
}
else {
LAB_009acac9:
iVar13 = *local_158;
if (iVar13 == 0) goto LAB_009ad2ce;
if (param_4 != (char *)0x0) goto LAB_009acadf;
if (*(int *)(iVar13 + 0x9c) < 1) goto LAB_009ad2d8;
iVar17 = 0;
do {
piVar15 = (int *)(iVar13 + iVar17 * 0xd8 + *(int *)(iVar13 + 0xa0));
/* try { // try from 009acb80 to 009acfb5 has its CatchHandler @ 009ad358 */
uStackY_180 = 0x9acb85;
iVar13 = CBaseAnimating::LookupBone((CBaseAnimating *)this,(char *)((int)piVar15 + *piVar15));
if (iVar13 != -1) {
piVar18 = (int *)&stack0xfffffe84;
if (*(int *)(*local_158 + 0x9c) == iVar17) goto LAB_009acb21;
goto LAB_009acba8;
}
iVar17 = iVar17 + 1;
iVar13 = *local_158;
} while (iVar17 < *(int *)(iVar13 + 0x9c));
if (*(int *)(iVar13 + 0x9c) == iVar17) goto LAB_009acb21;
uStackY_180 = 0x9ad318;
local_154 = CBaseAnimating::LookupBone((CBaseAnimating *)this,"ValveBiped.Bip01_R_Hand");
}
piVar18 = (int *)&stack0xfffffe84;
if (local_154 == -1) goto LAB_009acb21;
LAB_009acba8:
uStackY_180 = 0x9acbc7;
(**(code **)(*(int *)this + 0x358))();
uStackY_180 = 0x9acbcf;
CBaseEntity::StopFollowingEntity((CBaseEntity *)param_1);
local_4c = 0;
local_48 = 0;
local_44 = 0;
uStackY_180 = 0x9acbf3;
CBaseEntity::SetAbsOrigin((CBaseEntity *)param_1,(Vector *)&local_4c);
local_4c = 0;
local_48 = 0;
local_44 = 0;
uStackY_180 = 0x9acc17;
CBaseEntity::SetAbsAngles((CBaseEntity *)param_1,(QAngle *)&local_4c);
uStackY_180 = 0x9acc1f;
CBaseAnimating::InvalidateBoneCache((CBaseAnimating *)param_1);
uStackY_180 = 0x9acc38;
(**(code **)(*(int *)param_1 + 0x358))();
uStackY_180 = 0x9acc4d;
MatrixInvert(local_ac,local_7c);
uStackY_180 = 0x9acc66;
ConcatTransforms(local_dc,local_7c,(matrix3x4_t *)&local_4c);
uStackY_180 = 0x9acc7b;
MatrixAngles((matrix3x4_t *)&local_4c,local_124);
local_130 = local_40;
local_12c = local_30;
local_128 = local_20;
uStackY_180 = 0x9accc9;
(**(code **)(*(int *)param_1 + 0x1dc))();
if (param_2 == (CTerrorPlayer *)0x0) {
LAB_009ad050:
/* try { // try from 009ad085 to 009ad08a has its CatchHandler @ 009ad358 */
uStackY_180 = 0x9ad08b;
(**(code **)(*(int *)this + 0x234))();
piVar19 = &uStackY_180;
local_13c = local_148 * param_3 + local_e8;
local_138 = local_144 * param_3 + local_e4;
local_134 = local_e0 + 32.0 + local_140 * param_3;
local_118 = local_13c - local_130;
local_114 = local_138 - local_12c;
local_110 = local_134 - local_128;
}
else {
uStackY_180 = 0x9accdf;
iVar13 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_2);
uStackY_180 = 0x9acce7;
cVar11 = IsASurvivorTeam(iVar13);
if (cVar11 == '\0') goto LAB_009ad050;
if (((byte)param_2[0x14d] & 0x10) != 0) {
/* try { // try from 009acfd6 to 009acfda has its CatchHandler @ 009ad358 */
uStackY_180 = 0x9acfdb;
CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)param_2);
}
fVar1 = *(float *)(param_2 + 0x274);
fVar2 = *(float *)(param_2 + 0x278);
fVar3 = *(float *)(param_2 + 0x27c);
uStackY_180 = 0x9acd4c;
iVar13 = (**(code **)(*(int *)param_2 + 0x250))();
fVar4 = *(float *)(iVar13 + 8);
if (((byte)param_2[0x14d] & 8) != 0) {
uStackY_180 = 0x9ad293;
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_2);
}
local_13c = fVar1 * 0.5 + *(float *)(param_2 + 0x2e0);
local_138 = fVar2 * 0.5 + *(float *)(param_2 + 0x2e4);
local_134 = fVar4 + *(float *)(param_2 + 0x2e8) + fVar3 * 0.5;
if (((byte)this[0x14d] & 8) != 0) {
uStackY_180 = 0x9ad268;
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
if (16384.0 < (local_138 - *(float *)(this + 0x2e4)) * (local_138 - *(float *)(this + 0x2e4)) +
(local_13c - *(float *)(this + 0x2e0)) * (local_13c - *(float *)(this + 0x2e0))) {
local_134 = local_134 + 32.0;
}
local_114 = local_138 - local_12c;
local_110 = local_134 - local_128;
local_118 = local_13c - local_130;
uStackY_180 = 0x9ace41;
VectorNormalize((Vector *)&local_118);
if (local_144 * local_114 + local_148 * local_118 + local_140 * local_110 < 0.8) {
/* try { // try from 009ad15b to 009ad352 has its CatchHandler @ 009ad358 */
uStackY_180 = 0x9ad161;
iVar13 = (**(code **)(*(int *)param_2 + 0x250))();
fVar1 = *(float *)(iVar13 + 8);
if (((byte)param_2[0x14d] & 8) != 0) {
uStackY_180 = 0x9ad353;
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_2);
}
local_134 = fVar1 + *(float *)(param_2 + 0x2e8);
local_13c = *(float *)(param_2 + 0x2e0);
local_138 = *(float *)(param_2 + 0x2e4);
if (((byte)this[0x14d] & 8) != 0) {
uStackY_180 = 0x9ad32b;
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
if (16384.0 < (local_138 - *(float *)(this + 0x2e4)) * (local_138 - *(float *)(this + 0x2e4))
+ (local_13c - *(float *)(this + 0x2e0)) *
(local_13c - *(float *)(this + 0x2e0))) {
local_134 = local_134 + 32.0;
}
local_114 = local_138 - local_12c;
local_110 = local_134 - local_128;
local_118 = local_13c - local_130;
uStackY_180 = 0x9ad239;
VectorNormalize((Vector *)&local_118);
}
local_118 = local_118 * param_3;
local_114 = local_114 * param_3;
local_110 = local_110 * param_3;
}
piVar15 = *(int **)(param_1 + 0x238);
piVar18 = piVar19;
if (piVar15 != (int *)0x0) {
iVar13 = *piVar15;
*piVar19 = (int)piVar15;
piVar19[2] = (int)local_100;
piVar19[1] = (int)local_10c;
pcVar6 = *(code **)(iVar13 + 0xc4);
piVar19[-1] = 0x9aceec;
(*pcVar6)();
iVar13 = *piVar15;
piVar19[3] = 1;
piVar19[2] = (int)local_124;
piVar19[1] = (int)local_10c;
*piVar19 = (int)piVar15;
pcVar6 = *(code **)(iVar13 + 0xbc);
piVar19[-1] = 0x9acf0d;
(*pcVar6)();
local_f4 = 0;
local_f0 = 0;
local_ec = 0;
if (((byte)this[0x14d] & 0x10) != 0) {
*piVar19 = (int)this;
piVar19[-1] = 0x9acf3c;
CBaseEntity::CalcAbsoluteVelocity((CBaseEntity *)*piVar19);
}
local_e8 = local_118 + *(float *)(this + 0x274);
local_e4 = local_114 + *(float *)(this + 0x278);
local_e0 = local_110 + *(float *)(this + 0x27c);
iVar13 = *piVar15;
piVar19[2] = (int)&local_f4;
piVar19[1] = (int)local_10c;
*piVar19 = (int)piVar15;
pcVar6 = *(code **)(iVar13 + 0xd4);
piVar19[-1] = 0x9acf9d;
(*pcVar6)();
iVar13 = *piVar15;
piVar19[2] = (int)&local_f4;
piVar19[1] = (int)&local_e8;
*piVar19 = (int)piVar15;
pcVar6 = *(code **)(iVar13 + 0xcc);
piVar19[-1] = 0x9acfb6;
(*pcVar6)();
iVar13 = *piVar9;
*piVar19 = (int)piVar9;
pcVar6 = *(code **)(iVar13 + 0x6c);
piVar19[-1] = 0x9acfc4;
(*pcVar6)();
return cVar10;
}
LAB_009acb21:
iVar13 = *piVar9;
*piVar18 = (int)piVar9;
pcVar6 = *(code **)(iVar13 + 0x6c);
piVar18[-1] = 0x9acb2f;
(*pcVar6)();
return cVar10;
}
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.