Skip to content

Commit

Permalink
Merge pull request #152 from Chopper1337/viewangles-fix
Browse files Browse the repository at this point in the history
Add backup viewangles/buttons to usercmd
  • Loading branch information
degeneratehyperbola authored Jul 11, 2023
2 parents 7e41ae8 + cbbff9a commit 2e66cc3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions NEPS/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ void createMoveCallback(UserCmd *cmd, bool &sendPacket) noexcept

previousViewAngles = cmd->viewangles;

cmd->viewanglesBackup.x = cmd->viewangles.x;
cmd->viewanglesBackup.y = cmd->viewangles.y;
cmd->viewanglesBackup.z = cmd->viewangles.z;

cmd->buttonsBackup = cmd->buttons;

previousCmd = *cmd;

if (fakePitchPerformed)
Expand Down
2 changes: 2 additions & 0 deletions NEPS/SDK/UserCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ uint32_t UserCmd::computeCRC() const noexcept
crc.process(&randomSeed, sizeof(randomSeed));
crc.process(&mousedx, sizeof(mousedx));
crc.process(&mousedy, sizeof(mousedy));
crc.process(&viewanglesBackup, sizeof(viewanglesBackup));
crc.process(&buttonsBackup, sizeof(buttonsBackup));

return crc;
}
4 changes: 3 additions & 1 deletion NEPS/SDK/UserCmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ struct UserCmd
short mousedx;
short mousedy;
bool hasBeenPredicted;
PAD(24)
Vector viewanglesBackup;
int buttonsBackup;
PAD(8)

uint32_t computeCRC() const noexcept;
};
Expand Down

0 comments on commit 2e66cc3

Please sign in to comment.