prevent SSinput from constantly reporting null movements (#59558)

Just prevents SSinput from constantly calling Move() every tick for every user even when no actual movement is requested.

Only done rudimentary testing - straightforward and we've been using this for months on CM13 but without diagonal movement.

I asked the original SSinput author back then which said that it was likely an oversight. I believe moving the diagonal movement direction buffer reset to keyLoop instead of Move() also makes sense as it is actually relevant to SSinput and not client actions as a whole (eg. if you call built-in movement verbs)
This commit is contained in:
fira
2021-06-09 14:07:23 -03:00
committed by GitHub
parent 9ab1ab5b45
commit 6c2d17bb15
2 changed files with 5 additions and 3 deletions
@@ -7,8 +7,13 @@
movement_dir = movement_dir | user.movement_keys[_key]
if(user.next_move_dir_add)
movement_dir |= user.next_move_dir_add
user.next_move_dir_add = 0
if(user.next_move_dir_sub)
movement_dir &= ~user.next_move_dir_sub
user.next_move_dir_sub = 0
if(!movement_dir)
return
// Sanity checks in case you hold left and right and up to make sure you only go up
if((movement_dir & NORTH) && (movement_dir & SOUTH))
movement_dir &= ~(NORTH|SOUTH)