CSheetSimulator::ComputeForces
0x004afc90 · 880 bytes · __thiscall
_ZN15CSheetSimulator13ComputeForcesEv
Decompiled
undefined (1 param)
/* CSheetSimulator::ComputeForces() */
void __thiscall CSheetSimulator::ComputeForces(CSheetSimulator *this)
{
uint uVar1;
int iVar2;
float *pfVar3;
int *piVar4;
int iVar5;
int iVar6;
int iVar7;
float fVar8;
float fVar9;
float fVar10;
float fVar11;
float fVar12;
float fVar13;
float fVar14;
int local_30;
float local_2c;
float local_28;
int local_20;
if (0 < *(int *)(this + 0x28)) {
iVar7 = 0;
local_20 = 0;
do {
local_28 = *(float *)(this + 0x50);
piVar4 = (int *)(*(int *)(this + 0x1c) + iVar7);
uVar1 = piVar4[1];
if ((int)uVar1 < 0) {
pfVar3 = (float *)(*(int *)(this + 0x18) + ~uVar1 * 0xc);
local_30 = *piVar4;
iVar6 = *(int *)(this + 8);
iVar2 = local_30 * 0x34 + iVar6;
local_2c = *(float *)(iVar2 + 0x10);
fVar12 = *(float *)(iVar2 + 4) - *pfVar3;
fVar11 = *(float *)(iVar2 + 8) - pfVar3[1];
fVar9 = *(float *)(iVar2 + 0xc) - pfVar3[2];
fVar13 = *(float *)(iVar2 + 0x14);
fVar10 = *(float *)(iVar2 + 0x18);
local_28 = *(float *)(this + 0x4c);
}
else {
iVar6 = *(int *)(this + 8);
local_30 = *piVar4;
iVar2 = uVar1 * 0x34 + iVar6;
iVar5 = local_30 * 0x34 + iVar6;
local_2c = *(float *)(iVar5 + 0x10) - *(float *)(iVar2 + 0x10);
fVar12 = *(float *)(iVar5 + 4) - *(float *)(iVar2 + 4);
fVar11 = *(float *)(iVar5 + 8) - *(float *)(iVar2 + 8);
fVar9 = *(float *)(iVar5 + 0xc) - *(float *)(iVar2 + 0xc);
fVar13 = *(float *)(iVar5 + 0x14) - *(float *)(iVar2 + 0x14);
fVar10 = *(float *)(iVar5 + 0x18) - *(float *)(iVar2 + 0x18);
}
fVar8 = SQRT(fVar11 * fVar11 + fVar12 * fVar12 + fVar9 * fVar9);
if (1e-06 <= fVar8) {
fVar14 = 1.0 / fVar8;
iVar6 = iVar6 + local_30 * 0x34;
fVar13 = -((fVar13 * fVar11 * fVar14 + local_2c * fVar12 * fVar14 + fVar10 * fVar9 * fVar14)
* *(float *)(this + 0x54) + (fVar8 - (float)piVar4[2]) * local_28);
fVar12 = fVar12 * fVar14 * fVar13;
fVar10 = fVar11 * fVar14 * fVar13;
fVar13 = fVar9 * fVar14 * fVar13;
*(float *)(iVar6 + 0x1c) = *(float *)(iVar6 + 0x1c) + fVar12;
*(float *)(iVar6 + 0x20) = *(float *)(iVar6 + 0x20) + fVar10;
*(float *)(iVar6 + 0x24) = *(float *)(iVar6 + 0x24) + fVar13;
iVar6 = *(int *)(*(int *)(this + 0x1c) + 4 + iVar7);
if (-1 < iVar6) {
iVar6 = iVar6 * 0x34 + *(int *)(this + 8);
*(float *)(iVar6 + 0x1c) = *(float *)(iVar6 + 0x1c) - fVar12;
*(float *)(iVar6 + 0x20) = *(float *)(iVar6 + 0x20) - fVar10;
*(float *)(iVar6 + 0x24) = *(float *)(iVar6 + 0x24) - fVar13;
}
}
local_20 = local_20 + 1;
iVar7 = iVar7 + 0xc;
} while (local_20 < *(int *)(this + 0x28));
}
iVar7 = 0;
if (0 < *(int *)(this + 0x3c)) {
do {
iVar6 = iVar7 * 4;
iVar7 = iVar7 + 1;
pfVar3 = (float *)(*(int *)(*(int *)(this + 0x30) + iVar6) * 0x34 + *(int *)(this + 8));
pfVar3[9] = pfVar3[9] - *(float *)(this + 0xa4) * *pfVar3;
} while (iVar7 < *(int *)(this + 0x3c));
}
iVar7 = 0;
iVar6 = 0;
if (0 < *(int *)this * *(int *)(this + 4)) {
do {
iVar2 = *(int *)(this + 8) + iVar7;
if (*(int *)(iVar2 + 0x2c) < 0) {
fVar9 = *(float *)(iVar2 + 0x1c);
fVar11 = *(float *)(iVar2 + 0x20);
fVar12 = *(float *)(iVar2 + 0x24);
}
else {
fVar9 = *(float *)(iVar2 + 0x1c);
fVar11 = *(float *)(iVar2 + 0x20);
fVar12 = *(float *)(iVar2 + 0x24);
pfVar3 = (float *)(*(int *)(this + 0x90) + *(int *)(iVar2 + 0x2c) * 0x14);
fVar13 = pfVar3[1];
fVar10 = pfVar3[2];
fVar8 = fVar13 * fVar11 + *pfVar3 * fVar9 + fVar10 * fVar12;
if (fVar8 < 0.0) {
*(float *)(iVar2 + 0x1c) = fVar9 - *pfVar3 * fVar8;
*(float *)(iVar2 + 0x20) = fVar11 - fVar13 * fVar8;
*(float *)(iVar2 + 0x24) = fVar12 - fVar8 * fVar10;
iVar2 = *(int *)(this + 8) + iVar7;
fVar9 = *(float *)(iVar2 + 0x1c);
fVar11 = *(float *)(iVar2 + 0x20);
fVar12 = *(float *)(iVar2 + 0x24);
}
}
fVar13 = *(float *)(this + 0x58);
iVar6 = iVar6 + 1;
iVar7 = iVar7 + 0x34;
*(float *)(iVar2 + 0x20) = fVar11 - *(float *)(iVar2 + 0x14) * fVar13;
*(float *)(iVar2 + 0x24) = fVar12 - *(float *)(iVar2 + 0x18) * fVar13;
*(float *)(iVar2 + 0x1c) = fVar9 - fVar13 * *(float *)(iVar2 + 0x10);
} while (iVar6 < *(int *)this * *(int *)(this + 4));
}
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.