From 4283bbde646e444c5eadae3f8b6772eb3de8f875 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 2 May 2015 19:44:35 -0700 Subject: [PATCH 1/6] tiletxt lint Use 'const' for string literals when compiling win/share/tilemap.c with '-DTILETEXT' to generate util/tiletxt.o. --- win/share/tilemap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/win/share/tilemap.c b/win/share/tilemap.c index 5e05a1888..209088929 100644 --- a/win/share/tilemap.c +++ b/win/share/tilemap.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 tilemap.c $NHDT-Date: 1429464668 2015/04/19 17:31:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.18 $ */ +/* NetHack 3.5 tilemap.c $NHDT-Date: 1430621065 2015/05/03 02:44:25 $ $NHDT-Branch: master $:$NHDT-Revision: 1.19 $ */ /* SCCS Id: @(#)tilemap.c 3.5 2000/06/04 */ /* NetHack may be freely redistributed. See license for details. */ @@ -177,7 +177,7 @@ int set, entry; i = entry - tilenum; if (i < (MAXEXPCHARS * EXPL_MAX)) { if (set == OTH_GLYPH) { - static char *explosion_types[] = { /* hack.h */ + static const char *explosion_types[] = { /* hack.h */ "dark", "noxious", "muddy", "wet", "magical", "fiery", "frosty" }; From 15a5fe8d766bd68b5596a5488fe5184fb2934361 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 3 May 2015 08:56:39 +0300 Subject: [PATCH 2/6] Barb quest home has a forest --- dat/Barb.des | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dat/Barb.des b/dat/Barb.des index ea8ab9738..0f94f5668 100644 --- a/dat/Barb.des +++ b/dat/Barb.des @@ -35,6 +35,15 @@ MAP ....................................PP...PP................................. ....................................PP....PP................................ ENDMAP + +# the forest beyond the river +REPLACE_TERRAIN:(37,0,59,19),'.','T', 5% +REPLACE_TERRAIN:(60,0,64,19),'.','T', 10% +REPLACE_TERRAIN:(65,0,75,19),'.','T', 20% +# guarantee a path and free spot for the portal +TERRAIN:(randline (37,7),(62,02),7), '.' +TERRAIN:(62,02),'.' + # Dungeon Description REGION:(00,00,75,19),lit,"ordinary" REGION:(09,05,11,05),unlit,"ordinary" From be60ad6676047b6de800332b0e17bd8de65c6167 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 3 May 2015 10:31:24 +0300 Subject: [PATCH 3/6] Randomize secret door locations ... in the Wizard quest locate level and Rodney tower entrance --- dat/Wizard.des | 40 ++++++++++++++++++++++++---------------- dat/yendor.des | 7 ++++--- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/dat/Wizard.des b/dat/Wizard.des index 1b4ed5d86..faf3827d8 100644 --- a/dat/Wizard.des +++ b/dat/Wizard.des @@ -115,25 +115,25 @@ FLAGS: hardfloor GEOMETRY:center,center MAP ............. ....................................................... -.............. .............}}}}}}}.}}}}}}}}}}}}}}}}}}}.}}}}}}}....... +.............. .............}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}....... .............. ..............}.................................}....... -.............. ..............}.---------S---------------------.}....... +.............. ..............}.-------------------------------.}....... ............... .........C....}.|.............................|.}....... ............... ..........C....}.|.---------------------------.|.}....... -............... .........CCC.....|.|.........................|.|......... -................ ....C....CCC...}.|.|.---S-------------------.|.|.}....... +............... .........CCC...}.|.|.........................|.|.}....... +................ ....C....CCC...}.|.|.-----------------------.|.|.}....... .......C..C..... .....C....CCC...}.|.|.|......+.......+......|.|.|.}....... .............C..CC.....C....CCC...}.|.|.|......|-------|......|.|.|.}....... -................ ....C....CCC...}.|.|.|......|.......S......|.|.|.}....... +................ ....C....CCC...}.|.|.|......|.......|......|.|.|.}....... ......C..C..... ....C....CCC...}.|.|.|......|-------|......|.|.|.}....... ............C.. ...C....CCC...}.|.|.|......+.......+......|.|.|.}....... ........C...... ....C....CCC...}.|.|.-----------------------.|.|.}....... -....C......C... ........CCC.....|.|.........................|.|......... -......C..C.... .........C....}.|.--------------------S------.|.}....... +....C......C... ........CCC...}.|.|.........................|.|.}....... +......C..C.... .........C....}.|.---------------------------.|.}....... .............. .........C....}.|.............................|.}....... ............. ..............}.-------------------------------.}....... ............. .............}.................................}....... -............. .............}}}}}}}.}}}}}}}}}}}}}}}}}}}.}}}}}}}....... +............. .............}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}....... ............. ....................................................... ENDMAP @@ -143,18 +143,26 @@ REPLACE_TERRAIN:(34,1,68,19), '}', '.', 2% # Dungeon Description REGION:(00,00,75,20),lit,"ordinary" -REGION:(37,04,65,16),unlit,"ordinary" -REGION:(41,08,46,12),lit,"ordinary" -REGION:(56,08,61,12),lit,"ordinary" +REGION:(37,04,65,16),unlit,"ordinary",filled,irregular { + ROOMDOOR:true,closed,north|south|west|east,random +} +REGION:(39,06,63,14),unlit,"ordinary",filled,irregular { + ROOMDOOR:true,closed,north|south|west|east,random +} + +REGION:(41,08,46,12),lit,"ordinary",filled,irregular { + ROOMDOOR:true,closed,north|south|west,random +} +REGION:(56,08,61,12),lit,"ordinary",filled,irregular { + ROOMDOOR:true,closed,north|south|east,random +} REGION:(48,08,54,08),unlit,"ordinary" REGION:(48,12,54,12),unlit,"ordinary" -REGION:(48,10,54,10),unlit,"ordinary" +REGION:(48,10,54,10),unlit,"ordinary",filled,irregular { + ROOMDOOR:true,closed,north|south|west|east,random +} # Doors -DOOR:locked,(45,03) -DOOR:locked,(43,07) -DOOR:locked,(58,15) -DOOR:locked,(55,10) DOOR:locked,(55,08) DOOR:locked,(55,12) DOOR:locked,(47,08) diff --git a/dat/yendor.des b/dat/yendor.des index dcb77c986..5dcc0baf8 100644 --- a/dat/yendor.des +++ b/dat/yendor.des @@ -162,7 +162,7 @@ MAP |..---|.}--.--}.|..|.......|. |.....|.}}---}}.|..|.......|. |.....S.}}}}}}}.|..|.......|. -|.....|.........|..S.......|. +|.....|.........|..|.......|. ----------------------------. ENDMAP STAIR:levregion(01,00,79,20),(0,0,28,12),up @@ -175,9 +175,10 @@ REGION:(07,03,15,11),unlit,"morgue",unfilled REGION:(17,06,18,11),unlit,"beehive" # make the entry chamber a real room; it affects monster arrival; # `unfilled' is a kludge to force an ordinary room to remain a room -REGION:(20,06,26,11),unlit,"ordinary",unfilled +REGION:(20,06,26,11),unlit,"ordinary",unfilled { + ROOMDOOR:true, closed, north|west, random +} DOOR:closed,(18,05) -DOOR:closed,(19,11) LADDER:(11,07),up # Non diggable walls # Walls inside the moat stay diggable From 23a671147f6aba3f4e00a04e73f71d8121dc128c Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 3 May 2015 00:47:10 -0700 Subject: [PATCH 4/6] tiles-related build stuff * Add missing entry for include/tile.h to (top)/Files; also add new entry for generated file util/tiletxt.c (Unix only); * Add several missing entries for tile utility programs that can be built by sys/unix/Makefile.utl to util/.gitignore; * Update sys/unix/Makefile.utl to build 'tilemap' differently so that it won't leave behind an unwanted subdirectory tree under OSX: util/tilemap.dSYM/ util/tilemap.dSYM/Contents/ util/tilemap.dSYM/Contents/Info.plist util/tilemap.dSYM/Contents/Resources/ util/tilemap.dSYM/Contents/Resources/DWARF/ util/tilemap.dSYM/Contents/Resources/DWARF/tilemap It now generates util/tiletxt.c on the fly, to be compiled into tiletxt.o, so that tilemap.c can be compiled in the ordinary manner and tilemap.o can be kept around for dependency checking. (Creating real source file win/share/tiletxt.c would be a little bit cleaner, but it's effectively two lines long so seems silly to be in the source distribution.) I looked to see whether I could find a linker or compiler option to suppress that stuff but failed. I'm sure something of the sort must exist but didn't pursue it. Someday I might actually learn about how OSX works.... --- Files | 4 ++++ sys/unix/Makefile.utl | 27 ++++++++++++++++++++------- util/.gitignore | 20 +++++++++++++------- 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/Files b/Files index 658cfc3ee..be68c61ef 100644 --- a/Files +++ b/Files @@ -322,6 +322,8 @@ include: date.h onames.h pm.h vis_tab.h (files generated by yacc (or copied from sys/share) at compile time) dgn_comp.h lev_comp.h +(file for tiles support copied from win/share at compile time) +tile.h (files for win32 that are moved into include at compile time) win32api.h @@ -342,6 +344,8 @@ nethack.ico util: (files generated by lex and yacc (or copied from sys/share) at compile time) dgn_lex.c dgn_yacc.c lev_lex.c lev_yacc.c +(file generated for unix at compile time if various tiles utilities are built) +tiletxt.c (files generated for win32 at compile time) uudecode.exe diff --git a/sys/unix/Makefile.utl b/sys/unix/Makefile.utl index e1c677c2f..f73c94400 100644 --- a/sys/unix/Makefile.utl +++ b/sys/unix/Makefile.utl @@ -1,5 +1,5 @@ # Makefile for NetHack's utility programs. -# NetHack 3.5 Makefile.utl $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ +# NetHack 3.5 Makefile.utl $NHDT-Date: 1430639195 2015/05/03 07:46:35 $ $NHDT-Branch: master $:$NHDT-Revision: 1.19 $ # NetHack 3.5 Makefile.utl $Date: 2012/01/10 17:47:30 $ $Revision: 1.18 $ # Root of source tree: @@ -325,8 +325,13 @@ xpm2img.ttp: xpm2img.o bitmfile.o tile2beos: tile2beos.o $(TEXT_IO) $(CC) $(LFLAGS) -o tile2beos tile2beos.o $(TEXT_IO) -lbe -tilemap: ../win/share/tilemap.c $(HACK_H) - $(CC) $(CFLAGS) $(LFLAGS) -o tilemap ../win/share/tilemap.c $(LIBS) +#--compiling and linking in one step leaves extra debugging files (in their +# own subdirectories!) on OSX; compile and link separately to suppress +# that without mucking about with extra OS-specific CFLAGS and/or LFLAGS +#tilemap: ../win/share/tilemap.c $(HACK_H) +# $(CC) $(CFLAGS) $(LFLAGS) -o tilemap ../win/share/tilemap.c $(LIBS) +tilemap: tilemap.o + $(CC) $(LFLAGS) -o tilemap tilemap.o $(LIBS) ../src/tile.c: tilemap ./tilemap @@ -334,9 +339,17 @@ tilemap: ../win/share/tilemap.c $(HACK_H) cp ../win/share/tile.h ../include/tile.h tiletext.o: ../win/share/tiletext.c $(CONFIG_H) ../include/tile.h $(CC) $(CFLAGS) -c ../win/share/tiletext.c -tiletxt.o: ../win/share/tilemap.c $(HACK_H) - $(CC) $(CFLAGS) -c -DTILETEXT ../win/share/tilemap.c - mv tilemap.o tiletxt.o +tiletxt.c: ./Makefile + echo '/* alternate compilation for tilemap.c to create tiletxt.o' > tiletxt.c + echo ' that does not rely on "cc -c -o tiletxt.o tilemap.c"' >> tiletxt.c + echo ' since many pre-POSIX compilers did not support that */' >> tiletxt.c + echo '#define TILETEXT' >> tiletxt.c + echo '#include "../win/share/tilemap.c"' >> tiletxt.c + echo '/*tiletxt.c*/' >> tiletxt.c +tiletxt.o: tiletxt.c ../win/share/tilemap.c $(HACK_H) + $(CC) $(CFLAGS) -c tiletxt.c +tilemap.o: ../win/share/tilemap.c $(HACK_H) + $(CC) $(CFLAGS) -c ../win/share/tilemap.c gifread.o: ../win/share/gifread.c $(CONFIG_H) ../include/tile.h $(CC) $(CFLAGS) -c ../win/share/gifread.c @@ -402,7 +415,7 @@ clean: spotless: clean -rm -f lev_lex.c lev_yacc.c dgn_lex.c dgn_yacc.c -rm -f ../include/lev_comp.h ../include/dgn_comp.h - -rm -f ../include/tile.h + -rm -f ../include/tile.h tiletxt.c -rm -f makedefs lev_comp dgn_comp recover dlb -rm -f gif2txt txt2ppm tile2x11 tile2img.ttp xpm2img.ttp tilemap diff --git a/util/.gitignore b/util/.gitignore index 22139b7ab..6982f2d05 100644 --- a/util/.gitignore +++ b/util/.gitignore @@ -1,13 +1,19 @@ -dgn_yacc.c dgn_lex.c -makedefs -tilemap -dgn_comp +dgn_yacc.c lev_lex.c lev_yacc.c -tile2x11 +tiletxt.c +makedefs +dgn_comp lev_comp -tileedit -tile2bmp dlb recover +tilemap +tileedit +tile2x11 +tile2bmp +tile2beos +gif2txt +txt2ppm +tile2img.ttp +xpm2ppm.ttp From fc567b5ce36e871b8b3fa660d9ad339b65a95ffa Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 3 May 2015 01:03:24 -0700 Subject: [PATCH 5/6] tiles lint Several instances of "comparison between signed and unsigned". win/share/tiletext.c win/X11/tile2x11.c --- win/X11/tile2x11.c | 12 ++++++------ win/share/tiletext.c | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/win/X11/tile2x11.c b/win/X11/tile2x11.c index ebfd3bd9b..52d6e2896 100644 --- a/win/X11/tile2x11.c +++ b/win/X11/tile2x11.c @@ -1,10 +1,10 @@ +/* $NHDT-Date: 1430640199 2015/05/03 08:03:19 $ $NHDT-Branch: master $:$NHDT-Revision: 1.3 $ */ +/* $Date: 2002/03/17 20:02:47 $ $Revision: 1.2 $ */ + /* * Convert the given input files into an output file that is expected * by nethack. * - * $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ - * $Date: 2002/03/17 20:02:47 $ $Revision: 1.2 $ - * * Assumptions: * + Two dimensional byte arrays are in row order and are not padded * between rows (x11_colormap[][]). @@ -28,7 +28,7 @@ static unsigned char pix_to_colormap(pix) pixel pix; { - int i; + unsigned i; for (i = 0; i < header.ncolors; i++) { if (pix.r == ColorMap[CM_RED][i] && @@ -80,9 +80,9 @@ convert_tiles(tb_ptr, total) static void merge_text_colormap() { - int i, j; + unsigned i, j; - for (i = 0; i < colorsinmap; i++) { + for (i = 0; i < (unsigned)colorsinmap; i++) { for (j = 0; j < header.ncolors; j++) if (x11_colormap[j][CM_RED] == ColorMap[CM_RED][i] && x11_colormap[j][CM_GREEN] == ColorMap[CM_GREEN][i] && diff --git a/win/share/tiletext.c b/win/share/tiletext.c index ea78eb02f..f5489d4fe 100644 --- a/win/share/tiletext.c +++ b/win/share/tiletext.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 tiletext.c $NHDT-Date: 1429484196 2015/04/19 22:56:36 $ $NHDT-Branch: master $:$NHDT-Revision: 1.6 $ */ +/* NetHack 3.5 tiletext.c $NHDT-Date: 1430640200 2015/05/03 08:03:20 $ $NHDT-Branch: master $:$NHDT-Revision: 1.7 $ */ /* NetHack 3.5 tiletext.c $Date: 2009/05/06 10:59:03 $ $Revision: 1.4 $ */ /* SCCS Id: @(#)tiletext.c 3.5 1999/10/24 */ /* NetHack may be freely redistributed. See license for details. */ @@ -286,8 +286,8 @@ const char *type; /* Fill placeholder with noise */ if ( !placeholder_init ) { placeholder_init++; - for ( i=0; i Date: Sun, 3 May 2015 01:22:25 -0700 Subject: [PATCH 6/6] fix "gold wield inconsistency" 'w$' reported "you can't wield gold" but 'w*$', choosing from inventory and picking gold, let you wield gold. The old code checked whether gold had been picked before checking whether '?' or '*' had been picked to request selection from inventory. This wasn't an issue with 3.4.3's !GOLDINV configuration (but probably was for anyone who explicitly switched to GOLDINV) because getobj()'s callers only inserted gold into inventory when they intended to accept it as a valid choice. Fix is just to swap two adjacent 'if' blocks in getobj() so that '*' is processed before the test of whether '$' has been chosen. Most of the diff is indentation and other minor reformatting. --- src/invent.c | 63 ++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/src/invent.c b/src/invent.c index a23c92166..7b3861e62 100644 --- a/src/invent.c +++ b/src/invent.c @@ -1111,7 +1111,30 @@ register const char *let,*word; } return(allownone ? &zeroobj : (struct obj *) 0); } - if(ilet == def_oc_syms[COIN_CLASS].sym) { + /* since gold is now kept in inventory, we need to do processing for + select-from-invent before checking whether gold has been picked */ + if (ilet == '?' || ilet == '*') { + char *allowed_choices = (ilet == '?') ? lets : (char *)0; + long ctmp = 0; + + if (ilet == '?' && !*lets && *altlets) + allowed_choices = altlets; + ilet = display_pickinv(allowed_choices, TRUE, + allowcnt ? &ctmp : (long *)0); + if (!ilet) continue; + if (allowcnt && ctmp >= 0) { + cnt = ctmp; + if (!cnt) prezero = TRUE; + allowcnt = 2; + } + if (ilet == '\033') { + if (flags.verbose) + pline1(Never_mind); + return (struct obj *)0; + } + /* they typed a letter (not a space) at the prompt */ + } + if (ilet == def_oc_syms[COIN_CLASS].sym) { if (!usegold) { You("cannot %s gold.", word); return(struct obj *)0; @@ -1124,43 +1147,21 @@ register const char *let,*word; */ if (allowcnt == 2 && cnt <= 0) { if (cnt < 0 || !prezero) - pline_The( - "LRS would be very interested to know you have that much."); + pline_The( + "LRS would be very interested to know you have that much."); return (struct obj *)0; } - } - if(ilet == '?' || ilet == '*') { - char *allowed_choices = (ilet == '?') ? lets : (char *)0; - long ctmp = 0; - - if (ilet == '?' && !*lets && *altlets) - allowed_choices = altlets; - ilet = display_pickinv(allowed_choices, TRUE, - allowcnt ? &ctmp : (long *)0); - if(!ilet) continue; - if (allowcnt && ctmp >= 0) { - cnt = ctmp; - if (!cnt) prezero = TRUE; - allowcnt = 2; - } - if(ilet == '\033') { - if(flags.verbose) - pline1(Never_mind); - return((struct obj *)0); - } - /* they typed a letter (not a space) at the prompt */ - } - if(allowcnt == 2 && !strcmp(word,"throw")) { + if (allowcnt == 2 && !strcmp(word,"throw")) { /* permit counts for throwing gold, but don't accept * counts for other things since the throw code will * split off a single item anyway */ if (ilet != def_oc_syms[COIN_CLASS].sym) - allowcnt = 1; - if(cnt == 0 && prezero) return((struct obj *)0); - if(cnt > 1) { - You("can only throw one item at a time."); - continue; + allowcnt = 1; + if (cnt == 0 && prezero) return (struct obj *)0; + if (cnt > 1) { + You("can only throw one item at a time."); + continue; } } context.botl = 1; /* May have changed the amount of money */