ChangeLog update
[tetrinet/clach04.git] / tetris.h
blob167ae845be81af5a163f347673a1ea2b68ff7770
1 /* Tetrinet for Linux, by Andrew Church <achurch@achurch.org>
2 * This program is public domain.
4 * Tetris constants and routine declarations.
5 */
7 #ifndef TETRIS_H
8 #define TETRIS_H
10 /*************************************************************************/
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 */
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 */
30 /*************************************************************************/
32 #define MAX_SPECIALS 64
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;
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;
53 PieceData piecedata[7][4];
55 extern int current_piece, current_rotation;
58 extern void init_shapes(void);
59 extern int get_shape(int piece, int rotation, char buf[4][4]);
61 extern void new_game(void);
63 extern void new_piece(void);
64 extern void step_down(void);
65 extern void do_special(const char *type, int from, int to);
67 extern int tetris_timeout(void);
68 extern void tetris_timeout_action(void);
69 extern void tetris_input(int c);
71 /*************************************************************************/
73 #endif /* TETRIS_H */