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