CGameMovement::Friction
0x00456ee0 · 397 bytes · __thiscall
_ZN13CGameMovement8FrictionEv
Decompiled
undefined (1 param)
/* CGameMovement::Friction() */
void __thiscall CGameMovement::Friction(CGameMovement *this)
{
int *piVar1;
int iVar2;
longdouble lVar3;
float fVar4;
float fVar5;
float fVar6;
float fVar7;
if (*(float *)(*(CBaseEntity **)(this + 4) + 0x2010) == 0.0) {
iVar2 = *(int *)(this + 8);
fVar4 = SQRT(*(float *)(iVar2 + 0x44) * *(float *)(iVar2 + 0x44) +
*(float *)(iVar2 + 0x40) * *(float *)(iVar2 + 0x40) +
*(float *)(iVar2 + 0x48) * *(float *)(iVar2 + 0x48));
if (0.1 <= fVar4) {
iVar2 = CBaseEntity::GetGroundEntity(*(CBaseEntity **)(this + 4));
fVar5 = 0.0;
if (iVar2 != 0) {
fVar5 = *(float *)(sv_friction._28_4_ + 0x2c);
piVar1 = *(int **)(this + 4);
fVar6 = (float)piVar1[0x860];
lVar3 = (longdouble)(**(code **)(*piVar1 + 0x260))(piVar1);
fVar7 = *(float *)(sv_stopspeed._28_4_ + 0x2c);
if (*(float *)(sv_stopspeed._28_4_ + 0x2c) <= fVar4) {
fVar7 = fVar4;
}
fVar5 = fVar6 * *(float *)(gpGlobals + 0x10) * fVar5 * fVar7 * (float)lVar3;
}
fVar6 = fVar4 - fVar5;
if (fVar4 - fVar5 <= 0.0) {
fVar6 = 0.0;
}
if (fVar6 != fVar4) {
fVar6 = fVar6 / fVar4;
iVar2 = *(int *)(this + 8);
*(float *)(iVar2 + 0x40) = *(float *)(iVar2 + 0x40) * fVar6;
*(float *)(iVar2 + 0x44) = *(float *)(iVar2 + 0x44) * fVar6;
*(float *)(iVar2 + 0x48) = *(float *)(iVar2 + 0x48) * fVar6;
}
iVar2 = *(int *)(this + 8);
fVar6 = 1.0 - fVar6;
*(float *)(iVar2 + 0x68) = *(float *)(iVar2 + 0x68) - fVar6 * *(float *)(iVar2 + 0x40);
*(float *)(iVar2 + 0x6c) = *(float *)(iVar2 + 0x6c) - *(float *)(iVar2 + 0x44) * fVar6;
*(float *)(iVar2 + 0x70) = *(float *)(iVar2 + 0x70) - *(float *)(iVar2 + 0x48) * fVar6;
return;
}
}
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.