#include #include #include #include #include #include #include #define VUNIT 1 /* ver unit */ #define HUNIT 2 /* hor unit */ #define NORM_OFFSET 13 /* x offset for blocks */ #define NEXT_HEIGHT (VUNIT*5) /* height for next block */ jmp_buf rest; /* to restart the game */ #define BLUE 1 #define GREEN 2 #define CYAN 3 #define RED 4 #define PURPLE 5 #define YELLOW 6 #define WHITE 7 #define BLACK 8 int score_position; /* position of this game in the hiscore tab */ int shape_no; /* the dripping shape */ int xpos, ypos, rot; /* x, y, rotation of shape_no */ int score; /* score */ int lines; /* number of lines collapsed */ int level; /* current level */ int next; /* "show next" switch */ int next_no; /* next shape */ int next_rot; /* rotation of next shape */ char *name; /* username */ #define UWIDTH 12 #define UHEIGHT 22 unsigned char grid[UWIDTH][UHEIGHT]; struct shape_table { int table[5][4]; int pointv[4]; char color; } shape[27]; #define HIGH_SCORES_TABLE "/usr/local/share/games/pentix/pentix.res" #define QUOTATIONS_TABLE "/usr/local/share/games/pentix/pentix.qtn" #define HIGH_SCORES_TABLE_SIZE 16 #define MAXNAMELEN 8 #define MAXHOSTLEN 256 #define MAXDATELEN 14 struct score_table { char name[MAXNAMELEN+1]; int score; int lines; int level; char hostname[MAXHOSTLEN+1]; char date[MAXDATELEN+1]; } high_scores[HIGH_SCORES_TABLE_SIZE]; char quotations[50][BUFSIZ]; /* quotation pool */ int qcount; /* quotation count */ #define LEAP_LEVEL_DELAY 240 /* leap level delay in seconds */ /* main */ void initialise(void); void init_all(void); void init_curses(void); void exit_curses(void); void main_loop(void); void drop_block(void); int waituser(void); void end_game(void); void end_proc(void); void left_proc(void); void right_proc(void); void rot_proc(void); void fast_proc(void); void show_next(int on); void print_shape(int, int, int, int, int); void addbl(int, int, int); void scinsert(int); void scdelete(int); void scmove(int, int); /* shapes */ void define_shapes(void); void store_shape(int, int, int, int); void create_shape(void); /* misc */ int block_can_drop(int, int, int, int); int block_can_left(int, int, int, int); int block_can_right(int, int, int, int); int check_rot(int, int, int, int); void remove_full_lines(int); void update_highscore_table(void); void read_high_scores(void); void write_high_scores(void); void print_high_scores(void); void read_quotations(void); void print_quotation(void); void print_authors(void); void print_help(void); void setup_level(void); void show_score(int); int factorial(int); int usec_delta(int, int); extern char *ctime(); extern char *strncpy(char[], const char[], size_t); extern void bzero(void* , size_t); extern void srandom(unsigned long); extern long random(void); extern uid_t getuid(void); extern int atoi(const char[]); extern int isdigit(int);