1 2This document describes the installation of NetHack with an X11 interface. 3 4There are no explicit UNIX dependencies in this code, but we have only 5tested it under UNIX, using X11R4, X11R5, or X11R6. We have two reports 6that the code also works under DesqView/X on MS-DOS with djgpp, but you 7will have to add dependencies for the X code to that makefile before you 8can use it. Other X11R4+ platforms may work as well, with some tweaking 9likely. Follow WIN* in sys/unix/Makefile.src for compilation hints. 10 11(If you try to compile it with X11R3 or earlier, you will get many errors, 12starting with complaints about XtPointer not being declared. If you get 13around the compilation problems, you will still need a recent library of 14Athena Widgets to link against. Once compiled, you can probably run it 15under an R3 X server, though.) 16 17The reason this uses the Athena widget set is that the Athena widgets come 18free from MIT (like X11). Unfortunately, the companies that resell X11 19(value subtracted er, added software; yea, yea, that's the ticket) usually 20discourage its use by either omitting the set or putting it on the 21"unsupported" portion of their tape. If you do not have the Athena 22widgets, you may obtain them via anonymous ftp from ftp.x.org. 23 24 25To use this code, define X11_GRAPHICS in include/config.h. (You can comment 26out TTY_GRAPHICS or change DEFAULT_WINDOW_SYS if you want to, but there's 27little reason to do so. The X11 version almost requires a config file 28for full effect, so you can just as well set windowtype there; also, you 29or someone else might just possibly be stuck in a situation where you can't 30use the X version -- over a non-blindingly-fast modem, say.) You may also 31want to define USE_XPM or GRAPHIC_TOMBSTONE as discussed below. 32 33In src/Makefile, add $(WINX11SRC), $(WINX11OBJ), and $(WINX11LIB) to 34WINSRC, WINOBJ, and WINLIB respectively, and compile. This will give you 35an executable supporting both X11 and tty windowing. 36 37 38If you want to use the optional tiles (multicolored pictures instead of a 39replacement font), you will need to have the win/share files and change 40the VARDATND setting in the top Makefile to contain the tile files before 41you do your 'make all'. 42 43If you get a linker error referring to `substitute_tiles' then most 44likely you have overlooked the WINSRC, WINOBJ, WINLIB step above. 45Alternatively, you are building with more than one non-tty interface 46specified but haven't followed the direction in src/Makefile to remove 47all but one instance of tile.o from the WINxxxOBJ values used for WINOBJ. 48 49When using tiles, you have the option of defining USE_XPM in config.h. 50This causes NetHack to use the XPM file format for the "x11tiles" file 51rather than a custom format. Since the XPM format can be processed by 52existing tools such as PBMPlus and XV, you can modify the tiles to suit 53your environment. However, you need to make sure the number of tiles 54in each row of the image remains the same (currently 40), as the code 55depends on this to calculate the size of each tile. For example, you may 56magnify them for display on high-resolution screens using the following 57command: 58 xpmtoppm x11tiles | pnmscale -xscale 1 -yscale 1.6875 | 59 pnmdepth 255 | ppmquant 100 | ppmtoxpm >x11tiles_big.xpm 60To use XPM, you must have the free XPM libraries installed in your system. 61Official xpm releases can be found by ftp on: 62 ftp.x.org (198.4.202.8) contrib/libraries (Boston, USA) 63 avahi.inria.fr (138.96.12.1) pub/xpm (Sophia Antipolis, France) 64If you do choose to define USE_XPM, be sure to add "-lXpm" to WINX11LIB 65in src/Makefile. 66 67If you define USE_XPM in config.h, you may also define GRAPHIC_TOMBSTONE 68which causes the closing tombstone to be displayed from the image file 69specified by the "tombstone" X resource (rip.xpm by default). In this 70case, make sure the top Makefile VARDATND also contains rip.xpm. 71 72 73Whether or not you install tile support, you can provide support for 74special graphics symbols via alternate fonts. (The fonts and tiles 75cannot be used at the same time, but the same executable handles both.) 76The two included X11 fonts use the general NetHack map area remapping 77to represent object/dungeon/trap/effect characters (see win/X11/nethack.rc 78and the Guidebook) as monocolored symbols and monsters as monocolored 79letters. For instance, a ruby potion will show up as a potion symbol in 80red. It's easier to see the difference between fonts and tiles than to 81describe it. :-) Unless you are the only one using your executable and 82you already know which you prefer, we suggest installing the optional files 83for both possibilities and letting each person decide for themselves. 84 85To use the included fonts, you will need to install one or both of them 86and then use the symbol mappings found in nethack.rc. The fonts are found 87in nh10.bdf and ibm.bdf. You first need to convert the bdf files to whatever 88form your X11 server recognizes (usually using a command called bdftosnf 89for R4 servers or bdftopcf for R5 servers). Then run mkfontdir on the 90directory containing your font files (you might want to copy them to GAMEDIR, 91from the top Makefile, after you've done "make install"). If these commands 92aren't familiar, talk to your local X11 guru and read the man pages. 93Finally, add that directory to your font search path (e.g. xset fp+ GAMEDIR, 94setting GAMEDIR to the value of GAMEDIR in the top Makefile). Alternatively, 95you (assuming you are a system administrator) can install the fonts in your 96standard X11 font directory. If you do not install the fonts in the standard 97X11 font directory, all persons playing nethack must add that "xset fp+" 98command to their .xinitrc file, or whatever file they execute when starting 99X11. Adding the "xset" command to the nethack.sh is also an alternative, 100though it may clutter your X11 font search path after playing several games, 101so this method is not recommended. See the note below for the alternative 102installation procedure for Sun's OpenWindows. 103 104 105If your X11 include files and libraries are not installed in a standard 106place (i.e. /usr/include/X11 and /usr/lib respectively) you will need to 107prepend an appropriate -I<idirectory> parameter to CFLAGS and a 108-L<ldirectory> parameter to LFLAGS, setting <?directory> to the place to 109find the include and library files for X11. 110 111 112Finally, to ensure NetHack's windows look the way they were intended to 113look, make sure the top Makefile VARDATND also contains NetHack.ad. If it 114does, running nethack will automatically take the appropriate steps to 115cause this file to be used to initialize NetHack's X11 resources. 116 117 118Three icon suggestions to the window manager are supported: nh72, nh56, 119and nh32. Data for them comes from the source files nh72icon, nh56icon, 120and nh32icon; they are compiled into the program via #includes in winX.c. 121Selection between them is controlled by the "icon" resource in NetHack.ad; 122the default is nh72. 123 124 125Sorry, an Imakefile is not included. Unlike many X11 programs, X11 126support is only a small, optional, part of nethack, and the Makefile is 127needed for systems that don't use X11. 128 129 130Notes for Sun's OpenWindows: 131 1. For OpenWindows 3.0 (NOT 2.x), define OPENWINBUG in include/unixconf.h. 132 The library bug from SunOS 4.1.x is fixed in Solaris 2.x (or when 133 proper Sun patches have been applied to 4.1.x), so it is also 134 unnecessary there. (Defining it when unnecessary causes the same 135 problem being avoided when it is necessary. :-) 136 137 2. In addition to the changes suggested by the comments in src/Makefile, 138 139 -- for OpenWindows 2.x and 3.0 (NOT 3.1) (i.e., versions for SunOS 4.x), 140 add -I/usr/openwin/include to CFLAGS, -L/usr/openwin/lib to LFLAGS, 141 and -lm to WINX11LIB in src/Makefile. 142 143 -- for OpenWindows 3.1 (i.e., versions for Solaris 2.x), add 144 -I/usr/openwin/include to CFLAGS, -L/usr/openwin/lib -L/usr/ccs/lib 145 -R/usr/openwin/lib to LFLAGS, and -lsocket -lnsl -lm 146 to WINX11LIB in src/Makefile. 147 148 (Naturally, if your OpenWindows is installed elsewhere, adapt the 149 openwin paths.) This will allow you to create a game executable. 150 151 3. Run the fonts through convertfont and run bldfamily on the directory. 152 Now you must let your X server know where to find the fonts. For a 153 personal installation, the simplest thing is to include the directory 154 of the fonts in the environment variable FONTPATH, as set in your 155 .profile or .login before starting the server. For a multi-user 156 installation, you have the various "xset fp+" options outlined 157 above for standard X. 158 159 4. Something must still be done with the NetHack.ad file -- all three 160 of the possibilities mentioned for standard X11 should work. 161 162 163Notes for AIX 3.2: 164 1. AIX 3.2 includes the Athena Widget Toolkit library (and other things) 165 under the /usr/lpp/X11/Xamples tree, so you will have to add 166 -L/usr/lpp/X11/Xamples/lib to LFLAGS. If you can't find libXaw.a on 167 your first build, go into /usr/lib/X11/Xamples, read the README file, 168 and build the library. 169 170Notes for XFree86 - (on linux and BSD386 platforms) 171 172 1. Edit src/Makefile for linux/BSD386. Even though you use the 173 Open Look Window manager, do not define OPENWINBUG. Use the 174 standard X11 object and library options. 175 176 2. Follow the standard installation directions defined above. 177 178 179File Description 180--------- --------------------------------------------------------------- 181nethack.rc - A sample configuration file for fonts nh10 and ibm. 182nh10.bdf - A modified version of the 10x20 standard font. 183ibm.bdf - A modified version of one of the ibm (8x14) nethack font. 184 Must be used in conjunction with NetHack.ad or nethack.rc. 185nh32icon - A 32x32 icon bitmap for use with window managers. 186nh56icon - A 56x56 icon bitmap for use with window managers. 187nh72icon - A 72x72 icon bitmap for use with window managers. 188nh_icon.xpm - A color icon for use with window managers. 189NetHack.ad - A sample .Xdefaults for a color screen. 190../../include/Window.h 191../../include/WindowP.h 192Window.c - A bare-bones widget that has 16 colors and a drawing canvas. 193../../include/winX.h 194 - Defines for the X window-port. 195win*.c - Code for the X window-port 196dialogs.c - A better dialog widget. Original code (modified slightly 197 by Dean Luick) distributed under the X copyright by Tim 198 Theisen. This is from his Ghostview program (which is under 199 the GNU public license, v2 or higher). 200pet_mark.xbm - A pet indicator bitmap for tiles. 201rip.xpm - A graphical tombstone. 202tile2x11.c - Converts win/share tiles for X11 use. 203