CGameMovement::TryPlayerMove
0x00458b60 · 3092 bytes · __thiscall
_ZN13CGameMovement13TryPlayerMoveEP6VectorP10CGameTrace
Decompiled
undefined (3 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CGameMovement::TryPlayerMove(Vector*, CGameTrace*) */
uint __thiscall
CGameMovement::TryPlayerMove(CGameMovement *this,Vector *param_1,CGameTrace *param_2)
{
float fVar1;
float fVar2;
code *pcVar3;
int iVar4;
char cVar5;
undefined4 uVar6;
uint uVar7;
float *pfVar8;
int iVar9;
int iVar10;
int iVar11;
longdouble lVar12;
float fVar13;
float fVar14;
float fVar15;
float fVar16;
int local_16c;
uint local_164;
float local_160;
float local_15c;
Vector *local_150;
undefined4 local_144;
undefined4 local_140;
undefined4 local_13c;
undefined4 local_138;
int local_134;
float local_130;
float local_12c;
float local_128;
float local_124;
float local_120;
float local_11c;
float local_118;
float local_114;
float local_110;
float local_10c;
float local_108;
float local_104;
float local_100 [4];
float local_f0;
float local_ec;
undefined4 local_c4;
undefined4 local_c0;
undefined4 local_bc;
undefined4 local_b8;
undefined4 local_b4;
undefined4 local_b0;
float local_ac;
float local_a8;
float local_a4;
undefined4 local_a0;
CGameTrace local_9c;
CGameTrace local_9b;
undefined2 local_9a;
float local_98;
undefined4 local_94;
undefined2 local_90;
CGameTrace local_8e;
CGameTrace local_8d;
undefined4 local_8c;
undefined4 local_88;
undefined4 local_84;
undefined4 local_80;
undefined2 local_7c;
undefined2 local_7a;
undefined4 local_78;
undefined4 local_74;
undefined1 local_70 [44];
float local_44;
char local_39;
local_144 = 0;
local_140 = 0;
if (___atan2f_finite == 0) {
local_134 = 0;
}
else {
(**(code **)(___atan2f_finite + 0x50))
(___atan2f_finite,&local_144,0,0,0,0,
"/data/src/game/server/../../game/shared/gamemovement.cpp",0xaea,
&TryPlayerMove(Vector*,CGameTrace*)::tm_fmt,"(%s)%s","Unaccounted",
"CGameMovement::TryPlayerMove");
local_134 = ___atan2f_finite;
}
iVar10 = _DAT_0105db00;
local_13c = local_144;
local_138 = local_140;
/* try { // try from 00459037 to 00459085 has its CatchHandler @ 0045979c */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar11 = ThreadGetCurrentId(), iVar10 == iVar11)) {
if ((char *)*_DAT_0105d15c != "CGameMovement::TryPlayerMove") {
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc138c6,(char *)0x1,0xbfafa1);
}
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
local_118 = 0.0;
iVar10 = *(int *)(this + 8);
iVar11 = 0;
local_114 = 0.0;
local_110 = 0.0;
local_16c = 4;
fVar16 = *(float *)(iVar10 + 0x44);
local_164 = 0;
fVar1 = *(float *)(iVar10 + 0x40);
local_15c = 0.0;
local_160 = *(float *)(gpGlobals + 0x10);
fVar2 = *(float *)(iVar10 + 0x48);
fVar14 = fVar16;
fVar15 = fVar2;
fVar13 = fVar1;
local_124 = fVar1;
local_120 = fVar16;
local_11c = fVar2;
while (SQRT(fVar14 * fVar14 + fVar13 * fVar13 + fVar15 * fVar15) != 0.0) {
local_10c = *(float *)(iVar10 + 0x9c) + fVar13 * local_160;
local_108 = fVar14 * local_160 + *(float *)(iVar10 + 0xa0);
local_104 = fVar15 * local_160 + *(float *)(iVar10 + 0xa4);
if (g_bMovementOptimizations == '\0') {
pcVar3 = *(code **)(*(int *)this + 0x3c);
/* try { // try from 0045929f to 00459638 has its CatchHandler @ 00459778 */
uVar6 = (**(code **)(*(int *)this + 0x40))(this,0,0);
(*pcVar3)(this,*(int *)(this + 8) + 0x9c,&local_10c,uVar6,8,&local_c4);
joined_r0x004592e2:
if ((local_8d == (CGameTrace)0x0) && (local_98 < 1.0)) {
(**(code **)(*(int *)this + 0xa4))(this,*(int *)(this + 8) + 0x9c,&local_10c,&local_c4);
}
}
else {
if (((param_1 == (Vector *)0x0) || (local_10c != *(float *)param_1)) ||
((local_108 != *(float *)(param_1 + 4) || (local_104 != *(float *)(param_1 + 8))))) {
pcVar3 = *(code **)(*(int *)this + 0x3c);
/* try { // try from 00458d8e to 00458e60 has its CatchHandler @ 00459778 */
uVar6 = (**(code **)(*(int *)this + 0x40))(this,0,0);
(*pcVar3)(this,*(int *)(this + 8) + 0x9c,&local_10c,uVar6,8,&local_c4);
goto joined_r0x004592e2;
}
local_c4 = *(undefined4 *)param_2;
local_c0 = *(undefined4 *)(param_2 + 4);
local_bc = *(undefined4 *)(param_2 + 8);
local_b8 = *(undefined4 *)(param_2 + 0xc);
local_b4 = *(undefined4 *)(param_2 + 0x10);
local_b0 = *(undefined4 *)(param_2 + 0x14);
local_ac = *(float *)(param_2 + 0x18);
local_a8 = *(float *)(param_2 + 0x1c);
local_a4 = *(float *)(param_2 + 0x20);
local_a0 = *(undefined4 *)(param_2 + 0x24);
local_9c = param_2[0x28];
local_9b = param_2[0x29];
local_9a = *(undefined2 *)(param_2 + 0x2a);
local_98 = *(float *)(param_2 + 0x2c);
local_94 = *(undefined4 *)(param_2 + 0x30);
local_90 = *(undefined2 *)(param_2 + 0x34);
local_8e = param_2[0x36];
local_8d = param_2[0x37];
local_8c = *(undefined4 *)(param_2 + 0x38);
local_84 = *(undefined4 *)(param_2 + 0x40);
local_88 = *(undefined4 *)(param_2 + 0x3c);
local_80 = *(undefined4 *)(param_2 + 0x44);
local_7c = *(undefined2 *)(param_2 + 0x48);
local_7a = *(undefined2 *)(param_2 + 0x4a);
local_78 = *(undefined4 *)(param_2 + 0x4c);
local_74 = *(undefined4 *)(param_2 + 0x50);
}
local_15c = local_15c + local_98;
if (local_8e != (CGameTrace)0x0) {
iVar10 = *(int *)(this + 8);
local_164 = 4;
*(undefined4 *)(iVar10 + 0x40) = vec3_origin;
*(undefined4 *)(iVar10 + 0x44) = DAT_01053d4c;
*(undefined4 *)(iVar10 + 0x48) = DAT_01053d50;
goto LAB_00459219;
}
if (0.03125 < local_98) {
if (local_98 != 1.0) {
LAB_004590ab:
iVar10 = *(int *)(this + 8);
iVar9 = 0;
*(undefined4 *)(iVar10 + 0x9c) = local_b8;
*(undefined4 *)(iVar10 + 0xa0) = local_b4;
*(undefined4 *)(iVar10 + 0xa4) = local_b0;
iVar10 = *(int *)(this + 8);
local_124 = *(float *)(iVar10 + 0x40);
local_120 = *(float *)(iVar10 + 0x44);
local_11c = *(float *)(iVar10 + 0x48);
goto LAB_00458e27;
}
pcVar3 = *(code **)(*(int *)this + 0x3c);
uVar6 = (**(code **)(*(int *)this + 0x40))(this,0,0);
(*pcVar3)(this,&local_b8,&local_b8,uVar6,8,local_70);
if ((local_39 == '\0') && (local_44 == 1.0)) goto LAB_004590ab;
LAB_0045910f:
iVar10 = *(int *)(this + 8);
LAB_00459112:
*(undefined4 *)(iVar10 + 0x40) = vec3_origin;
*(undefined4 *)(iVar10 + 0x44) = DAT_01053d4c;
*(undefined4 *)(iVar10 + 0x48) = DAT_01053d50;
iVar10 = *(int *)(this + 8);
break;
}
iVar10 = *(int *)(this + 8);
iVar9 = iVar11;
LAB_00458e27:
if (local_98 == 1.0) break;
(**(code **)(*IMoveHelper::sm_pSingleton + 0xc))
(IMoveHelper::sm_pSingleton,&local_c4,iVar10 + 0x40);
fVar13 = local_a4;
lVar12 = (longdouble)(**(code **)(*(int *)this + 0x38))(this);
fVar15 = local_98;
fVar14 = local_a4;
uVar7 = local_164 | 1;
if (fVar13 <= (float)lVar12) {
uVar7 = local_164;
}
local_164 = uVar7 | 2;
if (local_a4 != 0.0) {
local_164 = uVar7;
}
if (4 < iVar9) goto LAB_0045910f;
iVar11 = iVar9 + 1;
local_100[iVar9 * 3] = local_ac;
fVar13 = local_a8;
local_100[iVar9 * 3 + 2] = fVar14;
local_100[iVar9 * 3 + 1] = fVar13;
if (((iVar11 != 1) || ((*(CBaseEntity **)(this + 4))[0x186] != (CBaseEntity)0x2)) ||
(iVar10 = CBaseEntity::GetGroundEntity(*(CBaseEntity **)(this + 4)), fVar13 = local_100[2],
iVar10 != 0)) {
local_150 = (Vector *)local_100;
iVar10 = 0;
do {
ClipVelocity(this,(Vector *)&local_124,local_150,(Vector *)(*(int *)(this + 8) + 0x40),1.0);
pfVar8 = local_100;
iVar9 = 0;
do {
if ((iVar9 != iVar10) &&
(iVar4 = *(int *)(this + 8),
pfVar8[1] * *(float *)(iVar4 + 0x44) + *pfVar8 * *(float *)(iVar4 + 0x40) +
pfVar8[2] * *(float *)(iVar4 + 0x48) < 0.0)) break;
iVar9 = iVar9 + 1;
pfVar8 = pfVar8 + 3;
} while (iVar9 < iVar11);
if (iVar9 == iVar11) break;
local_150 = local_150 + 0xc;
iVar10 = iVar10 + 1;
} while (iVar10 < iVar11);
if (iVar10 == iVar11) {
if (iVar10 != 2) goto LAB_0045910f;
local_130 = local_ec * local_100[1] - local_f0 * local_100[2];
local_12c = local_100[2] * local_100[3] - local_ec * local_100[0];
local_128 = local_f0 * local_100[0] - local_100[3] * local_100[1];
VectorNormalize((Vector *)&local_130);
iVar10 = *(int *)(this + 8);
fVar13 = *(float *)(iVar10 + 0x44) * local_12c + *(float *)(iVar10 + 0x40) * local_130 +
*(float *)(iVar10 + 0x48) * local_128;
*(float *)(iVar10 + 0x40) = local_130 * fVar13;
*(float *)(iVar10 + 0x44) = local_12c * fVar13;
*(float *)(iVar10 + 0x48) = fVar13 * local_128;
}
iVar10 = *(int *)(this + 8);
if (0.0 < fVar16 * *(float *)(iVar10 + 0x44) + fVar1 * *(float *)(iVar10 + 0x40) +
fVar2 * *(float *)(iVar10 + 0x48)) goto LAB_00458ff0;
goto LAB_00459112;
}
lVar12 = (longdouble)(**(code **)(*(int *)this + 0x38))(this);
if (fVar13 <= (float)lVar12) {
ClipVelocity(this,(Vector *)&local_124,(Vector *)local_100,(Vector *)&local_118,
(1.0 - *(float *)(*(int *)(this + 4) + 0x2180)) *
*(float *)(sv_bounce._28_4_ + 0x2c) + 1.0);
}
else {
ClipVelocity(this,(Vector *)&local_124,(Vector *)local_100,(Vector *)&local_118,1.0);
}
iVar10 = *(int *)(this + 8);
*(float *)(iVar10 + 0x40) = local_118;
*(float *)(iVar10 + 0x44) = local_114;
*(float *)(iVar10 + 0x48) = local_110;
iVar10 = *(int *)(this + 8);
local_124 = local_118;
local_120 = local_114;
local_11c = local_110;
LAB_00458ff0:
local_16c = local_16c + -1;
if (local_16c == 0) break;
fVar13 = *(float *)(iVar10 + 0x40);
fVar14 = *(float *)(iVar10 + 0x44);
local_160 = (1.0 - fVar15) * local_160;
fVar15 = *(float *)(iVar10 + 0x48);
}
if (local_15c == 0.0) {
*(undefined4 *)(iVar10 + 0x40) = vec3_origin;
*(undefined4 *)(iVar10 + 0x44) = DAT_01053d4c;
*(undefined4 *)(iVar10 + 0x48) = DAT_01053d50;
iVar10 = *(int *)(this + 8);
}
fVar16 = SQRT(fVar1 * fVar1 + fVar16 * fVar16) -
SQRT(*(float *)(iVar10 + 0x44) * *(float *)(iVar10 + 0x44) +
*(float *)(iVar10 + 0x40) * *(float *)(iVar10 + 0x40));
if (SafeFallSpeed + SafeFallSpeed < fVar16) {
uVar6 = 0x3f800000;
}
else {
if (fVar16 <= SafeFallSpeed) goto LAB_00459219;
uVar6 = 0x3f59999a;
}
/* try { // try from 0045920d to 00459212 has its CatchHandler @ 00459778 */
(**(code **)(*(int *)this + 0xdc))(this,uVar6);
LAB_00459219:
iVar10 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar11 = ThreadGetCurrentId(), iVar10 == iVar11)) {
cVar5 = CVProfNode::ExitScope();
if (cVar5 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_134 != 0) {
(**(code **)(local_134 + 0x54))(local_134,local_13c,local_138,0,0,0);
}
return local_164;
}
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.