CGrabController::ComputeError
0x004ecd30 · 403 bytes · __thiscall
_ZN15CGrabController12ComputeErrorEv
Decompiled
undefined (1 param)
/* CGrabController::ComputeError() */
longdouble __thiscall CGrabController::ComputeError(CGrabController *this)
{
uint uVar1;
int *piVar2;
undefined *puVar3;
int iVar4;
float fVar5;
float fVar6;
float fVar7;
float local_18;
float local_14;
float local_10;
if (*(float *)(this + 0x50) <= 0.0) {
return (longdouble)0.0;
}
uVar1 = *(uint *)(this + 0x2068);
if (((uVar1 == 0xffffffff) ||
(puVar3 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar3 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar3 + 8) != uVar1 >> 0xc)) {
fVar5 = *(float *)(this + 0x54);
iVar4 = 0;
}
else {
iVar4 = *(int *)(puVar3 + 4);
if (iVar4 != 0) {
piVar2 = *(int **)(iVar4 + 0x238);
if (piVar2 == (int *)0x0) {
DevMsg("Object attached to Physcannon has no physics object\n");
DetachEntity(this,false);
fVar5 = 9999.0;
goto LAB_004ecd8c;
}
(**(code **)(*piVar2 + 0x11c))(piVar2,&local_18,0);
fVar5 = 0.0;
fVar6 = *(float *)(this + 0x50);
fVar7 = SQRT((*(float *)(this + 0x1c) - local_18) * (*(float *)(this + 0x1c) - local_18) +
(*(float *)(this + 0x20) - local_14) * (*(float *)(this + 0x20) - local_14) +
(*(float *)(this + 0x24) - local_10) * (*(float *)(this + 0x24) - local_10));
if (0.0 < fVar6) {
if (fVar6 <= 1.0) {
fVar5 = 1.0 - fVar6;
}
else {
*(undefined4 *)(this + 0x50) = 0x3f800000;
fVar6 = 1.0;
}
if (*(float *)(this + 0x3c) <= fVar7 / fVar6 && fVar7 / fVar6 != *(float *)(this + 0x3c)) {
fVar7 = fVar7 * 0.5;
}
fVar5 = fVar7 * fVar6 + fVar5 * *(float *)(this + 0x54);
*(float *)(this + 0x54) = fVar5;
goto LAB_004ecd7c;
}
}
fVar5 = *(float *)(this + 0x54);
}
LAB_004ecd7c:
if ((*(byte *)(iVar4 + 0x14e) & 0x10) != 0) {
fVar5 = fVar5 * 3.0;
*(float *)(this + 0x54) = fVar5;
}
*(undefined4 *)(this + 0x50) = 0;
LAB_004ecd8c:
return (longdouble)fVar5;
}
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.