File: tetris.h

package info (click to toggle)
tetrinet 0.11%2BCVS20070911-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 332 kB
  • sloc: ansic: 4,410; makefile: 41
file content (73 lines) | stat: -rw-r--r-- 2,142 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* Tetrinet for Linux, by Andrew Church <achurch@achurch.org>
 * This program is public domain.
 *
 * Tetris constants and routine declarations.
 */

#ifndef TETRIS_H
#define TETRIS_H

/*************************************************************************/

#define PIECE_BAR	0	/* Straight bar */
#define PIECE_SQUARE	1	/* Square block */
#define PIECE_L_REVERSE	2	/* Reversed L block */
#define PIECE_L		3	/* L block */
#define PIECE_Z		4	/* Z block */
#define PIECE_S		5	/* S block */
#define PIECE_T		6	/* T block */

#define SPECIAL_A	0	/* Add line */
#define SPECIAL_C	1	/* Clear line */
#define SPECIAL_N	2	/* Nuke field */
#define SPECIAL_R	3	/* Clear random blocks */
#define SPECIAL_S	4	/* Switch fields */
#define SPECIAL_B	5	/* Clear special blocks */
#define SPECIAL_G	6	/* Block gravity */
#define SPECIAL_Q	7	/* Blockquake */
#define SPECIAL_O	8	/* Block bomb */

/*************************************************************************/

#define MAX_SPECIALS	64

extern int piecefreq[7], specialfreq[9];
extern int old_mode;
extern int initial_level, lines_per_level, level_inc, level_average;
extern int special_lines, special_count, special_capacity;
extern Field fields[6];
extern int levels[6];
extern int lines;
extern signed char specials[MAX_SPECIALS];
extern int next_piece;
extern int current_x, current_y;


typedef struct {
    int hot_x, hot_y;	/* Hotspot coordinates */
    int top, left;	/* Top-left coordinates relative to hotspot */
    int bottom, right;	/* Bottom-right coordinates relative to hotspot */
    char shape[4][4];	/* Shape data for the piece */
} PieceData;

extern PieceData piecedata[7][4];

extern int current_piece, current_rotation;


extern void init_shapes(void);
extern int get_shape(int piece, int rotation, char buf[4][4]);

extern void new_game(void);

extern void new_piece(void);
extern void step_down(void);
extern void do_special(const char *type, int from, int to);

extern int tetris_timeout(void);
extern void tetris_timeout_action(void);
extern void tetris_input(int c);

/*************************************************************************/

#endif	/* TETRIS_H */