billr@saab.CNA.TEK.COM (Bill Randle) (12/22/90)
Submitted-by: Rich Burridge <rburridge@sun.COM> Posting-number: Volume 12, Issue 12 Archive-name: reve/Patch4c Patch-To: reve: Volume 11, Issue 52-58 Environment: SunView, XView, X11R4, termcap #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 3 (of 4)." # Contents: patches04c # Wrapped by billr@saab on Fri Dec 21 11:35:54 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'patches04c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'patches04c'\" else echo shar: Extracting \"'patches04c'\" \(37317 characters\) sed "s/^X//" >'patches04c' <<'END_OF_FILE' X X------- color.h ------- X*** /tmp/da06825 Tue Dec 18 10:08:17 1990 X--- color.h Tue Dec 11 18:19:51 1990 X*************** X*** 22,45 **** X * (see README file), then an attempt will be made to fix them. X */ X X! #define OTH_COLOR "othcolor" X! #define OTH_COLORSIZE 8 X X #define C_WHITE 0 X! #define C_LGREY 1 X! #define C_LBROWN 2 X! #define C_BEIGE 3 X! #define C_DBROWN 4 X! #define C_BLACK 5 X! #define C_SPARE6 6 X! #define C_SPARE7 7 X! X! #define oth_colorsetup(r, g, b) \ X! (r)[C_WHITE] = 255 ; (g)[C_WHITE] = 255 ; (b)[C_WHITE] = 255 ; \ X! (r)[C_LGREY] = 200 ; (g)[C_LGREY] = 200 ; (b)[C_LGREY] = 200 ; \ X! (r)[C_LBROWN] = 200 ; (g)[C_LBROWN] = 150 ; (b)[C_LBROWN] = 100 ; \ X! (r)[C_BEIGE] = 255 ; (g)[C_BEIGE] = 240 ; (b)[C_BEIGE] = 220 ; \ X! (r)[C_DBROWN] = 185 ; (g)[C_DBROWN] = 145 ; (b)[C_DBROWN] = 100 ; \ X! (r)[C_BLACK] = 0 ; (g)[C_BLACK] = 0 ; (b)[C_BLACK] = 0 ; \ X! (r)[C_SPARE6] = 0 ; (g)[C_SPARE6] = 0 ; (b)[C_SPARE6] = 0 ; \ X! (r)[C_SPARE7] = 0 ; (g)[C_SPARE7] = 0 ; (b)[C_SPARE7] = 0 ; X--- 22,45 ---- X * (see README file), then an attempt will be made to fix them. X */ X X! #define REVE_COLOR "revecolor" X! #define REVE_COLORSIZE 8 X X #define C_WHITE 0 X! #define C_BLACK 1 X! #define C_PANEL 2 X! #define C_SQUARE 3 X! #define C_BORDER 4 X! #define C_GRID 5 X! #define C_TEXT 6 X! #define C_ITEMS 7 X! X! #define reve_colorsetup(r, g, b) \ X! (r)[C_WHITE] = 255 ; (g)[C_WHITE] = 255 ; (b)[C_WHITE] = 255 ; \ X! (r)[C_BLACK] = 0 ; (g)[C_BLACK] = 0 ; (b)[C_BLACK] = 0 ; \ X! (r)[C_PANEL] = 255 ; (g)[C_PANEL] = 240 ; (b)[C_PANEL] = 220 ; \ X! (r)[C_SQUARE] = 200 ; (g)[C_SQUARE] = 150 ; (b)[C_SQUARE] = 100 ; \ X! (r)[C_BORDER] = 185 ; (g)[C_BORDER] = 145 ; (b)[C_BORDER] = 100 ; \ X! (r)[C_GRID] = 200 ; (g)[C_GRID] = 200 ; (b)[C_GRID] = 200 ; \ X! (r)[C_TEXT] = 0 ; (g)[C_TEXT] = 0 ; (b)[C_TEXT] = 0 ; \ X! (r)[C_ITEMS] = 200 ; (g)[C_ITEMS] = 200 ; (b)[C_ITEMS] = 200 ; X X------- extern.h ------- X*** /tmp/da06828 Tue Dec 18 10:08:18 1990 X--- extern.h Sun Dec 16 10:53:55 1990 X*************** X*** 32,37 **** X--- 32,41 ---- X extern int cury ; /* Current mouse Y position. */ X extern int down ; /* Indicates is a mouse button is down. */ X extern int first_move ; /* Set if computer plays first move. */ X+ extern int help_height ; /* Height of the help window. */ X+ extern int help_showing ; /* If set, the help window is visible. */ X+ extern int help_width ; /* Width of the help window. */ X+ extern int hfont_height ; /* Height in pixels for help font. */ X extern int iconic ; /* Start as an icon if set. */ X extern int inv_video ; /* Set if displaying in inverse video. */ X extern int iscolor[] ; /* Set if this is a color screen. */ X*************** X*** 51,56 **** X--- 55,61 ---- X extern int nextc ; /* Current event identifier. */ X extern int next_player ; /* Next player (BLACK or WHITE) to move. */ X extern int nfont_height ; /* Height in pixels for normal font. */ X+ extern int old_diffval ; /* Old difficulty value (possibly restored). */ X extern int piece_x ; /* Current X position of moving piece. */ X extern int piece_y ; /* Current Y position of moving piece */ X extern int play_computer ; /* Set if playing against the computer. */ X*************** X*** 75,80 **** X--- 80,94 ---- X extern int wx ; /* Initial X position of the window. */ X extern int wy ; /* Initial Y position of the window. */ X X+ extern FILE *hfp ; /* File descriptor for online help file. */ X+ X+ extern long help_offsets[] ; /* Offsets into the reve help file. */ X+ X+ extern char *colstr[] ; /* X resource color values. */ X+ extern int rcols[] ; /* Red colormap values. */ X+ extern int gcols[] ; /* Green colormap values. */ X+ extern int bcols[] ; /* Blue colormap values. */ X+ X extern time_t timeleft ; /* Amount of time left for computer moves. */ X extern long edges[] ; /* Edges Stability Table */ X extern long note ; /* Note value for current computer move. */ X*************** X*** 84,89 **** X--- 98,104 ---- X extern char edgefile[] ; /* Location of the reve edge table file. */ X extern char gamefile[] ; /* Name of file for load/save. */ X extern char geometry[MAXDPY][MAXLINE] ; /* X11 geometry information. */ X+ extern char helpfile[] ; /* Location of the reve online help file. */ X extern char line[] ; X extern char *notes_values[] ; /* Values for cyclic notes button. */ X extern char *player_values[] ; /* Values for cyclic black/white item. */ X X------- reve.h ------- X*** /tmp/da06831 Tue Dec 18 10:08:19 1990 X--- reve.h Sun Dec 16 02:37:24 1990 X*************** X*** 63,68 **** X--- 63,69 ---- X #define BGAP 10 /* Width of the gap between buttons. */ X #define BHEIGHT 32 /* Height of a reve button item. */ X #define BWIDTH 64 /* Width of a reve button item. */ X+ #define CGAP 4 /* Size of the gap for a cycle item. */ X #define CHEIGHT 20 /* Height of a reve cycle item. */ X #define CHOICEGAP 5 /* Gap between choices in a choice item. */ X #define CWIDTH 32 /* Width of a reve cycle item. */ X*************** X*** 103,111 **** X--- 104,115 ---- X #define LINEFEED 13 X #define RETURN 10 X X+ #define CTL(n) n - 96 /* Control characters. */ X #define ESCAPE 27 /* ASCII escape character. */ X #define EQUAL(a, b) !strncmp(a, b, strlen(b)) X #define FOR_BOARD(i) for (i = 0; i < 64; i++) X+ #define HELP_COLS 80 /* Number of columns in help window. */ X+ #define HELP_ROWS 60 /* Number of rows in help window. */ X #define ICONHEIGHT 64 /* Height in pixels for reve icon. */ X #define ICONWIDTH 64 /* Width in pixels of reve icon. */ X #define INC argc-- ; argv++ ; X*************** X*** 117,130 **** X #define MAXCURSORS 3 /* Maximum number of cursor types. */ X #define MAXDIFF 9 /* Number of levels of difficulty. */ X #define MAXDPY 2 /* Maximum possible number of displays. */ X! #define MAXFONTS 2 /* Maximum number of font types. */ X #define MAXIMAGES 11 /* Maximum number of image types. */ X! #define MAXITEMS 24 /* Number of different panel items. */ X X #ifndef MAXLINE X! #define MAXLINE 80 /* Length of character strings. */ X #endif /*!MAXLINE*/ X X #define MAX_PROFMAX 60 /* Maximum search depth. */ X #define NIVEAUMAX 25 /* Maximum possible depth. */ X X--- 121,135 ---- X #define MAXCURSORS 3 /* Maximum number of cursor types. */ X #define MAXDIFF 9 /* Number of levels of difficulty. */ X #define MAXDPY 2 /* Maximum possible number of displays. */ X! #define MAXFONTS 3 /* Maximum number of font types. */ X #define MAXIMAGES 11 /* Maximum number of image types. */ X! #define MAXITEMS 29 /* Number of different panel items. */ X X #ifndef MAXLINE X! #define MAXLINE 120 /* Length of character strings. */ X #endif /*!MAXLINE*/ X X+ #define MAXPAGES 10 /* Maximum number of pages in reve help file. */ X #define MAX_PROFMAX 60 /* Maximum search depth. */ X #define NIVEAUMAX 25 /* Maximum possible depth. */ X X*************** X*** 150,155 **** X--- 155,163 ---- X #define PROPS_WIDTH ((NOBUTS*BWIDTH) + ((NOBUTS-1)*BGAP) + (2*BBORDER)) X #define PSIZE 40 /* Diameter of playing piece. */ X X+ #define B_COLOR(c) (iscolor[(int) cur_dpyno] ? c : C_BLACK) X+ #define W_COLOR(c) (iscolor[(int) cur_dpyno] ? c : C_WHITE) X+ X #define TICKHEIGHT 16 /* Height of the tick toggle box. */ X #define TICKWIDTH 16 /* Width of the tick toggle box. */ X X*************** X*** 157,162 **** X--- 165,174 ---- X #define EDGENAME "reve.edgetable" X #endif /*!EDGENAME*/ X X+ #ifndef HELPNAME X+ #define HELPNAME "reve.help" X+ #endif /*!HELPNAME*/ X+ X #ifndef INT_SIGNAL X #define SIGRET void X #else X*************** X*** 191,197 **** X #define KEYBOARD 109 /* Keyboard character has been pressed. */ X #define MOUSE_MOVING 110 /* Mouse is moving. */ X #define PROPS_REPAINT 111 /* Property window needs repainting. */ X! #define IGNORE_EVENT 112 /* No interest in this event. */ X X /* Batch, last move, locking or show all direction (ON or OFF). */ X enum bltype { IS_OFF, IS_ON } ; X--- 203,210 ---- X #define KEYBOARD 109 /* Keyboard character has been pressed. */ X #define MOUSE_MOVING 110 /* Mouse is moving. */ X #define PROPS_REPAINT 111 /* Property window needs repainting. */ X! #define HELP_REPAINT 112 /* Help window needs repainting. */ X! #define IGNORE_EVENT 113 /* No interest in this event. */ X X /* Batch, last move, locking or show all direction (ON or OFF). */ X enum bltype { IS_OFF, IS_ON } ; X*************** X*** 207,213 **** X X enum dpy_type { DPY1, DPY2 } ; /* Possible dpy types. */ X X! enum font_type { NFONT, BFONT } ; /* Text font definitions. */ X X enum gr_type { GSUNVIEW, GTTY, GX11, GXVIEW } ; /* Graphical systems. */ X X--- 220,226 ---- X X enum dpy_type { DPY1, DPY2 } ; /* Possible dpy types. */ X X! enum font_type { BFONT, HFONT, NFONT} ; /* Text font definitions. */ X X enum gr_type { GSUNVIEW, GTTY, GX11, GXVIEW } ; /* Graphical systems. */ X X*************** X*** 223,237 **** X enum move_type { M_BEST, M_MOVE, M_PROFMAX, M_SUGGESTION, M_TIME } ; X X /* Different panel items. */ X! enum panel_type { LOAD_BUT, MOVES_BUT, NEW_GAME_BUT, SAVE_BUT, X! SUGGEST_BUT, UNDO_BUT, PROPS_BUT, CANCEL_BUT, X QUIT_BUT, BLACK_PLAYS, WHITE_PLAYS, PANEL_MES, X EVAL_MES, SCORE_MES, TURN_MES, COMP_CHOICE, X DIFF_CHOICE, MAX_DEPTH, OPT_ANIM, OPT_BEST, X! OPT_LAST, OPT_EVAL, OPT_NUM, OPT_FLIP } ; X X enum res_type { R_ANIMATE, R_BESTMOVE, R_DIFFICULTY, R_LAST, /* Resources. */ X! R_LOG, R_NOTES, R_NUMBER, R_QUICK } ; X X enum set_type { INCREMENT, DECREMENT, NONE } ; /* Cycle directions. */ X X--- 236,254 ---- X enum move_type { M_BEST, M_MOVE, M_PROFMAX, M_SUGGESTION, M_TIME } ; X X /* Different panel items. */ X! enum panel_type { LOAD_BUT, MOVES_BUT, NEW_GAME_BUT, HELP_BUT, X! REDO_BUT, PROPS_BUT, SAVE_BUT, SUGGEST_BUT, X! EDIT_BUT, STOP_BUT, UNDO_BUT, CANCEL_BUT, X QUIT_BUT, BLACK_PLAYS, WHITE_PLAYS, PANEL_MES, X EVAL_MES, SCORE_MES, TURN_MES, COMP_CHOICE, X DIFF_CHOICE, MAX_DEPTH, OPT_ANIM, OPT_BEST, X! OPT_LAST, OPT_EVAL, OPT_NUM, OPT_FLIP, X! HELP_PAGE } ; X X enum res_type { R_ANIMATE, R_BESTMOVE, R_DIFFICULTY, R_LAST, /* Resources. */ X! R_LOG, R_NOTES, R_NUMBER, R_QUICK, X! R_PANELC, R_BOARDC, R_BOARDBC, R_GRIDC, X! R_TEXTC, R_ITEMC, R_PROPS, R_HELP } ; X X enum set_type { INCREMENT, DECREMENT, NONE } ; /* Cycle directions. */ X X*************** X*** 239,247 **** X X enum playtype { PLAY_BLACK, PLAY_WHITE } ; /* What the computer is playing. */ X X! enum win_type { W_MAIN, W_PROPS } ; /* Window types. */ X X! extern char *getenv() ; X extern void exit() ; X X typedef struct { X--- 256,264 ---- X X enum playtype { PLAY_BLACK, PLAY_WHITE } ; /* What the computer is playing. */ X X! enum win_type { W_MAIN, W_HELP, W_PROPS } ; /* Window types. */ X X! extern char *getenv(), *malloc() ; X extern void exit() ; X X typedef struct { X*************** X*** 288,305 **** X int depth ; X } ; X X char *getenv(), *index() ; X char *get_resource() ; X X void animate_move(), batch(), check_button_down() ; X void check_choice_down(), check_cycle_down(), check_item_down() ; X! void check_item_up(), check_toggle_down(), close_frame() ; X! void color_area() ; X void computer_move(), computer_plays(), connect_to_reve() ; X! void create_menu(), destroy_frame() ; X! void do_action(), do_computer_move(), do_cycle_key() ; X! void do_key_move(), do_move(), do_props() ; X! void do_selection(), do_suggest(), domove() ; X void done(), draw_button(), draw_choice() ; X void draw_cycle(), draw_cycle_item(), draw_image() ; X void draw_line(), draw_outline(), draw_piece() ; X--- 305,325 ---- X int depth ; X } ; X X+ FILE *find_file() ; X+ X char *getenv(), *index() ; X char *get_resource() ; X X void animate_move(), batch(), check_button_down() ; X void check_choice_down(), check_cycle_down(), check_item_down() ; X! void check_item_up(), check_toggle_down(), color_area() ; X void computer_move(), computer_plays(), connect_to_reve() ; X! void create_menu(), destroy_frame(), display_help() ; X! void do_action() ; X! void do_computer_move(), do_edit(), do_help() ; X! void do_key(), do_key_move(), do_move() ; X! void do_props(), do_selection() ; X! void do_stop(), do_suggest(), domove() ; X void done(), draw_button(), draw_choice() ; X void draw_cycle(), draw_cycle_item(), draw_image() ; X void draw_line(), draw_outline(), draw_piece() ; X*************** X*** 309,329 **** X void get_options(), get_xy(), getparam() ; X void handle_board_event(), handle_event(), handle_item() ; X void handle_key(), init_canvas(), init_edge_table() ; X! void init_fonts(), initboard(), initialise() ; X! void load_colors(), load_game() ; X! void load_resources(), lock_screen() ; X! void make_canvas(), make_frame(), make_icon() ; X void make_message(), make_move(), make_panel() ; X void message(), nap_upto(), new_game() ; X! void open_frame(), paint_prop_sheet(), position_popup() ; X! void process_event(), quit() ; X! void read_resources(), remove_textfield(), reset_time() ; X void save_game(), set_computer(), set_cursor() ; X void set_cycle(), set_display_types(), set_eval() ; X! void set_option(), set_score(), set_timer() ; X void set_turn(), show_all(), show_all_moves() ; X void show_best(), show_last(), show_number() ; X! void show_suggestion(), start_tool() ; X! void suggest(), think(), undo() ; X void update_board_image(), usage(), who_wins() ; X void write_to_reve() ; X--- 329,352 ---- X void get_options(), get_xy(), getparam() ; X void handle_board_event(), handle_event(), handle_item() ; X void handle_key(), init_canvas(), init_edge_table() ; X! void init_help_file(), init_fonts(), initboard() ; X! void initialise(), load_colors(), load_game() ; X! void load_resources(), lock_screen(), make_canvas() ; X! void make_frame(), make_help_window(), make_icon() ; X void make_message(), make_move(), make_panel() ; X void message(), nap_upto(), new_game() ; X! void paint_help(), paint_help_text(), paint_prop_sheet() ; X! void position_popup() ; X! void process_event(), quit(), read_resources() ; X! void read_str(), redo(), redo_move() ; X! void remove_textfield(), reset_time() ; X void save_game(), set_computer(), set_cursor() ; X void set_cycle(), set_display_types(), set_eval() ; X! void set_frame(), set_option() ; X! void set_score(), set_timer() ; X void set_turn(), show_all(), show_all_moves() ; X void show_best(), show_last(), show_number() ; X! void show_suggestion(), start_tool(), suggest() ; X! void think(), undo(), undo_move() ; X void update_board_image(), usage(), who_wins() ; X void write_to_reve() ; X X------- Imakefile ------- X*** /tmp/da06834 Tue Dec 18 10:08:19 1990 X--- Imakefile Wed Dec 12 16:22:49 1990 X*************** X*** 58,64 **** X X /* Compilation flags and standard macro definitions. */ X X! SYS_LIBRARIES = $(XLIB) X CDEFS = $(NOSELECT) $(NO_USLEEP) $(EDGENAME) $(SELTYPE) \ X $(SIGRET) X DEFINES = $(CDEFS) -DX11 X--- 58,65 ---- X X /* Compilation flags and standard macro definitions. */ X X! X11LIBS = $(XLIB) X! TTYLIBS = -ltermcap X CDEFS = $(NOSELECT) $(NO_USLEEP) $(EDGENAME) $(SELTYPE) \ X $(SIGRET) X DEFINES = $(CDEFS) -DX11 X*************** X*** 72,85 **** X EDGENAME = -DEDGENAME=\"$(EDGENAMEFILE)\" X X X! SRCS = boardstuff.c events.c items.c makemove.c main.c \ X! procs.c rev_eval.c rev_ip.c rev_iycp.c x11.c X! OBJS = boardstuff.o events.o items.o makemove.o main.o \ X! procs.o rev_eval.o rev_ip.o rev_iycp.o x11.o X X! ComplexProgramTarget(reve) X MakeDirectories(install,$(USRLIBDIR)$(PATHSEP)reve) X InstallNonExec($(ETABLE),$(USRLIBDIR)$(PATHSEP)reve) X X install:: install.man X X--- 73,99 ---- X EDGENAME = -DEDGENAME=\"$(EDGENAMEFILE)\" X X X! REVESRCS = rev_eval.c rev_ip.c rev_iycp.c X! STDSRCS = boardstuff.c events.c makemove.c main.c procs.c X! REVEOBJS = rev_eval.o rev_ip.o rev_iycp.o X! STDOBJS = boardstuff.o events.o makemove.o main.o procs.o X X! SRCS1 = $(STDSRCS) $(REVESRCS) common.c items.c x11.c X! OBJS1 = $(STDOBJS) $(REVEOBJS) common.o items.o x11.o X! SRCS2 = $(STDSRCS) $(REVESRCS) common.c items.c tty.c X! OBJS2 = $(STDOBJS) $(REVEOBJS) common.o items.o tty.o X! X! X! PROGRAMS = reve X! X! ComplexProgramTarget_1(reve, $(X11LIBS), /**/) X MakeDirectories(install,$(USRLIBDIR)$(PATHSEP)reve) X InstallNonExec($(ETABLE),$(USRLIBDIR)$(PATHSEP)reve) X+ X+ tty: tty_reve X+ -cp tty_reve reve X+ X+ NormalProgramTarget(tty_reve, $(OBJS2), /**/, /**/, $(TTYLIBS)) X X install:: install.man X X X------- reve_proc.c ------- X*** /tmp/da06837 Tue Dec 18 10:08:20 1990 X--- reve_proc.c Sun Dec 16 11:09:45 1990 X*************** X*** 31,36 **** X--- 31,38 ---- X X int saveres = 0 ; /* If set, save computer results to log file. */ X X+ char edgefile[MAXLINE] ; /* Location of the reve edge table file. */ X+ X /* REVE global variables */ X X int damier[NIVEAUMAX][64] ; /* Boards at different depth level */ X X------- common.c ------- X*** /tmp/da06840 Tue Dec 18 10:08:21 1990 X--- common.c Sun Dec 16 11:01:07 1990 X*************** X*** 25,43 **** X #include "reve.h" X #include "extern.h" X X! void X! init_edge_table(edgefile) /* Load reve edge table values. */ X! char *edgefile ; X { X! char buf[MAXLINE], *getenv(), name[MAXLINE], *paths, *ptr ; X! int i, line ; X FILE *fp = NULL ; X X! i = 0 ; X! if ((fp = fopen(edgefile, "r")) == NULL) X { X paths = getenv("PATH") ; X! if ((ptr = paths) && edgefile[0] != '/') X for (;;) X if (*ptr == ':' || *ptr == 0) X { X--- 25,42 ---- X #include "reve.h" X #include "extern.h" X X! FILE * X! find_file(filename) X! char *filename ; X { X! char name[MAXLINE], *paths, *ptr ; X! int i = 0 ; X FILE *fp = NULL ; X X! if ((fp = fopen(filename, "r")) == NULL) X { X paths = getenv("PATH") ; X! if ((ptr = paths) && filename[0] != '/') X for (;;) X if (*ptr == ':' || *ptr == 0) X { X*************** X*** 52,59 **** X } X else name[i++] = *ptr++ ; X } X X! if (fp == NULL) X { X FPRINTF(stderr, "Cannot open Edge Stability Table file\n") ; X exit(1) ; X--- 51,69 ---- X } X else name[i++] = *ptr++ ; X } X+ return(fp) ; X+ } X+ X+ X+ void X+ init_edge_table(edgefile) /* Load reve edge table values. */ X+ char *edgefile ; X+ { X+ char buf[MAXLINE], *ptr ; X+ int i, line ; X+ FILE *fp = NULL ; X X! if ((fp = find_file(edgefile)) == NULL) X { X FPRINTF(stderr, "Cannot open Edge Stability Table file\n") ; X exit(1) ; X X------- boardstuff.c ------- X*** /tmp/da06843 Tue Dec 18 10:08:21 1990 X--- boardstuff.c Tue Dec 11 19:53:46 1990 X*************** X*** 235,242 **** X { X int color, x, y ; X X! if (iscolor[(int) cur_dpyno]) color = (state == IS_ON) ? C_BLACK : C_LBROWN ; X! else color = (state == IS_ON) ? C_BLACK : C_WHITE ; X X x = (move & 7) * CELL_SIZE + BBORDER ; X y = (move >> 3) * CELL_SIZE + BBORDER ; X--- 235,242 ---- X { X int color, x, y ; X X! if (state == IS_ON) color = C_BLACK ; X! else color = W_COLOR(C_SQUARE) ; X X x = (move & 7) * CELL_SIZE + BBORDER ; X y = (move >> 3) * CELL_SIZE + BBORDER ; X*************** X*** 513,519 **** X show_all(state) X enum bltype state ; X { X! int color, d, i, x, y ; X X d = (int) cur_dpyno ; X batch(IS_ON) ; X--- 513,519 ---- X show_all(state) X enum bltype state ; X { X! int d, i, x, y ; X X d = (int) cur_dpyno ; X batch(IS_ON) ; X*************** X*** 547,554 **** X s_all.square[i] = FREE ; X x = (i & 7) * CELL_SIZE + BBORDER + 1 ; X y = (i >> 3) * CELL_SIZE + BBORDER + 1 ; X! color = (iscolor[d]) ? C_LBROWN : C_WHITE ; X! color_area(W_MAIN, x, CY + y, CELL_SIZE - 2, CELL_SIZE - 2, color) ; X } X } X batch(IS_OFF) ; X--- 547,554 ---- X s_all.square[i] = FREE ; X x = (i & 7) * CELL_SIZE + BBORDER + 1 ; X y = (i >> 3) * CELL_SIZE + BBORDER + 1 ; X! color_area(W_MAIN, x, CY + y, X! CELL_SIZE - 2, CELL_SIZE - 2, W_COLOR(C_SQUARE)) ; X } X } X batch(IS_OFF) ; X*************** X*** 602,608 **** X else if (board.square[move] == WHITE) X color = (state == IS_ON) ? C_BLACK : C_WHITE ; X else if (iscolor[(int) cur_dpyno]) X! color = (state == IS_ON) ? C_BLACK : C_LBROWN ; X else X color = (state == IS_ON) ? C_BLACK : C_WHITE ; X X--- 602,608 ---- X else if (board.square[move] == WHITE) X color = (state == IS_ON) ? C_BLACK : C_WHITE ; X else if (iscolor[(int) cur_dpyno]) X! color = (state == IS_ON) ? C_BLACK : C_SQUARE ; X else X color = (state == IS_ON) ? C_BLACK : C_WHITE ; X X*************** X*** 627,638 **** X if (suggestion != -1) X { X rop = RCLR ; X- color = (iscolor[(int) cur_dpyno]) ? C_LBROWN : C_WHITE ; X if (iscolor[(int) cur_dpyno]) rop = RSRC ; X draw_line(W_MAIN, suggest_x-5, CY+suggest_y-5, X! suggest_x+5, CY+suggest_y+5, rop, color) ; X draw_line(W_MAIN, suggest_x-5, CY+suggest_y+5, X! suggest_x+5, CY+suggest_y-5, rop, color) ; X suggestion = -1 ; X } X } X--- 627,637 ---- X if (suggestion != -1) X { X rop = RCLR ; X if (iscolor[(int) cur_dpyno]) rop = RSRC ; X draw_line(W_MAIN, suggest_x-5, CY+suggest_y-5, X! suggest_x+5, CY+suggest_y+5, rop, W_COLOR(C_SQUARE)) ; X draw_line(W_MAIN, suggest_x-5, CY+suggest_y+5, X! suggest_x+5, CY+suggest_y-5, rop, W_COLOR(C_SQUARE)) ; X suggestion = -1 ; X } X } X X------- events.c ------- X*** /tmp/da06846 Tue Dec 18 10:08:22 1990 X--- events.c Sun Dec 16 02:47:52 1990 X*************** X*** 37,42 **** X--- 37,45 ---- X n = (int) item ; X if (items[n].x == -1) return ; X if (items[n].wtype != curwin) return ; X+ if (tinput && (n == (int) SUGGEST_BUT || n == (int) EDIT_BUT || X+ n == (int) STOP_BUT || n == (int) UNDO_BUT)) X+ return ; X if ((curx > items[n].x) && (curx < (items[n].x + items[n].width)) && X (cury > items[n].y) && (cury < (items[n].y + items[n].height))) X { X*************** X*** 43,49 **** X down = nextc ; X itemno = n ; X but_inverted = itemno ; X! draw_button(W_MAIN, (enum panel_type) itemno, C_LGREY, BUT_INVERT) ; X } X } X X--- 46,52 ---- X down = nextc ; X itemno = n ; X but_inverted = itemno ; X! draw_button(W_MAIN, (enum panel_type) itemno, C_ITEMS, BUT_INVERT) ; X } X } X X*************** X*** 81,87 **** X direction = INCREMENT ; X down = nextc ; X itemno = n ; X! draw_cycle(curwin, (enum panel_type) n, C_LGREY, CY_LINVERT) ; X } X else if ((curx > ix) && (curx < (ix + CWIDTH)) && X (cury > items[n].y) && (cury < (items[n].y + CHEIGHT)) && X--- 84,90 ---- X direction = INCREMENT ; X down = nextc ; X itemno = n ; X! draw_cycle(curwin, (enum panel_type) n, C_ITEMS, CY_LINVERT) ; X } X else if ((curx > ix) && (curx < (ix + CWIDTH)) && X (cury > items[n].y) && (cury < (items[n].y + CHEIGHT)) && X*************** X*** 90,96 **** X direction = DECREMENT ; X down = nextc ; X itemno = n ; X! draw_cycle(curwin, (enum panel_type) n, C_LGREY, CY_RINVERT) ; X } X } X X--- 93,99 ---- X direction = DECREMENT ; X down = nextc ; X itemno = n ; X! draw_cycle(curwin, (enum panel_type) n, C_ITEMS, CY_RINVERT) ; X } X } X X*************** X*** 118,126 **** X void X check_item_up() X { X- int color, d ; X- X- d = (int) cur_dpyno ; X if ((nextc == LEFT_UP && down == LEFT_DOWN) || X (nextc == MIDDLE_UP && down == MIDDLE_DOWN) || X (nextc == RIGHT_UP && down == RIGHT_DOWN)) X--- 121,126 ---- X*************** X*** 133,151 **** X case P_BUTTON : if (items[itemno].x != -1) X draw_button(items[itemno].wtype, X (enum panel_type) itemno, X! C_LGREY, BUT_NORMAL) ; X break ; X! case P_CHOICE : color = (iscolor[d]) ? C_BEIGE : C_WHITE ; X! draw_choice(items[itemno].wtype, X! (enum panel_type) itemno, color) ; X break ; X case P_CYCLE : draw_cycle(items[itemno].wtype, X (enum panel_type) itemno, X! C_LGREY, CY_NORMAL) ; X break ; X! case P_TOGGLE : color = (iscolor[d]) ? C_BEIGE : C_WHITE ; X! draw_toggle(items[itemno].wtype, X! (enum panel_type) itemno, color) ; X } X } X } X--- 133,151 ---- X case P_BUTTON : if (items[itemno].x != -1) X draw_button(items[itemno].wtype, X (enum panel_type) itemno, X! W_COLOR(C_ITEMS), BUT_NORMAL) ; X break ; X! case P_CHOICE : draw_choice(items[itemno].wtype, X! (enum panel_type) itemno, X! W_COLOR(C_PANEL)) ; X break ; X case P_CYCLE : draw_cycle(items[itemno].wtype, X (enum panel_type) itemno, X! W_COLOR(C_ITEMS), CY_NORMAL) ; X break ; X! case P_TOGGLE : draw_toggle(items[itemno].wtype, X! (enum panel_type) itemno, X! W_COLOR(C_PANEL)) ; X } X } X } X*************** X*** 218,236 **** X X X void X! do_cycle_key(item, ch) X! enum panel_type item ; X! int ch ; X { X! int color, d, maxw, val ; X X! d = (int) cur_dpyno ; X! color = (iscolor[d]) ? C_BEIGE : C_WHITE ; X if (!validkey) X { X validkey = cur_ch ; X! if (item == OPT_EVAL) message(PANEL_MES, "Notes?") ; X! else message(PANEL_MES, items[(int) item].label) ; X } X else X { X--- 218,240 ---- X X X void X! do_key(item, ch) X! int item, ch ; X { X! int color, maxw, val ; X X! color = W_COLOR(C_PANEL) ; X if (!validkey) X { X validkey = cur_ch ; X! switch (item) X! { X! case 'C' : message(PANEL_MES, items[(int) COMP_CHOICE].label) ; X! break ; X! case 'D' : message(PANEL_MES, items[(int) DIFF_CHOICE].label) ; X! break ; X! case 'O' : message(PANEL_MES, "Option?") ; X! } X } X else X { X*************** X*** 237,290 **** X val = -1 ; X switch (item) X { X! case COMP_CHOICE : switch (ch) X! { X! case 'a' : /* All (both). */ X! case 'A' : val = CP_BOTH ; X! break ; X! case 'b' : /* Black. */ X! case 'B' : val = CP_BLACK ; X! break ; X! case 'n' : /* Neither. */ X! case 'N' : val = CP_NEITHER ; X! break ; X! case 'w' : /* White. */ X! case 'W' : val = CP_WHITE ; X! break ; X! default : return ; X! } X! maxw = items[(int) item].width / X! items[(int) item].nopts ; X! curx = items[(int) item].x + (maxw * val) ; X! itemno = (int) item ; X! items[(int) item].value = val ; X! draw_choice(W_PROPS, item, color) ; X! break ; X! case DIFF_CHOICE : if (ch >= '1' && ch <= '9') val = ch - '1' ; X! items[(int) item].value = val ; X! draw_choice(W_PROPS, item, color) ; X! break ; X! case OPT_EVAL : color = (iscolor[d]) ? C_BEIGE : C_WHITE ; X! switch (ch) X! { X! case 'n' : X! case 'N' : val = 0 ; X! break ; X! case 'y' : X! case 'Y' : val = 1 ; X! break ; X! default : return ; X! } X! items[(int) item].value = val ; X! draw_toggle(W_PROPS, OPT_EVAL, color) ; X } X if (val != -1) X { X validkey = 0 ; X message(PANEL_MES, "") ; X! items[(int) item].value = item_value = val ; X direction = NONE ; X! (*items[(int) item].func)() ; X } X } X } X--- 241,315 ---- X val = -1 ; X switch (item) X { X! case 'C' : itemno = (int) COMP_CHOICE ; X! switch (ch) X! { X! case 'a' : /* All (both). */ X! case 'A' : val = CP_BOTH ; X! break ; X! case 'b' : /* Black. */ X! case 'B' : val = CP_BLACK ; X! break ; X! case 'n' : /* Neither. */ X! case 'N' : val = CP_NEITHER ; X! break ; X! case 'w' : /* White. */ X! case 'W' : val = CP_WHITE ; X! break ; X! default : return ; X! } X! maxw = items[itemno].width / items[itemno].nopts ; X! curx = items[itemno].x + (maxw * val) ; X! items[itemno].value = val ; X! break ; X! X! case 'D' : itemno = (int) DIFF_CHOICE ; X! if (ch >= '1' && ch <= '9') val = ch - '1' ; X! maxw = items[itemno].width / items[itemno].nopts ; X! curx = items[itemno].x + (maxw * val) ; X! items[itemno].value = val ; X! break ; X! X! case 'O' : switch (ch) X! { X! case 'a' : X! case 'A' : itemno = (int) OPT_ANIM ; X! break ; X! case 'b' : X! case 'B' : itemno = (int) OPT_BEST ; X! break ; X! case 'l' : X! case 'L' : itemno = (int) OPT_LAST ; X! break ; X! case 'e' : X! case 'E' : itemno = (int) OPT_EVAL ; X! break ; X! case 'n' : X! case 'N' : itemno = (int) OPT_NUM ; X! break ; X! case 'f' : X! case 'F' : itemno = (int) OPT_FLIP ; X! break ; X! default : return ; X! } X! val = items[itemno].value ; X } X if (val != -1) X { X validkey = 0 ; X message(PANEL_MES, "") ; X! items[itemno].value = item_value = val ; X direction = NONE ; X! (*items[itemno].func)() ; X! X! switch (item) X! { X! case 'C' : draw_choice(W_PROPS, (enum panel_type) itemno, color) ; X! break ; X! case 'D' : draw_choice(W_PROPS, (enum panel_type) itemno, color) ; X! break ; X! case 'O' : draw_toggle(W_PROPS, (enum panel_type) itemno, color) ; X! } X } X } X } X*************** X*** 342,352 **** X process_event() ; X X if (nextc == FRAME_REPAINT) init_canvas() ; X else if (nextc == PROPS_REPAINT) paint_prop_sheet() ; X else if (nextc == KEYBOARD) handle_key() ; X else if (nextc == EXIT_WINDOW && but_inverted != -1) X { X! draw_button(W_MAIN, (enum panel_type) but_inverted, C_LGREY, BUT_NORMAL) ; X but_inverted = -1 ; X down = 0 ; X } X--- 367,378 ---- X process_event() ; X X if (nextc == FRAME_REPAINT) init_canvas() ; X+ else if (nextc == HELP_REPAINT) paint_help() ; X else if (nextc == PROPS_REPAINT) paint_prop_sheet() ; X else if (nextc == KEYBOARD) handle_key() ; X else if (nextc == EXIT_WINDOW && but_inverted != -1) X { X! draw_button(W_MAIN, (enum panel_type) but_inverted, C_ITEMS, BUT_NORMAL) ; X but_inverted = -1 ; X down = 0 ; X } X*************** X*** 388,400 **** X } X switch (cur_ch) X { X! case 'C' : do_cycle_key(COMP_CHOICE, nextc) ; /* Cycle items. */ X break ; X- case 'D' : do_cycle_key(DIFF_CHOICE, nextc) ; X- break ; X- case 'N' : do_cycle_key(OPT_EVAL, nextc) ; X- break ; X X case 'M' : show_all_moves() ; /* Button items. */ X break ; X case 'L' : curx = 0 ; X--- 414,426 ---- X } X switch (cur_ch) X { X! case 'C' : /* Computer choice. */ X! case 'D' : /* Difficulty. */ X! case 'O' : do_key(cur_ch, nextc) ; /* Options. */ X break ; X X+ case 'H' : do_help() ; X+ break ; X case 'M' : show_all_moves() ; /* Button items. */ X break ; X case 'L' : curx = 0 ; X*************** X*** 402,407 **** X--- 428,435 ---- X break ; X case 'n' : new_game() ; X break ; X+ case 'r' : redo() ; X+ break ; X case 'S' : curx = BBORDER + (2*(BWIDTH+BGAP)) ; X draw_textfield() ; X break ; X*************** X*** 411,416 **** X--- 439,448 ---- X break ; X case 'p' : do_props() ; X break ; X+ X+ case CTL('l') : init_canvas() ; X+ paint_prop_sheet() ; X+ break ; X X case 'q' : destroy_frame() ; X exit(0) ; X END_OF_FILE if test 37317 -ne `wc -c <'patches04c'`; then echo shar: \"'patches04c'\" unpacked with wrong size! fi # end of 'patches04c' fi echo shar: End of archive 3 \(of 4\). cp /dev/null ark3isdone MISSING="" for I in 1 2 3 4 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 4 archives. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0