Skip to content

Commit

Permalink
Treat directions as one button for keyrepeat
Browse files Browse the repository at this point in the history
  • Loading branch information
Nopey committed Dec 1, 2024
1 parent 90bc319 commit 70a048f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/controller/controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static inline void ctrl_action_push(ctrl_event **ev, int action) {
}

void controller_cmd(controller *ctrl, int action, ctrl_event **ev) {
ctrl->current |= action;
ctrl->current |= (action & ACTMASK_DIRECTIONS) ? ACTMASK_DIRECTIONS : action;
if((ctrl->last & action) && (!ctrl->repeat || action == ACT_KICK || action == ACT_PUNCH || action == ACT_ESC)) {
return;
}
Expand Down
4 changes: 3 additions & 1 deletion src/controller/controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ enum
ACT_DOWN = 0x10,
ACT_LEFT = 0x20,
ACT_ESC = 0x40,
ACT_RIGHT = 0x80
ACT_RIGHT = 0x80,

ACTMASK_DIRECTIONS = (ACT_UP | ACT_DOWN | ACT_LEFT | ACT_RIGHT),
};

enum
Expand Down

0 comments on commit 70a048f

Please sign in to comment.