CPhysMagnet::DoMagnetSuck
0x007a0b20 · 1224 bytes · __thiscall
_ZN11CPhysMagnet12DoMagnetSuckEP11CBaseEntity
Decompiled
undefined (2 params)
/* CPhysMagnet::DoMagnetSuck(CBaseEntity*) */
void __thiscall CPhysMagnet::DoMagnetSuck(CPhysMagnet *this,CBaseEntity *param_1)
{
CBaseEntity *this_00;
int *piVar1;
int iVar2;
int iVar3;
longdouble lVar4;
undefined4 uVar5;
float fVar6;
Vector local_144 [12];
float local_138;
float local_134;
float local_130;
CTraceFilterSimple local_12c [16];
float local_11c;
float local_118;
float local_114;
float local_10c;
float local_108;
float local_104;
undefined4 local_fc;
undefined4 local_f8;
undefined4 local_f4;
undefined4 local_ec;
undefined4 local_e8;
undefined4 local_e4;
undefined4 local_dc;
undefined1 local_d8;
undefined1 local_d7;
CBaseEntity *local_c0 [20];
float local_70 [3];
Vector local_64 [32];
float local_44;
CBaseEntity *local_24;
if (((((byte)this[0x148] & 4) == 0) || (this[0x1450] == (CPhysMagnet)0x0)) ||
(*(float *)(gpGlobals + 0xc) <= *(float *)(this + 0x145c) &&
*(float *)(this + 0x145c) != *(float *)(gpGlobals + 0xc))) {
return;
}
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
local_70[0] = 0.0;
local_70[1] = 0.0;
local_70[2] = -96.0;
VectorTransform(local_70,(matrix3x4_t *)(this + 0x28c),(float *)local_144);
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
local_70[0] = 0.0;
local_70[1] = 0.0;
local_70[2] = -64.0;
VectorTransform(local_70,(matrix3x4_t *)(this + 0x28c),&local_138);
CFlaggedEntitiesEnum::CFlaggedEntitiesEnum((CFlaggedEntitiesEnum *)local_70,local_c0,0x14,0);
iVar2 = UTIL_EntitiesInSphere(local_144,80.0,(CFlaggedEntitiesEnum *)local_70);
uVar5 = 0;
iVar3 = 0;
if (0 < iVar2) {
do {
while (((this_00 = local_c0[iVar3], param_1 == this_00 || (this_00 == (CBaseEntity *)0x0)) ||
((piVar1 = *(int **)(this_00 + 0x238), piVar1 == (int *)0x0 ||
((this_00[0x186] != (CBaseEntity)0x6 ||
(lVar4 = (longdouble)(**(code **)(*piVar1 + 0x78))(piVar1), 5000.0 <= (float)lVar4)))
)))) {
LAB_007a0c38:
iVar3 = iVar3 + 1;
if (iVar3 == iVar2) goto LAB_007a0f78;
}
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
if (((byte)this[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
}
local_11c = *(float *)(this + 0x2e0);
local_118 = *(float *)(this + 0x2e4);
local_10c = *(float *)(this_00 + 0x2e0) - local_11c;
local_114 = *(float *)(this + 0x2e8);
local_108 = *(float *)(this_00 + 0x2e4) - local_118;
local_104 = *(float *)(this_00 + 0x2e8) - local_114;
local_dc = 0;
local_d7 = local_10c * local_10c + local_104 * local_104 + local_108 * local_108 != 0.0;
local_d8 = 1;
local_fc = uVar5;
local_f8 = uVar5;
local_f4 = uVar5;
local_ec = uVar5;
local_e8 = uVar5;
local_e4 = uVar5;
CTraceFilterSimple::CTraceFilterSimple
(local_12c,(IHandleEntity *)this,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
(**(code **)(*enginetrace + 0x14))(enginetrace,&local_11c,0x46004003,local_12c,local_70);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine((Vector *)local_70,local_64,0xff,0,0,true,-1.0);
}
if ((local_44 != 1.0) && (this_00 != local_24)) goto LAB_007a0c38;
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
iVar3 = iVar3 + 1;
local_11c = local_138 - *(float *)(this_00 + 0x2e0);
local_118 = local_134 - *(float *)(this_00 + 0x2e4);
local_114 = local_130 - *(float *)(this_00 + 0x2e8);
VectorNormalize((Vector *)&local_11c);
lVar4 = (longdouble)(**(code **)(*piVar1 + 0x78))(piVar1);
fVar6 = (float)lVar4 * 5.0;
local_11c = local_11c * fVar6;
local_118 = local_118 * fVar6;
local_114 = fVar6 * local_114;
(**(code **)(*piVar1 + 0xd8))(piVar1,&local_11c,0);
} while (iVar3 != iVar2);
}
LAB_007a0f78:
*(float *)(this + 0x145c) = *(float *)(gpGlobals + 0xc) + 2.0;
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.