diff -pur nethack-3.4.3\dat\cmdhelp nethack-3.4.3-trapsontop\dat\cmdhelp --- nethack-3.4.3\dat\cmdhelp Sun Dec 07 23:39:12 2003 +++ nethack-3.4.3-trapsontop\dat\cmdhelp Sat Aug 26 16:12:36 2006 @@ -1,4 +1,5 @@ ^ Show the type of a trap +% Toggle whether traps are displayed above or beneath objects ^[ Cancel command ^A Redo the previous command ^C Quit the game diff -pur nethack-3.4.3\dat\opthelp nethack-3.4.3-trapsontop\dat\opthelp --- nethack-3.4.3\dat\opthelp Sun Dec 07 23:39:14 2003 +++ nethack-3.4.3-trapsontop\dat\opthelp Sat Aug 26 16:12:36 2006 @@ -43,6 +43,7 @@ standout use standout mode for --M time display elapsed game time, in moves [FALSE] tombstone print tombstone when you die [TRUE] toptenwin print topten in a window rather than stdout [FALSE] +trap_on_top display traps on top of objects [FALSE] travel enable the command to travel to a map location via [TRUE] a shortest-path algorithm, usually invoked by '_'. verbose print more commentary during the game [TRUE] diff -pur nethack-3.4.3\include\extern.h nethack-3.4.3-trapsontop\include\extern.h --- nethack-3.4.3\include\extern.h Sun Dec 07 23:39:14 2003 +++ nethack-3.4.3-trapsontop\include\extern.h Sat Aug 26 16:12:36 2006 @@ -1389,6 +1389,7 @@ E void NDECL(initoptions); E void FDECL(parseoptions, (char *,BOOLEAN_P,BOOLEAN_P)); E int NDECL(doset); E int NDECL(dotogglepickup); +E int NDECL(dotoggletrapontop); E void NDECL(option_help); E void FDECL(next_opt, (winid,const char *)); E int FDECL(fruitadd, (char *)); diff -pur nethack-3.4.3\include\flag.h nethack-3.4.3-trapsontop\include\flag.h --- nethack-3.4.3\include\flag.h Sun Dec 07 23:39:14 2003 +++ nethack-3.4.3-trapsontop\include\flag.h Sun Aug 27 03:44:03 2006 @@ -160,6 +160,7 @@ struct instance_flags { boolean echo; /* 1 to echo characters */ boolean IBMgraphics; /* use IBM extended character set */ unsigned msg_history; /* hint: # of top lines to save */ + boolean trap_on_top; /* display traps on top of objects */ boolean num_pad; /* use numbers for movement commands */ boolean news; /* print news */ boolean window_inited; /* true if init_nhwindows() completed */ diff -pur nethack-3.4.3\src\cmd.c nethack-3.4.3-trapsontop\src\cmd.c --- nethack-3.4.3\src\cmd.c Sun Dec 07 23:39:14 2003 +++ nethack-3.4.3-trapsontop\src\cmd.c Sat Aug 26 16:12:36 2006 @@ -82,6 +82,7 @@ extern int NDECL(doredraw); /**/ extern int NDECL(doread); /**/ extern int NDECL(dosave); /**/ extern int NDECL(dosearch); /**/ +extern int NDECL(dotoggletrapontop); /**/ extern int NDECL(doidtrap); /**/ extern int NDECL(dopay); /**/ extern int NDECL(dosit); /**/ @@ -1457,6 +1458,7 @@ static const struct func_tab cmdlist[] = {',', FALSE, dopickup}, {':', TRUE, dolook}, {';', TRUE, doquickwhatis}, + {'%', TRUE, dotoggletrapontop}, {'^', TRUE, doidtrap}, {'\\', TRUE, dodiscovered}, /* Robert Viduya */ {'@', TRUE, dotogglepickup}, diff -pur nethack-3.4.3\src\display.c nethack-3.4.3-trapsontop\src\display.c --- nethack-3.4.3\src\display.c Sun Dec 07 23:39:14 2003 +++ nethack-3.4.3-trapsontop\src\display.c Sun Aug 27 03:45:52 2006 @@ -325,12 +325,20 @@ unmap_object(x, y) register struct obj *obj; \ register struct trap *trap; \ \ - if ((obj = vobj_at(x,y)) && !covers_objects(x,y)) \ - map_object(obj,show); \ - else if ((trap = t_at(x,y)) && trap->tseen && !covers_traps(x,y)) \ - map_trap(trap,show); \ + if (iflags.trap_on_top) \ + if ((trap = t_at(x,y)) && trap->tseen && !covers_traps(x,y)) \ + map_trap(trap,show); \ + else if ((obj = vobj_at(x,y)) && !covers_objects(x,y)) \ + map_object(obj,show); \ + else \ + map_background(x,y,show); \ else \ - map_background(x,y,show); \ + if ((obj = vobj_at(x,y)) && !covers_objects(x,y)) \ + map_object(obj,show); \ + else if ((trap = t_at(x,y)) && trap->tseen && !covers_traps(x,y))\ + map_trap(trap,show); \ + else \ + map_background(x,y,show); \ } void diff -pur nethack-3.4.3\src\options.c nethack-3.4.3-trapsontop\src\options.c --- nethack-3.4.3\src\options.c Sun Dec 07 23:39:14 2003 +++ nethack-3.4.3-trapsontop\src\options.c Sun Aug 27 03:44:49 2006 @@ -187,6 +187,7 @@ static struct Bool_Opt #endif {"tombstone",&flags.tombstone, TRUE, SET_IN_GAME}, {"toptenwin",&flags.toptenwin, FALSE, SET_IN_GAME}, + {"trap_on_top", &iflags.trap_on_top, FALSE, SET_IN_GAME}, {"travel", &iflags.travelcmd, TRUE, SET_IN_GAME}, #ifdef WIN32CON {"use_inverse", &iflags.wc_inverse, TRUE, SET_IN_GAME}, /*WC*/ @@ -1024,6 +1025,10 @@ boolean tinitial, tfrom_file; return; } + if (match_optname(opts, "trap_on_top", 11, FALSE)) { + if(!initial) need_redraw = TRUE; + } + #if defined(MICRO) && !defined(AMIGA) /* included for compatibility with old NetHack.cnf files */ if (match_optname(opts, "IBM_", 4, FALSE)) { @@ -3165,6 +3170,15 @@ dotogglepickup() } pline("Autopickup: %s.", buf); return 0; +} + +int +dotoggletrapontop() +{ + iflags.trap_on_top = !iflags.trap_on_top; + (void) doredraw(); + pline("Traps now shown %s objects.", iflags.trap_on_top ? "above" : "below"); + return 0; } #ifdef AUTOPICKUP_EXCEPTIONS