CBaseEntity::PhysicsTryMove
0x0078d930 · 2564 bytes · __thiscall
_ZN11CBaseEntity14PhysicsTryMoveEfP10CGameTrace
Decompiled
undefined (3 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CBaseEntity::PhysicsTryMove(float, CGameTrace*) */
uint __thiscall CBaseEntity::PhysicsTryMove(CBaseEntity *this,float param_1,CGameTrace *param_2)
{
CBaseEntity CVar1;
float fVar2;
float fVar3;
float fVar4;
char cVar5;
uint uVar6;
float *pfVar7;
uint uVar8;
CBaseEntity *pCVar9;
int iVar10;
Vector *pVVar11;
int iVar12;
int iVar13;
longdouble lVar14;
float fVar15;
float fVar16;
float fVar17;
float fVar18;
int local_118;
uint local_110;
float local_10c;
Vector *local_100;
undefined4 local_f4;
undefined4 local_f0;
undefined4 local_e8;
undefined4 local_e4;
int local_e0;
float local_dc;
float local_d8;
float local_d4;
float local_d0;
float local_cc;
float local_c8;
float local_c4;
float local_c0;
float local_bc;
float local_b8;
float local_b4;
float local_b0;
float local_ac [15];
undefined4 local_70;
undefined4 local_6c;
undefined4 local_68;
undefined4 local_64;
undefined4 local_60;
undefined4 local_5c;
float local_58;
float local_54;
float local_50;
undefined4 local_4c;
CGameTrace local_48;
CGameTrace local_47;
undefined2 local_46;
float local_44;
undefined4 local_40;
undefined2 local_3c;
CGameTrace local_3a;
CGameTrace local_39;
undefined4 local_38;
undefined4 local_34;
undefined4 local_30;
undefined4 local_2c;
undefined2 local_28;
undefined2 local_26;
CBaseEntity *local_24;
undefined4 local_20;
local_f4 = 0;
local_f0 = 0;
if (___atan2f_finite == 0) {
local_e0 = 0;
}
else {
(**(code **)(___atan2f_finite + 0x50))
(___atan2f_finite,&local_f4,0,0,0,0,"/data/src/game/server/physics_main.cpp",0x452,
&PhysicsTryMove(float,CGameTrace*)::tm_fmt,"(%s)%s","Unaccounted",
"CBaseEntity::PhysicsTryMove");
local_e0 = ___atan2f_finite;
}
iVar12 = _DAT_0105db00;
local_e8 = local_f4;
local_e4 = local_f0;
/* try { // try from 0078ded6 to 0078df24 has its CatchHandler @ 0078e35e */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar13 = ThreadGetCurrentId(), iVar12 == iVar13)) {
if ((char *)*_DAT_0105d15c != "CBaseEntity::PhysicsTryMove") {
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xcb1f9d,(char *)0x1,0xbfafa1);
}
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
/* try { // try from 0078da04 to 0078ddf5 has its CatchHandler @ 0078e33a */
uVar6 = (**(code **)(*(int *)this + 0x2c8))(this);
local_d0 = 0.0;
local_cc = 0.0;
local_c8 = 0.0;
if (((byte)this[0x14d] & 0x10) != 0) {
CalcAbsoluteVelocity(this);
}
fVar2 = *(float *)(this + 0x274);
iVar12 = 0;
local_118 = 4;
local_110 = 0;
fVar3 = *(float *)(this + 0x278);
fVar4 = *(float *)(this + 0x27c);
local_10c = param_1;
local_dc = fVar2;
local_d8 = fVar3;
local_d4 = fVar4;
local_b8 = fVar2;
local_b4 = fVar3;
local_b0 = fVar4;
while (((local_b8 != vec3_origin || (DAT_01053d4c != local_b4)) || (DAT_01053d50 != local_b0))) {
uVar8 = 0;
if ((*(uint *)(this + 0x14c) & 0x800) != 0) {
/* try { // try from 0078dfe5 to 0078e337 has its CatchHandler @ 0078e33a */
CalcAbsolutePosition(this);
uVar8 = *(uint *)(this + 0x14c) & 0x800;
}
local_c4 = local_b8 * local_10c + *(float *)(this + 0x2e0);
local_c0 = local_b4 * local_10c + *(float *)(this + 0x2e4);
local_bc = local_b0 * local_10c + *(float *)(this + 0x2e8);
if (uVar8 != 0) {
CalcAbsolutePosition(this);
}
Physics_TraceEntity(this,(Vector *)(this + 0x2e0),(Vector *)&local_c4,uVar6,
(CGameTrace *)&local_70);
if (local_39 != (CGameTrace)0x0) {
SetAbsVelocity(this,(Vector *)&vec3_origin);
LAB_0078e31e:
local_110 = 4;
goto LAB_0078df49;
}
iVar13 = iVar12;
if (0.0 < local_44) {
SetAbsOrigin(this,(Vector *)&local_64);
iVar13 = 0;
local_dc = local_b8;
local_d8 = local_b4;
local_d4 = local_b0;
}
if (local_44 == 1.0) break;
if (local_24 == (CBaseEntity *)0x0) {
SetAbsVelocity(this,(Vector *)&local_b8);
Warning("PhysicsTryMove: !trace.u.ent");
goto LAB_0078e31e;
}
if (0.7 < local_50) {
local_110 = local_110 | 1;
cVar5 = (**(code **)(*(int *)this + 0x19c))(this,local_24);
if (cVar5 != '\0') {
pCVar9 = (CBaseEntity *)GetGroundEntity(this);
if (pCVar9 != local_24) {
SetGroundChangeTime(this,param_1 + *(float *)(gpGlobals + 0xc) +
(local_44 * local_10c - local_10c));
}
SetGroundEntity(this,local_24);
}
}
if ((local_50 == 0.0) && (local_110 = local_110 | 2, param_2 != (CGameTrace *)0x0)) {
*(undefined4 *)param_2 = local_70;
*(undefined4 *)(param_2 + 0x20) = 0;
*(undefined4 *)(param_2 + 4) = local_6c;
*(undefined4 *)(param_2 + 8) = local_68;
*(undefined4 *)(param_2 + 0xc) = local_64;
*(undefined4 *)(param_2 + 0x10) = local_60;
*(undefined4 *)(param_2 + 0x14) = local_5c;
*(float *)(param_2 + 0x18) = local_58;
*(float *)(param_2 + 0x1c) = local_54;
*(undefined4 *)(param_2 + 0x24) = local_4c;
*(float *)(param_2 + 0x2c) = local_44;
param_2[0x28] = local_48;
param_2[0x29] = local_47;
*(undefined2 *)(param_2 + 0x2a) = local_46;
*(undefined4 *)(param_2 + 0x30) = local_40;
*(undefined2 *)(param_2 + 0x34) = local_3c;
param_2[0x36] = local_3a;
param_2[0x37] = local_39;
*(undefined4 *)(param_2 + 0x38) = local_38;
*(undefined4 *)(param_2 + 0x3c) = local_34;
*(undefined4 *)(param_2 + 0x40) = local_30;
*(undefined4 *)(param_2 + 0x44) = local_2c;
*(undefined2 *)(param_2 + 0x48) = local_28;
*(undefined2 *)(param_2 + 0x4a) = local_26;
*(CBaseEntity **)(param_2 + 0x4c) = local_24;
*(undefined4 *)(param_2 + 0x50) = local_20;
}
PhysicsImpact(this,local_24,(CGameTrace *)&local_70);
if ((((byte)this[0x14c] & 1) != 0) || ((**(byte **)(this + 0x30) & 2) != 0)) break;
local_10c = (1.0 - local_44) * local_10c;
if (4 < iVar13) {
LAB_0078e2eb:
SetAbsVelocity(this,(Vector *)&vec3_origin);
goto LAB_0078df49;
}
iVar12 = iVar13 + 1;
CVar1 = this[0x186];
local_ac[iVar13 * 3] = local_58;
local_ac[iVar13 * 3 + 1] = local_54;
local_ac[iVar13 * 3 + 2] = local_50;
if ((CVar1 == (CBaseEntity)0x2) &&
((((byte)this[0x150] & 1) == 0 ||
(lVar14 = (longdouble)(**(code **)(*(int *)this + 0x260))(this), (float)lVar14 != 1.0)))) {
local_100 = (Vector *)0x0;
pVVar11 = (Vector *)local_ac;
do {
if (0.7 < *(float *)(pVVar11 + 8)) {
PhysicsClipVelocity(this,(Vector *)&local_dc,pVVar11,(Vector *)&local_d0,1.0);
local_dc = local_d0;
local_d8 = local_cc;
local_d4 = local_c8;
}
else {
fVar16 = *(float *)(sv_bounce._28_4_ + 0x2c);
lVar14 = (longdouble)(**(code **)(*(int *)this + 0x260))(this);
PhysicsClipVelocity(this,(Vector *)&local_dc,pVVar11,(Vector *)&local_d0,
(1.0 - (float)lVar14) * fVar16 + 1.0);
}
local_100 = (Vector *)((int)local_100 + 1);
pVVar11 = pVVar11 + 0xc;
} while ((int)local_100 < iVar12);
local_dc = local_d0;
local_d8 = local_cc;
local_d4 = local_c8;
local_b8 = local_dc;
local_b4 = local_d8;
local_b0 = local_d4;
}
else {
local_100 = (Vector *)local_ac;
iVar13 = 0;
do {
PhysicsClipVelocity(this,(Vector *)&local_dc,local_100,(Vector *)&local_d0,1.0);
pfVar7 = local_ac;
iVar10 = 0;
do {
if ((iVar10 != iVar13) &&
(pfVar7[1] * local_cc + *pfVar7 * local_d0 + pfVar7[2] * local_c8 < 0.0)) break;
iVar10 = iVar10 + 1;
pfVar7 = pfVar7 + 3;
} while (iVar10 < iVar12);
if (iVar10 == iVar12) break;
local_100 = local_100 + 0xc;
iVar13 = iVar13 + 1;
} while (iVar13 < iVar12);
fVar16 = local_d0;
fVar17 = local_cc;
fVar15 = local_c8;
if (iVar13 == iVar12) {
if (iVar13 != 2) break;
fVar16 = local_ac[5] * local_ac[1] - local_ac[4] * local_ac[2];
fVar17 = local_ac[2] * local_ac[3] - local_ac[5] * local_ac[0];
fVar18 = local_ac[4] * local_ac[0] - local_ac[1] * local_ac[3];
fVar15 = local_b4 * fVar17 + local_b8 * fVar16 + local_b0 * fVar18;
fVar16 = fVar16 * fVar15;
fVar17 = fVar17 * fVar15;
fVar15 = fVar18 * fVar15;
}
local_b8 = fVar16;
local_b4 = fVar17;
local_b0 = fVar15;
if (fVar17 * fVar3 + fVar16 * fVar2 + fVar15 * fVar4 <= 0.0) goto LAB_0078e2eb;
}
local_118 = local_118 + -1;
if (local_118 == 0) break;
}
/* try { // try from 0078df3e to 0078df42 has its CatchHandler @ 0078e33a */
SetAbsVelocity(this,(Vector *)&local_b8);
LAB_0078df49:
iVar12 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar13 = ThreadGetCurrentId(), iVar12 == iVar13)) {
cVar5 = CVProfNode::ExitScope();
if (cVar5 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_e0 != 0) {
(**(code **)(local_e0 + 0x54))(local_e0,local_e8,local_e4,0,0,0);
}
return local_110;
}
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.