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 #1 for Reve v1.1 (Part 4 of 4). Message-ID: <1990Nov9.002936.10403@sunaus.oz> Date: 9 Nov 90 00:29:36 GMT Organization: Sun Microsystems - Australia Lines: 977 ------CUT HERE------patch1 - part4------CUT HERE------ ------- xview.c ------- *** /tmp/da28887 Fri Nov 9 10:38:30 1990 --- xview.c Thu Nov 8 10:31:17 1990 *************** *** 7,17 **** * Copyright (c) 1990 - Rich Burridge & Yves Gallot. * All rights reserved. * ! * Permission is given to distribute these sources, as long as the ! * introductory messages are not removed, and no monies are exchanged. * ! * You are forbidden from using Reve as is, or in a modified state, in ! * any tournaments, without the permission of the authors. * * No responsibility is taken for any errors or inaccuracies inherent * either to the comments or the code of this program, but if reported --- 7,22 ---- * Copyright (c) 1990 - Rich Burridge & Yves Gallot. * All rights reserved. * ! * Permission is granted to copy this source, for redistribution ! * in source form only, provided the news headers in "substantially ! * unaltered format" are retained, the introductory messages are not ! * removed, and no monies are exchanged. * ! * Permission is also granted to copy this source, without the ! * news headers, for the purposes of making an executable copy by ! * means of compilation, provided that such copy will not be used ! * for the purposes of competition in any othello tournaments, without ! * prior permission from the authors. * * No responsibility is taken for any errors or inaccuracies inherent * either to the comments or the code of this program, but if reported *************** *** 18,24 **** * (see README file), then an attempt will be made to fix them. */ - #include #include "reve.h" #include "color.h" #include "extern.h" --- 23,28 ---- *************** *** 25,30 **** --- 29,35 ---- #include "images.h" #include #include + #include #include #include #include *************** *** 33,57 **** enum gr_type gtype = GXVIEW ; /* Graphics type. */ ! #define XV_SET (void) xv_set ! #define WINDOW_DONE (void) window_done ! #define BOLDFONT "lucidasanstypewriter-bold-12" ! #define DEFFONT "fixed" ! #define NORMALFONT "lucidasanstypewriter-12" ! static void menu_proc() ; ! mpr_static(icon_pr, 64, 64, 1, icon_image) ; ! mpr_static(cicon_pr, 64, 64, 8, cicon_image) ; Canvas canvas ; Canvas_paint_window cpw ; Event *cur_event ; ! Frame frame ; ! Icon reve_icon ; Menu menus[MAXMENUS] ; ! Notify_value destroy() ; Server_image hglass_pr, nocur_pr ; Xv_Cursor cursor[MAXCURSORS] ; --- 38,76 ---- enum gr_type gtype = GXVIEW ; /* Graphics type. */ ! enum popup_pos {P_BELOW, P_RIGHT } ; /* Positions relative to main frame. */ ! #define FRAME_BORDER_SIZE 7 ! #define FRAME_LABEL_SIZE 30 ! #define XV_CREATE (void) xv_create ! #define XV_SET (void) xv_set ! #define BOLDFONT "lucidasanstypewriter-bold-12" ! #define DEFFONT "fixed" ! #define NORMALFONT "lucidasanstypewriter-12" Canvas canvas ; Canvas_paint_window cpw ; Event *cur_event ; ! Frame cframe ; /* Frame for Reve game board. */ ! Frame frame ; /* Frame for control panel. */ ! Frame ls_frame ; /* Frame for load/save pop-up window. */ ! Icon creve_icon ; /* Icon for game board. */ ! Icon reve_icon ; /* Icon for control panel. */ ! Panel panel ; /* Xview interface panel. */ ! ! Frame ls_frame ; /* Frame for load/save pop-up window. */ ! Panel ls_panel ; /* Panel for load/save operations. */ ! Panel_item ls_button ; /* Button to start load/save operation. */ ! Panel_item ls_text ; /* Load/Save text filename item. */ ! Panel_item mes_items[4] ; /* Four generic message items. */ ! Panel_setting start_load_save() ; ! Menu game_menu ; /* Menu for 'New Game' button. */ Menu menus[MAXMENUS] ; ! Notify_value quit_proc() ; ! Panel_item black_item ; ! Panel_item white_item ; Server_image hglass_pr, nocur_pr ; Xv_Cursor cursor[MAXCURSORS] ; *************** *** 75,81 **** --- 94,106 ---- int opvals[3] ; /* Pixrect rasterop values. */ int started ; /* Set just before window is displayed. */ + void destroy_frame() ; + static void menu_proc(), new_game_proc(), pop_props(), set_depth() ; + static void set_player(), unimplemented(), xv_load_game(), xv_save_game() ; + extern int mnb ; /* Number of current move */ + + void batch(state) /* Turn graphics batching on or off. */ enum bltype state ; *************** *** 155,161 **** void destroy_frame() /* Destroy reve window. */ { ! WINDOW_DONE(frame) ; } --- 180,188 ---- void destroy_frame() /* Destroy reve window. */ { ! xv_destroy_safe(frame) ; ! xv_destroy_safe(cframe) ; ! exit(0) ; } *************** *** 170,176 **** --- 197,223 ---- } + /*ARGSUSED*/ void + draw_button(item, color, image) /* **DUMMY ROUTINE** */ + enum panel_type item ; + int color ; + enum image_type image ; + { + } + + + /*ARGSUSED*/ + void + draw_cycle(item, color, image) /* **DUMMY ROUTINE** */ + enum panel_type item ; + int color ; + enum image_type image ; + { + } + + + void draw_image(x, y, width, height, image) int x, y, width, height ; enum image_type image ; *************** *** 193,199 **** d = (int) cur_dpyno ; if (iscolor[d]) gc_val.foreground = palette[color] ; ! else gc_val.foreground = foregnd ; gc_val.function = opvals[(int) op] ; XChangeGC(dpy, gc, GCForeground | GCFunction, &gc_val) ; XDrawLine(dpy, xid, gc, x1, y1, x2, y2) ; --- 240,250 ---- d = (int) cur_dpyno ; if (iscolor[d]) gc_val.foreground = palette[color] ; ! else ! { ! if (color == C_WHITE) gc_val.foreground = backgnd ; ! else gc_val.foreground = foregnd ; ! } gc_val.function = opvals[(int) op] ; XChangeGC(dpy, gc, GCForeground | GCFunction, &gc_val) ; XDrawLine(dpy, xid, gc, x1, y1, x2, y2) ; *************** *** 248,253 **** --- 299,336 ---- } + void + draw_textfield() /* **DUMMY ROUTINE** */ + { + } + + + static Notify_value + frame_event(frame, event, arg, type) + Frame frame ; + Event *event ; + Notify_arg arg ; + Notify_event_type type ; + { + int action ; + + action = event_action(event) ; + if (action == ACTION_CLOSE) XV_SET(cframe, XV_SHOW, FALSE, 0) ; + if (action == WIN_RESIZE) + { + position_popup(frame, cframe, P_BELOW) ; + XV_SET(cframe, XV_SHOW, TRUE, 0) ; + } + return(notify_next_event_func(frame, event, arg, type)) ; + } + + + void + get_filename() /* **DUMMY ROUTINE** */ + { + } + + XFontStruct * get_font(name) char *name ; *************** *** 286,291 **** --- 369,375 ---- init_ws_type() { + show_notes = TRUE ; /* Override generic value for XView version. */ move_delta = 10 ; cur_dpyno = DPY1 ; started = 0 ; /* Kludge to correctly handle repaints. */ *************** *** 331,339 **** void make_canvas() /* Create canvas for game board. */ { ! canvas = xv_create(frame, CANVAS, CANVAS_RETAINED, FALSE, ! OPENWIN_AUTO_CLEAR, FALSE, XV_HEIGHT, TOTAL_HEIGHT, XV_WIDTH, TOTAL_WIDTH, CANVAS_PAINTWINDOW_ATTRS, --- 415,431 ---- void make_canvas() /* Create canvas for game board. */ { ! cframe = xv_create(XV_NULL, FRAME, ! XV_SHOW, FALSE, ! FRAME_ICON, creve_icon, ! FRAME_NO_CONFIRM, TRUE, ! WIN_ERROR_MSG, "Reve: Can't create window.", ! FRAME_SHOW_RESIZE_CORNER, FALSE, ! FRAME_SHOW_HEADER, FALSE, ! 0) ; ! canvas = xv_create(cframe, CANVAS, CANVAS_RETAINED, FALSE, ! OPENWIN_AUTO_CLEAR, FALSE, XV_HEIGHT, TOTAL_HEIGHT, XV_WIDTH, TOTAL_WIDTH, CANVAS_PAINTWINDOW_ATTRS, *************** *** 348,358 **** WIN_EVENT_PROC, canvas_proc, 0, 0) ; cpw = canvas_paint_window(canvas) ; ! cursor[(int) CANVASCUR] = xv_get(cpw, WIN_CURSOR) ; ! dpy = (Display *) xv_get(frame, XV_DISPLAY) ; ! xid = (Drawable) xv_get(cpw, XV_XID) ; screen = DefaultScreen(dpy) ; root = RootWindow(dpy, screen) ; --- 440,453 ---- WIN_EVENT_PROC, canvas_proc, 0, 0) ; + window_fit(cframe) ; + notify_interpose_destroy_func(cframe, quit_proc) ; + cpw = canvas_paint_window(canvas) ; ! cursor[(int) CANVASCUR] = xv_get(cpw, WIN_CURSOR, NULL) ; ! dpy = (Display *) xv_get(frame, XV_DISPLAY, NULL) ; ! xid = (Drawable) xv_get(cpw, XV_XID, NULL) ; screen = DefaultScreen(dpy) ; root = RootWindow(dpy, screen) ; *************** *** 387,415 **** cursor[(int) NOCURSOR] = xv_create(XV_NULL, CURSOR, CURSOR_IMAGE, nocur_pr, 0) ; ! load_colors() ; - images[(int) BUT_STENCIL] = make_server_image(button_stencil_image) ; - images[(int) BUT_INVERT] = make_server_image(button_invert_image) ; - images[(int) BUT_NORMAL] = make_server_image(button_normal_image) ; - images[(int) CY_NORMAL] = make_server_image(cycle_glyph_image) ; - images[(int) CY_STENCIL] = make_server_image(cycle_stencil_image) ; - images[(int) CY_LINVERT] = make_server_image(cycle_linvert_image) ; - images[(int) CY_RINVERT] = make_server_image(cycle_rinvert_image) ; images[(int) P_WHITE] = make_server_image(white_image) ; images[(int) P_BLACK] = make_server_image(black_image) ; } ! void ! make_frame(argc, argv) /* Create reve window. */ int argc ; char *argv[] ; { opvals[(int) RCLR] = GXclear ; opvals[(int) RSRC] = GXcopy ; opvals[(int) RINV] = GXxor ; xv_init(XV_INIT_ARGS, argc, argv, 0) ; frame = xv_create(XV_NULL, FRAME, FRAME_ICON, reve_icon, --- 482,507 ---- cursor[(int) NOCURSOR] = xv_create(XV_NULL, CURSOR, CURSOR_IMAGE, nocur_pr, 0) ; ! if (!monochrome) load_colors() ; images[(int) P_WHITE] = make_server_image(white_image) ; images[(int) P_BLACK] = make_server_image(black_image) ; } ! void ! make_frame(argc, argv) /* Create frame and the panel, buttons, menus. */ int argc ; char *argv[] ; { + Menu_item item ; + opvals[(int) RCLR] = GXclear ; opvals[(int) RSRC] = GXcopy ; opvals[(int) RINV] = GXxor ; + /* Create the frame and the control panel */ + xv_init(XV_INIT_ARGS, argc, argv, 0) ; frame = xv_create(XV_NULL, FRAME, FRAME_ICON, reve_icon, *************** *** 416,423 **** FRAME_LABEL, line, FRAME_NO_CONFIRM, TRUE, FRAME_SHOW_RESIZE_CORNER, FALSE, ! WIN_ERROR_MSG, "Can't create window.", ! 0) ; iscolor[(int) cur_dpyno] = ((int) xv_get(frame, WIN_DEPTH) > 1) ? 1 : 0 ; } --- 508,693 ---- FRAME_LABEL, line, FRAME_NO_CONFIRM, TRUE, FRAME_SHOW_RESIZE_CORNER, FALSE, ! WIN_ERROR_MSG, "Reve: Can't create window.", ! NULL) ; ! ! panel = (Panel) xv_create(frame, PANEL, 0) ; ! ! /* Menu for the 'new game' button */ ! ! game_menu = (Menu) xv_create(XV_NULL, MENU, ! MENU_NOTIFY_PROC, new_game_proc, ! MENU_STRINGS, ! "Human (black) vs. Computer (white)", ! "Computer (black) vs. Human (white)", ! "Human (black) vs. Human (white)", ! 0, ! 0) ; ! ! /* Create the buttons and other controls. */ ! ! XV_CREATE(panel, PANEL_BUTTON, ! PANEL_ITEM_X, xv_col(panel, 0), ! PANEL_ITEM_Y, xv_row(panel, 0), ! PANEL_LABEL_STRING, "New Game", ! PANEL_ITEM_MENU, game_menu, ! 0) ; ! ! XV_CREATE(panel, PANEL_BUTTON, ! PANEL_ITEM_X, xv_col(panel, 15), ! PANEL_ITEM_Y, xv_row(panel, 0), ! PANEL_LABEL_STRING, "Load Game...", ! PANEL_NOTIFY_PROC, xv_load_game, ! 0) ; ! ! XV_CREATE(panel, PANEL_BUTTON, ! PANEL_ITEM_X, xv_col(panel, 30), ! PANEL_ITEM_Y, xv_row(panel, 0), ! PANEL_LABEL_STRING, "Save Game...", ! PANEL_NOTIFY_PROC, xv_save_game, ! 0) ; ! ! XV_CREATE(panel, PANEL_BUTTON, ! PANEL_ITEM_X, xv_col(panel, 45), ! PANEL_ITEM_Y, xv_row(panel, 0), ! PANEL_LABEL_STRING, " Help ", ! PANEL_NOTIFY_PROC, unimplemented, ! 0) ; ! ! XV_CREATE(panel, PANEL_BUTTON, ! PANEL_ITEM_X, xv_col(panel, 0), ! PANEL_ITEM_Y, xv_row(panel, 1), ! PANEL_LABEL_STRING, " Moves? ", ! PANEL_NOTIFY_PROC, show_all_moves, ! 0) ; ! ! XV_CREATE(panel, PANEL_BUTTON, ! PANEL_ITEM_X, xv_col(panel, 15), ! PANEL_ITEM_Y, xv_row(panel, 1), ! PANEL_LABEL_STRING, " Suggest ", ! PANEL_NOTIFY_PROC, suggest, ! 0) ; ! ! XV_CREATE(panel, PANEL_BUTTON, ! PANEL_ITEM_X, xv_col(panel, 30), ! PANEL_ITEM_Y, xv_row(panel, 1), ! PANEL_LABEL_STRING, " Undo ", ! PANEL_NOTIFY_PROC, undo, ! 0) ; ! ! XV_CREATE(panel, PANEL_BUTTON, ! PANEL_ITEM_X, xv_col(panel, 45), ! PANEL_ITEM_Y, xv_row(panel, 1), ! PANEL_LABEL_STRING, " Quit ", ! PANEL_NOTIFY_PROC, destroy_frame, ! 0) ; ! ! XV_CREATE(panel, PANEL_CHECK_BOX, ! PANEL_ITEM_X, xv_col(panel, 0), ! PANEL_ITEM_Y, xv_row(panel, 4), ! PANEL_LABEL_STRING, "Show Info ", ! PANEL_NOTIFY_PROC, pop_props, ! PANEL_VALUE, 1, ! 0) ; ! ! black_item = xv_create(panel, PANEL_CHOICE_STACK, ! PANEL_ITEM_X, xv_col(panel, 0), ! PANEL_ITEM_Y, xv_row(panel, 2), ! PANEL_LABEL_STRING, "Black:", ! PANEL_CHOICE_STRINGS, ! "human", ! "computer", ! 0, ! PANEL_NOTIFY_PROC, set_player, ! PANEL_VALUE, items[(int) BLACK_PLAYS].value, ! 0) ; ! ! white_item = xv_create(panel, PANEL_CHOICE_STACK, ! PANEL_ITEM_X, xv_col(panel, 0), ! PANEL_ITEM_Y, xv_row(panel, 3), ! PANEL_LABEL_STRING, "White:", ! PANEL_CHOICE_STRINGS, ! "human", ! "computer", ! 0, ! PANEL_NOTIFY_PROC, set_player, ! PANEL_VALUE, items[(int) WHITE_PLAYS].value, ! 0) ; ! ! mes_items[(int) (TURN_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE, ! PANEL_ITEM_X, xv_col(panel, 30), ! PANEL_ITEM_Y, xv_row(panel, 2), ! PANEL_LABEL_STRING, "Black to move", ! 0) ; ! ! mes_items[(int) (SCORE_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE, ! PANEL_ITEM_X, xv_col(panel, 30), ! PANEL_ITEM_Y, xv_row(panel, 3), ! PANEL_LABEL_STRING, "", ! 0) ; ! ! mes_items[(int) (EVAL_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE, ! PANEL_ITEM_X, xv_col(panel, 30), ! PANEL_ITEM_Y, xv_row(panel, 4), ! PANEL_LABEL_STRING, "", ! 0) ; ! ! ! mes_items[(int) (PANEL_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE, ! PANEL_ITEM_X, xv_col(panel, 30), ! PANEL_ITEM_Y, xv_row(panel, 5), ! PANEL_LABEL_STRING, "", ! 0) ; ! ! XV_CREATE(panel, PANEL_CHOICE_STACK, ! PANEL_ITEM_X, xv_col(panel, 0), ! PANEL_ITEM_Y, xv_row(panel, 5), ! PANEL_LABEL_STRING, "Difficulty: ", ! PANEL_CHOICE_STRINGS, ! " Instant", ! " 1 Minute", ! " 3 Minutes", ! " 5 Minutes", ! "10 Minutes", ! "15 Minutes", ! "20 Minutes", ! "Tournament (30)", ! "60 MInutes", ! 0, ! PANEL_NOTIFY_PROC, set_depth, ! PANEL_VALUE, 0, ! 0) ; ! ! window_fit(panel) ; ! window_fit(frame) ; ! notify_interpose_event_func(frame, frame_event, NOTIFY_SAFE) ; ! notify_interpose_destroy_func(frame, quit_proc) ; ! ! ls_frame = xv_create(frame, FRAME_CMD, ! FRAME_LABEL, "Name your Game ...", ! FRAME_CMD_PUSHPIN_IN, TRUE, ! 0) ; ! ! ls_panel = (Panel) xv_get(ls_frame, FRAME_CMD_PANEL) ; ! ! ls_text = XV_CREATE(ls_panel, PANEL_TEXT, ! PANEL_ITEM_X, xv_col(ls_panel, 0), ! PANEL_ITEM_Y, xv_row(ls_panel, 0), ! PANEL_LABEL_STRING, "Load File: ", ! PANEL_VALUE, gamefile, ! PANEL_VALUE_DISPLAY_LENGTH, 30, ! PANEL_VALUE_STORED_LENGTH, 255, ! 0) ; ! ! ls_button = xv_create(ls_panel, PANEL_BUTTON, ! PANEL_LABEL_STRING, "Load", ! PANEL_NOTIFY_PROC, start_load_save, ! XV_X, xv_col(ls_panel, 18), ! XV_Y, xv_row(ls_panel, 1), ! 0) ; ! window_fit(ls_panel) ; ! window_fit(ls_frame) ; ! iscolor[(int) cur_dpyno] = ((int) xv_get(frame, WIN_DEPTH) > 1) ? 1 : 0 ; } *************** *** 425,436 **** void make_icon() { reve_icon = xv_create(XV_NULL, ICON, ! ICON_IMAGE, &icon_pr, 0) ; } Drawable make_server_image(image) unsigned short image[] ; --- 695,727 ---- void make_icon() { + + /* XXX: Need to correctly handle color icons on a color screen. */ + + Server_image icon_sv ; + + icon_sv = xv_create(XV_NULL, SERVER_IMAGE, + SERVER_IMAGE_BITS, icon_image, + SERVER_IMAGE_DEPTH, 1, + XV_WIDTH, 64, + XV_HEIGHT, 64, + 0) ; + reve_icon = xv_create(XV_NULL, ICON, ! ICON_IMAGE, icon_sv, 0) ; + creve_icon = xv_create(XV_NULL, ICON, + ICON_IMAGE, icon_sv, + 0) ; } + void + make_panel() /* **DUMMY ROUTINE** */ + { + } + + Drawable make_server_image(image) unsigned short image[] ; *************** *** 442,448 **** XV_HEIGHT, 64, SERVER_IMAGE_BITS, image, 0) ; ! return((int) xv_get(temp, XV_XID)) ; } --- 733,739 ---- XV_HEIGHT, 64, SERVER_IMAGE_BITS, image, 0) ; ! return((int) xv_get(temp, XV_XID, NULL)) ; } *************** *** 459,464 **** --- 750,840 ---- void + message(mtype, str) + enum panel_type mtype ; + char *str ; + { + XV_SET(mes_items[(int) (mtype - PANEL_MES)], PANEL_LABEL_STRING, str, 0) ; + } + + + static void + new_game_proc(menu, menu_item) + Menu menu ; + Menu_item menu_item ; + { + switch((int) xv_get(menu_item, MENU_VALUE)) + { + case 1 : items[(int) BLACK_PLAYS].value = HUMAN ; + items[(int) WHITE_PLAYS].value = COMPUTER ; + cmode = WHITE_START ; + dtype = XBLACK ; + break ; + + case 2 : items[(int) BLACK_PLAYS].value = COMPUTER ; + items[(int) WHITE_PLAYS].value = HUMAN ; + cmode = BLACK_START ; + dtype = XWHITE ; + break ; + + case 3 : items[(int) BLACK_PLAYS].value = HUMAN ; + items[(int) WHITE_PLAYS].value = HUMAN ; + cmode = BLACK_START ; + dtype = XBOTH ; + } + XV_SET(black_item, PANEL_VALUE, items[(int) BLACK_PLAYS].value) ; + XV_SET(white_item, PANEL_VALUE, items[(int) WHITE_PLAYS].value) ; + new_game() ; + } + + + /* Callback for the check box to show/hide evaluation and score. */ + + static void + pop_props(item, value, event) + { + show_notes = !show_notes ; + if (!show_notes) + { + XV_SET(mes_items[(int) (EVAL_MES - PANEL_MES)], + PANEL_LABEL_STRING, "", + 0) ; + XV_SET(mes_items[(int) (SCORE_MES - PANEL_MES)], + PANEL_LABEL_STRING, "", + 0) ; + } + } + + + void + position_popup(parent, child, position) + Frame parent, child ; + int position ; + { + Rect crect, prect ; + int height, width ; + + if (((int) xv_get(child, XV_SHOW)) && position == P_RIGHT) return ; + frame_get_rect(parent, &prect) ; + frame_get_rect(child, &crect) ; + height = (int) xv_get(parent, XV_HEIGHT) ; + width = (int) xv_get(parent, XV_WIDTH) ; + + switch (position) + { + case P_BELOW : crect.r_left = prect.r_left + FRAME_BORDER_SIZE ; + crect.r_top = prect.r_top + height + FRAME_LABEL_SIZE + + FRAME_BORDER_SIZE ; + break ; + case P_RIGHT : crect.r_left = prect.r_left + width + + (2 * FRAME_BORDER_SIZE) ; + crect.r_top = prect.r_top ; + } + frame_set_rect(child, &crect) ; + } + + + void process_event() /* Process the next canvas event. */ { int id ; *************** *** 493,499 **** --- 869,896 ---- } + static Notify_value + quit_proc(frame, status) + Frame frame ; + Destroy_status status ; + { + if (status == DESTROY_PROCESS_DEATH || status == DESTROY_CLEANUP) + { + xv_destroy_safe(frame) ; + xv_destroy_safe(cframe) ; + exit(0) ; + } + return(notify_next_destroy_func(frame, status)) ; + } + + void + remove_textfield() /* **DUMMY ROUTINE** */ + { + } + + + void set_cursor(ctype) enum curtype ctype ; { *************** *** 505,522 **** /*ARGSUSED*/ void ! start_tool(dtype) /* Display window and start the notifier. */ ! enum disp_type dtype ; { ! if (iscolor[(int) cur_dpyno]) { ! reve_icon = (Icon) xv_get(frame, FRAME_ICON) ; ! XV_SET(reve_icon, ! ICON_IMAGE, &cicon_pr, ! 0) ; ! XV_SET(frame, FRAME_ICON, reve_icon, 0) ; } ! window_fit(frame) ; started = 1 ; xv_main_loop(frame) ; } --- 902,1025 ---- /*ARGSUSED*/ void ! set_cycle(mtype, str) /* **DUMMY ROUTINE** */ ! enum panel_type mtype ; ! char *str ; { ! } ! ! ! static void ! set_depth(item, value, event) /* Callback to set the level of difficulty */ ! Panel_item item ; ! int value ; ! Event *event ; ! { ! level = value + 1 ; ! items[(int) DIFFICULTY].value = level - 1 ; ! } ! ! ! static void ! set_player(item, value, event) /* Callback to set black/white player. */ ! Panel_item item ; ! int value ; ! Event *event ; ! { ! char *label ; ! enum panel_type this, other ; ! int curi, curo ; ! ! label = (char *) xv_get(item, PANEL_LABEL_STRING) ; ! if (EQUAL(label, "Black")) { ! this = BLACK_PLAYS ; ! other = WHITE_PLAYS ; } ! else ! { ! this = WHITE_PLAYS ; ! other = BLACK_PLAYS ; ! } ! ! curi = items[(int) this].value = value ; ! curo = items[(int) other].value ; ! ! if (curi == COMPUTER && curo == COMPUTER) ! { ! curi = HUMAN ; ! XV_SET(item, PANEL_VALUE, curi, 0) ; ! items[(int) this].value = curi ; ! message(PANEL_MES, "Computer can't play both players.") ; ! } ! if (curi == HUMAN && curo == COMPUTER) ! dtype = (this == BLACK_PLAYS) ? XBLACK : XWHITE ; ! else if (curi == COMPUTER && curo == HUMAN) ! dtype = (this == BLACK_PLAYS) ? XWHITE : XBLACK ; ! else if (curi == HUMAN && curo == HUMAN) ! dtype = (dtype == XTWO) ? XTWO : XBOTH ; ! ! if (curi == COMPUTER) ! if ((this == BLACK_PLAYS && cmode == BLACK_START) || ! (this == WHITE_PLAYS && cmode == WHITE_START)) ! computer_move(next_player) ; ! } ! ! ! Panel_setting ! start_load_save(item, event) ! Panel_item item ; ! Event *event ; ! { ! char *label ; ! ! XV_SET(ls_frame, XV_SHOW, FALSE, NULL) ; ! STRCPY(gamefile, (char *) xv_get(ls_text, PANEL_VALUE)) ; ! label = (char *) xv_get(ls_button, PANEL_LABEL_STRING) ; ! if (EQUAL(label, "Load")) load_game() ; ! else save_game() ; ! return(PANEL_NONE) ; ! } ! ! ! /*ARGSUSED*/ ! void ! start_tool(dtype) /* Display window and start the notifier. */ ! enum disp_type dtype ; ! { started = 1 ; xv_main_loop(frame) ; + } + + + static void /* Dummy function for unimplemented callbacks */ + unimplemented() + { + message(PANEL_MES, "Not implemented yet.\n") ; + } + + + static void + xv_load_game(item, value, event) /* Callback for loading a game button. */ + Panel_item item ; + int value ; + Event *event ; + { + position_popup(frame, ls_frame, P_RIGHT) ; + XV_SET(ls_text, PANEL_LABEL_STRING, "Load File: ", 0) ; + XV_SET(ls_button, PANEL_LABEL_STRING, "Load", 0) ; + XV_SET(ls_frame, XV_SHOW, TRUE, NULL) ; + } + + + static void + xv_save_game(item, value, event) /* Callback load saving a game button. */ + Panel_item item ; + int value ; + Event *event ; + { + position_popup(frame, ls_frame, P_RIGHT) ; + XV_SET(ls_text, PANEL_LABEL_STRING, "Save File: ", 0) ; + XV_SET(ls_button, PANEL_LABEL_STRING, "Save", 0) ; + XV_SET(ls_frame, XV_SHOW, TRUE, NULL) ; } ------- sunview.c ------- *** /tmp/da28890 Fri Nov 9 10:38:31 1990 --- sunview.c Mon Nov 5 09:08:30 1990 *************** *** 7,17 **** * Copyright (C) 1990 - Rich Burridge & Yves Gallot. * All rights reserved. * ! * Permission is given to distribute these sources, as long as the ! * introductory messages are not removed, and no monies are exchanged. * ! * You are forbidden from using Reve as is, or in a modified state, in ! * any tournaments, without the permission of the authors. * * No responsibility is taken for any errors or inaccuracies inherent * either to the comments or the code of this program, but if reported --- 7,22 ---- * Copyright (C) 1990 - Rich Burridge & Yves Gallot. * All rights reserved. * ! * Permission is granted to copy this source, for redistribution ! * in source form only, provided the news headers in "substantially ! * unaltered format" are retained, the introductory messages are not ! * removed, and no monies are exchanged. * ! * Permission is also granted to copy this source, without the ! * news headers, for the purposes of making an executable copy by ! * means of compilation, provided that such copy will not be used ! * for the purposes of competition in any othello tournaments, without ! * prior permission from the authors. * * No responsibility is taken for any errors or inaccuracies inherent * either to the comments or the code of this program, but if reported *************** *** 18,26 **** * (see README file), then an attempt will be made to fix them. */ - #include - #include "color.h" #include "reve.h" #include "extern.h" #include "images.h" #include --- 23,30 ---- * (see README file), then an attempt will be made to fix them. */ #include "reve.h" + #include "color.h" #include "extern.h" #include "images.h" #include *************** *** 316,322 **** CURSOR_SET(cursor[(int) HOURGLASS], CURSOR_OP, PIX_SRC ^ PIX_DST, 0) ; cursor[(int) NOCURSOR] = cursor_create(CURSOR_IMAGE, &nocur_pr, 0) ; CURSOR_SET(cursor[(int) NOCURSOR], CURSOR_OP, PIX_SRC ^ PIX_DST, 0) ; ! load_colors() ; images[(int) BUT_STENCIL] = &button_stencil_pr ; images[(int) BUT_INVERT] = &button_invert_pr ; --- 320,326 ---- CURSOR_SET(cursor[(int) HOURGLASS], CURSOR_OP, PIX_SRC ^ PIX_DST, 0) ; cursor[(int) NOCURSOR] = cursor_create(CURSOR_IMAGE, &nocur_pr, 0) ; CURSOR_SET(cursor[(int) NOCURSOR], CURSOR_OP, PIX_SRC ^ PIX_DST, 0) ; ! if (!monochrome) load_colors() ; images[(int) BUT_STENCIL] = &button_stencil_pr ; images[(int) BUT_INVERT] = &button_invert_pr ;