diff --git a/Makefile b/Makefile index 2a73628..16e9e7d 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,14 @@ TILES = player_stand_tile.inc \ player_walk2_tile.inc player_walk2_tile_reversed.inc \ grass_tile.inc dirt_tile.inc flag_tile.inc \ switch1_off_tile.inc switch1_on_tile.inc \ + switch2_off_tile.inc switch2_on_tile.inc \ + switch3_off_tile.inc switch3_on_tile.inc \ + switch4_off_tile.inc switch4_on_tile.inc \ + switch0_off_tile.inc switch0_on_tile.inc \ tile1_off_tile.inc tile1_on_tile.inc \ + tile2_off_tile.inc tile2_on_tile.inc \ + tile3_off_tile.inc tile3_on_tile.inc \ + tile4_off_tile.inc tile4_on_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 \ diff --git a/switch0_off_tile.txt b/switch0_off_tile.txt new file mode 100644 index 0000000..3a606f0 --- /dev/null +++ b/switch0_off_tile.txt @@ -0,0 +1,14 @@ +xSWITCH_SWITCH +tTEXT + BG +---------- + + xx + xx + xxxxxx + xx xx + xx xx + tt + tt t + t tt + tt diff --git a/switch0_on_tile.txt b/switch0_on_tile.txt new file mode 100644 index 0000000..8cc4598 --- /dev/null +++ b/switch0_on_tile.txt @@ -0,0 +1,14 @@ +xSWITCH_SWITCH +tTEXT + BG +---------- + + tt + tt t + t tt + tt + xx xx + xx xx + xxxxxx + xx + xx diff --git a/switch2_off_tile.txt b/switch2_off_tile.txt new file mode 100644 index 0000000..d4688f9 --- /dev/null +++ b/switch2_off_tile.txt @@ -0,0 +1,14 @@ +xSWITCH_SWITCH +tTEXT + BG +---------- + + xx + xx + xxxxxx + xx xx + xx xx + tt + t t + t + ttt diff --git a/switch2_on_tile.txt b/switch2_on_tile.txt new file mode 100644 index 0000000..13c789d --- /dev/null +++ b/switch2_on_tile.txt @@ -0,0 +1,14 @@ +xSWITCH_SWITCH +tTILE2 + BG +---------- + + tt + t t + t + ttt + xx xx + xx xx + xxxxxx + xx + xx diff --git a/switch3_off_tile.txt b/switch3_off_tile.txt new file mode 100644 index 0000000..a712c9c --- /dev/null +++ b/switch3_off_tile.txt @@ -0,0 +1,14 @@ +xSWITCH_SWITCH +tTEXT + BG +---------- + + xx + xx + xxxxxx + xx xx + xx xx + ttt + tt + t + ttt diff --git a/switch3_on_tile.txt b/switch3_on_tile.txt new file mode 100644 index 0000000..02139e0 --- /dev/null +++ b/switch3_on_tile.txt @@ -0,0 +1,14 @@ +xSWITCH_SWITCH +tTILE3 + BG +---------- + + ttt + tt + t + ttt + xx xx + xx xx + xxxxxx + xx + xx diff --git a/switch4_off_tile.txt b/switch4_off_tile.txt new file mode 100644 index 0000000..4b3beda --- /dev/null +++ b/switch4_off_tile.txt @@ -0,0 +1,14 @@ +xSWITCH_SWITCH +tTEXT + BG +---------- + + xx + xx + xxxxxx + xx xx + xx xx + t t + t t + tttt + t diff --git a/switch4_on_tile.txt b/switch4_on_tile.txt new file mode 100644 index 0000000..52649a1 --- /dev/null +++ b/switch4_on_tile.txt @@ -0,0 +1,14 @@ +xSWITCH_SWITCH +tTILE4 + BG +---------- + + t t + t t + tttt + t + xx xx + xx xx + xxxxxx + xx + xx diff --git a/switcher.c b/switcher.c index 2d3b1d7..c36b20c 100644 --- a/switcher.c +++ b/switcher.c @@ -34,6 +34,9 @@ enum palette { FLAG_FLAG, SWITCH_SWITCH, TILE1, + TILE2, + TILE3, + TILE4, STAR_STAR, }; static enum palette playfield[PLAYFIELD_SIDE * PLAYFIELD_SIDE]; @@ -47,10 +50,26 @@ static enum palette playfield[PLAYFIELD_SIDE * PLAYFIELD_SIDE]; #include "grass_tile.inc" #include "dirt_tile.inc" #include "flag_tile.inc" + #include "switch1_off_tile.inc" #include "switch1_on_tile.inc" +#include "switch2_off_tile.inc" +#include "switch2_on_tile.inc" +#include "switch3_off_tile.inc" +#include "switch3_on_tile.inc" +#include "switch4_off_tile.inc" +#include "switch4_on_tile.inc" +#include "switch0_off_tile.inc" +#include "switch0_on_tile.inc" + #include "tile1_off_tile.inc" #include "tile1_on_tile.inc" +#include "tile2_off_tile.inc" +#include "tile2_on_tile.inc" +#include "tile3_off_tile.inc" +#include "tile3_on_tile.inc" +#include "tile4_off_tile.inc" +#include "tile4_on_tile.inc" #include "stage1_tile.inc" #include "stage2_tile.inc" @@ -97,34 +116,34 @@ static char *stages[] = { "ggg gg", " " " " + "B N" + "2222222222" + " 1 " " " + "1 " " " + "@A1 !" + "g1 gg", + " d " + " d N " + " d " + " d g " + " d " + "Adg ggg" + " 1 !" + " g g" + " gd gd" + "ggggddggdd", + " !" + " D 4" + "C 3 44" + "3 3 4 " + " B" + " 222 2 2" " " - " " - " " - " " - " " - " ", - " " - " " - " " - " " - " " - " " - " " - " " - " " - " ", - " " - " " - " " - " " - " " - " " - " " - " " - " " - " ", + " A 1 111" + "@g " + "gd ", " " " " " " @@ -157,7 +176,7 @@ static char *stages[] = { " ", }; -enum switches_state { ALL_OFF, SWITCH1 }; +enum switches_state { ALL_OFF, SWITCH1, SWITCH2, SWITCH3, SWITCH4 }; enum switches_state switches_state; static uint32_t main_window = 0; @@ -250,8 +269,12 @@ static char sample_tilemap(size_t x, size_t y) { static bool solid_tile(size_t x, size_t y) { char tile = sample_tilemap(x, y); - return tile != ' ' && tile != '!' && tile != '@' && tile != 'A' && - (tile != '1' || switches_state == SWITCH1); + return tile != ' ' && tile != '!' && tile != '@' && + tile != 'A' && (tile != '1' || switches_state == SWITCH1) && + tile != 'B' && (tile != '2' || switches_state == SWITCH2) && + tile != 'C' && (tile != '3' || switches_state == SWITCH3) && + tile != 'D' && (tile != '4' || switches_state == SWITCH4) && + tile != 'N'; } static bool jumping = false; @@ -431,6 +454,17 @@ static void update_stage(struct timespec now, struct timespec dt_timespec) { case 'A': switches_state = SWITCH1; break; + case 'B': + switches_state = SWITCH2; + break; + case 'C': + switches_state = SWITCH3; + break; + case 'D': + switches_state = SWITCH4; + break; + case 'N': + switches_state = ALL_OFF; } } @@ -484,7 +518,14 @@ static void draw_tiles(void) { case 'd': tile = dirt_tile; break; case '!': tile = flag_tile; break; case 'A': tile = switches_state == SWITCH1 ? switch1_on_tile : switch1_off_tile; break; + case 'B': tile = switches_state == SWITCH2 ? switch2_on_tile : switch2_off_tile; break; + case 'C': tile = switches_state == SWITCH3 ? switch3_on_tile : switch3_off_tile; break; + case 'D': tile = switches_state == SWITCH4 ? switch4_on_tile : switch4_off_tile; break; + case 'N': tile = switches_state == ALL_OFF ? switch0_on_tile : switch0_off_tile; break; case '1': tile = switches_state == SWITCH1 ? tile1_on_tile : tile1_off_tile; break; + case '2': tile = switches_state == SWITCH2 ? tile2_on_tile : tile2_off_tile; break; + case '3': tile = switches_state == SWITCH3 ? tile3_on_tile : tile3_off_tile; break; + case '4': tile = switches_state == SWITCH4 ? tile4_on_tile : tile4_off_tile; break; } if (tile) draw_tile(tile, tx * TILE_SIDE, ty * TILE_SIDE); @@ -594,6 +635,9 @@ int main(int argc, char *argv[]) { [FLAG_FLAG] = make_color(255, 0, 0), [SWITCH_SWITCH] = make_color(200, 64, 0), [TILE1] = make_color(0, 255, 0), + [TILE2] = make_color(0, 0, 255), + [TILE3] = make_color(255, 0, 0), + [TILE4] = make_color(255, 255, 0), [STAR_STAR] = make_color(255, 255, 0), }; diff --git a/tile2_off_tile.txt b/tile2_off_tile.txt new file mode 100644 index 0000000..f23a6bb --- /dev/null +++ b/tile2_off_tile.txt @@ -0,0 +1,14 @@ +xTILE2 +tTEXT + BG +---------- + x x x x + x +x + tt x +x t t + t x +x ttt + x +x + x x x x diff --git a/tile2_on_tile.txt b/tile2_on_tile.txt new file mode 100644 index 0000000..86c8891 --- /dev/null +++ b/tile2_on_tile.txt @@ -0,0 +1,14 @@ +xTILE2 +tTEXT + BG +---------- + xxxxxxxx +xxxxxxxxxx +xxxxxxxxxx +xxxxttxxxx +xxxtxxtxxx +xxxxxtxxxx +xxxxtttxxx +xxxxxxxxxx +xxxxxxxxxx + xxxxxxxx diff --git a/tile3_off_tile.txt b/tile3_off_tile.txt new file mode 100644 index 0000000..265f846 --- /dev/null +++ b/tile3_off_tile.txt @@ -0,0 +1,14 @@ +xTILE3 +tTEXT + BG +---------- + x x x x + x +x + ttt x +x tt + t x +x ttt + x +x + x x x x diff --git a/tile3_on_tile.txt b/tile3_on_tile.txt new file mode 100644 index 0000000..8141595 --- /dev/null +++ b/tile3_on_tile.txt @@ -0,0 +1,15 @@ +xTILE3 +tTEXT + TILE3 +.BG +---------- +.x x x x . + x +x + ttt x +x tt + t x +x ttt + x +x +. x x x x. diff --git a/tile4_off_tile.txt b/tile4_off_tile.txt new file mode 100644 index 0000000..214c680 --- /dev/null +++ b/tile4_off_tile.txt @@ -0,0 +1,14 @@ +xTILE4 +tTEXT + BG +---------- + x x x x + x +x + t t x +x t t + tttt x +x t + x +x + x x x x diff --git a/tile4_on_tile.txt b/tile4_on_tile.txt new file mode 100644 index 0000000..19067a0 --- /dev/null +++ b/tile4_on_tile.txt @@ -0,0 +1,15 @@ +xTILE4 +tTEXT +.BG + TILE4 +---------- +.x x x x . + x +x + t t x +x t t + tttt x +x t + x +x +. x x x x.