mask mousexy more and rename UnpackFrameShorts to UnpackSignedShorts

This commit is contained in:
rtldg 2021-07-10 04:32:41 +00:00
parent 418676d26c
commit 7757c9330d
2 changed files with 4 additions and 4 deletions

View File

@ -227,8 +227,8 @@ enum struct frame_t
MoveType mt;
// Everything below is generally NOT loaded into memory for playback
// iReplayVersion >= 0x06
int mousexy; // `mousex | (mousey << 16)` // unpack with UnpackFrameShorts
int vel; // basically `forwardmove | (sidemove << 16)` // unpack with UnpackFrameShorts
int mousexy; // `mousex | (mousey << 16)` // unpack with UnpackSignedShorts
int vel; // basically `forwardmove | (sidemove << 16)` // unpack with UnpackSignedShorts
}
enum struct framecache_t
@ -412,7 +412,7 @@ stock int SteamIDToAuth(const char[] sInput)
}
// Can be used to unpack frame_t.mousexy and frame_t.vel
stock void UnpackFrameShorts(int x, int out[2])
stock void UnpackSignedShorts(int x, int out[2])
{
int a = (x & 0x0000FFFF);
out[0] = (a & 0x8000) ? (a | 0xFFFF0000) : a;

View File

@ -2921,7 +2921,7 @@ public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3
aFrame.flags = GetEntityFlags(client);
aFrame.mt = GetEntityMoveType(client);
aFrame.mousexy = mouse[0] | (mouse[1] << 16);
aFrame.mousexy = (mouse[0] & 0xFFFF) | ((mouse[1] & 0xFFFF) << 16);
aFrame.vel = LimitMoveVelFloat(vel[0]) | (LimitMoveVelFloat(vel[1]) << 16);
gA_PlayerFrames[client].SetArray(gI_PlayerFrames[client]++, aFrame, sizeof(frame_t));