data/spr_game.raw data/spr_game.pal data/spr_game.gpal \
data/spr_logo.raw data/spr_logo.pal \
data/menuscr.raw data/menuscr.pal data/menuscr.gpal \
- data/spr_menu.raw data/spr_menu.pal
+ data/spr_menu.raw data/spr_menu.pal \
+ data/controls.raw data/controls.pal data/controls.gpal
libs = libs/maxmod/libmm.a
--- /dev/null
+#include "game.h"
+#include "data.h"
+#include "gba.h"
+#include "util.h"
+#include "dma.h"
+#include "input.h"
+#include "debug.h"
+
+static int ctrlscr_start(void);
+static void ctrlscr_stop(void);
+static void ctrlscr_frame(void);
+static void ctrlscr_vblank(void);
+
+static struct screen ctrlscr = {
+ "controls",
+ ctrlscr_start,
+ ctrlscr_stop,
+ ctrlscr_frame,
+ ctrlscr_vblank
+};
+
+struct screen *init_controls_screen(void)
+{
+ return &ctrlscr;
+}
+
+static void setup_palette(void)
+{
+ int i;
+ unsigned char *cmap = gba_colors ? controls_gba_cmap : controls_cmap;
+
+ for(i=0; i<256; i++) {
+ int r = cmap[i * 3];
+ int g = cmap[i * 3 + 1];
+ int b = cmap[i * 3 + 2];
+ gba_bgpal[i] = RGB555(r, g, b);
+ }
+}
+
+static int ctrlscr_start(void)
+{
+ gba_setmode(4, DISPCNT_BG2 | DISPCNT_OBJ);
+ dma_copy16(3, gba_vram_lfb0, controls_pixels, 240 * 160 / 2, 0);
+
+ setup_palette();
+ return 0;
+}
+
+static void ctrlscr_stop(void)
+{
+ wait_vblank();
+}
+
+static void ctrlscr_frame(void)
+{
+ update_keyb();
+
+ if(KEYPRESS(BN_START) || KEYPRESS(BN_A) || KEYPRESS(BN_B)) {
+ change_screen(find_screen("menu"));
+ return;
+ }
+
+ wait_vblank();
+}
+
+static void ctrlscr_vblank(void)
+{
+}
extern unsigned char spr_logo_pixels[];
extern unsigned char spr_logo_cmap[];
+extern unsigned char controls_pixels[];
+extern unsigned char controls_cmap[];
+extern unsigned char controls_gba_cmap[];
+
#endif /* DATA_H_ */
.globl spr_menu_cmap
.globl spr_logo_pixels
.globl spr_logo_cmap
+ .globl controls_pixels
+ .globl controls_cmap
+ .globl controls_gba_cmap
.align 1
color_pixels:
.align 1
spr_logo_cmap:
.incbin "data/spr_logo.pal"
+
+ .align 1
+controls_pixels:
+ .incbin "data/controls.raw"
+
+ .align 1
+controls_cmap:
+ .incbin "data/controls.pal"
+
+ .align 1
+controls_gba_cmap:
+ .incbin "data/controls.gpal"
+
struct screen *init_logo_screen(void);
struct screen *init_menu_screen(void);
struct screen *init_game_screen(void);
+struct screen *init_controls_screen(void);
struct screen *curscr;
if(!(scrlist[num_scr++] = init_menu_screen())) {
return -1;
}
+ if(!(scrlist[num_scr++] = init_controls_screen())) {
+ return -1;
+ }
if(!(scrlist[num_scr++] = init_game_screen())) {
return -1;
}
static void victory(void)
{
- int sec, time_bonus;
+ int sec, time_bonus = 0;
total_time = timer_msec - start_time;
sec = total_time / 1000;
{
update_keyb();
- if(KEYPRESS(BN_START) || (sel == 0 && KEYPRESS(BN_A))) {
+ if(KEYPRESS(BN_START)) {
change_screen(find_screen("game"));
return;
}
+ if(KEYPRESS(BN_A)) {
+ switch(sel) {
+ case MENU_START:
+ change_screen(find_screen("game"));
+ return;
+ case MENU_CTRL:
+ change_screen(find_screen("controls"));
+ return;
+ default:
+ break;
+ }
+ }
+
if(KEYPRESS(BN_DOWN) && sel <= NUM_MENU_ITEMS) {
cur_x = pos[++sel][0] - CUR_XOFFS;
cur_y = pos[sel][1];