PhysGetMassCenterOverride
0x0077a410 · 656 bytes · __cdecl
_Z25PhysGetMassCenterOverrideP11CBaseEntityP10vcollide_tR7solid_t
Decompiled
undefined (3 params)
/* PhysGetMassCenterOverride(CBaseEntity*, vcollide_t*, solid_t&) */
void PhysGetMassCenterOverride(CBaseEntity *param_1,vcollide_t *param_2,solid_t *param_3)
{
float fVar1;
float fVar2;
float fVar3;
int iVar4;
undefined4 *puVar5;
int iVar6;
undefined4 *puVar7;
float *pfVar8;
float fVar9;
float local_40;
float local_3c;
float local_38;
float local_34 [3];
float local_28;
float local_24;
float local_20;
iVar4 = PhysGetMassCenterOverrideIndex(*(undefined4 *)(param_1 + 0x154));
if (-1 < iVar4) {
pfVar8 = (float *)(iVar4 * 0x20 + g_PhysicsHook._44_4_);
local_40 = *pfVar8;
local_3c = pfVar8[1];
local_38 = pfVar8[2];
if (pfVar8[6] == 0.0) {
if (((byte)param_1[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(param_1);
}
VectorITransform(&local_40,(matrix3x4_t *)(param_1 + 0x28c),(float *)(param_3 + 0x600));
}
else if (pfVar8[6] == 1.4013e-45) {
(**(code **)(*physcollision + 100))
(physcollision,
*(undefined4 *)(*(int *)(param_2 + 4) + *(int *)(param_3 + 0x60c) * 4),local_34);
if (((byte)param_1[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(param_1);
}
VectorTransform(local_34,(matrix3x4_t *)(param_1 + 0x28c),&local_28);
fVar1 = pfVar8[3];
fVar2 = pfVar8[4];
fVar3 = pfVar8[5];
fVar9 = (((local_24 * fVar2 + local_28 * fVar1 + local_20 * fVar3) - pfVar8[2] * fVar3) -
pfVar8[1] * fVar2) - *pfVar8 * fVar1;
local_40 = fVar1 * fVar9 + local_40;
local_3c = fVar2 * fVar9 + local_3c;
local_38 = fVar9 * fVar3 + local_38;
if (((byte)param_1[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(param_1);
}
VectorITransform(&local_40,(matrix3x4_t *)(param_1 + 0x28c),(float *)(param_3 + 0x600));
}
iVar6 = g_PhysicsHook._56_4_;
if ((0 < (int)g_PhysicsHook._56_4_) && (iVar6 = g_PhysicsHook._56_4_ + -1, iVar4 != iVar6)) {
puVar7 = (undefined4 *)(iVar6 * 0x20 + g_PhysicsHook._44_4_);
puVar5 = (undefined4 *)(iVar4 * 0x20 + g_PhysicsHook._44_4_);
*puVar5 = *puVar7;
puVar5[1] = puVar7[1];
puVar5[2] = puVar7[2];
puVar5[3] = puVar7[3];
puVar5[4] = puVar7[4];
puVar5[5] = puVar7[5];
puVar5[6] = puVar7[6];
puVar5[7] = puVar7[7];
iVar6 = g_PhysicsHook._56_4_ + -1;
}
g_PhysicsHook._56_4_ = iVar6;
if (0.03125 < SQRT(*(float *)(param_3 + 0x608) * *(float *)(param_3 + 0x608) +
*(float *)(param_3 + 0x600) * *(float *)(param_3 + 0x600) +
*(float *)(param_3 + 0x604) * *(float *)(param_3 + 0x604))) {
*(solid_t **)(param_3 + 0x614) = param_3 + 0x600;
}
}
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.