From 162c8b864f9c9c98470887d4bc6c03eab222452a Mon Sep 17 00:00:00 2001 From: Ian C Date: Tue, 10 Oct 2006 00:05:34 +0000 Subject: Added joypad mappings for pre-defined tapes --- arm9/source/tapes.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 69 insertions(+), 7 deletions(-) (limited to 'arm9/source/tapes.c') diff --git a/arm9/source/tapes.c b/arm9/source/tapes.c index adac3b6..ce4082c 100644 --- a/arm9/source/tapes.c +++ b/arm9/source/tapes.c @@ -24,6 +24,7 @@ #include "tapes.h" #include "framebuffer.h" +#include "keyboard.h" #include "zx81.h" #include "maze_bin.h" @@ -41,12 +42,46 @@ typedef struct const u8 *tape; const u32 *tape_len; sImage img; - void *source_pcx; + const void *source_pcx; + SoftKey *keys; const char *text; } Tape; #define NO_TAPES 3 +static SoftKey maze_keys[]= + { + SK_PAD_UP, SK_7, + SK_PAD_LEFT, SK_5, + SK_PAD_RIGHT, SK_8, + SK_PAD_START, SK_C, + SK_PAD_SELECT, SK_A, + NUM_SOFT_KEYS + }; + +static SoftKey cpatrol_keys[]= + { + SK_PAD_UP, SK_F, + SK_PAD_R, SK_J, + SK_PAD_L, SK_N, + SK_PAD_DOWN, SK_V, + SK_PAD_A, SK_0, + NUM_SOFT_KEYS + }; + +static SoftKey sabotage_keys[]= + { + SK_PAD_UP, SK_W, + SK_PAD_LEFT, SK_H, + SK_PAD_RIGHT, SK_J, + SK_PAD_DOWN, SK_S, + SK_PAD_A, SK_E, + SK_PAD_R, SK_1, + SK_PAD_L, SK_2, + SK_PAD_START, SK_0, + NUM_SOFT_KEYS + }; + static Tape tapes[NO_TAPES]= { { @@ -54,32 +89,44 @@ static Tape tapes[NO_TAPES]= &maze_bin_size, {0}, maze_inlay_bin, + maze_keys, "%3d monster maze%\n" "(c) 1983 Malcom E. Evans\n\n" - "Escape the maze and its T-Rex\n" - "\n\n" + "Escape the maze and its T-Rex\n\n" + "use joypad for turning and to\n" + "move forward.\n" + "%start% to start.\n" + "%select% to appeal.\n\n" "%note% when the screen goes grey\n" "for 30-60 seconds this is not a\n" - "problem, and is the game creating\n" - "the lair of rex." + "problem - the game is creating\n" + "the maze." }, { cpatrol_bin, &cpatrol_bin_size, {0}, cpatrol_inlay_bin, + cpatrol_keys, "%city patrol%\n" "(c) 1982 Don Priestley\n\n" "Defend the city from the aliens.\n\n" "yes - that parallax city was\n" "done with a text mode and the\n" - "equivalent of a 0.8mhz z80" + "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" }, { sabotage_bin, &sabotage_bin_size, {0}, sabotage_inlay_bin, + sabotage_keys, "%sabotage%\n" "(c) 1982 Don Priestley\n\n" "Destroy the boxes before the\n" @@ -90,7 +137,11 @@ static Tape tapes[NO_TAPES]= "the dazzling graphics of other\n" "ZX81 games it more than makes\n" "up with a simply joyous\n" - "gameplay mechanic.\n" + "gameplay mechanic.\n\n" + "The joypad controls the player.\n" + "%A% plants a bomb. %L% shoulder\n" + "to play as the guard, %R% as\n" + "the saboteur." } }; @@ -127,6 +178,9 @@ static void DisplayTape(Tape *t) FB_Print("to choose",0,10,FB_RGB(255,255,255),-1); FB_Print("A to select",0,30,FB_RGB(255,255,255),-1); FB_Print("B to cancel",0,40,FB_RGB(255,255,255),-1); + FB_Print("REMEMBER TO",0,60,FB_RGB(255,255,255),-1); + FB_Print("LOAD \"\"",0,70,FB_RGB(255,255,255),-1); + FB_Print("ON THE ZX81!",0,80,FB_RGB(255,255,255),-1); ZX81DisplayString(t->text); } @@ -163,8 +217,16 @@ void SelectTape(void) } else if (key & KEY_A) { + int f; + done=TRUE; ZX81SetTape(tapes[current].tape,*tapes[current].tape_len); + + for(f=0;tapes[current].keys[f]!=NUM_SOFT_KEYS;f+=2) + { + SK_DefinePad(tapes[current].keys[f], + tapes[current].keys[f+1]); + } } else if (key & KEY_B) { -- cgit v1.2.3