Subversion Repositories HelenOS

Rev

Rev 2787 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2787 Rev 4692
Line 53... Line 53...
53
 * columns of rows 21 and 22.  Rows 0 and 22 exist as boundary areas
53
 * columns of rows 21 and 22.  Rows 0 and 22 exist as boundary areas
54
 * so that regions `outside' the visible area can be examined without
54
 * so that regions `outside' the visible area can be examined without
55
 * worrying about addressing problems.
55
 * worrying about addressing problems.
56
 */
56
 */
57
 
57
 
58
    /* the board */
58
/* The board */
59
#define B_COLS  12
59
#define B_COLS  12
60
#define B_ROWS  23
60
#define B_ROWS  23
61
#define B_SIZE  (B_ROWS * B_COLS)
61
#define B_SIZE  (B_ROWS * B_COLS)
62
 
62
 
63
typedef unsigned char cell;
63
typedef uint32_t cell;
-
 
64
 
64
extern cell board[B_SIZE];  /* 1 => occupied, 0 => empty */
65
extern cell board[B_SIZE];  /* 1 => occupied, 0 => empty */
65
 
66
 
66
    /* the displayed area (rows) */
67
/* The displayed area (rows) */
67
#define D_FIRST 1
68
#define D_FIRST  1
68
#define D_LAST  22
69
#define D_LAST   22
69
 
70
 
70
    /* the active area (rows) */
71
/* The active area (rows) */
71
#define A_FIRST 1
72
#define A_FIRST  1
72
#define A_LAST  21
73
#define A_LAST   21
73
 
74
 
74
/*
75
/*
75
 * Minimum display size.
76
 * Minimum display size.
76
 */
77
 */
77
#define MINROWS 23
78
#define MINROWS  23
78
#define MINCOLS 40
79
#define MINCOLS  40
79
 
80
 
80
extern int  Rows, Cols; /* current screen size */
81
/* Current screen size */
-
 
82
extern int Rows;
-
 
83
extern int Cols;
81
 
84
 
82
/*
85
/*
83
 * Translations from board coordinates to display coordinates.
86
 * Translations from board coordinates to display coordinates.
84
 * As with board coordinates, display coordiates are zero origin.
87
 * As with board coordinates, display coordiates are zero origin.
85
 */
88
 */
Line 129... Line 132...
129
 */
132
 */
130
struct shape {
133
struct shape {
131
    int rot;    /* index of rotated version of this shape */
134
    int rot;     /* index of rotated version of this shape */
132
    int rotc;   /* -- " -- in classic version  */
135
    int rotc;    /* -- " -- in classic version  */
133
    int off[3]; /* offsets to other blots if center is at (0,0) */
136
    int off[3];  /* offsets to other blots if center is at (0,0) */
-
 
137
    uint32_t color;
134
};
138
};
135
 
139
 
136
extern const struct shape shapes[];
140
extern const struct shape shapes[];
137
 
141
 
138
extern const struct shape *curshape;
142
extern const struct shape *curshape;
Line 147... Line 151...
147
 * depending on its current value, via the `faster' macro below.
151
 * depending on its current value, via the `faster' macro below.
148
 * The value eventually reaches a limit, and things stop going faster,
152
 * The value eventually reaches a limit, and things stop going faster,
149
 * but by then the game is utterly impossible.
153
 * but by then the game is utterly impossible.
150
 */
154
 */
151
extern long fallrate;   /* less than 1 million; smaller => faster */
155
extern long fallrate;  /* less than 1 million; smaller => faster */
-
 
156
 
152
#define faster() (fallrate -= fallrate / 3000)
157
#define faster()  (fallrate -= fallrate / 3000)
153
 
158
 
154
/*
159
/*
155
 * Game level must be between 1 and 9.  This controls the initial fall rate
160
 * Game level must be between 1 and 9.  This controls the initial fall rate
156
 * and affects scoring.
161
 * and affects scoring.
Line 170... Line 175...
170
 *
175
 *
171
 * If previewing has been turned on, the score is multiplied by PRE_PENALTY.
176
 * If previewing has been turned on, the score is multiplied by PRE_PENALTY.
172
 */
177
 */
173
#define PRE_PENALTY 0.75
178
#define PRE_PENALTY  0.75
174
 
179
 
175
extern int  score;      /* the obvious thing */
180
extern int score;  /* The obvious thing */
176
//extern gid_t  gid, egid;
-
 
177
 
181
 
178
extern char key_msg[100];
182
extern char key_msg[100];
179
extern int  showpreview;
183
extern int showpreview;
180
extern int  classic;
184
extern int classic;
181
 
185
 
182
int fits_in(const struct shape *, int);
186
extern int fits_in(const struct shape *, int);
183
void    place(const struct shape *, int, int);
187
extern void place(const struct shape *, int, int);
184
void    stop(char *);
188
extern void stop(char *);
185
 
189
 
186
/** @}
190
/** @}
187
 */
191
 */
188
 
-