From b2f86e20e052d9923523e29743172ea98266d28f Mon Sep 17 00:00:00 2001 From: Ian C Date: Tue, 25 Jun 2019 18:37:47 +0000 Subject: Added original Hardwire code. --- hardwire/piecemap.h | 222 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 222 insertions(+) create mode 100644 hardwire/piecemap.h (limited to 'hardwire/piecemap.h') diff --git a/hardwire/piecemap.h b/hardwire/piecemap.h new file mode 100644 index 0000000..1844663 --- /dev/null +++ b/hardwire/piecemap.h @@ -0,0 +1,222 @@ + +/* + Define TETRIS mode piece maps + + Object types : + + SPECIAL + CROSS + UPDOWN + ACROSS + LEFTDOWN + RIGHTDOWN + LEFTUP + RIGHTUP + BLANK + +*/ + +#define NO_TETRIS_PIECE 7 + +#define NO_PIECE_SET 11 + +#define TOP_PS 0 +#define BOT_PS 1 +#define LFT_PS 2 +#define RGT_PS 3 +#define L_R_PS 4 +#define U_D_PS 5 +#define CRS_PS 6 +#define L_U_PS 7 +#define L_D_PS 8 +#define R_U_PS 9 +#define R_D_PS 10 + +PieceSet piece_set[NO_PIECE_SET]= + { + { /* TOP_PS */ + 4, + {UPDOWN,CROSS,LEFTDOWN,RIGHTDOWN,BLANK} + }, + + { /* BOT_PS */ + 4, + {UPDOWN,CROSS,LEFTUP,RIGHTUP,BLANK} + }, + + { /* LFT_PS */ + 4, + {ACROSS,CROSS,RIGHTDOWN,RIGHTUP,BLANK} + }, + + { /* RGT_PS */ + 4, + {ACROSS,CROSS,LEFTDOWN,LEFTUP,BLANK} + }, + + { /* L_R_PS */ + 2, + {ACROSS,CROSS,BLANK,BLANK,BLANK} + }, + + { /* U_D_PS */ + 2, + {UPDOWN,CROSS,BLANK,BLANK,BLANK} + }, + + { /* CRS_PS */ + 1, + {CROSS,BLANK,BLANK,BLANK,BLANK} + }, + + { /* L_U_PS */ + 2, + {LEFTUP,CROSS,BLANK,BLANK,BLANK} + }, + + { /* L_D_PS */ + 2, + {LEFTDOWN,CROSS,BLANK,BLANK,BLANK} + }, + + { /* R_U_PS */ + 2, + {RIGHTUP,CROSS,BLANK,BLANK,BLANK} + }, + + { /* R_D_PS */ + 2, + {RIGHTDOWN,CROSS,BLANK,BLANK,BLANK} + } + }; + + +Piece tetris_map[NO_TETRIS_PIECE]= + { + { /* PIECE 1 - LONG */ + 0,0, + { + {BLANK, TOP_PS, BLANK, BLANK}, + {BLANK, U_D_PS, BLANK, BLANK}, + {BLANK, U_D_PS, BLANK, BLANK}, + {BLANK, BOT_PS, BLANK, BLANK}, + } + }, + { /* PIECE 2 - BOX */ + 0,0, + { + {CRS_PS, CRS_PS, BLANK, BLANK}, + {CRS_PS, CRS_PS, BLANK, BLANK}, + {BLANK, BLANK, BLANK, BLANK}, + {BLANK, BLANK, BLANK, BLANK}, + } + }, + { /* PIECE 3 - TEE */ + 0,0, + { + {BLANK, TOP_PS, BLANK, BLANK}, + {LFT_PS, CRS_PS, RGT_PS, BLANK}, + {BLANK, BLANK, BLANK, BLANK}, + {BLANK, BLANK, BLANK, BLANK}, + } + }, + { /* PIECE 4 - LEFT DOGLEG */ + 0,0, + { + {LFT_PS, L_D_PS, BLANK, BLANK}, + {BLANK, U_D_PS, BLANK, BLANK}, + {BLANK, U_D_PS, BLANK, BLANK}, + {BLANK, BLANK, BLANK, BLANK}, + } + }, + { /* PIECE 5 - RIGHT DOGLEG */ + 0,0, + { + {BLANK, R_D_PS, RGT_PS, BLANK}, + {BLANK, U_D_PS, BLANK, BLANK}, + {BLANK, U_D_PS, BLANK, BLANK}, + {BLANK, BLANK, BLANK, BLANK}, + } + }, + { /* PIECE 6 - LEFT S */ + 0,0, + { + {LFT_PS, L_D_PS, BLANK, BLANK}, + {BLANK, R_U_PS, RGT_PS, BLANK}, + {BLANK, BLANK, BLANK, BLANK}, + {BLANK, BLANK, BLANK, BLANK}, + } + }, + { /* PIECE 7 - RIGHT S */ + 0,0, + { + {BLANK, R_D_PS, RGT_PS, BLANK}, + {LFT_PS, L_U_PS, BLANK, BLANK}, + {BLANK, BLANK, BLANK, BLANK}, + {BLANK, BLANK, BLANK, BLANK}, + } + } + }; + + +struct + { + int x,y; + } tetris_off[NO_TETRIS_PIECE][4]= + { + { /* PIECE 1 - LONG */ + {1,1}, + {1,1}, + {2,1}, + {1,2} + }, + { /* PIECE 2 - BOX */ + {0,0}, + {2,0}, + {2,2}, + {0,2} + }, + { /* PIECE 3 - TEE */ + {1,1}, + {2,1}, + {2,2}, + {1,2} + }, + { /* PIECE 4 - LEFT DOGLEG */ + {1,1}, + {2,1}, + {2,2}, + {1,2} + }, + { /* PIECE 5 - RIGHT DOGLEG */ + {1,1}, + {2,1}, + {2,2}, + {1,2} + }, + { /* PIECE 6 - LEFT S */ + {1,1}, + {2,1}, + {2,2}, + {1,2} + }, + { /* PIECE 7 - RIGHT S */ + {1,1}, + {2,1}, + {2,2}, + {1,2} + } + }; + + + +int tetris_height[NO_TETRIS_PIECE]= + { + 4, /* PIECE 1 - LONG */ + 2, /* PIECE 2 - BOX */ + 2, /* PIECE 3 - TEE */ + 3, /* PIECE 4 - LEFT DOGLEG */ + 3, /* PIECE 5 - RIGHT DOGLEG */ + 2, /* PIECE 6 - LEFT S */ + 2 /* PIECE 7 - RIGHT S */ + }; -- cgit v1.2.3