Tetris

Tetris ported from OpenBSD. More...

Files

file  input.c
file  input.h
file  scores.c
file  scores.h
file  screen.c
file  screen.h
file  shapes.c
file  tetris.c
file  tetris.h

Data Structures

struct  highscore
struct  shape
struct  winsize_t

Defines

#define A_FIRST   1
#define A_LAST   21
#define B_COLS   12
#define B_ROWS   23
#define B_SIZE   (B_ROWS * B_COLS)
#define BC   B_COLS
#define BL   (B_COLS - 1)
#define BR   (B_COLS + 1)
#define CTOD(x)   ((x) * 2 + (((Cols - 2 * B_COLS) >> 1) - 1))
#define D_FIRST   1
#define D_LAST   22
#define EXPIRATION   (5L * 365 * 24 * 60 * 60)
#define faster()   (fallrate -= fallrate / 3000)
#define MAXHISCORES   10
#define MAXLEVEL   9
#define MAXLOGNAME   16
#define MAXSCORES   9
#define MINCOLS   40
#define MINLEVEL   1
#define MINROWS   23
#define ML   -1
#define MR   1
#define NLEVELS   (MAXLEVEL + 1)
#define NUMSPOTS   (MAXHISCORES + 1)
#define PRE_PENALTY   0.75
#define putpad(s)   tputs(s, 1, put)
#define RTOD(x)   ((x) - 1)
#define STOP   (B_COLS - 3)
#define TC   (-B_COLS)
#define TL   (-B_COLS - 1)
#define TR   (-B_COLS + 1)
#define TV_POS(tv)   ((tv)->tv_sec > 0 || ((tv)->tv_sec == 0 && (tv)->tv_usec > 0))
#define TV_SUB(res, sub)

Typedefs

typedef uint32_t cell

Functions

void clear_screen (void)
static void copyhiscore (int dest, int src)
 Copy from hiscore table score with index src to dest.
static void elide (void)
int fits_in (const struct shape *shape, int pos)
static bool get_display_color_sup (void)
static int get_display_size (winsize_t *ws)
void initscores (void)
void insertscore (int score, int level)
int loadscores (void)
int main (int argc, char *argv[])
 Main entry point.
void moveto (sysarg_t r, sysarg_t c)
void place (const struct shape *shape, int pos, int onoff)
static void putstr (const char *s)
static struct shaperandshape (void)
static void resume_normal (void)
int rwait (struct timeval *tvp)
void savescores (void)
void scr_clear (void)
void scr_end (void)
void scr_init (void)
void scr_msg (char *s, bool set)
void scr_set (void)
void scr_update (void)
static void setup_board (void)
void showscores (int firstgame)
static void srandomdev (void)
static void start_standout (uint32_t color)
void stop (const char *why)
static int tetris_menu (int *level)
static void tetris_menu_draw (int level)
int tgetchar (void)
void tsleep (void)
static void usage (void)

Variables

cell board [B_SIZE]
cell board [B_SIZE]
int classic
int classic
int Cols
int Cols
static const char copyright []
static int curscore
static cell curscreen [B_SIZE]
shapecurshape
shapecurshape
long fallrate
long fallrate
static int firstgame = 1
static aid_t getchar_inprog = 0
static int isset
char key_msg [100]
char key_msg [100]
static char lastchar = '\0'
static struct shapelastshape
shapenextshape
shapenextshape
int Rows
int Rows
int score
int score
static struct highscore scores [NUMSPOTS]
shape shapes []
shape shapes []
int showpreview
int showpreview
static bool use_color
winsize_t winsize
winsize_t winsize

Detailed Description

Tetris ported from OpenBSD.


Function Documentation

int main ( int  argc,
char *  argv[] 
)

Main entry point.

Returns:
Zero on success, non-zero on error.

Definition at line 236 of file tetris.c.


Generated on Thu Jun 2 07:45:57 2011 for HelenOS/USB by  doxygen 1.4.7