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