#include #include #include #include #include #include #include #include #include #include #include /* #include */ #define UWIDTH 10 /* canvas size in units */ #define UHEIGHT 20 #define UNIT 28 /* pixels in a unit */ #define SHADOW_OFFSET UNIT #define SHADOW_HEIGHT (UNIT+SHADOW_OFFSET) /* shadow area height in * pixels */ #define NEXT_HEIGHT (UNIT*5) /* Height for next block */ #define HIGH_TABLE_SIZE 15 /* size of high score table */ #define LOW_SCORES 5 /* number of high scores that are really low scores */ #ifndef HIGH_SCORE_TABLE # define HIGH_SCORE_TABLE "/usr2/mark/src/autotetris/autoTetrisScores" #endif #define ITIMER_NULL ((struct itimerval *)0) #define NO_COLS 16 #define RED 1 #define ORANGE 2 #define YELLOW 3 #define GREEN 4 #define BLUE 5 #define CYAN 6 #define VIOLET 7 #define WHITE 9 #define GRAY 10 #define BLACK 11 #define CLR (color ? (PIX_SRC | PIX_COLOR(WHITE)): PIX_SRC ) #define OP (color ? (PIX_SRC | PIX_COLOR(col)): PIX_SRC ) Frame mainframe, score_frame; Panel panel, score_panel; Canvas canvas; Pixwin *pw; Panel_item high_score_item[HIGH_TABLE_SIZE], score_item, level_item, rows_item, game_over, time_item, seed_item, high_score_label_item, rowElimItem, rowElimProgressItem, holesItem; Server_image pr; int end_of_game, score_position; int display_shape_no, display_xpos, display_ypos, display_rot, score, rows; int next_no, next_rot; char *name; unsigned char displaygrid[UWIDTH][UHEIGHT]; #define MYVERSION 5 struct aux_score_table { int version; int seed; int RowElimWeight; int MaxFlatWeight; int VariationWeight; int HolesWeight; int GameOverWeight; int FissureWeight; int ExposeHoleWeight; int RowElimProgressWeight; int MaxHeightWeight; int Seconds; int LookAheadWeight; } high_aux_scores[HIGH_TABLE_SIZE]; struct score_table { char name[BUFSIZ]; int score; int rows; int level; char hostname[BUFSIZ]; char date[BUFSIZ]; } high_scores[HIGH_TABLE_SIZE]; struct shape_table { int table[4][4]; int minX[4]; int maxX[4]; int width; int height; int offset; int pointv[4]; char color; int cycletop; } shape[7]; struct shape { int shape; int rot; int width; int height; int offset; int pointv; char color; int was_shown; int was_shadowed; } *current, *next; int my_client_object; Notify_client *me; char *about_string(); void print_high_scores(), done_proc(), quit_proc(), start_proc(), pause_proc(), restart_proc(), about_proc(), control_panel_proc(), adversary_panel_proc(); void canvas_event_proc(); Notify_value drop_block(), fast_proc(), real_fast_proc(), auto_restart_proc(); int instantdrop, autorestart, nodisplay, noscores, seed, explainholes, signalEndOfGame; int AdversaryEnabled, useSeed; int starttime, pausedtime; #define PWDEPTH(pw) ((pw)->pw_pixrect->pr_depth) struct bestPlay { int bestx, bestrot, bestscore; }; int color;