From 531ee88980febc77c9ba487c02143cce923ddbdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Sun, 16 Jan 2022 14:38:47 +0000 Subject: [PATCH] Add support for 8 levels --- Makefile | 4 ++- stage3_tile.txt | 13 +++++++++ stage4_tile.txt | 13 +++++++++ stage5_tile.txt | 13 +++++++++ stage6_tile.txt | 13 +++++++++ stage7_tile.txt | 13 +++++++++ stage8_tile.txt | 13 +++++++++ switcher.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++-- 8 files changed, 155 insertions(+), 3 deletions(-) create mode 100644 stage3_tile.txt create mode 100644 stage4_tile.txt create mode 100644 stage5_tile.txt create mode 100644 stage6_tile.txt create mode 100644 stage7_tile.txt create mode 100644 stage8_tile.txt diff --git a/Makefile b/Makefile index 085962b..2a73628 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,9 @@ TILES = player_stand_tile.inc \ grass_tile.inc dirt_tile.inc flag_tile.inc \ switch1_off_tile.inc switch1_on_tile.inc \ tile1_off_tile.inc tile1_on_tile.inc \ - stage1_tile.inc stage2_tile.inc star_tile.inc \ + stage1_tile.inc stage2_tile.inc stage3_tile.inc stage4_tile.inc \ + stage5_tile.inc stage6_tile.inc stage7_tile.inc stage8_tile.inc \ + star_tile.inc \ rebind_rebind1_tile.inc rebind_rebind2_tile.inc rebind_rebind3_tile.inc \ rebind_left1_tile.inc rebind_left2_tile.inc \ rebind_right1_tile.inc rebind_right2_tile.inc \ diff --git a/stage3_tile.txt b/stage3_tile.txt new file mode 100644 index 0000000..27f56c1 --- /dev/null +++ b/stage3_tile.txt @@ -0,0 +1,13 @@ +xTEXT +.BG +---------- +..xxxxxx.. +.xx....xx. +.......xx. +.......xx. +....xxxx.. +.......xx. +.......xx. +.......xx. +.xx....xx. +..xxxxxx.. diff --git a/stage4_tile.txt b/stage4_tile.txt new file mode 100644 index 0000000..1e4e203 --- /dev/null +++ b/stage4_tile.txt @@ -0,0 +1,13 @@ +xTEXT +.BG +---------- +....xx.xx. +...xx..xx. +..xx...xx. +.xx....xx. +.xxxxxxxx. +.......xx. +.......xx. +.......xx. +.......xx. +.......xx. diff --git a/stage5_tile.txt b/stage5_tile.txt new file mode 100644 index 0000000..920508c --- /dev/null +++ b/stage5_tile.txt @@ -0,0 +1,13 @@ +xTEXT +.BG +---------- +.xxxxxxxx. +.xx....... +.xx....... +.xx....... +.xxxxxx... +......xx.. +.......xx. +.......xx. +.xx...xx.. +..xxxxx... diff --git a/stage6_tile.txt b/stage6_tile.txt new file mode 100644 index 0000000..63ab3ac --- /dev/null +++ b/stage6_tile.txt @@ -0,0 +1,13 @@ +xTEXT +.BG +---------- +....xx.... +...xx..... +..xx...... +.xx....... +.xxxxxx... +.xx...xx.. +.xx....xx. +.xx....xx. +..xx..xx.. +...xxxx... diff --git a/stage7_tile.txt b/stage7_tile.txt new file mode 100644 index 0000000..a6496b3 --- /dev/null +++ b/stage7_tile.txt @@ -0,0 +1,13 @@ +xTEXT +.BG +---------- +.xxxxxxxx. +.......xx. +.......xx. +......xx.. +......xx.. +.....xx... +.....xx... +....xx.... +....xx.... +....xx.... diff --git a/stage8_tile.txt b/stage8_tile.txt new file mode 100644 index 0000000..2c0862c --- /dev/null +++ b/stage8_tile.txt @@ -0,0 +1,13 @@ +xTEXT +.BG +---------- +...xxxx... +..xx..xx.. +.xx....xx. +..xx..xx.. +...xxxx... +..xx..xx.. +.xx....xx. +.xx....xx. +..xx..xx.. +...xxxx... diff --git a/switcher.c b/switcher.c index 517931f..2d3b1d7 100644 --- a/switcher.c +++ b/switcher.c @@ -13,7 +13,7 @@ #include #include -#define STAGES 2 +#define STAGES 8 enum game_mode { TITLESCREEN, STAGE }; enum game_mode game_mode = TITLESCREEN; bool stages_beat[STAGES]; @@ -54,6 +54,12 @@ static enum palette playfield[PLAYFIELD_SIDE * PLAYFIELD_SIDE]; #include "stage1_tile.inc" #include "stage2_tile.inc" +#include "stage3_tile.inc" +#include "stage4_tile.inc" +#include "stage5_tile.inc" +#include "stage6_tile.inc" +#include "stage7_tile.inc" +#include "stage8_tile.inc" #include "star_tile.inc" #include "rebind_rebind1_tile.inc" @@ -88,7 +94,67 @@ static char *stages[] = { " A " " 11g " "@ !" - "ggg gg" + "ggg gg", + " " + " " + " " + " " + " " + " " + " " + " " + " " + " ", + " " + " " + " " + " " + " " + " " + " " + " " + " " + " ", + " " + " " + " " + " " + " " + " " + " " + " " + " " + " ", + " " + " " + " " + " " + " " + " " + " " + " " + " " + " ", + " " + " " + " " + " " + " " + " " + " " + " " + " " + " ", + " " + " " + " " + " " + " " + " " + " " + " " + " " + " ", }; enum switches_state { ALL_OFF, SWITCH1 }; @@ -450,6 +516,12 @@ static void draw_titlescreen(struct timespec now) { } draw_tile(stage1_tile, 1 * TILE_SIDE, TILE_SIDE); draw_tile(stage2_tile, 2 * TILE_SIDE, TILE_SIDE); + draw_tile(stage3_tile, 3 * TILE_SIDE, TILE_SIDE); + draw_tile(stage4_tile, 4 * TILE_SIDE, TILE_SIDE); + draw_tile(stage5_tile, 5 * TILE_SIDE, TILE_SIDE); + draw_tile(stage6_tile, 6 * TILE_SIDE, TILE_SIDE); + draw_tile(stage7_tile, 7 * TILE_SIDE, TILE_SIDE); + draw_tile(stage8_tile, 8 * TILE_SIDE, TILE_SIDE); size_t underline_y = 2 * TILE_SIDE + 1; size_t underline_x = selection_index * TILE_SIDE + TILE_SIDE + 2; for (size_t x = 0; x < TILE_SIDE - 4; x++)