1 /* Tetrinet for Linux, by Andrew Church <achurch@achurch.org> 2 * This program is public domain. 3 * 4 * Tetris constants and routine declarations. 5 */ 6 7 #ifndef TETRIS_H 8 #define TETRIS_H 9 10 /*************************************************************************/ 11 12 #define PIECE_BAR 0 /* Straight bar */ 13 #define PIECE_SQUARE 1 /* Square block */ 14 #define PIECE_L_REVERSE 2 /* Reversed L block */ 15 #define PIECE_L 3 /* L block */ 16 #define PIECE_Z 4 /* Z block */ 17 #define PIECE_S 5 /* S block */ 18 #define PIECE_T 6 /* T block */ 19 20 #define SPECIAL_A 0 /* Add line */ 21 #define SPECIAL_C 1 /* Clear line */ 22 #define SPECIAL_N 2 /* Nuke field */ 23 #define SPECIAL_R 3 /* Clear random blocks */ 24 #define SPECIAL_S 4 /* Switch fields */ 25 #define SPECIAL_B 5 /* Clear special blocks */ 26 #define SPECIAL_G 6 /* Block gravity */ 27 #define SPECIAL_Q 7 /* Blockquake */ 28 #define SPECIAL_O 8 /* Block bomb */ 29 30 /*************************************************************************/ 31 32 #define MAX_SPECIALS 64 33 34 extern int piecefreq[7], specialfreq[9]; 35 extern int old_mode; 36 extern int initial_level, lines_per_level, level_inc, level_average; 37 extern int special_lines, special_count, special_capacity; 38 extern Field fields[6]; 39 extern int levels[6]; 40 extern int lines; 41 extern char specials[MAX_SPECIALS]; 42 extern int next_piece; 43 extern int current_x, current_y; 44 45 46 typedef struct { 47 int hot_x, hot_y; /* Hotspot coordinates */ 48 int top, left; /* Top-left coordinates relative to hotspot */ 49 int bottom, right; /* Bottom-right coordinates relative to hotspot */ 50 char shape[4][4]; /* Shape data for the piece */ 51 } PieceData; 52 53 extern PieceData piecedata[7][4]; 54 55 extern int current_piece, current_rotation; 56 57 58 extern void init_shapes(void); 59 extern int get_shape(int piece, int rotation, char buf[4][4]); 60 61 extern void new_game(void); 62 63 extern void new_piece(void); 64 extern void step_down(void); 65 extern void do_special(const char *type, int from, int to); 66 67 extern int tetris_timeout(void); 68 extern void tetris_timeout_action(void); 69 extern void tetris_input(int c); 70 71 /*************************************************************************/ 72 73 #endif /* TETRIS_H */ 74