games-request@tekred.TEK.COM (01/22/88)
Submitted by: Kurt Hoyt <kwh@sei.cmu.edu> Comp.sources.games: Volume 3, Issue 67 Archive-name: x11conq/Part01 [As the subject line says, this and the next two files are a set of diffs to apply to the previously posted xconq game to make it run in an X-windows, version 11 environment. (If you don't have the original xconq posting, it can be found from a number of archive sites. If you need a list of archive sites, send me mail.) -br] #! /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 1 (of 3)." # Contents: MANIFEST x11diffs.1 # Wrapped by billr@tekred on Wed Jan 20 08:46:41 1988 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f MANIFEST -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"MANIFEST\" else echo shar: Extracting \"MANIFEST\" \(234 characters\) sed "s/^X//" >MANIFEST <<'END_OF_MANIFEST' X File Name Archive # Description X----------------------------------------------------------- X MANIFEST 1 This shipping list X x11diffs.1 1 X x11diffs.2 2 X x11diffs.3 3 END_OF_MANIFEST if test 234 -ne `wc -c <MANIFEST`; then echo shar: \"MANIFEST\" unpacked with wrong size! fi # end of overwriting check fi if test -f x11diffs.1 -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"x11diffs.1\" else echo shar: Extracting \"x11diffs.1\" \(40544 characters\) sed "s/^X//" >x11diffs.1 <<'END_OF_x11diffs.1' Xdiff -c ./MANIFEST X11/MANIFEST X*** ./MANIFEST Thu Jul 16 14:55:00 1987 X--- X11/MANIFEST Wed Oct 28 08:20:56 1987 X*************** X*** 37,41 X xconq.c 5 X xconq.h 3 X xconq.nr 1 X! xmap.6 5 X! xmap.c 7 X X--- 37,40 ----- X xconq.c 5 X xconq.h 3 X xconq.nr 1 X! Xdiff -c ./Makefile X11/Makefile X*** ./Makefile Thu Jul 16 14:55:00 1987 X--- X11/Makefile Wed Oct 28 08:36:30 1987 X*************** X*** 12,18 X X MANDIR = /usr/local/man/man6 X X! XFONTPATH = /usr/new/lib/X/font X X # This name sets the default period for xconq. WWII is most familiar and X # popular. X X--- 12,18 ----- X X MANDIR = /usr/local/man/man6 X X! XFONTPATH = /usr/lib/X11/fonts X X # This name sets the default period for xconq. WWII is most familiar and X # popular. X*************** X*** 22,28 X OBJ = xconq.o init.o do.o mplay.o move.o atk.o side.o city.o unit.o order.o \ X util.o X.o input.o draw.o output.o help.o X X! LIBS = -lX X X CFLAGS = -O -D$(SYSTEM) X # -DXCONQDIR="$(DESTDIR)" -DXCONQLIB="$(LIBDIR)" X X--- 22,28 ----- X OBJ = xconq.o init.o do.o mplay.o move.o atk.o side.o city.o unit.o order.o \ X util.o X.o input.o draw.o output.o help.o X X! LIBS = -lX11 X X CFLAGS = -O -D$(SYSTEM) X # -DXCONQDIR="$(DESTDIR)" -DXCONQLIB="$(LIBDIR)" X*************** X*** 27,33 X CFLAGS = -O -D$(SYSTEM) X # -DXCONQDIR="$(DESTDIR)" -DXCONQLIB="$(LIBDIR)" X X! all: xconq xconq.doc mkmap xmap X X # The standard game X X X--- 27,33 ----- X CFLAGS = -O -D$(SYSTEM) X # -DXCONQDIR="$(DESTDIR)" -DXCONQLIB="$(LIBDIR)" X X! all: xconq xconq.doc mkmap X X # The standard game X X*************** X*** 32,38 X # The standard game X X xconq: $(OBJ) $(PERIODOBJ) X! cc -o xconq $(CFLAGS) $(OBJ) $(PERIODOBJ) $(LIBS) X X # For connoiseurs X X X--- 32,38 ----- X # The standard game X X xconq: $(OBJ) $(PERIODOBJ) X! cc -o x11conq $(CFLAGS) $(OBJ) $(PERIODOBJ) $(LIBS) X X # For connoiseurs X X*************** X*** 37,43 X # For connoiseurs X X gxconq: $(OBJ) greek.o X! cc -o gxconq $(CFLAGS) $(OBJ) greek.o $(LIBS) X X nxconq: $(OBJ) napoleon.o X cc -o nxconq $(CFLAGS) $(OBJ) napoleon.o $(LIBS) X X--- 37,43 ----- X # For connoiseurs X X gxconq: $(OBJ) greek.o X! cc -o gx11conq $(CFLAGS) $(OBJ) greek.o $(LIBS) X X nxconq: $(OBJ) napoleon.o X cc -o nx11conq $(CFLAGS) $(OBJ) napoleon.o $(LIBS) X*************** X*** 40,46 X cc -o gxconq $(CFLAGS) $(OBJ) greek.o $(LIBS) X X nxconq: $(OBJ) napoleon.o X! cc -o nxconq $(CFLAGS) $(OBJ) napoleon.o $(LIBS) X X # Dependencies on include files X X X--- 40,46 ----- X cc -o gx11conq $(CFLAGS) $(OBJ) greek.o $(LIBS) X X nxconq: $(OBJ) napoleon.o X! cc -o nx11conq $(CFLAGS) $(OBJ) napoleon.o $(LIBS) X X # Dependencies on include files X X*************** X*** 60,68 X mkmap: mkmap.c mkmap.h X cc -o mkmap $(CFLAGS) mkmap.c X X- xmap: xmap.c X- cc -o xmap $(CFLAGS) xmap.c -lX X- X # Installation requires programs in $(DESTDIR) and a library directory. X X install: X X--- 60,65 ----- X mkmap: mkmap.c mkmap.h X cc -o mkmap $(CFLAGS) mkmap.c X X # Installation requires programs in $(DESTDIR) and a library directory. X X install: X*************** X*** 66,72 X # Installation requires programs in $(DESTDIR) and a library directory. X X install: X! cp xconq mkmap xmap $(DESTDIR) X cp lib/* $(LIBDIR) X cp lib/*.onx $(XFONTPATH) X cp *.6 $(MANDIR) X X--- 63,69 ----- X # Installation requires programs in $(DESTDIR) and a library directory. X X install: X! cp x11conq mkmap $(DESTDIR) X cp lib/* $(LIBDIR) X cp lib/*.snf $(XFONTPATH) X cp *.6 $(MANDIR) X*************** X*** 68,74 X install: X cp xconq mkmap xmap $(DESTDIR) X cp lib/* $(LIBDIR) X! cp lib/*.onx $(XFONTPATH) X cp *.6 $(MANDIR) X X clean: X X--- 65,71 ----- X install: X cp x11conq mkmap $(DESTDIR) X cp lib/* $(LIBDIR) X! cp lib/*.snf $(XFONTPATH) X cp *.6 $(MANDIR) X X clean: X*************** X*** 72,78 X cp *.6 $(MANDIR) X X clean: X! rm -f xconq gxconq nxconq mkmap xmap *.o *.xconq X X # Pretty output for your favorite fancy printer X X X--- 69,75 ----- X cp *.6 $(MANDIR) X X clean: X! rm -f x11conq gx11conq nx11conq mkmap *.o *.xconq X X # Pretty output for your favorite fancy printer X X*************** X*** 90,96 X X rinstall: X ( netunam $(DISTER) shebs: ; \ X! bsdcp -p xconq mkmap xmap xconq.doc $(DISTER)$(DESTDIR); \ X bsdcp -p lib/*.onx lib/xconq.news $(DISTER)$(LIBDIR); \ X bsdcp -p lib/*.map lib/*.scn $(DISTER)$(LIBDIR); \ X bsdcp -p *.6 $(DISTER)$(MANDIR); ) X X--- 87,93 ----- X X rinstall: X ( netunam $(DISTER) shebs: ; \ X! bsdcp -p x11conq mkmap xconq.doc $(DISTER)$(DESTDIR); \ X bsdcp -p lib/*.onx lib/xconq.news $(DISTER)$(LIBDIR); \ X bsdcp -p lib/*.map lib/*.scn $(DISTER)$(LIBDIR); \ X bsdcp -p *.6 $(DISTER)$(MANDIR); ) X*************** X*** 100,108 X # reducing 200K to 20K... X X shar: X! uuencode ww2.onx <lib/ww2.onx >ww2.u X! uuencode greek.onx <lib/greek.onx >greek.u X! uuencode 1800.onx <lib/1800.onx >1800.u X shar ReadMe Makefile Xdefaults *.6 *.nr >shar.1 X shar [A-Za-c]*.[ch] >shar.2 X shar [d-l]*.[ch] >shar.3 X X--- 97,105 ----- X # reducing 200K to 20K... X X shar: X! uuencode ww2.snf <lib/ww2.snf >ww2.u X! uuencode greek.snf <lib/greek.snf >greek.u X! uuencode 1800.snf <lib/1800.snf >1800.u X shar ReadMe Makefile Xdefaults *.6 *.nr >shar.1 X shar [A-Za-c]*.[ch] >shar.2 X shar [d-l]*.[ch] >shar.3 Xdiff -c ./README X11/README X*** ./README Thu Jul 16 14:55:01 1987 X--- X11/README Wed Oct 28 08:40:03 1987 X*************** X*** 3,9 X To get started, follow these steps: X X 0. Finish the unpacking process by doing "make unshar". This uuudecodes X! and uncompresses some files. X X 1. Look at config.h and edit as desired. The most important items are X the system you're using and the pathnames to the aux programs and map X X--- 3,9 ----- X To get started, follow these steps: X X 0. Finish the unpacking process by doing "make unshar". This uuudecodes X! and uncompresses some files. (Not needed with the tar file) X X 1. Look at config.h and edit as desired. The most important items are X the system you're using and the pathnames to the aux programs and map X*************** X*** 15,21 X 3. "make all" should build everything that needs to be built, with the X exception of some specialized games (see the Makefile for details). X X! 4. Decide what to do about the X fonts *.onx. If your X can load from X an absolute pathname, then make sure they're in the xconq library directory. X They can also live in the default X font directory - xconq will always look X in both places for a font. Note that HP's X needs an easy fix to load from X X--- 15,21 ----- X 3. "make all" should build everything that needs to be built, with the X exception of some specialized games (see the Makefile for details). X X! 4. Decide what to do about the X fonts *.{bdf|snf}. If your X can load from X an absolute pathname, then make sure they're in the xconq library directory. X They can also live in the default X font directory - xconq will always look X in both places for a font. Note that HP's X needs an easy fix to load from X*************** X*** 55,57 X stan shebs X shebs@cs.utah.edu X seismo!utah-cs!shebs X X--- 55,77 ----- X stan shebs X shebs@cs.utah.edu X seismo!utah-cs!shebs X+ X11 notes: X+ X+ 1. The executable is called x11conq, in case you want to keep xconq for X10 X+ around in the same directory. It will read the same map and scenario files X+ and produce stats files exactly like xconq. The only difference is that it X+ runs under X11 instead of X10. If you want to call it xconq, you can X+ substitute xconq for x11conq in the Makefile or mv the executable. 'make X+ install' looks for x11conq to install. X+ X+ 2. I have access to a monochrome only uVax, so color hasn't been tested and X+ may not work at all. Check the get_colors routine in X.c if you have trouble. X+ X+ 3. I haven't tried playing it over a network. The X11 code works on a single X+ machine, and X is supposed to be network transparent.... X+ X+ 4. Testing has been done on a uVax running Ultrix 1.2 with XV11R1, fixes X+ 1-30. Other than that, you're on your own. X+ X+ Kurt Hoyt X+ kwh@sei.cmu.edu Xdiff -c ./X.c X11/X.c X*** ./X.c Thu Jul 16 14:55:01 1987 X--- X11/X.c Mon Nov 2 11:13:50 1987 X*************** X*** 1,4 X! /* Copyright (c) 1987 Stanley T. Shebs, University of Utah. */ X /* This program may be used, copied, modified, and redistributed freely */ X /* for noncommercial purposes, so long as this notice remains intact. */ X X X--- 1,5 ----- X! /* Copyright (c) 1987 Stanley T. Shebs, University of Utah; */ X! /* Kurt W. Hoyt, Software Engineering Institute. */ X /* This program may be used, copied, modified, and redistributed freely */ X /* for noncommercial purposes, so long as this notice remains intact. */ X X*************** X*** 2,8 X /* This program may be used, copied, modified, and redistributed freely */ X /* for noncommercial purposes, so long as this notice remains intact. */ X X! /* RCS $Header: X.c,v 1.9 87/06/08 21:44:52 shebs Exp $ */ X X #include "xconq.h" X X X--- 3,9 ----- X /* This program may be used, copied, modified, and redistributed freely */ X /* for noncommercial purposes, so long as this notice remains intact. */ X X! /* RCS $Header: X.c,v 1.9 87/10/27 10:23:25 kwh Exp $ */ X X #include "xconq.h" X X*************** X*** 66,71 X { X Side *side; X X mapmag = min(5, (MAXWIDTH / worldwidth)); X vwid = min(worldwidth, VWID); X vhgt = min(worldheight, VHGT); X X--- 67,85 ----- X { X Side *side; X X+ for_all_sides(side) { X+ if (side->host != NULL) { X+ if (debug) printf ("Opening display %s.\n", side->host); X+ open_display(side); X+ if (debug) printf ("Display %s opened.\n", side->host); X+ } X+ } X+ } X+ X+ open_windows() X+ { X+ Side *side; X+ X mapmag = min(5, (MAXWIDTH / worldwidth)); X vwid = min(worldwidth, VWID); X vhgt = min(worldheight, VHGT); X*************** X*** 72,77 X vwid2 = vwid/2; X vhgt2 = vhgt/2; X X for_all_sides(side) { X if (side->host != NULL) { X open_display(side); X X--- 86,95 ----- X vwid2 = vwid/2; X vhgt2 = vhgt/2; X X+ if (debug) X+ printf ("mapmag = %d, vwid = %d, vhgt = %d, vwid2 = %d, vhgt2 = %d\n", X+ mapmag, vwid, vhgt, vwid2, vhgt2); X+ X for_all_sides(side) { X if (side->host != NULL) { X if (debug) printf ("Making windows for %s.\n", side->host); X*************** X*** 74,80 X X for_all_sides(side) { X if (side->host != NULL) { X! open_display(side); X } X } X } X X--- 92,100 ----- X X for_all_sides(side) { X if (side->host != NULL) { X! if (debug) printf ("Making windows for %s.\n", side->host); X! open_window(side); X! if (debug) printf ("Windows for %s made.\n", side->host); X } X } X } X*************** X*** 87,95 X open_display(side) X Side *side; X { X! int i, mainwidth, mainheight; X! Window mainwin; X! X if ((side->display = XOpenDisplay(side->host)) == NULL) { X fprintf(stderr, "Display %s could not be opened!\n", side->host); X exit(0); X X--- 107,113 ----- X open_display(side) X Side *side; X { X! if (debug) printf ("Doing XOpenDisplay(%s).\n", side->host); X if ((side->display = XOpenDisplay(side->host)) == NULL) { X fprintf(stderr, "Display %s could not be opened!\n", side->host); X exit(0); X*************** X*** 94,100 X fprintf(stderr, "Display %s could not be opened!\n", side->host); X exit(0); X } X! XSetDisplay(side->display); X X get_fonts(side); X get_colors(side); X X--- 112,118 ----- X fprintf(stderr, "Display %s could not be opened!\n", side->host); X exit(0); X } X! } X X open_window(side) X Side *side; X*************** X*** 96,101 X } X XSetDisplay(side->display); X X get_fonts(side); X get_colors(side); X store_bitmaps(side); X X--- 114,131 ----- X } X } X X+ open_window(side) X+ Side *side; X+ { X+ unsigned long white = WhitePixel(side->display, 0); X+ unsigned long black = BlackPixel(side->display, 0); X+ int mainwidth; X+ int mainheight; X+ int i; X+ Display *disp = side->display; X+ Window mainwin; X+ XEvent event; X+ X get_fonts(side); X if (debug) printf ("...fonts\n"); X X*************** X*** 97,104 X XSetDisplay(side->display); X X get_fonts(side); X! get_colors(side); X! store_bitmaps(side); X X mainwidth = MAPWINSIZE + MAXWIDTH + 1; X mainheight = MAPWINSIZE + 13*fh + 3; X X--- 127,133 ----- X XEvent event; X X get_fonts(side); X! if (debug) printf ("...fonts\n"); X X mainwidth = MAPWINSIZE + MAXWIDTH + 1; X mainheight = MAPWINSIZE + 13*fh + 3; X*************** X*** 103,117 X mainwidth = MAPWINSIZE + MAXWIDTH + 1; X mainheight = MAPWINSIZE + 13*fh + 3; X X! side->bordertile = XMakeTile(side->bdcolor); X! /* kludge test - why doesn't this work for microvaxen? */ X! if (!side->fewcolors) { X! side->dotpix = XMakePixmap(side->dots, side->graycolor, side->bgcolor); X! } else { X! side->dotpix = BlackPixmap; X! } X! side->main = XCreateWindow(RootWindow, 50, 3, mainwidth, mainheight, X! 3, side->bordertile, side->dotpix); X mainwin = side->main; X X side->msg = XCreateWindow(mainwin, 0, 0, mainwidth, 10*fh, X X--- 132,140 ----- X mainwidth = MAPWINSIZE + MAXWIDTH + 1; X mainheight = MAPWINSIZE + 13*fh + 3; X X! side->main = XCreateSimpleWindow(disp, RootWindow (disp, 0), 50, 3, X! mainwidth, mainheight, 3, white, black); X! X mainwin = side->main; X side->gc = XCreateGC(disp, mainwin, 0, NULL); X X*************** X*** 113,118 X side->main = XCreateWindow(RootWindow, 50, 3, mainwidth, mainheight, X 3, side->bordertile, side->dotpix); X mainwin = side->main; X X side->msg = XCreateWindow(mainwin, 0, 0, mainwidth, 10*fh, X 1, side->bordertile, BlackPixmap); X X--- 136,142 ----- X mainwidth, mainheight, 3, white, black); X X mainwin = side->main; X+ side->gc = XCreateGC(disp, mainwin, 0, NULL); X X side->msg = XCreateSimpleWindow(disp, mainwin, 0, 0, X mainwidth, 10*fh, 1, white, black); X*************** X*** 114,147 X 3, side->bordertile, side->dotpix); X mainwin = side->main; X X! side->msg = XCreateWindow(mainwin, 0, 0, mainwidth, 10*fh, X! 1, side->bordertile, BlackPixmap); X! side->info = XCreateWindow(mainwin, 0, 10*fh+1, mainwidth, 2*fh, X! 1, side->bordertile, BlackPixmap); X! side->prompt = XCreateWindow(mainwin, 0, 12*fh+2, mainwidth, 1*fh, X! 1, side->bordertile, BlackPixmap); X! side->map = XCreateWindow(mainwin, 0, 13*fh+3, MAPWINSIZE, MAPWINSIZE, X! 1, side->bordertile, BlackPixmap); X! side->time = XCreateWindow(mainwin, MAPWINSIZE+fw, 13*fh+3+7, 9*fw, fh, X! 1, side->bordertile, BlackPixmap); X! side->clock = XCreateWindow(mainwin, X! MAPWINSIZE+fw+9*fw+fw, 13*fh+3+7, 2*fw, fh, X! 1, side->bordertile, BlackPixmap); X! side->mode = XCreateWindow(mainwin, X! MAPWINSIZE+12*fw+3*fw, 13*fh+3+7, 11*fw, fh, X! 1, side->bordertile, BlackPixmap); X! side->state = XCreateWindow(mainwin, MAPWINSIZE+1, 13*fh+3+7+fh+7, X! MAXWIDTH, 2*fh, X! 1, side->bordertile, BlackPixmap); X! side->sides = XCreateWindow(mainwin, MAPWINSIZE+1, 13*fh+3+7+fh+7+2*fh+7, X! MAXWIDTH, numsides*fh, X! 1, side->bordertile, BlackPixmap); X! side->world = XCreateWindow(mainwin, X! MAPWINSIZE+1, mainheight-mapmag*worldheight, X! worldwidth*mapmag, worldheight*mapmag, X! 1, side->bordertile, BlackPixmap); X! side->help = XCreateWindow(mainwin, 0, 13*fh+3, MAPWINSIZE, MAPWINSIZE, X! 1, side->bordertile, BlackPixmap); X X XStoreName(mainwin, programname); X XMapWindow(mainwin); X X--- 138,169 ----- X mainwin = side->main; X side->gc = XCreateGC(disp, mainwin, 0, NULL); X X! side->msg = XCreateSimpleWindow(disp, mainwin, 0, 0, X! mainwidth, 10*fh, 1, white, black); X! side->info = XCreateSimpleWindow(disp, mainwin, 0, 10*fh+1, X! mainwidth, 2*fh, 1, white, black); X! side->prompt = XCreateSimpleWindow(disp, mainwin, 0, 12*fh+2, X! mainwidth, 1*fh, 1, white, black); X! side->map = XCreateSimpleWindow(disp, mainwin, 0, 13*fh+3, X! MAPWINSIZE, MAPWINSIZE, 1, white, black); X! side->time = XCreateSimpleWindow(disp, mainwin, MAPWINSIZE+fw, X! 13*fh+3+7, 9*fw, fh, 1, white, black); X! side->clock = XCreateSimpleWindow(disp, mainwin, MAPWINSIZE+fw+9*fw+fw, X! 13*fh+3+7, 2*fw, fh, 1, white, black); X! side->mode = XCreateSimpleWindow(disp, mainwin, MAPWINSIZE+12*fw+3*fw, X! 13*fh+3+7, 11*fw, fh, 1, white, black); X! side->state = XCreateSimpleWindow(disp, mainwin, MAPWINSIZE+1, X! 13*fh+3+7+fh+7, MAXWIDTH, 2*fh, X! 1, white, black); X! side->sides = XCreateSimpleWindow(disp, mainwin, MAPWINSIZE+1, X! 13*fh+3+7+fh+7+2*fh+7, MAXWIDTH, X! numsides*fh, 1, white, black); X! side->world = XCreateSimpleWindow(disp, mainwin, MAPWINSIZE+1, X! mainheight-mapmag*worldheight, X! worldwidth*mapmag, worldheight*mapmag, X! 1, white, black); X! side->help = XCreateSimpleWindow(disp, side->map, 0, 0, MAPWINSIZE, X! MAPWINSIZE, 1, white, black); X X get_colors(side); X store_bitmaps(side); X*************** X*** 143,154 X side->help = XCreateWindow(mainwin, 0, 13*fh+3, MAPWINSIZE, MAPWINSIZE, X 1, side->bordertile, BlackPixmap); X X! XStoreName(mainwin, programname); X! XMapWindow(mainwin); X! XMapSubwindows(mainwin); X! XUnmapWindow(side->help); X! XDefineCursor(side->map, side->curs); X! XSelectInput(mainwin, KeyPressed|ButtonPressed|ExposeRegion|ExposeWindow); X X /* initialize random parameters */ X /* one-char strings simplify screen refresh */ X X--- 165,172 ----- X side->help = XCreateSimpleWindow(disp, side->map, 0, 0, MAPWINSIZE, X MAPWINSIZE, 1, white, black); X X! get_colors(side); X! store_bitmaps(side); X X XStoreName(disp, mainwin, programname); X XDefineCursor(disp, side->map, side->curs); X*************** X*** 150,155 X XDefineCursor(side->map, side->curs); X XSelectInput(mainwin, KeyPressed|ButtonPressed|ExposeRegion|ExposeWindow); X X /* initialize random parameters */ X /* one-char strings simplify screen refresh */ X for (i = 0; i < MAXNOTES; ++i) { X X--- 168,185 ----- X get_colors(side); X store_bitmaps(side); X X+ XStoreName(disp, mainwin, programname); X+ XDefineCursor(disp, side->map, side->curs); X+ XSelectInput(disp, side->map, KeyPressMask|ButtonPressMask|ExposureMask); X+ XMapWindow(disp, mainwin); X+ XMapSubwindows(disp, mainwin); X+ XUnmapWindow(disp, side->help); X+ X+ XWindowEvent(side->display, side->map, ExposureMask, &event); X+ if (event.type == Expose || event.type == GraphicsExpose) { X+ redraw (side); X+ XSync(side->display, TRUE); /* suppress extra events */ X+ } X /* initialize random parameters */ X /* one-char strings simplify screen refresh */ X for (i = 0; i < MAXNOTES; ++i) { X*************** X*** 171,176 X Side *side; X { X char *font1, *font2; X X if ((font1 = XGetDefault(programname, "BodyFont")) == NULL) X font1 = "9x15"; X X--- 201,207 ----- X Side *side; X { X char *font1, *font2; X+ int ifw, ifh; X X if ((font1 = XGetDefault(side->display, programname, "BodyFont")) == NULL) X font1 = "9x15"; X*************** X*** 172,178 X { X char *font1, *font2; X X! if ((font1 = XGetDefault(programname, "BodyFont")) == NULL) X font1 = "9x15"; X if ((side->msgfontinfo = XOpenFont(font1)) == NULL) { X perror(font1); X X--- 203,209 ----- X char *font1, *font2; X int ifw, ifh; X X! if ((font1 = XGetDefault(side->display, programname, "BodyFont")) == NULL) X font1 = "9x15"; X if ((side->msgfontinfo = XLoadQueryFont(side->display, font1)) == NULL) { X perror(font1); X*************** X*** 174,180 X X if ((font1 = XGetDefault(programname, "BodyFont")) == NULL) X font1 = "9x15"; X! if ((side->msgfontinfo = XOpenFont(font1)) == NULL) { X perror(font1); X exit(1); X } X X--- 205,211 ----- X X if ((font1 = XGetDefault(side->display, programname, "BodyFont")) == NULL) X font1 = "9x15"; X! if ((side->msgfontinfo = XLoadQueryFont(side->display, font1)) == NULL) { X perror(font1); X exit(1); X } X*************** X*** 178,186 X perror(font1); X exit(1); X } X! side->msgfont = side->msgfontinfo->id; X! fw = side->msgfontinfo->width; X! fh = side->msgfontinfo->height; X X if ((font2 = XGetDefault(programname, "IconFont")) == NULL) X font2 = fontname; X X--- 209,219 ----- X perror(font1); X exit(1); X } X! side->msgfont = side->msgfontinfo->fid; X! fw = side->msgfontinfo->max_bounds.rbearing - X! side->msgfontinfo->min_bounds.lbearing; X! fh = side->msgfontinfo->max_bounds.ascent + X! side->msgfontinfo->max_bounds.descent; X X if (debug) printf ("fw = %d, fh = %d\n", fw, fh); X X*************** X*** 182,188 X fw = side->msgfontinfo->width; X fh = side->msgfontinfo->height; X X! if ((font2 = XGetDefault(programname, "IconFont")) == NULL) X font2 = fontname; X if ((side->iconfontinfo = XOpenFont(font2)) == NULL) { X make_lib_pathname(fontname, "onx", spbuf); X X--- 215,223 ----- X fh = side->msgfontinfo->max_bounds.ascent + X side->msgfontinfo->max_bounds.descent; X X! if (debug) printf ("fw = %d, fh = %d\n", fw, fh); X! X! if ((font2 = XGetDefault(side->display, programname, "IconFont")) == NULL) X font2 = fontname; X if ((side->iconfontinfo = XLoadQueryFont(side->display, font2)) == NULL) { X make_lib_pathname(fontname, "snf", spbuf); X*************** X*** 184,191 X X if ((font2 = XGetDefault(programname, "IconFont")) == NULL) X font2 = fontname; X! if ((side->iconfontinfo = XOpenFont(font2)) == NULL) { X! make_lib_pathname(fontname, "onx", spbuf); X font2 = spbuf; X if ((side->iconfontinfo = XOpenFont(font2)) == NULL) { X fprintf(stderr, X X--- 219,226 ----- X X if ((font2 = XGetDefault(side->display, programname, "IconFont")) == NULL) X font2 = fontname; X! if ((side->iconfontinfo = XLoadQueryFont(side->display, font2)) == NULL) { X! make_lib_pathname(fontname, "snf", spbuf); X font2 = spbuf; X if ((side->iconfontinfo = X XLoadQueryFont(side->display, font2)) == NULL) { X*************** X*** 187,193 X if ((side->iconfontinfo = XOpenFont(font2)) == NULL) { X make_lib_pathname(fontname, "onx", spbuf); X font2 = spbuf; X! if ((side->iconfontinfo = XOpenFont(font2)) == NULL) { X fprintf(stderr, X "Warning: Can't open icon font - substituting letters\n"); X if ((side->iconfontinfo = XOpenFont(font1)) == NULL) { X X--- 222,229 ----- X if ((side->iconfontinfo = XLoadQueryFont(side->display, font2)) == NULL) { X make_lib_pathname(fontname, "snf", spbuf); X font2 = spbuf; X! if ((side->iconfontinfo = X! XLoadQueryFont(side->display, font2)) == NULL) { X fprintf(stderr, X "Warning: Can't open icon font - substituting letters\n"); X if ((side->iconfontinfo = X*************** X*** 190,196 X if ((side->iconfontinfo = XOpenFont(font2)) == NULL) { X fprintf(stderr, X "Warning: Can't open icon font - substituting letters\n"); X! if ((side->iconfontinfo = XOpenFont(font1)) == NULL) { X perror(font2); X exit(1); X } X X--- 226,233 ----- X XLoadQueryFont(side->display, font2)) == NULL) { X fprintf(stderr, X "Warning: Can't open icon font - substituting letters\n"); X! if ((side->iconfontinfo = X! XLoadQueryFont(side->display, font1)) == NULL) { X perror(font2); X exit(1); X } X*************** X*** 196,202 X } X } X } X! if (side->iconfontinfo->width != SQ || side->iconfontinfo->height != SQ) { X fprintf(stderr, "Warning: Icon font is %dx%d, should be %dx%d\n", X side->iconfontinfo->width, side->iconfontinfo->height, X SQ, SQ); X X--- 233,247 ----- X } X } X } X! X! ifw = side->iconfontinfo->max_bounds.rbearing - X! side->iconfontinfo->min_bounds.lbearing; X! ifh = side->iconfontinfo->max_bounds.ascent + X! side->iconfontinfo->max_bounds.descent; X! X! if (debug) printf ("ifw = %d, ifh = %d\n", ifw, ifh); X! X! if (ifw != SQ || ifh != SQ) { X fprintf(stderr, "Warning: Icon font is %dx%d, should be %dx%d\n", X ifw, ifh, SQ, SQ); X } X*************** X*** 198,205 X } X if (side->iconfontinfo->width != SQ || side->iconfontinfo->height != SQ) { X fprintf(stderr, "Warning: Icon font is %dx%d, should be %dx%d\n", X! side->iconfontinfo->width, side->iconfontinfo->height, X! SQ, SQ); X } X side->iconfont = side->iconfontinfo->id; X } X X--- 243,249 ----- X X if (ifw != SQ || ifh != SQ) { X fprintf(stderr, "Warning: Icon font is %dx%d, should be %dx%d\n", X! ifw, ifh, SQ, SQ); X } X side->iconfont = side->iconfontinfo->fid; X } X*************** X*** 201,207 X side->iconfontinfo->width, side->iconfontinfo->height, X SQ, SQ); X } X! side->iconfont = side->iconfontinfo->id; X } X X /* Acquire a set of colors. There are too many to make it feasible to */ X X--- 245,251 ----- X fprintf(stderr, "Warning: Icon font is %dx%d, should be %dx%d\n", X ifw, ifh, SQ, SQ); X } X! side->iconfont = side->iconfontinfo->fid; X } X X /* Acquire a set of colors. There are too many to make it feasible to */ X*************** X*** 216,229 X int i; X X /* this set should work everywhere, though not well */ X! side->bgcolor = BlackPixel; X! side->owncolor = BlackPixel; X! side->curscolor = BlackPixel; X! side->enemycolor = BlackPixel; X! side->fgcolor = WhitePixel; X! side->bdcolor = WhitePixel; X! side->graycolor = WhitePixel; X! if (Debug) printf("%d colors available\n", DisplayCells()); X /* now try to get better colors if possible */ X X /* blow this off -- since our gpx has only grey values -- jrk */ X X--- 260,275 ----- X int i; X X /* this set should work everywhere, though not well */ X! XSetForeground (side->display, side->gc, WhitePixel (side->display, 0)); X! XSetBackground (side->display, side->gc, BlackPixel (side->display, 0)); X! side->fgcolor = WhitePixel(side->display, 0); X! side->bgcolor = BlackPixel(side->display, 0); X! side->owncolor = BlackPixel(side->display, 0); X! side->curscolor = BlackPixel(side->display, 0); X! side->enemycolor = BlackPixel(side->display, 0); X! side->bdcolor = WhitePixel(side->display, 0); X! side->graycolor = WhitePixel(side->display, 0); X! if (Debug) printf("%d colors available\n", DisplayCells(side->display,0)); X /* now try to get better colors if possible */ X X /* blow this off -- since our gpx has only grey values -- jrk */ X*************** X*** 244,250 X } else { X side->fewcolors = TRUE; X for (i = 0; i < NUMTERRTYPES; ++i) { X! side->sqcolor[i] = WhitePixel; X } X } X */ X X--- 290,296 ----- X } else { X side->fewcolors = TRUE; X for (i = 0; i < NUMTERRTYPES; ++i) { X! side->sqcolor[i] = WhitePixel(side->display, 0); X } X } X */ X*************** X*** 251,257 X /* instead, the else clause from above */ X side->fewcolors = TRUE; X for (i=0; i < NUMTERRTYPES; ++i) { X! side->sqcolor[i] = request_color(terrcolors[i]); X } X } X X X--- 297,303 ----- X /* instead, the else clause from above */ X side->fewcolors = TRUE; X for (i=0; i < NUMTERRTYPES; ++i) { X! side->sqcolor[i] = WhitePixel(side->display, 0); X } X } X X*************** X*** 260,266 X request_color(name) X char *name; X { X! Color truecolor, availcolor; X X XGetColor(name, &availcolor, &truecolor); X XGetHardwareColor(&availcolor); X X--- 306,312 ----- X request_color(name) X char *name; X { X! XColor truecolor, availcolor; X X /* XGetColor(name, &availcolor, &truecolor); X XGetHardwareColor(&availcolor); X*************** X*** 262,268 X { X Color truecolor, availcolor; X X! XGetColor(name, &availcolor, &truecolor); X XGetHardwareColor(&availcolor); X if (truecolor.red != availcolor.red || X truecolor.green != availcolor.green || X X--- 308,314 ----- X { X XColor truecolor, availcolor; X X! /* XGetColor(name, &availcolor, &truecolor); X XGetHardwareColor(&availcolor); X if (truecolor.red != availcolor.red || X truecolor.green != availcolor.green || X*************** X*** 271,277 X fprintf(stderr, "(%d %d %d instead of %d %d %d)\n", X availcolor.red, availcolor.green, availcolor.blue, X truecolor.red, truecolor.green, truecolor.blue); X! } X return availcolor.pixel; X } X X X--- 317,323 ----- X fprintf(stderr, "(%d %d %d instead of %d %d %d)\n", X availcolor.red, availcolor.green, availcolor.blue, X truecolor.red, truecolor.green, truecolor.blue); X! }*/ X return availcolor.pixel; X } X X*************** X*** 284,289 X Side *side; X { X int actualwidth, actualheight; X X side->ccurs = XStoreBitmap(SQ, SQ, ccurs_bits); X side->cmask = XStoreBitmap(SQ, SQ, cmask_bits); X X--- 330,339 ----- X Side *side; X { X int actualwidth, actualheight; X+ Display *disp = side->display; X+ Window win = side->main; X+ XColor white, black, dummy; X+ Colormap cmap; X X side->ccurs = XCreateBitmapFromData(disp, win, ccurs_bits, SQ, SQ); X side->cmask = XCreateBitmapFromData(disp, win, cmask_bits, SQ, SQ); X*************** X*** 285,298 X { X int actualwidth, actualheight; X X! side->ccurs = XStoreBitmap(SQ, SQ, ccurs_bits); X! side->cmask = XStoreBitmap(SQ, SQ, cmask_bits); X! side->bombpics[0] = XStoreBitmap(bomb1_width, bomb1_height, bomb1_bits); X! side->bombpics[1] = XStoreBitmap(bomb2_width, bomb2_height, bomb2_bits); X! side->bombpics[2] = XStoreBitmap(bomb3_width, bomb3_height, bomb3_bits); X! side->mcurs = XStoreBitmap(SQ, SQ, mcurs_bits); X! side->mmask = XStoreBitmap(SQ, SQ, mmask_bits); X! side->dots = XStoreBitmap(dots_width, dots_height, dots_bits); X X /* Bobcats generate curious results on this... X XQueryCursorShape(SQ, SQ, &actualwidth, &actualheight); X X--- 335,352 ----- X XColor white, black, dummy; X Colormap cmap; X X! side->ccurs = XCreateBitmapFromData(disp, win, ccurs_bits, SQ, SQ); X! side->cmask = XCreateBitmapFromData(disp, win, cmask_bits, SQ, SQ); X! side->bombpics[0] = XCreateBitmapFromData(disp, win, bomb1_bits, X! bomb1_width, bomb1_height); X! side->bombpics[1] = XCreateBitmapFromData(disp, win, bomb2_bits, X! bomb2_width, bomb2_height); X! side->bombpics[2] = XCreateBitmapFromData(disp, win, bomb3_bits, X! bomb3_width, bomb3_height); X! side->mcurs = XCreateBitmapFromData(disp, win, mcurs_bits, SQ, SQ); X! side->mmask = XCreateBitmapFromData(disp, win, mmask_bits, SQ, SQ); X! side->dots = XCreateBitmapFromData(disp, win, dots_bits, X! dots_width, dots_height); X X /* Bobcats generate curious results on this... X XQueryCursorShape(SQ, SQ, &actualwidth, &actualheight); X*************** X*** 301,308 X side->host, SQ, SQ); X } X */ X! side->curs = XStoreCursor(side->mcurs, side->mmask, (SQ-1)/2, (SQ-1)/2, X! side->bgcolor, side->fgcolor, GXcopy); X } X X /* Main funnel for input returns both mouse and keyboard events, and maybe */ X X--- 355,367 ----- X side->host, SQ, SQ); X } X */ X! cmap = DefaultColormap(side->display, 0); X! XLookupColor(disp, cmap, "black", &dummy, &black); X! XLookupColor(disp, cmap, "white", &dummy, &white); X! side->curs = XCreatePixmapCursor(disp, side->mcurs, side->mmask, X! &white, &black, X! (unsigned int) (SQ-1)/2, X! (unsigned int) (SQ-1)/2); X } X X /* Main funnel for input returns both mouse and keyboard events, and maybe */ X*************** X*** 316,321 X char *keyp; X int *xp, *yp; X { X XEvent evt; X char *buf; X int nchar, rawx, rawy; X X--- 375,382 ----- X char *keyp; X int *xp, *yp; X { X+ #define BUFFERSIZE 10 X+ X XEvent evt; X char buf[BUFFERSIZE]; X int nchar, rawx, rawy; X*************** X*** 317,323 X int *xp, *yp; X { X XEvent evt; X! char *buf; X int nchar, rawx, rawy; X Window dummy; X X X--- 378,384 ----- X #define BUFFERSIZE 10 X X XEvent evt; X! char buf[BUFFERSIZE]; X int nchar, rawx, rawy; X Window dummy; X X*************** X*** 327,333 X beepedplayer = TRUE; X } X while (TRUE) { X! XNextEvent(&evt); X switch (evt.type) { X case KeyPressed: X buf = XLookupMapping(&evt, &nchar); X X--- 388,396 ----- X beepedplayer = TRUE; X } X while (TRUE) { X! XWindowEvent(curside->display, curside->map, X! (ExposureMask | KeyPressMask | ButtonPressMask), X! &evt); X switch (evt.type) { X case KeyPress: X nchar = XLookupString(&evt, buf, BUFFERSIZE, NULL, NULL); X*************** X*** 329,336 X while (TRUE) { X XNextEvent(&evt); X switch (evt.type) { X! case KeyPressed: X! buf = XLookupMapping(&evt, &nchar); X if (nchar > 0) { X if (Debug) printf("%c\n", *buf); X *keyp = *buf; X X--- 392,399 ----- X (ExposureMask | KeyPressMask | ButtonPressMask), X &evt); X switch (evt.type) { X! case KeyPress: X! nchar = XLookupString(&evt, buf, BUFFERSIZE, NULL, NULL); X if (nchar > 0) { X if (Debug) printf("%c\n", *buf); X *keyp = *buf; X*************** X*** 337,344 X return KEYBOARD; X } X break; X! case ButtonPressed: X! XQueryMouse(curside->map, &rawx, &rawy, &dummy); X *xp = wrap((rawx / SQ) + (curside->vcx - vwid2)); X *yp = (curside->vcy + vhgt2) - (rawy / SQ); X if (Debug) printf("%d %d\n", *xp, *yp); X X--- 400,408 ----- X return KEYBOARD; X } X break; X! case ButtonPress: X! rawx = evt.xbutton.x; X! rawy = evt.xbutton.y; X *xp = wrap((rawx / SQ) + (curside->vcx - vwid2)); X *yp = (curside->vcy + vhgt2) - (rawy / SQ); X if (Debug) printf("%d %d\n", *xp, *yp); X*************** X*** 344,354 X if (Debug) printf("%d %d\n", *xp, *yp); X return MOUSE; X break; X! case ExposeRegion: X! case ExposeWindow: X! if (evt.window == curside->main) { X! XSync(TRUE); /* suppress extra exposures */ X! redraw(curside); X } X break; X default: X X--- 408,418 ----- X if (Debug) printf("%d %d\n", *xp, *yp); X return MOUSE; X break; X! case GraphicsExpose: X! case Expose: X! if (evt.xexpose.window = curside->main) { X! redraw (curside); X! XSync(curside->display, TRUE); /* suppress extra events */ X } X break; X default: X*************** X*** 362,368 X X /* Get rid of extra key/mouse clicks. */ X X! flush_input() X { X if (active_display(curside)) X XSync(TRUE); X X--- 426,433 ----- X X /* Get rid of extra key/mouse clicks. */ X X! flush_input(side) X! Side *side; X { X if (active_display(side)) X XSync(side->display, TRUE); X*************** X*** 364,371 X X flush_input() X { X! if (active_display(curside)) X! XSync(TRUE); X } X X /* A predicate that tests whether our display can safely be written to. */ X X--- 429,436 ----- X flush_input(side) X Side *side; X { X! if (active_display(side)) X! XSync(side->display, TRUE); X } X X /* A predicate that tests whether our display can safely be written to. */ X*************** X*** 376,382 X { X if (side != NULL && side->host != NULL && X !side->lost && side->display != NULL) { X- XSetDisplay(side->display); X return TRUE; X } else { X return FALSE; X X--- 441,446 ----- X { X if (side != NULL && side->host != NULL && X !side->lost && side->display != NULL) { X return TRUE; X } else { X return FALSE; X*************** X*** 390,397 X Side *side; X { X if (active_display(side)) { X! if (side->lastx > 0) erase_cursor(side, curx, cury); X! if (side->lastvcx > 0) undraw_box(side); X show_info(side); X show_note(side); X show_time(side); X X--- 454,463 ----- X Side *side; X { X if (active_display(side)) { X! if (side->lastx > 0) X! erase_cursor(side, curx, cury); X! if (side->lastvcx > 0) X! undraw_box(side); X show_info(side); X show_note(side); X show_time(side); X*************** X*** 403,409 X show_map(side); X show_world(side); X draw_cursor(side, curx, cury); X! flush_output(); X } X } X X X--- 469,475 ----- X show_map(side); X show_world(side); X draw_cursor(side, curx, cury); X! flush_output(side); X } X } X X*************** X*** 410,416 X /* Trivial abstraction - sometimes other routines like to ensure all output */ X /* actually on the screen. */ X X! flush_output() X { X XFlush(); X } X X--- 476,483 ----- X /* Trivial abstraction - sometimes other routines like to ensure all output */ X /* actually on the screen. */ X X! flush_output(side) X! Side *side; X { X if (active_display (side)) X XFlush(side->display); X*************** X*** 412,418 X X flush_output() X { X! XFlush(); X } X X /* Shut all displays down. As it happens, we now rely on windows shutting */ X X--- 479,486 ----- X flush_output(side) X Side *side; X { X! if (active_display (side)) X! XFlush(side->display); X } X X /* Shut all displays down. As it happens, we now rely on windows shutting */ X*************** X*** 434,441 X X /* Get a boolean value from .Xdefaults - use for customization flags. */ X X! boolean_default(prog, def) X! char *prog, *def; X { X char *str; X X X--- 502,510 ----- X X /* Get a boolean value from .Xdefaults - use for customization flags. */ X X! boolean_default(disp, prog, def) X! Display *disp; X! char *prog, *def; X { X char *str; X X*************** X*** 439,445 X { X char *str; X X! return ((str = XGetDefault(prog, def)) != NULL && strcmp(str, "on") == 0); X } X X #endif XWINDOWS X X--- 508,515 ----- X { X char *str; X X! return ((str = XGetDefault(disp, prog, def)) != NULL && X! strcmp(str, "on") == 0); X } X X #endif XWINDOWS Xdiff -c ./Xdefaults X11/Xdefaults X*** ./Xdefaults Thu Jul 16 14:55:02 1987 X--- X11/Xdefaults Wed Oct 28 09:15:45 1987 X*************** X*** 3,11 X # the full pathname of the font. This will also work if you are experimenting X # and don't want to recompile the program just to get a font from elsewhere. X X! xconq.SideName: Rockjock X! xconq.BodyFont: timrom12 X! xconq.IconFont: /u/shebs/games/xconq/lib/ww2.onx X X nxconq.IconFont: /u/shebs/games/xconq/lib/1800.onx X gxconq.IconFont: /u/shebs/games/xconq/lib/greek.onx X X--- 3,11 ----- X # the full pathname of the font. This will also work if you are experimenting X # and don't want to recompile the program just to get a font from elsewhere. X X! x11conq.SideName: Rockjock X! x11conq.BodyFont: 6x13 X! x11conq.IconFont: /usr/games/lib/xconq/ww2.snf X X nx11conq.IconFont: /usr/games/lib/xconq/1800.snf X gx11conq.IconFont: /usr/games/lib/xconq/greek.snf X*************** X*** 7,12 X xconq.BodyFont: timrom12 X xconq.IconFont: /u/shebs/games/xconq/lib/ww2.onx X X! nxconq.IconFont: /u/shebs/games/xconq/lib/1800.onx X! gxconq.IconFont: /u/shebs/games/xconq/lib/greek.onx X X X--- 7,12 ----- X x11conq.BodyFont: 6x13 X x11conq.IconFont: /usr/games/lib/xconq/ww2.snf X X! nx11conq.IconFont: /usr/games/lib/xconq/1800.snf X! gx11conq.IconFont: /usr/games/lib/xconq/greek.snf X END_OF_x11diffs.1 if test 40544 -ne `wc -c <x11diffs.1`; then echo shar: \"x11diffs.1\" unpacked with wrong size! fi # end of overwriting check fi echo shar: End of archive 1 \(of 3\). cp /dev/null ark1isdone MISSING="" for I in 1 2 3 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 3 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