CBaseCombatCharacter::Weapon_Drop
0x005f5f50 · 2011 bytes · __thiscall
_ZN20CBaseCombatCharacter11Weapon_DropEP17CBaseCombatWeaponPK6VectorS4_
Decompiled
undefined (4 params)
/* CBaseCombatCharacter::Weapon_Drop(CBaseCombatWeapon*, Vector const*, Vector const*) */
void __thiscall
CBaseCombatCharacter::Weapon_Drop
(CBaseCombatCharacter *this,CBaseCombatWeapon *param_1,Vector *param_2,Vector *param_3)
{
undefined4 uVar1;
code *pcVar2;
CBaseEdict *pCVar3;
char cVar4;
uint uVar5;
int *piVar6;
int iVar7;
int iVar8;
undefined4 *puVar9;
undefined4 *puVar10;
int *piVar11;
longdouble lVar12;
float fVar13;
float fVar14;
float fVar15;
float *local_100;
float local_e8 [3];
matrix3x4_t local_dc [48];
float local_ac;
float local_a8;
float local_a4;
float local_7c;
float local_78;
float local_74;
float local_4c;
float local_48;
float local_44;
puVar10 = (undefined4 *)&stack0xfffffec4;
puVar9 = (undefined4 *)&stack0xfffffec4;
if (param_1 == (CBaseCombatWeapon *)0x0) {
return;
}
if (((byte)this[0x151] & 0x20) != 0) {
cVar4 = (**(code **)(*(int *)param_1 + 0x548))();
if (cVar4 != '\0') {
iVar7 = (**(code **)(*(int *)param_1 + 0x518))();
if (iVar7 != *(int *)(param_1 + 0x1420)) {
if (param_1[0x6c] == (CBaseCombatWeapon)0x0) {
pCVar3 = *(CBaseEdict **)(param_1 + 0x30);
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar8 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar8 + 2) = 0;
}
}
else {
param_1[0x70] = (CBaseCombatWeapon)((byte)param_1[0x70] | 1);
}
*(int *)(param_1 + 0x1420) = iVar7;
}
if ((*(char **)(param_1 + 0x7c) == "weapon_smg1") ||
(cVar4 = CBaseEntity::ClassMatchesComplex((CBaseEntity *)param_1,"weapon_smg1"),
cVar4 != '\0')) {
iVar7 = UTIL_PlayerByIndex(1);
if (iVar7 == 0) {
iVar7 = (**(code **)(*(int *)param_1 + 0x510))();
if (iVar7 != *(int *)(param_1 + 0x1420)) {
CServerNetworkProperty::NetworkStateChanged((short)param_1 + 0x24);
goto LAB_005f651d;
}
}
else {
pcVar2 = *(code **)(*g_pGameRules + 0x80);
(**(code **)(*(int *)param_1 + 0x55c))();
UTIL_PlayerByIndex(1);
lVar12 = (longdouble)(*pcVar2)();
iVar7 = (**(code **)(*(int *)this + 0x1fc))();
iVar7 = (int)((float)iVar7 / (float)lVar12 + (float)iVar7 / (float)lVar12);
if (iVar7 != *(int *)(param_1 + 0x1420)) {
if (param_1[0x6c] == (CBaseCombatWeapon)0x0) {
pCVar3 = *(CBaseEdict **)(param_1 + 0x30);
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar8 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar8 + 2) = 0;
}
}
else {
param_1[0x70] = (CBaseCombatWeapon)((byte)param_1[0x70] | 1);
}
LAB_005f651d:
*(int *)(param_1 + 0x1420) = iVar7;
}
}
}
}
cVar4 = (**(code **)(*(int *)param_1 + 0x54c))();
if ((cVar4 != '\0') &&
(iVar7 = (**(code **)(*(int *)param_1 + 0x51c))(), iVar7 != *(int *)(param_1 + 0x1424))) {
if (param_1[0x6c] == (CBaseCombatWeapon)0x0) {
pCVar3 = *(CBaseEdict **)(param_1 + 0x30);
if (pCVar3 != (CBaseEdict *)0x0) {
*(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
iVar8 = CBaseEdict::GetChangeAccessor(pCVar3);
*(undefined2 *)(iVar8 + 2) = 0;
}
}
else {
param_1[0x70] = (CBaseCombatWeapon)((byte)param_1[0x70] | 1);
}
*(int *)(param_1 + 0x1424) = iVar7;
}
}
cVar4 = (**(code **)(*(int *)this + 0x16c))();
if (cVar4 == '\0') {
piVar11 = *(int **)(param_1 + 0x13e0);
if (piVar11 == (int *)0x0) {
iVar7 = CBaseEntity::GetModel((CBaseEntity *)param_1);
if (iVar7 == 0) {
piVar11 = *(int **)(param_1 + 0x13e0);
}
else {
CBaseAnimating::LockStudioHdr((CBaseAnimating *)param_1);
piVar11 = *(int **)(param_1 + 0x13e0);
}
if (piVar11 != (int *)0x0) goto LAB_005f613e;
LAB_005f6550:
iVar7 = CBaseAnimating::LookupBone((CBaseAnimating *)this,"ValveBiped.Weapon_bone");
}
else {
LAB_005f613e:
iVar7 = *piVar11;
if ((iVar7 == 0) || (*(int *)(iVar7 + 0x9c) < 1)) goto LAB_005f6550;
iVar8 = 0;
do {
piVar6 = (int *)(iVar7 + iVar8 * 0xd8 + *(int *)(iVar7 + 0xa0));
iVar7 = CBaseAnimating::LookupBone((CBaseAnimating *)this,(char *)((int)piVar6 + *piVar6));
if (iVar7 != -1) goto LAB_005f6197;
iVar7 = *piVar11;
iVar8 = iVar8 + 1;
} while (iVar8 < *(int *)(iVar7 + 0x9c));
iVar7 = CBaseAnimating::LookupBone((CBaseAnimating *)this,"ValveBiped.Weapon_bone");
}
if (iVar7 != -1) {
LAB_005f6197:
(**(code **)(*(int *)this + 0x358))();
CBaseEntity::StopFollowingEntity((CBaseEntity *)param_1);
local_4c = 0.0;
local_48 = 0.0;
local_44 = 0.0;
CBaseEntity::SetAbsOrigin((CBaseEntity *)param_1,(Vector *)&local_4c);
local_4c = 0.0;
local_48 = 0.0;
local_44 = 0.0;
CBaseEntity::SetAbsAngles((CBaseEntity *)param_1,(QAngle *)&local_4c);
CBaseAnimating::InvalidateBoneCache((CBaseAnimating *)param_1);
(**(code **)(*(int *)param_1 + 0x358))();
MatrixInvert((matrix3x4_t *)&local_ac,(matrix3x4_t *)&local_7c);
ConcatTransforms(local_dc,(matrix3x4_t *)&local_7c,(matrix3x4_t *)&local_4c);
MatrixAngles((matrix3x4_t *)&local_4c,local_e8);
(**(code **)(*(int *)param_1 + 0x1dc))();
goto joined_r0x005f62d8;
}
(**(code **)(*(int *)this + 1000))();
fVar14 = local_ac * 10.0;
fVar15 = local_a8 * 10.0;
fVar13 = local_a4 * 10.0;
(**(code **)(*(int *)this + 0x478))();
local_4c = fVar14 + local_7c;
local_44 = fVar13 + local_74;
local_48 = fVar15 + local_78;
CBaseEntity::SetAbsOrigin((CBaseEntity *)param_1,(Vector *)&local_4c);
}
else {
(**(code **)(*(int *)this + 0x478))();
local_ac = local_4c;
local_a8 = local_48;
local_a4 = local_44 - 12.0;
uVar5 = (**(code **)*enginetrace)();
if ((uVar5 & 1) != 0) {
Msg();
}
CBaseEntity::SetAbsOrigin((CBaseEntity *)param_1,(Vector *)&local_ac);
(**(code **)(*(int *)this + 1000))();
VectorAngles((Vector *)&local_4c,(QAngle *)&local_7c);
CBaseEntity::SetAbsAngles((CBaseEntity *)param_1,(QAngle *)&local_7c);
}
puVar9 = (undefined4 *)&stack0xfffffebc;
puVar10 = (undefined4 *)&stack0xfffffebc;
joined_r0x005f62d8:
if (param_2 == (Vector *)0x0) {
local_100 = &local_7c;
if (param_3 == (Vector *)0x0) {
iVar7 = *(int *)this;
*puVar10 = this;
pcVar2 = *(code **)(iVar7 + 0x16c);
puVar10[-1] = 0x5f6684;
cVar4 = (*pcVar2)();
fVar13 = 400.0;
if (cVar4 == '\0') {
iVar7 = *random_valve;
puVar10[2] = 0x80;
puVar10[1] = 0x40;
*puVar10 = random_valve;
pcVar2 = *(code **)(iVar7 + 8);
puVar10[-1] = 0x5f6738;
iVar7 = (*pcVar2)();
fVar13 = (float)iVar7;
}
iVar7 = *(int *)this;
puVar10[1] = this;
*puVar10 = &local_4c;
pcVar2 = *(code **)(iVar7 + 0x3ec);
puVar10[-1] = 0x5f66ab;
(*pcVar2)();
puVar10 = puVar10 + -1;
local_78 = local_48 * fVar13;
local_74 = local_44 * fVar13;
local_7c = fVar13 * local_4c;
}
else {
local_78 = *(float *)(param_3 + 4);
local_74 = *(float *)(param_3 + 8);
local_7c = *(float *)param_3;
if (400.0 < SQRT(local_78 * local_78 + local_74 * local_74 + local_7c * local_7c)) {
*puVar10 = local_100;
puVar10[-1] = 0x5f634c;
VectorNormalize((Vector *)*puVar10);
local_7c = local_7c * 400.0;
local_78 = local_78 * 400.0;
local_74 = local_74 * 400.0;
}
}
}
else {
if (((byte)param_1[0x14d] & 8) != 0) {
*puVar9 = param_1;
puVar9[-1] = 0x5f6400;
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)*puVar9);
}
puVar9[0xc] = 0;
puVar9[0xb] = 0;
puVar9[10] = 0;
puVar9[9] = 0x3f800000;
puVar9[8] = 0x3e4ccccd;
puVar9[5] = *(undefined4 *)param_2;
puVar9[6] = *(undefined4 *)(param_2 + 4);
puVar9[7] = *(undefined4 *)(param_2 + 8);
puVar9[2] = *(undefined4 *)(param_1 + 0x2e0);
puVar9[3] = *(undefined4 *)(param_1 + 0x2e4);
uVar1 = *(undefined4 *)(param_1 + 0x2e8);
puVar9[1] = this;
*puVar9 = &local_4c;
puVar9[4] = uVar1;
puVar9[-1] = 0x5f60d4;
VecCheckToss();
local_7c = local_4c;
local_78 = local_48;
local_74 = local_44;
puVar10 = puVar9;
}
local_100 = &local_7c;
iVar7 = *(int *)param_1;
*puVar10 = param_1;
puVar10[1] = local_100;
pcVar2 = *(code **)(iVar7 + 0x3b4);
puVar10[-1] = 0x5f610a;
(*pcVar2)();
puVar10[1] = param_1;
*puVar10 = this;
puVar10[-1] = 0x5f6116;
Weapon_Detach((CBaseCombatCharacter *)*puVar10,(CBaseCombatWeapon *)puVar10[1]);
if (((byte)this[0x149] & 0x20) != 0) {
*puVar10 = param_1;
puVar10[-1] = 0x5f6127;
UTIL_Remove((CBaseEntity *)*puVar10);
}
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.