X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/f8df8c0281a2b93b58f947c4bc167c998f05e804..da6a856c31649c6fc011d45d51542876e1b13539:/tetris/tetris.h?ds=sidebyside diff --git a/tetris/tetris.h b/tetris/tetris.h index d3aebd2c..8e1479f1 100644 --- a/tetris/tetris.h +++ b/tetris/tetris.h @@ -1,4 +1,4 @@ -/* $NetBSD: tetris.h,v 1.5 1999/01/03 17:13:51 hubertf Exp $ */ +/* $NetBSD: tetris.h,v 1.16 2020/07/21 02:42:05 nia Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -15,11 +15,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,6 +34,8 @@ * @(#)tetris.h 8.1 (Berkeley) 5/31/93 */ +#include + /* * Definitions for Tetris. */ @@ -58,7 +56,7 @@ #define B_SIZE (B_ROWS * B_COLS) typedef unsigned char cell; -cell board[B_SIZE]; /* 1 => occupied, 0 => empty */ +extern cell board[B_SIZE]; /* 1 => occupied, 0 => empty */ /* the displayed area (rows) */ #define D_FIRST 1 @@ -74,7 +72,8 @@ cell board[B_SIZE]; /* 1 => occupied, 0 => empty */ #define MINROWS 23 #define MINCOLS 40 -int Rows, Cols; /* current screen size */ +extern int Rows, Cols; /* current screen size */ +extern int Offset; /* vert. offset to center board */ /* * Translations from board coordinates to display coordinates. @@ -125,15 +124,15 @@ int Rows, Cols; /* current screen size */ * rotated forms. */ struct shape { + int color; int rot; /* index of rotated version of this shape */ int off[3]; /* offsets to other blots if center is at (0,0) */ }; -extern struct shape shapes[]; -#define randshape() (&shapes[random() % 7]) +extern const struct shape shapes[]; +#define randshape() (&shapes[arc4random_uniform(7)]) -struct shape *curshape; -struct shape *nextshape; +extern const struct shape *nextshape; /* * Shapes fall at a rate faster than once per second. @@ -145,7 +144,7 @@ struct shape *nextshape; * The value eventually reaches a limit, and things stop going faster, * but by then the game is utterly impossible. */ -long fallrate; /* less than 1 million; smaller => faster */ +extern long fallrate; /* less than 1 million; smaller => faster */ #define faster() (fallrate -= fallrate / 3000) /* @@ -165,11 +164,13 @@ long fallrate; /* less than 1 million; smaller => faster */ * we find that it is at rest and integrate it---until then, it can * still be moved or rotated). */ -int score; /* the obvious thing */ +extern int score; /* the obvious thing */ +extern gid_t gid, egid; -char key_msg[100]; -int showpreview; +extern char key_msg[100]; +extern int showpreview; +extern int nocolor; -int fits_in __P((struct shape *, int)); -void place __P((struct shape *, int, int)); -void stop __P((char *)) __attribute__((__noreturn__)); +int fits_in(const struct shape *, int); +void place(const struct shape *, int, int); +void stop(const char *) __dead;