From 5a05c0b7b950e6a76c5ebb9b5f52fa24115013c8 Mon Sep 17 00:00:00 2001 From: Ian C Date: Tue, 10 Oct 2006 23:00:37 +0000 Subject: Now allows multiple pad keys to be mapped to the same key -- improves City Patrol no end! --- arm9/source/keyboard.c | 14 ++++++++++++-- arm9/source/tapes.c | 18 ++++++++++-------- source/keyboard.c | 14 ++++++++++++-- source/tapes.c | 18 ++++++++++-------- 4 files changed, 44 insertions(+), 20 deletions(-) diff --git a/arm9/source/keyboard.c b/arm9/source/keyboard.c index 786b32d..c58aaae 100644 --- a/arm9/source/keyboard.c +++ b/arm9/source/keyboard.c @@ -51,14 +51,24 @@ static SoftKey pad_L_key = NUM_SOFT_KEYS; static SoftKey pad_start_key = NUM_SOFT_KEYS; static SoftKey pad_select_key = NUM_SOFT_KEYS; +#define CLEAR_STATE(SHORTCUT) \ + do \ + { \ + if (SHORTCUT != NUM_SOFT_KEYS && \ + !key_state[SHORTCUT].handled) \ + { \ + key_state[SHORTCUT].new_state = FALSE; \ + } \ + } while(0) + #define CHECK_STATE(KEYS,BIT,CODE,SHORTCUT) \ do \ { \ key_state[CODE].new_state = (KEYS & BIT); \ if (SHORTCUT != NUM_SOFT_KEYS && \ - !key_state[SHORTCUT].handled) \ + !key_state[SHORTCUT].handled && (KEYS & BIT)) \ { \ - key_state[SHORTCUT].new_state = (KEYS & BIT); \ + key_state[SHORTCUT].new_state = TRUE; \ } \ } while(0) diff --git a/arm9/source/tapes.c b/arm9/source/tapes.c index ce4082c..c5915ac 100644 --- a/arm9/source/tapes.c +++ b/arm9/source/tapes.c @@ -62,9 +62,11 @@ static SoftKey maze_keys[]= static SoftKey cpatrol_keys[]= { SK_PAD_UP, SK_F, - SK_PAD_R, SK_J, - SK_PAD_L, SK_N, + SK_PAD_RIGHT, SK_J, + SK_PAD_LEFT, SK_N, SK_PAD_DOWN, SK_V, + SK_PAD_R, SK_N, + SK_PAD_L, SK_J, SK_PAD_A, SK_0, NUM_SOFT_KEYS }; @@ -114,12 +116,12 @@ static Tape tapes[NO_TAPES]= "yes - that parallax city was\n" "done with a text mode and the\n" "equivalent of a 0.8mhz z80\n\n" - "the joypad controls up and down.\n" - "the %L% and %R% shoulder buttons\n" - "move left and right.\n" - "when moving left or right use\n" - "the other shoulder button\n" - "to move fast. %A% fires.\n" + "the joypad controls the cursor.\n" + "hold %L% or %R% shoulder buttons\n" + "to move fast when moving in the\n" + "same direction.\n" + "%A% fires.\n" + "as does just about everything.\n" }, { sabotage_bin, diff --git a/source/keyboard.c b/source/keyboard.c index 786b32d..c58aaae 100644 --- a/source/keyboard.c +++ b/source/keyboard.c @@ -51,14 +51,24 @@ static SoftKey pad_L_key = NUM_SOFT_KEYS; static SoftKey pad_start_key = NUM_SOFT_KEYS; static SoftKey pad_select_key = NUM_SOFT_KEYS; +#define CLEAR_STATE(SHORTCUT) \ + do \ + { \ + if (SHORTCUT != NUM_SOFT_KEYS && \ + !key_state[SHORTCUT].handled) \ + { \ + key_state[SHORTCUT].new_state = FALSE; \ + } \ + } while(0) + #define CHECK_STATE(KEYS,BIT,CODE,SHORTCUT) \ do \ { \ key_state[CODE].new_state = (KEYS & BIT); \ if (SHORTCUT != NUM_SOFT_KEYS && \ - !key_state[SHORTCUT].handled) \ + !key_state[SHORTCUT].handled && (KEYS & BIT)) \ { \ - key_state[SHORTCUT].new_state = (KEYS & BIT); \ + key_state[SHORTCUT].new_state = TRUE; \ } \ } while(0) diff --git a/source/tapes.c b/source/tapes.c index ce4082c..c5915ac 100644 --- a/source/tapes.c +++ b/source/tapes.c @@ -62,9 +62,11 @@ static SoftKey maze_keys[]= static SoftKey cpatrol_keys[]= { SK_PAD_UP, SK_F, - SK_PAD_R, SK_J, - SK_PAD_L, SK_N, + SK_PAD_RIGHT, SK_J, + SK_PAD_LEFT, SK_N, SK_PAD_DOWN, SK_V, + SK_PAD_R, SK_N, + SK_PAD_L, SK_J, SK_PAD_A, SK_0, NUM_SOFT_KEYS }; @@ -114,12 +116,12 @@ static Tape tapes[NO_TAPES]= "yes - that parallax city was\n" "done with a text mode and the\n" "equivalent of a 0.8mhz z80\n\n" - "the joypad controls up and down.\n" - "the %L% and %R% shoulder buttons\n" - "move left and right.\n" - "when moving left or right use\n" - "the other shoulder button\n" - "to move fast. %A% fires.\n" + "the joypad controls the cursor.\n" + "hold %L% or %R% shoulder buttons\n" + "to move fast when moving in the\n" + "same direction.\n" + "%A% fires.\n" + "as does just about everything.\n" }, { sabotage_bin, -- cgit v1.2.3