SurvivorGiveItem::ThrowItem
0x00930900 · 1467 bytes · __thiscall
_ZN16SurvivorGiveItem9ThrowItemEP11SurvivorBot
Decompiled
undefined (2 params)
/* SurvivorGiveItem::ThrowItem(SurvivorBot*) */
void __thiscall SurvivorGiveItem::ThrowItem(SurvivorGiveItem *this,SurvivorBot *param_1)
{
uint uVar1;
int iVar2;
code *pcVar3;
int *piVar4;
QAngle *pQVar5;
int iVar6;
undefined4 uVar7;
undefined *puVar8;
uint uVar9;
undefined4 *puVar10;
int *piVar11;
int *piVar12;
CBaseEntity *this_00;
float fVar13;
int iStackY_134;
int local_130;
int local_104;
float local_100;
float local_f4;
float local_f0;
float local_ec;
float local_e8;
float local_e4;
float local_e0;
undefined **local_dc [4];
float local_cc;
float local_c8;
float local_c4;
float local_bc;
float local_b8;
float local_b4;
undefined4 local_ac;
undefined4 local_a8;
undefined4 local_a4;
undefined4 local_9c;
undefined4 local_98;
undefined4 local_94;
undefined4 local_8c;
undefined1 local_88;
undefined1 local_87;
float local_70;
float local_6c;
undefined4 local_68;
float local_64;
float local_60;
float local_44;
char local_39;
uVar1 = *(uint *)(this + 0x38);
if ((((uVar1 == 0xffffffff) ||
(puVar8 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar8 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar8 + 8) != uVar1 >> 0xc)) || (*(int *)(puVar8 + 4) == 0)) {
return;
}
uVar1 = *(uint *)(this + 0x34);
if (uVar1 == 0xffffffff) {
LAB_0093097a:
pQVar5 = (QAngle *)(**(code **)(*(int *)param_1 + 0x238))();
AngleVectors(pQVar5,(Vector *)&local_f4);
}
else {
uVar9 = uVar1 & 0xfff;
puVar10 = (undefined4 *)(g_pEntityList + uVar9 * 0x10 + 4);
if (((puVar10 == (undefined4 *)0x0) ||
(*(uint *)(g_pEntityList + uVar9 * 0x10 + 8) != uVar1 >> 0xc)) ||
(*(int *)(g_pEntityList + uVar9 * 0x10 + 4) == 0)) goto LAB_0093097a;
if (((byte)param_1[0x14d] & 8) == 0) {
LAB_00930dbc:
this_00 = (CBaseEntity *)*puVar10;
}
else {
this_00 = (CBaseEntity *)0x0;
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
uVar1 = *(uint *)(this + 0x34);
if (uVar1 != 0xffffffff) {
puVar10 = (undefined4 *)(g_pEntityList + (uVar1 & 0xfff) * 0x10 + 4);
if (puVar10 == (undefined4 *)0x0) {
this_00 = (CBaseEntity *)0x0;
}
else if (puVar10[1] == uVar1 >> 0xc) goto LAB_00930dbc;
}
}
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
local_ec = 0.0;
local_f0 = *(float *)(this_00 + 0x2e4) - *(float *)(param_1 + 0x2e4);
local_f4 = *(float *)(this_00 + 0x2e0) - *(float *)(param_1 + 0x2e0);
VectorNormalize((Vector *)&local_f4);
}
iVar6 = CGlobalEntityList::FindEntityByName
((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,"throw_item_target",
(CBaseEntity *)0x0,(CBaseEntity *)0x0,(CBaseEntity *)0x0,
(IEntityFindFilter *)0x0);
piVar4 = (int *)&stack0xfffffed4;
if (iVar6 != 0) {
local_104 = 0;
local_100 = -1.0;
piVar4 = (int *)&stack0xfffffed4;
do {
piVar11 = piVar4;
piVar11[3] = (int)IgnoreActorsTraceFilterFunction;
piVar11[2] = 0;
piVar11[1] = 0;
*piVar11 = (int)local_dc;
piVar11[-1] = 0x930bec;
CTraceFilterSimple::CTraceFilterSimple
((CTraceFilterSimple *)*piVar11,(IHandleEntity *)piVar11[1],piVar11[2],
(_func_bool_IHandleEntity_ptr_int *)piVar11[3]);
local_dc[0] = &PTR_ShouldHitEntity_00c23430;
if ((*(byte *)(iVar6 + 0x14d) & 8) != 0) {
*piVar11 = iVar6;
piVar11[-1] = 0x930c0b;
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)*piVar11);
}
iVar2 = *(int *)param_1;
piVar11[1] = (int)param_1;
*piVar11 = (int)&local_e8;
pcVar3 = *(code **)(iVar2 + 0x234);
piVar11[-1] = 0x930a25;
(*pcVar3)();
piVar12 = piVar11 + -1;
local_bc = *(float *)(iVar6 + 0x2e0) - local_e8;
local_b8 = *(float *)(iVar6 + 0x2e4) - local_e4;
local_88 = 1;
local_94 = 0;
local_b4 = *(float *)(iVar6 + 0x2e8) - local_e0;
local_98 = 0;
local_9c = 0;
local_8c = 0;
local_a4 = 0;
local_a8 = 0;
local_ac = 0;
local_cc = local_e8;
local_c8 = local_e4;
local_c4 = local_e0;
local_87 = local_b8 * local_b8 + local_bc * local_bc + local_b4 * local_b4 != 0.0;
iVar2 = *enginetrace;
piVar11[3] = (int)&local_70;
*piVar11 = (int)&local_cc;
piVar11[-1] = (int)enginetrace;
piVar11[2] = (int)local_dc;
piVar11[1] = 0x2006041;
pcVar3 = *(code **)(iVar2 + 0x14);
piVar11[-2] = 0x930b2c;
(*pcVar3)();
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
piVar11[5] = -0x40800000;
*piVar11 = (int)&local_64;
piVar11[4] = 1;
piVar11[3] = 0;
piVar11[2] = 0;
piVar11[1] = 0xff;
piVar11[-1] = (int)&local_70;
piVar11[-2] = 0x930b72;
DebugDrawLine((Vector *)piVar11[-1],(Vector *)*piVar11,piVar11[1],piVar11[2],piVar11[3],
SUB41(piVar11[4],0),(float)piVar11[5]);
}
if ((1.0 <= local_44) && (local_39 == '\0')) {
local_c4 = 0.0;
piVar11[-1] = (int)&local_cc;
local_cc = local_64 - local_70;
local_c8 = local_60 - local_6c;
piVar11[-2] = 0x930c4c;
VectorNormalize((Vector *)piVar11[-1]);
fVar13 = local_c8 * local_f0 + local_cc * local_f4 + local_c4 * local_ec;
if (local_100 < fVar13) {
local_104 = iVar6;
local_100 = fVar13;
}
}
*piVar11 = iVar6;
piVar11[5] = 0;
piVar11[4] = 0;
piVar11[3] = 0;
piVar11[2] = 0;
piVar11[1] = (int)"throw_item_target";
piVar11[-1] = (int)gEntList;
piVar11[-2] = 0x930bc2;
iVar6 = CGlobalEntityList::FindEntityByName
((CGlobalEntityList *)piVar11[-1],(CBaseEntity *)*piVar11,(char *)piVar11[1]
,(CBaseEntity *)piVar11[2],(CBaseEntity *)piVar11[3],
(CBaseEntity *)piVar11[4],(IEntityFindFilter *)piVar11[5]);
piVar4 = piVar11 + -1;
} while (iVar6 != 0);
piVar4 = piVar11 + -1;
if (local_104 != 0) {
if ((*(byte *)(local_104 + 0x14d) & 8) != 0) {
piVar11[-1] = local_104;
piVar11[-2] = 0x930da0;
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)piVar11[-1]);
}
uVar7 = 0;
local_70 = *(float *)(local_104 + 0x2e0);
local_6c = *(float *)(local_104 + 0x2e4);
local_68 = *(undefined4 *)(local_104 + 0x2e8);
uVar1 = *(uint *)(this + 0x38);
if (((uVar1 != 0xffffffff) &&
(puVar8 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar8 + 8) == uVar1 >> 0xc)) {
uVar7 = *(undefined4 *)(puVar8 + 4);
}
piVar11[1] = 1;
piVar11[2] = (int)&local_70;
*piVar11 = uVar7;
piVar11[-1] = (int)param_1;
piVar11[-2] = 0x930d3a;
CCSPlayer::DropWeapon
((CCSPlayer *)piVar11[-1],(CBaseCombatWeapon *)*piVar11,SUB41(piVar11[1],0),
(Vector *)piVar11[2]);
goto LAB_00930d3a;
}
}
piVar12 = piVar4;
uVar7 = 0;
uVar1 = *(uint *)(this + 0x38);
if (((uVar1 != 0xffffffff) &&
(puVar8 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar8 + 8) == uVar1 >> 0xc)) {
uVar7 = *(undefined4 *)(puVar8 + 4);
}
piVar12[3] = 0;
piVar12[2] = 1;
piVar12[1] = uVar7;
*piVar12 = (int)param_1;
piVar12[-1] = 0x930ebb;
CCSPlayer::DropWeapon
((CCSPlayer *)*piVar12,(CBaseCombatWeapon *)piVar12[1],*(bool *)(piVar12 + 2),
(Vector *)piVar12[3]);
LAB_00930d3a:
uVar1 = *(uint *)(this + 0x38);
if (((uVar1 == 0xffffffff) ||
(puVar8 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar8 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar8 + 8) != uVar1 >> 0xc)) {
uVar7 = 0;
}
else {
uVar7 = *(undefined4 *)(puVar8 + 4);
}
piVar12[1] = (int)param_1;
*piVar12 = uVar7;
piVar12[2] = 0;
piVar12[-1] = 0x930d7d;
CTerrorWeapon::OnDropped
((CTerrorWeapon *)*piVar12,(CTerrorPlayer *)piVar12[1],(CTerrorPlayer *)piVar12[2]);
*(undefined4 *)(this + 0x38) = 0xffffffff;
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.