From 75e327e447dc01468912b90ca48e92f417cd9f62 Mon Sep 17 00:00:00 2001 From: Amos Date: Tue, 15 Aug 2023 20:19:38 +0200 Subject: [PATCH] Normalize pitch angles Prob not needed, but other unclamped angles/vectors were able to crash games in the past, so just normalize this too. --- r5dev/game/shared/usercmd.cpp | 1 + r5dev/game/shared/usercmd.h | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/r5dev/game/shared/usercmd.cpp b/r5dev/game/shared/usercmd.cpp index d540ece3..3a35ef25 100644 --- a/r5dev/game/shared/usercmd.cpp +++ b/r5dev/game/shared/usercmd.cpp @@ -30,6 +30,7 @@ int ReadUserCmd(bf_read* buf, CUserCmd* move, CUserCmd* from) // Viewangles must be normalized; applying invalid angles on the client // will result in undefined behavior, or a crash. move->viewangles.Normalize(); + move->pitchangles.Normalize(); // Some players abused a feature of the engine which allows you to perform // custom weapon activities. After some research, it appears that only the diff --git a/r5dev/game/shared/usercmd.h b/r5dev/game/shared/usercmd.h index c8a43623..896d41e4 100644 --- a/r5dev/game/shared/usercmd.h +++ b/r5dev/game/shared/usercmd.h @@ -48,7 +48,7 @@ public: int32_t tick_count; float_t command_time; QAngle viewangles; - char pad_0x0018[12]; + QAngle pitchangles; // Pitch angles? See [r5apex_ds+705D80]. float_t forwardmove; float_t sidemove; float_t upmove; @@ -56,9 +56,9 @@ public: byte impulse; byte cycleslot; byte weaponindex; - __int16 weaponselect; + short weaponselect; bool bUnk39; - __int16 weaponactivity; + short weaponactivity; int nUnk3C; bool controllermode; bool fixangles;