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 4 of 4). Message-ID: <1990Dec17.232207.24447@sunaus.oz> Date: 17 Dec 90 23:22:07 GMT Organization: Sun Microsystems - Australia Lines: 1392 ------CUT HERE------patch 4 - part 4------CUT HERE------ ------- items.c ------- *** /tmp/da06882 Tue Dec 18 10:10:23 1990 --- items.c Mon Dec 17 10:24:06 1990 *************** *** 40,45 **** --- 40,46 ---- x = items[(int) item].x ; y = items[(int) item].y ; + if (x == -1 && y == -1) return ; if (iscolor[(int) cur_dpyno]) { draw_stencil(wtype, x, y, BWIDTH, BHEIGHT, RSRC, color, *************** *** 50,56 **** BUT_STENCIL, image) ; label = items[(int) item].text ; if (image == BUT_INVERT) color = C_WHITE ; ! else color = C_BLACK ; x += ((BWIDTH - get_strwidth(NFONT, label)) / 2) ; y += (nfont_height + (BHEIGHT - nfont_height) / 2) - 5 ; draw_text(wtype, x, y, NFONT, color, label) ; --- 51,57 ---- BUT_STENCIL, image) ; label = items[(int) item].text ; if (image == BUT_INVERT) color = C_WHITE ; ! else color = C_TEXT ; x += ((BWIDTH - get_strwidth(NFONT, label)) / 2) ; y += (nfont_height + (BHEIGHT - nfont_height) / 2) - 5 ; draw_text(wtype, x, y, NFONT, color, label) ; *************** *** 64,75 **** int color ; { char *str ; ! int height, i, maxw, val, width, x, xoff, y ; if (strlen(items[(int) item].label)) draw_text(items[(int) item].wtype, items[(int) item].lx, items[(int) item].ly + bfont_height, ! BFONT, C_BLACK, items[(int) item].label) ; maxw = 0 ; for (i = 0; i < items[(int) item].nopts; i++) --- 65,77 ---- int color ; { char *str ; ! int height, i, maxw, tcol, val, width, x, xoff, y ; + tcol = B_COLOR(C_TEXT) ; if (strlen(items[(int) item].label)) draw_text(items[(int) item].wtype, items[(int) item].lx, items[(int) item].ly + bfont_height, ! BFONT, tcol, items[(int) item].label) ; maxw = 0 ; for (i = 0; i < items[(int) item].nopts; i++) *************** *** 100,109 **** xoff = (maxw - val) / 2 ; draw_text(items[(int) item].wtype, x + (i * maxw) + xoff, ! y + nfont_height + (nfont_height / 2), NFONT, C_BLACK, str) ; } val = items[(int) item].value ; draw_rect(wtype, x + (val * maxw) + 1, y + 1, x + ((val + 1) * maxw) - 1, y + height - 1, RSRC, C_BLACK) ; --- 102,112 ---- xoff = (maxw - val) / 2 ; draw_text(items[(int) item].wtype, x + (i * maxw) + xoff, ! y + nfont_height + (nfont_height / 2), NFONT, tcol, str) ; } val = items[(int) item].value ; + if (val < 0 || val >= items[(int) item].nopts) return ; draw_rect(wtype, x + (val * maxw) + 1, y + 1, x + ((val + 1) * maxw) - 1, y + height - 1, RSRC, C_BLACK) ; *************** *** 140,152 **** enum image_type image ; { char val[4] ; if (strlen(items[(int) item].label)) draw_text(items[(int) item].wtype, items[(int) item].lx, items[(int) item].ly + bfont_height, ! BFONT, C_BLACK, items[(int) item].label) ; ! SPRINTF(val, "%d", items[(int) item].value) ; set_cycle(wtype, item, val) ; draw_cycle(wtype, item, color, image) ; } --- 143,158 ---- enum image_type image ; { char val[4] ; + int tcol ; + tcol = B_COLOR(C_TEXT) ; if (strlen(items[(int) item].label)) draw_text(items[(int) item].wtype, items[(int) item].lx, items[(int) item].ly + bfont_height, ! BFONT, tcol, items[(int) item].label) ; ! if (item == MAX_DEPTH && !items[(int) item].value) STRCPY(val, "off") ; ! else SPRINTF(val, "%d", items[(int) item].value) ; set_cycle(wtype, item, val) ; draw_cycle(wtype, item, color, image) ; } *************** *** 158,166 **** { int y ; ! color_area(W_MAIN, tx + 1, ty + 1, tw - 2, th - 2, C_WHITE) ; y = ty + (nfont_height + (th - nfont_height) / 2) - 5 ; ! draw_text(W_MAIN, tx + 5, y, NFONT, C_BLACK, str) ; draw_line(W_MAIN, tx + 5 + get_strwidth(NFONT, str), y + 5, tx + 5 + get_strwidth(NFONT, str), y + 5 - nfont_height, RSRC, C_BLACK) ; --- 164,172 ---- { int y ; ! color_area(W_MAIN, tx + 1, ty + 1, tw - 2, th - 2, W_COLOR(C_PANEL)) ; y = ty + (nfont_height + (th - nfont_height) / 2) - 5 ; ! draw_text(W_MAIN, tx + 5, y, NFONT, B_COLOR(C_TEXT), str) ; draw_line(W_MAIN, tx + 5 + get_strwidth(NFONT, str), y + 5, tx + 5 + get_strwidth(NFONT, str), y + 5 - nfont_height, RSRC, C_BLACK) ; *************** *** 174,185 **** int color ; { enum image_type image ; ! int x, y ; if (strlen(items[(int) item].label)) draw_text(items[(int) item].wtype, items[(int) item].lx, items[(int) item].ly + bfont_height, ! BFONT, C_BLACK, items[(int) item].label) ; if (items[(int) item].value) image = TOGGLE_ON ; else image = TOGGLE_OFF ; --- 180,192 ---- int color ; { enum image_type image ; ! int tcol, x, y ; + tcol = B_COLOR(C_TEXT) ; if (strlen(items[(int) item].label)) draw_text(items[(int) item].wtype, items[(int) item].lx, items[(int) item].ly + bfont_height, ! BFONT, tcol, items[(int) item].label) ; if (items[(int) item].value) image = TOGGLE_ON ; else image = TOGGLE_OFF ; *************** *** 199,205 **** draw_text(items[(int) item].wtype, items[(int) item].x + TICKWIDTH + 10, items[(int) item].y + nfont_height, ! NFONT, C_BLACK, items[(int) item].text) ; } --- 206,212 ---- draw_text(items[(int) item].wtype, items[(int) item].x + TICKWIDTH + 10, items[(int) item].y + nfont_height, ! NFONT, tcol, items[(int) item].text) ; } *************** *** 211,222 **** lsval = (curx < (BBORDER + (2*(BWIDTH+BGAP)))) ? 'l' : 's' ; x1 = BBORDER + BWIDTH + (BGAP / 2) ; y1 = BBORDER + BHEIGHT + (BGAP / 2) ; ! color_area(W_MAIN, x1, y1, 4 * (BWIDTH + BGAP), BHEIGHT + BGAP, C_WHITE) ; draw_rect(W_MAIN, x1, y1, x1 + (4 * (BWIDTH + BGAP)) - 1, y1 + BHEIGHT + BGAP - 1, RSRC, C_BLACK) ; draw_text(W_MAIN, BBORDER + BWIDTH + BGAP, BBORDER + BHEIGHT + BGAP + (nfont_height + (BHEIGHT - nfont_height) / 2) - 5, ! BFONT, C_BLACK, "File:") ; tx = BBORDER + BWIDTH + BGAP + (BWIDTH / 2) + 10 ; ty = BBORDER + BHEIGHT + BGAP ; tw = (BWIDTH / 2) - 10 + (2 * (BWIDTH + BGAP)) ; --- 218,230 ---- lsval = (curx < (BBORDER + (2*(BWIDTH+BGAP)))) ? 'l' : 's' ; x1 = BBORDER + BWIDTH + (BGAP / 2) ; y1 = BBORDER + BHEIGHT + (BGAP / 2) ; ! color_area(W_MAIN, x1, y1, ! 4 * (BWIDTH + BGAP), BHEIGHT + BGAP, W_COLOR(C_PANEL)) ; draw_rect(W_MAIN, x1, y1, x1 + (4 * (BWIDTH + BGAP)) - 1, y1 + BHEIGHT + BGAP - 1, RSRC, C_BLACK) ; draw_text(W_MAIN, BBORDER + BWIDTH + BGAP, BBORDER + BHEIGHT + BGAP + (nfont_height + (BHEIGHT - nfont_height) / 2) - 5, ! BFONT, B_COLOR(C_TEXT), "File:") ; tx = BBORDER + BWIDTH + BGAP + (BWIDTH / 2) + 10 ; ty = BBORDER + BHEIGHT + BGAP ; tw = (BWIDTH / 2) - 10 + (2 * (BWIDTH + BGAP)) ; *************** *** 227,233 **** tinput = 1 ; items[(int) CANCEL_BUT].x = BBORDER + (4*(BWIDTH+BGAP)) ; items[(int) CANCEL_BUT].y = BBORDER + (1*(BHEIGHT+BGAP)) ; ! draw_button(W_MAIN, CANCEL_BUT, C_LGREY, BUT_NORMAL) ; } --- 235,241 ---- tinput = 1 ; items[(int) CANCEL_BUT].x = BBORDER + (4*(BWIDTH+BGAP)) ; items[(int) CANCEL_BUT].y = BBORDER + (1*(BHEIGHT+BGAP)) ; ! draw_button(W_MAIN, CANCEL_BUT, C_ITEMS, BUT_NORMAL) ; } *************** *** 273,286 **** if (strlen(items[(int) item].label)) draw_text(items[(int) item].wtype, items[(int) item].lx, items[(int) item].ly + bfont_height, ! BFONT, C_BLACK, items[(int) item].label) ; message = items[(int) item].text ; x = items[(int) item].x ; y = items[(int) item].y ; ! color = (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE ; ! color_area(wtype, x, y, TOTAL_WIDTH, 15, color) ; ! draw_text(wtype, x, y + nfont_height, NFONT, C_BLACK, message) ; } --- 281,293 ---- if (strlen(items[(int) item].label)) draw_text(items[(int) item].wtype, items[(int) item].lx, items[(int) item].ly + bfont_height, ! BFONT, B_COLOR(C_TEXT), items[(int) item].label) ; message = items[(int) item].text ; x = items[(int) item].x ; y = items[(int) item].y ; ! color_area(wtype, x, y, TOTAL_WIDTH, 15, W_COLOR(C_PANEL)) ; ! draw_text(wtype, x, y + nfont_height, NFONT, B_COLOR(C_TEXT), message) ; } *************** *** 287,301 **** void make_panel() { ! draw_button(W_MAIN, LOAD_BUT, C_LGREY, BUT_NORMAL) ; ! draw_button(W_MAIN, MOVES_BUT, C_LGREY, BUT_NORMAL) ; ! draw_button(W_MAIN, NEW_GAME_BUT, C_LGREY, BUT_NORMAL) ; ! draw_button(W_MAIN, SAVE_BUT, C_LGREY, BUT_NORMAL) ; ! draw_button(W_MAIN, SUGGEST_BUT, C_LGREY, BUT_NORMAL) ; ! draw_button(W_MAIN, UNDO_BUT, C_LGREY, BUT_NORMAL) ; ! draw_button(W_MAIN, PROPS_BUT, C_LGREY, BUT_NORMAL) ; ! draw_button(W_MAIN, QUIT_BUT, C_LGREY, BUT_NORMAL) ; make_message(W_MAIN, BLACK_PLAYS) ; make_message(W_MAIN, WHITE_PLAYS) ; --- 294,312 ---- void make_panel() { ! draw_button(W_MAIN, LOAD_BUT, C_ITEMS, BUT_NORMAL) ; ! draw_button(W_MAIN, MOVES_BUT, C_ITEMS, BUT_NORMAL) ; ! draw_button(W_MAIN, NEW_GAME_BUT, C_ITEMS, BUT_NORMAL) ; ! draw_button(W_MAIN, HELP_BUT, C_ITEMS, BUT_NORMAL) ; ! draw_button(W_MAIN, REDO_BUT, C_ITEMS, BUT_NORMAL) ; ! draw_button(W_MAIN, PROPS_BUT, C_ITEMS, BUT_NORMAL) ; ! draw_button(W_MAIN, SAVE_BUT, C_ITEMS, BUT_NORMAL) ; ! draw_button(W_MAIN, SUGGEST_BUT, C_ITEMS, BUT_NORMAL) ; ! draw_button(W_MAIN, EDIT_BUT, C_ITEMS, BUT_NORMAL) ; ! draw_button(W_MAIN, STOP_BUT, C_ITEMS, BUT_NORMAL) ; ! draw_button(W_MAIN, UNDO_BUT, C_ITEMS, BUT_NORMAL) ; ! draw_button(W_MAIN, QUIT_BUT, C_ITEMS, BUT_NORMAL) ; make_message(W_MAIN, BLACK_PLAYS) ; make_message(W_MAIN, WHITE_PLAYS) ; *************** *** 314,342 **** int n ; n = (int) mtype ; - color = (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE ; color_area(W_MAIN, items[n].x, items[n].y, ! get_strwidth(NFONT, items[n].text), nfont_height + 5, color) ; draw_text(W_MAIN, items[n].x, items[n].y + nfont_height, ! NFONT, C_BLACK, str) ; STRCPY(items[n].text, str) ; } void paint_prop_sheet() { ! int color, d ; ! d = (int) cur_dpyno ; ! color = (iscolor[d]) ? C_BEIGE : C_WHITE ; color_area(W_PROPS, 0, 0, PROPS_WIDTH, PROPS_HEIGHT, color) ; - color = (iscolor[d]) ? C_BEIGE : C_WHITE ; draw_choice(W_PROPS, COMP_CHOICE, color) ; draw_choice(W_PROPS, DIFF_CHOICE, color) ; ! draw_cycle_item(W_PROPS, MAX_DEPTH, C_LGREY, CY_NORMAL) ; draw_toggle(W_PROPS, OPT_ANIM, color) ; draw_toggle(W_PROPS, OPT_BEST, color) ; --- 325,383 ---- int n ; n = (int) mtype ; color_area(W_MAIN, items[n].x, items[n].y, ! get_strwidth(NFONT, items[n].text), ! nfont_height + 5, W_COLOR(C_PANEL)) ; draw_text(W_MAIN, items[n].x, items[n].y + nfont_height, ! NFONT, B_COLOR(C_TEXT), str) ; STRCPY(items[n].text, str) ; } void + paint_help() + { + if (hfp == NULL) return ; + color_area(W_HELP, 0, 0, + help_width, (2 * CGAP) + CHEIGHT, W_COLOR(C_PANEL)) ; + draw_cycle_item(W_HELP, HELP_PAGE, C_ITEMS, CY_NORMAL) ; + draw_line(W_HELP, 0, (2 * CGAP) + CHEIGHT, + help_width, (2 * CGAP) + CHEIGHT, RSRC, C_BLACK) ; + paint_help_text() ; + } + + + void + paint_help_text() + { + char buf[MAXLINE] ; + int i, y ; + + color_area(W_HELP, 0, (2 * CGAP) + CHEIGHT + 1, + help_width, ((hfont_height + 1) * HELP_ROWS) + (2 * CGAP) - 1, + W_COLOR(C_PANEL)) ; + FSEEK(hfp, help_offsets[items[(int) HELP_PAGE].value], 0) ; + for (i = 0; i < HELP_ROWS; i++) + { + if (fgets(buf, MAXLINE, hfp) == NULL) return ; + y = (3 * CGAP) + CHEIGHT + ((i + 1) * (hfont_height + 1)) ; + draw_text(W_HELP, CGAP, y, NFONT, B_COLOR(C_TEXT), buf) ; + } + } + + + void paint_prop_sheet() { ! int color ; ! color = W_COLOR(C_PANEL) ; color_area(W_PROPS, 0, 0, PROPS_WIDTH, PROPS_HEIGHT, color) ; draw_choice(W_PROPS, COMP_CHOICE, color) ; draw_choice(W_PROPS, DIFF_CHOICE, color) ; ! draw_cycle_item(W_PROPS, MAX_DEPTH, C_ITEMS, CY_NORMAL) ; draw_toggle(W_PROPS, OPT_ANIM, color) ; draw_toggle(W_PROPS, OPT_BEST, color) ; *************** *** 355,364 **** x1 = BBORDER + BWIDTH + (BGAP / 2) ; y1 = BBORDER + BHEIGHT + (BGAP / 2) ; color_area(W_MAIN, x1, y1, 4 * (BWIDTH + BGAP), BHEIGHT + BGAP, ! (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE) ; tinput = 0 ; items[(int) CANCEL_BUT].x = -1 ; items[(int) CANCEL_BUT].y = -1 ; } --- 396,410 ---- x1 = BBORDER + BWIDTH + (BGAP / 2) ; y1 = BBORDER + BHEIGHT + (BGAP / 2) ; color_area(W_MAIN, x1, y1, 4 * (BWIDTH + BGAP), BHEIGHT + BGAP, ! W_COLOR(C_PANEL)) ; tinput = 0 ; items[(int) CANCEL_BUT].x = -1 ; items[(int) CANCEL_BUT].y = -1 ; + + draw_button(W_MAIN, SUGGEST_BUT, C_ITEMS, BUT_NORMAL) ; + draw_button(W_MAIN, EDIT_BUT, C_ITEMS, BUT_NORMAL) ; + draw_button(W_MAIN, STOP_BUT, C_ITEMS, BUT_NORMAL) ; + draw_button(W_MAIN, UNDO_BUT, C_ITEMS, BUT_NORMAL) ; } *************** *** 368,379 **** enum panel_type item ; char *str ; { - color = (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE ; - color_area(wtype, items[(int) item].x, items[(int) item].y, ! items[(int) item].width, CHEIGHT, color) ; draw_text(wtype, items[(int) item].x, items[(int) item].y + nfont_height, ! NFONT, C_BLACK, str) ; STRCPY(items[(int) item].text, str) ; items[(int) item].width = get_strwidth(NFONT, str) ; } --- 414,423 ---- enum panel_type item ; char *str ; { color_area(wtype, items[(int) item].x, items[(int) item].y, ! items[(int) item].width, CHEIGHT, W_COLOR(C_PANEL)) ; draw_text(wtype, items[(int) item].x, items[(int) item].y + nfont_height, ! NFONT, B_COLOR(C_TEXT), str) ; STRCPY(items[(int) item].text, str) ; items[(int) item].width = get_strwidth(NFONT, str) ; } ------- main.c ------- *** /tmp/da06885 Tue Dec 18 10:10:24 1990 --- main.c Sun Dec 16 02:44:07 1990 *************** *** 38,46 **** } ; #endif /*NO_TIMEVAL*/ ! /* Text values for the cyclic buttons. */ char *comp_plays[] = { "white", "black", "neither", "both" } ; - char *diff_values[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL } ; char *notes_values[] = { "off", "on", NULL } ; char *player_values[] = { "human", "computer", NULL } ; --- 38,48 ---- } ; #endif /*NO_TIMEVAL*/ ! char *diff_values[] = { ! " 1 ", " 2 ", " 3 ", " 4 ", " 5 ", " 6 ", " 7 ", " 8 ", " 9 ", NULL ! } ; ! char *comp_plays[] = { "white", "black", "neither", "both" } ; char *notes_values[] = { "off", "on", NULL } ; char *player_values[] = { "human", "computer", NULL } ; *************** *** 52,58 **** "log", /* Boolean: write computer info to log file. */ "notes", /* Boolean: show computer notes. */ "number", /* Boolean: show last move (number on stone). */ ! "quick" /* Boolean: play quick game (don't flip stones). */ } ; enum cantype cmode, last_cmode ; --- 54,68 ---- "log", /* Boolean: write computer info to log file. */ "notes", /* Boolean: show computer notes. */ "number", /* Boolean: show last move (number on stone). */ ! "quick", /* Boolean: play quick game (don't flip stones). */ ! "panelColor", /* String: main and property panels color. */ ! "boardColor", /* String: playing board color. */ ! "boardBorderColor", /* String: playing board border color. */ ! "gridColor", /* String: grid lines color. */ ! "textColor", /* String: text color. */ ! "itemColor", /* String: color of the panel items. */ ! "properties", /* Boolean: initially show property window? */ ! "showHelp" /* Boolean: initially show help window? */ } ; enum cantype cmode, last_cmode ; *************** *** 61,66 **** --- 71,86 ---- enum set_type direction ; /* Incremental direction for cycle item. */ enum win_type curwin ; /* Window the current event for in. */ + FILE *hfp ; /* File descriptor for online help file. */ + + char *colstr[REVE_COLORSIZE] = { + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL + } ; + + int rcols[REVE_COLORSIZE] ; /* Red colormap values. */ + int gcols[REVE_COLORSIZE] ; /* Green colormap values. */ + int bcols[REVE_COLORSIZE] ; /* Blue colormap values. */ + int tx, ty, tw, th ; /* Position and size of text field. */ int piece_x ; /* Current X position of moving piece. */ *************** *** 77,82 **** --- 97,106 ---- int down ; /* Indicates is a mouse button is down. */ int first_move = 0 ; /* Set if computer plays first move. */ int iconic ; /* Set if window is currently iconic. */ + int help_height ; /* Height of the help window. */ + int help_showing ; /* If set, the help window is visible. */ + int help_width ; /* Width of the help window. */ + int hfont_height ; /* Height in pixels for help font. */ int inv_video = 0 ; /* Set if displaying in inverse video. */ int isblack ; /* Set if human to play the black pieces. */ int iscolor[MAXDPY] ; /* Set if this is a color screen. */ *************** *** 96,101 **** --- 120,126 ---- int nextc ; /* Current event identifier. */ int next_player ; /* Next player (BLACK or WHITE) to move. */ int nfont_height ; /* Height in pixels for normal font. */ + int old_diffval ; /* Old difficulty value (possibly restored). */ int play_computer ; /* Set if playing against the computer. */ int posspec ; /* Set if -Wp or -g option is present (for X11) */ int processing ; /* If set, computer is procesing a move. */ *************** *** 110,115 **** --- 135,142 ---- int wx ; /* Initial X position of the window. */ int wy ; /* Initial Y position of the window. */ + long help_offsets[MAXPAGES] ; /* Offsets into the reve help file. */ + /* Globals for passing arguments to "sandwich"; * this is to save time putting arguments on and off the * stack in a very heavily used piece of code *************** *** 168,177 **** new_game }, ! { /* save button. */ W_MAIN, P_BUTTON, 0, 0, "", BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)), BWIDTH, BHEIGHT, "save", 0, (char **) NULL, 0, draw_textfield --- 195,231 ---- new_game }, ! { /* help button. */ W_MAIN, P_BUTTON, 0, 0, "", BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)), + BWIDTH, BHEIGHT, "help", 0, + (char **) NULL, 0, + do_help + }, + + { /* redo button. */ + W_MAIN, P_BUTTON, 0, 0, + "", + BBORDER + (4*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)), + BWIDTH, BHEIGHT, "redo", 0, + (char **) NULL, 0, + redo + }, + + { /* props button. */ + W_MAIN, P_BUTTON, 0, 0, + "", + BBORDER + (5*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)), + BWIDTH, BHEIGHT, "props", 0, + (char **) NULL, 0, + do_props + }, + + { /* save button. */ + W_MAIN, P_BUTTON, 0, 0, + "", + BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)), BWIDTH, BHEIGHT, "save", 0, (char **) NULL, 0, draw_textfield *************** *** 180,209 **** { /* suggest button. */ W_MAIN, P_BUTTON, 0, 0, "", ! BBORDER + (4*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)), BWIDTH, BHEIGHT, "suggest", 0, (char **) NULL, 0, suggest }, { /* undo button. */ W_MAIN, P_BUTTON, 0, 0, "", ! BBORDER + (5*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)), BWIDTH, BHEIGHT, "undo", 0, (char **) NULL, 0, undo }, - { /* props button. */ - W_MAIN, P_BUTTON, 0, 0, - "", - BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)), - BWIDTH, BHEIGHT, "props", 0, - (char **) NULL, 0, - do_props - }, - { /* cancel button. */ W_MAIN, P_BUTTON, 0, 0, "", --- 234,274 ---- { /* suggest button. */ W_MAIN, P_BUTTON, 0, 0, "", ! BBORDER + (1*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)), BWIDTH, BHEIGHT, "suggest", 0, (char **) NULL, 0, suggest }, + { /* edit button. */ + W_MAIN, P_BUTTON, 0, 0, + "", + /* BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)), */ + -1, -1, + BWIDTH, BHEIGHT, "edit", 0, + (char **) NULL, 0, + do_edit + }, + + { /* stop button. */ + W_MAIN, P_BUTTON, 0, 0, + "", + /* BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)), */ + -1, -1, + BWIDTH, BHEIGHT, "stop", 0, + (char **) NULL, 0, + do_stop + }, + { /* undo button. */ W_MAIN, P_BUTTON, 0, 0, "", ! BBORDER + (4*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)), BWIDTH, BHEIGHT, "undo", 0, (char **) NULL, 0, undo }, { /* cancel button. */ W_MAIN, P_BUTTON, 0, 0, "", *************** *** 312,318 **** BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)), "Set search depth:", BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)), ! 0, 0, "", INIT_DEPTH, (char **) NULL, 0, set_option }, --- 377,383 ---- BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)), "Set search depth:", BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)), ! 0, 0, "", 0, (char **) NULL, 0, set_option }, *************** *** 371,376 **** --- 436,451 ---- (char **) NULL, 0, set_option }, + + { /* Help window page cycle. */ + W_HELP, P_CYCLE, + BBORDER + (0*(BWIDTH+BGAP)), CGAP, + "Page", + BBORDER + (1*(BWIDTH+BGAP)), CGAP, + 0, 0, "", 1, + (char **) NULL, 0, + display_help + }, } ; char geometry[MAXDPY][MAXLINE] ; /* X11 geometry information. */ *************** *** 378,383 **** --- 453,459 ---- char *black_dpy ; /* Black piece display information. */ char edgefile[MAXLINE] ; /* Location of the reve edge table file. */ char gamefile[MAXLINE] ; /* Name of file for load/save. */ + char helpfile[MAXLINE] ; /* Location of the reve online help file. */ char line[40] ; char progname[MAXLINE] ; /* The name of this program. */ char *white_dpy ; /* White piece display information. */ *************** *** 405,410 **** --- 481,487 ---- STRCPY(gamefile, "reve.game") ; SPRINTF(line, " Reve. V1.1.%1d", PATCHLEVEL) ; init_graphics(&argc, argv) ; + reve_colorsetup(rcols, gcols, bcols) ; /* Setup default colors. */ initialise() ; /* Initialise variables used by reve. */ load_resources() ; /* Get resources from various places. */ read_resources() ; /* Read resources from merged database. */ *************** *** 414,420 **** init_edge_table(edgefile) ; /* Load reve edge table values. */ #endif /*XVIEW*/ ! set_display_types() ; /* Work out what displays to initialise. */ if (init_ws_type()) /* Determine window system type. */ { FPRINTF(stderr,"Error initialising window system.\n") ; --- 491,499 ---- init_edge_table(edgefile) ; /* Load reve edge table values. */ #endif /*XVIEW*/ ! init_help_file(helpfile) ; /* Load reve help file page offsets. */ ! ! set_display_types() ; /* Work out what displays to initialise. */ if (init_ws_type()) /* Determine window system type. */ { FPRINTF(stderr,"Error initialising window system.\n") ; *************** *** 450,458 **** { cur_dpyno = dpyno ; make_icon() ; ! make_frame(argc, argv) ; /* Create reve window/icon. */ ! make_canvas() ; /* Create drawing canvas. */ ! init_fonts() ; /* Load normal and bold fonts. */ initboard() ; set_cursor(CANVASCUR) ; } --- 529,538 ---- { cur_dpyno = dpyno ; make_icon() ; ! make_frame(argc, argv) ; /* Create reve window/icon. */ ! make_canvas() ; /* Create drawing canvas. */ ! init_fonts() ; /* Load normal and bold fonts. */ ! make_help_window(argc, argv) ; /* Make help window based on normal font. */ initboard() ; set_cursor(CANVASCUR) ; } *************** *** 521,527 **** getparam(next, argv, "-d needs difficulty") ; level = atoi(next) ; if (level < 1 || level > MAXDIFF) level = INIT_DEPTH ; ! items[(int) DIFF_CHOICE].value = level - 1 ; break ; case 'e' : INC ; getparam(edgefile, argv, "-e needs an edgetable file") ; --- 601,607 ---- getparam(next, argv, "-d needs difficulty") ; level = atoi(next) ; if (level < 1 || level > MAXDIFF) level = INIT_DEPTH ; ! items[(int) DIFF_CHOICE].value = old_diffval = level-1 ; break ; case 'e' : INC ; getparam(edgefile, argv, "-e needs an edgetable file") ; *************** *** 530,535 **** --- 610,622 ---- getparam(geometry[0], argv, "-g needs geometry information") ; break ; + case 'h' : if (EQUAL(argv[0], "-help")) help_showing = TRUE ; + else + { + INC ; + getparam(helpfile, argv, "-h needs a help file") ; + } + break ; case 'i' : inv_video = 1 ; /* Display in inverse video. */ break ; case 'l' : if (EQUAL(argv[0], "-last")) DO_LAST = TRUE ; *************** *** 547,552 **** --- 634,641 ---- case 'n' : if (EQUAL(argv[0], "-notes")) SHOW_NOTES = TRUE ; else if (EQUAL(argv[0], "-number")) DO_NUMBER = TRUE ; break ; + case 'p' : if (EQUAL(argv[0], "-props")) props_showing = TRUE ; + break ; case 'q' : if (EQUAL(argv[0], "-quick")) QUICKGAME = TRUE ; break ; case '?' : *************** *** 654,663 **** color_area(W_MAIN, 0, 0, TOTAL_WIDTH, TOTAL_HEIGHT, C_WHITE) ; if (iscolor[d]) { ! color_area(W_MAIN, 0, 0, TOTAL_WIDTH, CY, C_BEIGE) ; ! color_area(W_MAIN, 0, CY, TOTAL_WIDTH, TOTAL_WIDTH, C_DBROWN) ; color_area(W_MAIN, 0 + BBORDER, CY + BBORDER, BOARD_SIZE * CELL_SIZE, ! BOARD_SIZE * CELL_SIZE, C_LBROWN) ; } make_panel() ; /* Create panel and panel items. */ --- 743,752 ---- color_area(W_MAIN, 0, 0, TOTAL_WIDTH, TOTAL_HEIGHT, C_WHITE) ; if (iscolor[d]) { ! color_area(W_MAIN, 0, 0, TOTAL_WIDTH, CY, C_PANEL) ; ! color_area(W_MAIN, 0, CY, TOTAL_WIDTH, TOTAL_WIDTH, C_BORDER) ; color_area(W_MAIN, 0 + BBORDER, CY + BBORDER, BOARD_SIZE * CELL_SIZE, ! BOARD_SIZE * CELL_SIZE, C_SQUARE) ; } make_panel() ; /* Create panel and panel items. */ *************** *** 666,674 **** batch(IS_ON) ; for (n = 0; n <= BOARD_SIZE; n++) { ! color = (iscolor[d]) ? C_LGREY : C_BLACK ; if (n == 0 || n == BOARD_SIZE) color = C_BLACK ; ! if (color == C_LGREY) adjust = 1 ; else adjust = 0 ; draw_line(W_MAIN, (n*CELL_SIZE)+BBORDER, /* Vertical. */ CY+BBORDER+adjust, (n*CELL_SIZE)+BBORDER, --- 755,763 ---- batch(IS_ON) ; for (n = 0; n <= BOARD_SIZE; n++) { ! color = B_COLOR(C_GRID) ; if (n == 0 || n == BOARD_SIZE) color = C_BLACK ; ! if (color == C_GRID) adjust = 1 ; else adjust = 0 ; draw_line(W_MAIN, (n*CELL_SIZE)+BBORDER, /* Vertical. */ CY+BBORDER+adjust, (n*CELL_SIZE)+BBORDER, *************** *** 711,716 **** --- 800,808 ---- message(TURN_MES, "Black to move.") ; batch(IS_OFF) ; + if (help_showing) set_frame(W_HELP, help_showing) ; + if (props_showing) set_frame(W_PROPS, props_showing) ; + if (loadgame) { loadgame = 0 ; *************** *** 741,748 **** DO_BESTMOVE = FALSE ; DO_LAST = FALSE ; DO_NUMBER = FALSE ; processing = FALSE ; /* No computer move initially. */ ! props_showing = FALSE ; QUICKGAME = FALSE ; validkey = 0 ; cmode = BLACK_START ; --- 833,841 ---- DO_BESTMOVE = FALSE ; DO_LAST = FALSE ; DO_NUMBER = FALSE ; + help_showing = FALSE ; /* Help window not visible. */ processing = FALSE ; /* No computer move initially. */ ! props_showing = FALSE ; /* Properties window not visible. */ QUICKGAME = FALSE ; validkey = 0 ; cmode = BLACK_START ; *************** *** 751,757 **** isblack = 0 ; iswhite = 0 ; level = INIT_DEPTH ; ! items[(int) DIFF_CHOICE].value = level - 1 ; black_dpy = NULL ; /* X11 black piece display information. */ white_dpy = NULL ; /* X11 white piece display information. */ --- 844,850 ---- isblack = 0 ; iswhite = 0 ; level = INIT_DEPTH ; ! items[(int) DIFF_CHOICE].value = old_diffval = level - 1 ; black_dpy = NULL ; /* X11 black piece display information. */ white_dpy = NULL ; /* X11 white piece display information. */ *************** *** 758,763 **** --- 851,857 ---- STRCPY(geometry[(int) DPY1], "") ; /* X11 geometry information. */ STRCPY(geometry[(int) DPY2], "") ; STRCPY(edgefile, EDGENAME) ; + STRCPY(helpfile, HELPNAME) ; } *************** *** 765,770 **** --- 859,865 ---- read_resources() /* Read all possible resources from database. */ { int boolval, intval ; + char str[MAXLINE] ; if (get_bool_resource(R_ANIMATE, &boolval)) ANIMATION = boolval ; if (get_bool_resource(R_BESTMOVE, &boolval)) DO_BESTMOVE = boolval ; *************** *** 773,779 **** { level = intval ; if (level < 1 || level > MAXDIFF) level = INIT_DEPTH ; ! items[(int) DIFF_CHOICE].value = level - 1 ; } if (get_bool_resource(R_LAST, &boolval)) DO_LAST = boolval ; --- 868,874 ---- { level = intval ; if (level < 1 || level > MAXDIFF) level = INIT_DEPTH ; ! items[(int) DIFF_CHOICE].value = old_diffval = level - 1 ; } if (get_bool_resource(R_LAST, &boolval)) DO_LAST = boolval ; *************** *** 781,789 **** --- 876,907 ---- if (get_bool_resource(R_NOTES, &boolval)) SHOW_NOTES = boolval ; if (get_bool_resource(R_NUMBER, &boolval)) DO_NUMBER = boolval ; if (get_bool_resource(R_QUICK, &boolval)) QUICKGAME = boolval ; + if (get_bool_resource(R_PROPS, &boolval)) props_showing = boolval ; + if (get_bool_resource(R_HELP, &boolval)) help_showing = boolval ; + + if (get_str_resource(R_PANELC, str)) read_str(&colstr[C_PANEL], str) ; + if (get_str_resource(R_BOARDC, str)) read_str(&colstr[C_SQUARE], str) ; + if (get_str_resource(R_BOARDBC, str)) read_str(&colstr[C_BORDER], str) ; + if (get_str_resource(R_GRIDC, str)) read_str(&colstr[C_GRID], str) ; + if (get_str_resource(R_TEXTC, str)) read_str(&colstr[C_TEXT], str) ; + if (get_str_resource(R_ITEMC, str)) read_str(&colstr[C_ITEMS], str) ; } + void + read_str(str, value) + char **str, *value ; + { + if (*str != NULL) (void) free(*str) ; + if (value != NULL && strlen(value)) + { + *str = (char *) malloc((unsigned) (strlen(value) + 1)) ; + STRCPY(*str, value) ; + } + else *str = NULL ; + } + + /* Setup the display information for the black and white displays. * There are a fair number of combinations allowed. This table hopefully * gives the setup information for each combination. *************** *** 875,883 **** FPRINTF(stderr, "%s version 1.1.%1d\n\n", progname, PATCHLEVEL) ; FPRINTF(stderr, "Usage: %s: [-animate] [-bestmove]\n", progname) ; FPRINTF(stderr, "\t[-black [display] ] [-c] [-d difficulty]\n") ; ! FPRINTF(stderr, "\t[-e edgefile] [-g geometry] [-last]\n") ; ! FPRINTF(stderr, "\t[-load gamefile] [-number] [-notes] [-v]\n") ; ! FPRINTF(stderr, "\t[-w [display] ] [-?] [-Wi] [-Wp x y] [-WP x y]\n") ; } --- 993,1002 ---- FPRINTF(stderr, "%s version 1.1.%1d\n\n", progname, PATCHLEVEL) ; FPRINTF(stderr, "Usage: %s: [-animate] [-bestmove]\n", progname) ; FPRINTF(stderr, "\t[-black [display] ] [-c] [-d difficulty]\n") ; ! FPRINTF(stderr, "\t[-e edgefile] [-g geometry] [-h helpfile] [-help]\n") ; ! FPRINTF(stderr, "\t[-i] [-last] [-load gamefile] [-log] [-m] [-number]\n") ; ! FPRINTF(stderr, "\t[-notes] [-props] [-quick] [-v] [-w [display] ]\n") ; ! FPRINTF(stderr, "\t[-?] [-Wi] [-Wp x y] [-WP x y]\n") ; } ------- procs.c ------- *** /tmp/da06888 Tue Dec 18 10:10:25 1990 --- procs.c Mon Dec 17 10:32:34 1990 *************** *** 29,39 **** void do_props() { props_showing = !props_showing ; ! if (props_showing == TRUE) open_frame(W_PROPS) ; ! else close_frame(W_PROPS) ; } --- 29,78 ---- void + display_help() + { + char str[4] ; + int val ; + + val = items[itemno].value ; + if (direction == INCREMENT && help_offsets[++val] != -1) + items[itemno].value++ ; + else if (direction == DECREMENT && help_offsets[--val] != -1) + items[itemno].value-- ; + else return ; + SPRINTF(str, "%d", items[itemno].value) ; + set_cycle(W_HELP, HELP_PAGE, str) ; + paint_help_text() ; + } + + + void + do_edit() + { + message(PANEL_MES, "Not currently implemented.") ; + } + + + void + do_help() + { + help_showing = !help_showing ; + set_frame(W_HELP, help_showing) ; + } + + + void + do_stop() + { + message(PANEL_MES, "Not currently implemented.") ; + } + + + void do_props() { props_showing = !props_showing ; ! set_frame(W_PROPS, props_showing) ; } *************** *** 81,89 **** suggest_x = BBORDER + ((suggestion & 7) + 1) * CELL_SIZE - CELL_SIZE / 2 ; suggest_y = BBORDER + ((suggestion >> 3) + 1) * CELL_SIZE - CELL_SIZE / 2 ; ! if (state == IS_OFF) ! color = (iscolor[(int) cur_dpyno]) ? C_LBROWN : C_WHITE ; ! else color = C_BLACK ; draw_line(W_MAIN, suggest_x-5, CY+suggest_y-5, suggest_x+5, CY+suggest_y+5, RSRC, color) ; --- 120,127 ---- suggest_x = BBORDER + ((suggestion & 7) + 1) * CELL_SIZE - CELL_SIZE / 2 ; suggest_y = BBORDER + ((suggestion >> 3) + 1) * CELL_SIZE - CELL_SIZE / 2 ; ! if (state == IS_OFF) color = W_COLOR(C_SQUARE) ; ! else color = C_BLACK ; draw_line(W_MAIN, suggest_x-5, CY+suggest_y-5, suggest_x+5, CY+suggest_y+5, RSRC, color) ; *************** *** 94,99 **** --- 132,161 ---- void + init_help_file(helpfile) /* Load reve help page offsets. */ + char *helpfile ; + { + char buf[MAXLINE] ; + int i, page ; + long offset ; + + for (i = 0; i < MAXPAGES; i++) help_offsets[i] = -1 ; + if ((hfp = find_file(helpfile)) == NULL) + { + FPRINTF(stderr, "Cannot open online help file\n") ; + return ; + } + page = 1 ; + for (;;) + { + offset = ftell(hfp) ; + if (fgets(buf, MAXLINE, hfp) == NULL) return ; + if (EQUAL(buf, "REVE(6)")) help_offsets[page++] = offset ; + } + } + + + void make_move() { if (legal(move, next_player, &board) == FALSE) *************** *** 129,135 **** init_canvas() ; message(EVAL_MES, "") ; message(PANEL_MES, "Use left mouse button to move") ; ! draw_button(W_MAIN, NEW_GAME_BUT, C_LGREY, BUT_NORMAL) ; } --- 191,197 ---- init_canvas() ; message(EVAL_MES, "") ; message(PANEL_MES, "Use left mouse button to move") ; ! draw_button(W_MAIN, NEW_GAME_BUT, C_ITEMS, BUT_NORMAL) ; } *************** *** 142,151 **** void set_computer(val) int val ; { ! int color, curi ; if (val == CP_WHITE) { --- 204,294 ---- void + redo() + { + enum panel_type p ; + + /* The amount we redo is dependant upon two things: + * + * 1/ Whether the opponent is the computer, in which case we redo + * two "moves". Otherwise we just redo one "move". + * + * 2/ A "move" is considered to be all consecutive moves by the opponent. + */ + + redo_move(next_player) ; + p = (next_player == BLACK) ? BLACK_PLAYS : WHITE_PLAYS ; + if (items[(int) p].value == COMPUTER) redo_move(next_player) ; + + set_score() ; + set_turn(next_player) ; + } + + + void + redo_move(player) + int player ; + { + int i, limit, n, x, y ; + + n = 63 - board.moves_left ; + while (moves[n].move != -1 && moves[n].player != player) n++ ; + + if (moves[n].move == -1 || n > 63) message(PANEL_MES, "No moves to redo.") ; + else + { + if (DO_LAST) show_last(last_move, IS_OFF) ; + if (DO_NUMBER) show_number(last_move, 60 - board.moves_left, IS_OFF) ; + do_suggest(player, suggestion, note, IS_OFF) ; + FOR_BOARD(i) + { + if (moves[n].square[i] != board.square[i]) + { + get_xy(i, &x, &y) ; + if (moves[n].square[i] == FREE) + color_area(W_MAIN, x, CY+y, PSIZE, PSIZE, W_COLOR(C_SQUARE)) ; + else draw_piece(moves[n].square[i], x, CY+y, RSRC) ; + } + board.square[i] = moves[n].square[i] ; + } + board.moves_left = moves[n].moves_left ; + board.player = moves[n].player ; + board.move = moves[n].move ; + board.note = moves[n].note ; + board.timeleft = moves[n].timeleft ; + last_move = board.move ; + + FOR_BOARD(i) old_board.square[i] = moves[n-1].square[i] ; + old_board.moves_left = moves[n-1].moves_left ; + old_board.player = moves[n-1].player ; + old_board.move = moves[n-1].move ; + old_board.note = moves[n-1].note ; + old_board.timeleft = moves[n-1].timeleft ; + + timeleft = board.timeleft ; + + #ifdef XVIEW + reset_time(timeleft) ; + #endif /*XVIEW*/ + + if (OPPONENT(player) == BLACK) cmode = BLACK_START ; + else cmode = WHITE_START ; + message(PANEL_MES, "") ; + + if (DO_LAST) show_last(last_move, IS_ON) ; + if (DO_NUMBER) show_number(last_move, 60 - board.moves_left, IS_ON) ; + if (SHOW_NOTES) set_eval(board.player, board.move, board.note) ; + else message(EVAL_MES, "") ; + next_player = OPPONENT(board.player) ; + } + } + + + void set_computer(val) int val ; { ! int curi ; if (val == CP_WHITE) { *************** *** 175,182 **** STRCPY(items[(int) WHITE_PLAYS].text, player_values[HUMAN]) ; } ! color = (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE ; ! draw_choice(W_PROPS, COMP_CHOICE, color) ; val = items[(int) BLACK_PLAYS].value ; val = items[(int) WHITE_PLAYS].value ; --- 318,326 ---- STRCPY(items[(int) WHITE_PLAYS].text, player_values[HUMAN]) ; } ! draw_choice(W_PROPS, COMP_CHOICE, W_COLOR(C_PANEL)) ; ! make_message(W_MAIN, BLACK_PLAYS) ; ! make_message(W_MAIN, WHITE_PLAYS) ; val = items[(int) BLACK_PLAYS].value ; val = items[(int) WHITE_PLAYS].value ; *************** *** 194,202 **** set_option() { char str[4] ; ! int color, d, maxw, n, val ; - d = (int) cur_dpyno ; switch (itemno) { case COMP_CHOICE : maxw = items[itemno].width / items[itemno].nopts ; --- 338,345 ---- set_option() { char str[4] ; ! int maxw, n, val ; switch (itemno) { case COMP_CHOICE : maxw = items[itemno].width / items[itemno].nopts ; *************** *** 214,233 **** val = (curx - items[itemno].x) / maxw ; level = val + 1 ; items[itemno].value = val ; ! color = (iscolor[d]) ? C_BEIGE : C_WHITE ; ! draw_choice(W_PROPS, DIFF_CHOICE, color) ; break ; case MAX_DEPTH : val = items[itemno].value ; if (direction == INCREMENT && val < MAX_PROFMAX) items[itemno].value++ ; ! else if (direction == DECREMENT && val > INIT_DEPTH) items[itemno].value-- ; ! SPRINTF(str, "%d", items[itemno].value) ; ! color = (iscolor[d]) ? C_LGREY : C_WHITE ; set_cycle(W_PROPS, MAX_DEPTH, str) ; ! profmax = items[itemno].value ; ! level = 1 ; break ; case OPT_ANIM : ANIMATION = !ANIMATION ; --- 357,390 ---- val = (curx - items[itemno].x) / maxw ; level = val + 1 ; items[itemno].value = val ; ! draw_choice(W_PROPS, DIFF_CHOICE, W_COLOR(C_PANEL)) ; ! ! items[(int) MAX_DEPTH].value = 0 ; ! set_cycle(W_PROPS, MAX_DEPTH, "off") ; break ; case MAX_DEPTH : val = items[itemno].value ; if (direction == INCREMENT && val < MAX_PROFMAX) items[itemno].value++ ; ! else if (direction == DECREMENT && val > 0) items[itemno].value-- ; ! if (!items[(int) itemno].value) STRCPY(str, "off") ; ! else SPRINTF(str, "%d", items[itemno].value) ; set_cycle(W_PROPS, MAX_DEPTH, str) ; ! ! if (items[itemno].value) ! { ! items[(int) DIFF_CHOICE].value = -1 ; ! level = 1 ; ! max_depth = items[itemno].value ; ! } ! else ! { ! items[(int) DIFF_CHOICE].value = old_diffval ; ! level = old_diffval + 1 ; ! max_depth = 2 ; ! } ! draw_choice(W_PROPS, DIFF_CHOICE, W_COLOR(C_PANEL)) ; break ; case OPT_ANIM : ANIMATION = !ANIMATION ; *************** *** 247,254 **** case OPT_NUM : DO_NUMBER = !DO_NUMBER ; n = 63 - board.moves_left ; ! show_number(moves[n].move, 60 - board.moves_left, ! DO_NUMBER, DO_NUMBER) ; break ; case OPT_FLIP : QUICKGAME = !QUICKGAME ; --- 404,412 ---- case OPT_NUM : DO_NUMBER = !DO_NUMBER ; n = 63 - board.moves_left ; ! if (board.moves_left < 60) ! show_number(moves[n].move, 60 - board.moves_left, ! DO_NUMBER) ; break ; case OPT_FLIP : QUICKGAME = !QUICKGAME ; *************** *** 306,311 **** --- 464,470 ---- } + void undo_move(player) int player ; { *************** *** 326,333 **** { get_xy(i, &x, &y) ; if (moves[n].square[i] == FREE) ! color_area(W_MAIN, x, CY+y, PSIZE, PSIZE, ! (iscolor[(int) cur_dpyno]) ? C_LBROWN : C_WHITE) ; else draw_piece(moves[n].square[i], x, CY+y, RSRC) ; } board.square[i] = moves[n].square[i] ; --- 485,491 ---- { get_xy(i, &x, &y) ; if (moves[n].square[i] == FREE) ! color_area(W_MAIN, x, CY+y, PSIZE, PSIZE, W_COLOR(C_SQUARE)) ; else draw_piece(moves[n].square[i], x, CY+y, RSRC) ; } board.square[i] = moves[n].square[i] ; *************** *** 338,344 **** board.note = moves[n].note ; board.timeleft = moves[n].timeleft ; last_move = board.move ; - moves[n+1].move = -1 ; FOR_BOARD(i) old_board.square[i] = moves[n-1].square[i] ; old_board.moves_left = moves[n-1].moves_left ; --- 496,501 ----