ChargerAttack::ShouldChargeAtVictim
0x00a891e0 · 1101 bytes · __thiscall
_ZN13ChargerAttack20ShouldChargeAtVictimEP7ChargerP13CTerrorPlayer
Decompiled
undefined (3 params)
/* ChargerAttack::ShouldChargeAtVictim(Charger*, CTerrorPlayer*) */
bool __thiscall
ChargerAttack::ShouldChargeAtVictim(ChargerAttack *this,Charger *param_1,CTerrorPlayer *param_2)
{
float fVar1;
float fVar2;
float fVar3;
float fVar4;
int *piVar5;
char cVar6;
uint uVar7;
Vector *pVVar8;
Vector *pVVar9;
float *pfVar10;
float *pfVar11;
undefined *puVar12;
undefined4 uVar13;
CBaseEntity *pCVar14;
longdouble extraout_ST0;
CTraceFilterSimple local_dc [16];
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;
Vector local_70 [12];
Vector local_64 [32];
float local_44;
CTerrorPlayer *local_24;
fVar1 = *(float *)(z_charge_max_speed._28_4_ + 0x2c);
fVar2 = *(float *)(z_charge_duration._28_4_ + 0x2c);
if (((byte)param_1[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
}
pCVar14 = (CBaseEntity *)0x0;
fVar3 = *(float *)(param_1 + 0x2e8);
uVar7 = *(uint *)(this + 0x34);
if (((uVar7 != 0xffffffff) &&
(puVar12 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar12 + 8) == uVar7 >> 0xc)) {
pCVar14 = *(CBaseEntity **)(puVar12 + 4);
}
if (((byte)pCVar14[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar14);
uVar7 = *(uint *)(this + 0x34);
}
fVar4 = *(float *)(pCVar14 + 0x2e8);
uVar13 = 0;
if (((uVar7 != 0xffffffff) &&
(puVar12 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar12 + 8) == uVar7 >> 0xc)) {
uVar13 = *(undefined4 *)(puVar12 + 4);
}
cVar6 = (**(code **)(*(int *)(param_1 + 0x4028) + 0x11c))
(param_1 + 0x4028,uVar13,fVar1 * fVar2 * 0.75);
if (cVar6 == '\0') {
uVar13 = 0;
uVar7 = *(uint *)(this + 0x34);
if (((uVar7 != 0xffffffff) &&
(puVar12 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar12 + 8) == uVar7 >> 0xc)) {
uVar13 = *(undefined4 *)(puVar12 + 4);
}
cVar6 = (**(code **)(*(int *)(param_1 + 0x4028) + 0x114))(param_1 + 0x4028,uVar13,0x42900000);
if (cVar6 == '\0') {
pCVar14 = (CBaseEntity *)0x0;
uVar7 = *(uint *)(this + 0x34);
if (((uVar7 != 0xffffffff) &&
(puVar12 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar12 + 8) == uVar7 >> 0xc)) {
pCVar14 = *(CBaseEntity **)(puVar12 + 4);
}
cVar6 = UTIL_IsFacingWithinTolerance((CBaseEntity *)param_1,pCVar14,0.9,(float *)0x0);
if (cVar6 != '\0') {
pVVar8 = (Vector *)(**(code **)(*(int *)param_2 + 0x288))(param_2);
pVVar9 = (Vector *)(**(code **)(*(int *)param_1 + 0x288))(param_1);
cVar6 = Charger::IsChargeBlocked(param_1,pVVar9,pVVar8);
if (cVar6 == '\0') {
pfVar10 = (float *)(**(code **)(*(int *)param_2 + 0x288))(param_2);
pfVar11 = (float *)(**(code **)(*(int *)param_1 + 0x288))(param_1);
local_bc = *pfVar10 - *pfVar11;
local_b8 = pfVar10[1] - pfVar11[1];
local_b4 = pfVar10[2] - pfVar11[2];
local_88 = 0;
local_8c = 0;
local_9c = 0x41a00000;
local_98 = 0x41a00000;
local_94 = 0x41a00000;
local_ac = 0;
local_a8 = 0;
local_a4 = 0;
local_87 = local_b4 * local_b4 + local_b8 * local_b8 + local_bc * local_bc != 0.0;
local_cc = *pfVar11;
local_c8 = pfVar11[1];
local_c4 = pfVar11[2];
CTraceFilterSimple::CTraceFilterSimple
(local_dc,(IHandleEntity *)param_1,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
(**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,0x202400b,local_dc,local_70);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine(local_70,local_64,0xff,0xff,0,true,-1.0);
}
if ((local_44 != 1.0) && (local_24 != param_2)) {
if (local_24 == (CTerrorPlayer *)0x0) {
return false;
}
piVar5 = *(int **)(local_24 + 0x238);
if (piVar5 == (int *)0x0) {
return false;
}
(**(code **)(*piVar5 + 0x78))(piVar5);
if (250.0 < (float)extraout_ST0) {
return false;
}
}
return ABS(fVar3 - fVar4) <= 120.0;
}
}
}
}
return false;
}
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.