CBaseCombatCharacter::Weapon_DropAll
0x005f58e0 · 1634 bytes · __thiscall
_ZN20CBaseCombatCharacter14Weapon_DropAllEb
Decompiled
undefined (2 params)
/* WARNING: Removing unreachable block (ram,0x005f5b78) */
/* WARNING: Removing unreachable block (ram,0x005f5af4) */
/* WARNING: Removing unreachable block (ram,0x005f5a67) */
/* WARNING: Removing unreachable block (ram,0x005f59e3) */
/* WARNING: Removing unreachable block (ram,0x005f5f0d) */
/* WARNING: Removing unreachable block (ram,0x005f5f14) */
/* WARNING: Removing unreachable block (ram,0x005f5f1c) */
/* WARNING: Removing unreachable block (ram,0x005f5f27) */
/* CBaseCombatCharacter::Weapon_DropAll(bool) */
void __thiscall CBaseCombatCharacter::Weapon_DropAll(CBaseCombatCharacter *this,bool param_1)
{
float fVar1;
float fVar2;
float fVar3;
float fVar4;
float fVar5;
float fVar6;
float fVar7;
float fVar8;
uint uVar9;
CBaseCombatWeapon *pCVar10;
int *piVar11;
CBaseCombatWeapon *pCVar12;
undefined *puVar13;
int iVar14;
undefined *puVar15;
CBaseCombatCharacter *pCVar16;
int iVar17;
bool bVar18;
longdouble lVar19;
QAngle local_40 [12];
Vector local_34 [12];
float local_28;
float local_24;
float local_20;
if (((byte)this[0x151] & 0x20) != 0) {
pCVar16 = this + 0x18f4;
do {
while ((((uVar9 = *(uint *)pCVar16, uVar9 == 0xffffffff ||
(puVar13 = g_pEntityList + (uVar9 & 0xfff) * 0x10, puVar13 == (undefined *)0xfffffffc
)) || (*(uint *)(puVar13 + 8) != uVar9 >> 0xc)) || (*(int *)(puVar13 + 4) == 0))) {
pCVar16 = pCVar16 + 4;
if (pCVar16 == this + 0x19d4) {
return;
}
}
pCVar16 = pCVar16 + 4;
(**(code **)(*(int *)this + 0x470))(this,*(int *)(puVar13 + 4),0,0);
} while (pCVar16 != this + 0x19d4);
return;
}
(**(code **)(*(int *)this + 1000))((Vector *)&local_28,this);
VectorAngles((Vector *)&local_28,local_40);
AngleVectors(local_40,local_34,(Vector *)0x0,(Vector *)0x0);
if ((AllocTempVector()::s_vecTemp == '\0') &&
(iVar14 = __cxa_guard_acquire(&AllocTempVector()::s_vecTemp), iVar14 != 0)) {
__cxa_guard_release(&AllocTempVector()::s_vecTemp);
}
if ((AllocTempVector()::s_nIndex == '\0') &&
(iVar14 = __cxa_guard_acquire(&AllocTempVector()::s_nIndex), iVar14 != 0)) {
AllocTempVector()::s_nIndex = 0;
__cxa_guard_release(&AllocTempVector()::s_nIndex);
}
AllocTempVector()::s_nIndex = AllocTempVector()::s_nIndex + 0x10001 & 0x7f;
LOCK();
UNLOCK();
fVar1 = *(float *)(this + 0x1a8);
iVar14 = AllocTempVector()::s_nIndex * 0xc;
bVar18 = AllocTempVector()::s_vecTemp == '\0';
fVar2 = *(float *)(this + 0x19c);
*(float *)(AllocTempVector()::s_vecTemp + iVar14) = fVar1 - fVar2;
*(float *)(AllocTempVector()::s_vecTemp + iVar14 + 4) =
*(float *)(this + 0x1ac) - *(float *)(this + 0x1a0);
*(float *)(AllocTempVector()::s_vecTemp + iVar14 + 8) =
*(float *)(this + 0x1b0) - *(float *)(this + 0x1a4);
if ((bVar18) && (iVar14 = __cxa_guard_acquire(&AllocTempVector()::s_vecTemp), iVar14 != 0)) {
__cxa_guard_release(&AllocTempVector()::s_vecTemp);
}
if ((AllocTempVector()::s_nIndex == '\0') &&
(iVar14 = __cxa_guard_acquire(&AllocTempVector()::s_nIndex), iVar14 != 0)) {
AllocTempVector()::s_nIndex = 0;
__cxa_guard_release(&AllocTempVector()::s_nIndex);
}
AllocTempVector()::s_nIndex = AllocTempVector()::s_nIndex + 0x10001 & 0x7f;
LOCK();
UNLOCK();
fVar3 = *(float *)(this + 0x1a8);
iVar14 = AllocTempVector()::s_nIndex * 0xc;
bVar18 = AllocTempVector()::s_vecTemp == '\0';
fVar4 = *(float *)(this + 0x19c);
*(float *)(AllocTempVector()::s_vecTemp + iVar14) = fVar3 - fVar4;
*(float *)(AllocTempVector()::s_vecTemp + iVar14 + 4) =
*(float *)(this + 0x1ac) - *(float *)(this + 0x1a0);
*(float *)(AllocTempVector()::s_vecTemp + iVar14 + 8) =
*(float *)(this + 0x1b0) - *(float *)(this + 0x1a4);
if ((bVar18) && (iVar14 = __cxa_guard_acquire(&AllocTempVector()::s_vecTemp), iVar14 != 0)) {
__cxa_guard_release(&AllocTempVector()::s_vecTemp);
}
if ((AllocTempVector()::s_nIndex == '\0') &&
(iVar14 = __cxa_guard_acquire(&AllocTempVector()::s_nIndex), iVar14 != 0)) {
AllocTempVector()::s_nIndex = 0;
__cxa_guard_release(&AllocTempVector()::s_nIndex);
}
AllocTempVector()::s_nIndex = AllocTempVector()::s_nIndex + 0x10001 & 0x7f;
LOCK();
UNLOCK();
iVar14 = AllocTempVector()::s_nIndex * 0xc;
bVar18 = AllocTempVector()::s_vecTemp == '\0';
*(float *)(AllocTempVector()::s_vecTemp + iVar14) =
*(float *)(this + 0x1a8) - *(float *)(this + 0x19c);
fVar5 = *(float *)(this + 0x1ac);
fVar6 = *(float *)(this + 0x1a0);
*(float *)(AllocTempVector()::s_vecTemp + iVar14 + 4) = fVar5 - fVar6;
*(float *)(AllocTempVector()::s_vecTemp + iVar14 + 8) =
*(float *)(this + 0x1b0) - *(float *)(this + 0x1a4);
if ((bVar18) && (iVar14 = __cxa_guard_acquire(&AllocTempVector()::s_vecTemp), iVar14 != 0)) {
__cxa_guard_release(&AllocTempVector()::s_vecTemp);
}
if ((AllocTempVector()::s_nIndex == '\0') &&
(iVar14 = __cxa_guard_acquire(&AllocTempVector()::s_nIndex), iVar14 != 0)) {
AllocTempVector()::s_nIndex = 0;
__cxa_guard_release(&AllocTempVector()::s_nIndex);
}
AllocTempVector()::s_nIndex = AllocTempVector()::s_nIndex + 0x10001 & 0x7f;
LOCK();
UNLOCK();
iVar17 = 1;
iVar14 = AllocTempVector()::s_nIndex * 0xc;
*(float *)(AllocTempVector()::s_vecTemp + iVar14) =
*(float *)(this + 0x1a8) - *(float *)(this + 0x19c);
fVar7 = *(float *)(this + 0x1ac);
fVar8 = *(float *)(this + 0x1a0);
*(float *)(AllocTempVector()::s_vecTemp + iVar14 + 4) = fVar7 - fVar8;
*(float *)(AllocTempVector()::s_vecTemp + iVar14 + 8) =
*(float *)(this + 0x1b0) - *(float *)(this + 0x1a4);
pCVar12 = (CBaseCombatWeapon *)GetActiveWeapon(this);
puVar13 = g_pEntityList;
do {
uVar9 = *(uint *)(this + iVar17 * 4 + 0x18f0);
if ((((uVar9 == 0xffffffff) ||
(puVar15 = puVar13 + (uVar9 & 0xfff) * 0x10, puVar15 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar15 + 8) != uVar9 >> 0xc)) ||
(pCVar10 = *(CBaseCombatWeapon **)(puVar15 + 4), pCVar10 == (CBaseCombatWeapon *)0x0)) {
joined_r0x005f5c03:
puVar13 = g_pEntityList;
g_pEntityList = puVar13;
if (iVar17 == 0x38) {
if (pCVar12 == (CBaseCombatWeapon *)0x0) {
return;
}
LAB_005f5cc3:
ThrowDirForWeaponStrip(this,pCVar12,local_34,(Vector *)&local_28);
lVar19 = (longdouble)(**(code **)(*random_valve + 4))(random_valve,0x44480000,0x447a0000);
fVar1 = (float)lVar19;
local_28 = local_28 * fVar1;
local_24 = local_24 * fVar1;
local_20 = fVar1 * local_20;
(**(code **)(*(int *)this + 0x470))(this,pCVar12,0,&local_28);
pCVar12[0x1458] = (CBaseCombatWeapon)0x0;
if (!param_1) {
return;
}
CCollisionProperty::SetSolidFlags
((CCollisionProperty *)(pCVar12 + 0x194),*(ushort *)(pCVar12 + 0x1b4) & 0xfffffff7
);
return;
}
}
else {
if (pCVar12 != pCVar10) {
DropWeaponForWeaponStrip
(this,pCVar10,local_34,local_40,
SQRT((fVar5 - fVar6) * (fVar7 - fVar8) + (fVar3 - fVar4) * (fVar1 - fVar2)));
if (param_1) {
CCollisionProperty::SetSolidFlags
((CCollisionProperty *)(pCVar10 + 0x194),
*(ushort *)(pCVar10 + 0x1b4) & 0xfffffff7);
piVar11 = *(int **)(pCVar10 + 0x238);
if (piVar11 != (int *)0x0) {
(**(code **)(*piVar11 + 0x4c))(piVar11,0x80);
}
}
goto joined_r0x005f5c03;
}
if (iVar17 == 0x38) goto LAB_005f5cc3;
}
iVar17 = iVar17 + 1;
} while( true );
}
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.