experimental - dungeon overview (trunk only)

Add Hojita Discordia's Dungeon Map overview as
conditional code for experimentation and testing.
Everything is guarded by
#ifdef DUNGEON_OVERVIEW
#endif

The notes that accompanied the original patch follow.

Dungeon Map Overview Patch for Nethack 3.4.3
Version 3
=============================================================================
Changelist:
    v3: Changed #level to #annotate to avoid #levelchange collision.  Fixed
        handling of elemental planes and astral plane (oops).  Changed
	formatting to be slightly closer to print_dungeon()'s.  Should be
	"final" version for 3.4.3.
    v2: Added tracking of trees.  Changed ctrl-m command to ctrl-o.  Portals
        displayed as "sealed" instead of "closed".
    v1: First release.
    (Note: all versions are mutually save compatible.)
=============================================================================
This patch creates a dungeon map overview that is recorded as the player
explores the dungeon.  I was tired of returning to a game a few days later
and having no idea what the dungeon looked like.  Trying to name pieces
of armor with shorthand didn't work so well as an intermediate solution
either, especially around nymphs.

It can be assumed that this map is in the mind of the hero and thus
can't be stolen, can be read when blind, or when buried, or when the hero
doesn't have any hands, or eyes, or hands free, or...etc. On the other hand,
this implies that the hero doesn't remember all of the details ("a fountain",
"some fountains", "many fountains") and that the map is subject to amnesia
when applicable.

This overview tracks fountains, altars, stores, temples, sinks, thrones,
trees, and dungeon branches.  It attempts to not spoil the player nor
reveal more information than the hero knows.  For this reason, it only
tracks dungeon features found in the guidebook and dungeon branches.

This patch breaks save file compatibility.  Sorry.

Added commands
=============================================================================
#overview (ctrl-o, if not in wizard mode) - displays overview
#annotate (ctrl-n, if using numpad) - names current level

Example Output From #overview
=============================================================================
The Dungeons of Doom: levels 1 to level 15
   Level 1:
      A fountain
   Level 3: (My stash.)
      An altar, some fountains
      Stairs down to The Gnomish Mines
   Level 7:
      Many fountains
   Level 8:
      Stairs up to Sokoban, level 7
   Level 15:
      A general store
      Sealed portal to The Quest
The Gnomish Mines: levels 4 to level 7
   Level 7: <- You are here
      Many stores, some fountains, a temple

More Details
=============================================================================
The overview shows only levels that have anything interesting to display and
doesn't show branches that don't have any interesting levels.

To avoid the map revealing more information than the hero knows, the overview
only displays things that the hero has seen or touched.  (If the hero
blinds herself, levitates above a known fountain, and obliterates it with a
wand of digging, the overview will still say that there is a fountain.)

This is done, sadly, by adding 6 bits to the rm struct to track the last
known dungeon type.  On the other hand, this change could potentially allow
a window port to do something like drawing an item and a fountain on the same
square.

Things That Could Be Better And Maybe Some Feedback Would Help
=============================================================================
"<- You Are Here" is pretty goofy
    -...but an indicator of some sort is nice.
=============================================================================
Many thanks to all the kind folks on r.g.r.n. who had very good feedback
about this patch, in particular L (for the trees), <Someone> Papaganou (for the
#annotate suggestion and some formatting feedback), and <Someone> (for the suggestion
of just overriding ctrl-o instead of using the very broken ctrl-m.)
=============================================================================
20060311. Hojita Discordia. (My usenet email is bogus. Sorry.)
This commit is contained in:
nethack.allison
2006-04-20 00:57:45 +00:00
parent 08d4a0c0fa
commit 660d3589c5
13 changed files with 800 additions and 3 deletions

View File

@@ -372,7 +372,8 @@ typedef unsigned char uchar;
#if !defined(MAC)
# define CLIPPING /* allow smaller screens -- ERS */
#endif
#define BARGETHROUGH /* allow some monster to move others out of their way */
#define AUTOPICKUP_EXCEPTIONS /* exceptions to autopickup */
#define BARGETHROUGH /* allow some monsters to move others out of their way */
#ifdef REDO
# define DOAGAIN '\001' /* ^A, the "redo" key used in cmd.c and getline.c */
@@ -390,10 +391,9 @@ typedef unsigned char uchar;
*/
/*#define GOLDOBJ */ /* Gold is kept on obj chains - Helge Hafting */
#define AUTOPICKUP_EXCEPTIONS /* exceptions to autopickup */
#define STATUS_VIA_WINDOWPORT /* re-work of the status line updating process */
#define STATUS_HILITES /* support hilites of status fields */
#define DUNGEON_OVERVIEW /* dungeon overview by Hojita Discordia */
/* End of Section 5 */
#include "global.h" /* Define everything else according to choices above */

View File

@@ -167,4 +167,70 @@ struct linfo {
#endif /* MFLOPPY */
};
#ifdef DUNGEON_OVERVIEW
/* types and structures for dungeon map recording
*
* It is designed to eliminate the need for an external notes file for some of
* the more mundane dungeon elements. "Where was the last altar I passed?" etc...
* Presumably the character can remember this sort of thing even if, months
* later in real time picking up an old save game, I can't.
*
* To be consistent, one can assume that this map is in the player's mind and
* has no physical correspondence (eliminating illiteracy/blind/hands/hands free
* concerns.) Therefore, this map is not exaustive nor detailed ("some fountains").
* This makes it also subject to player conditions (amnesia).
*/
/* Because clearly Nethack needs more ways to specify alignment */
#define Amask2msa(x) ((x) == 4 ? 3 : (x) & AM_MASK)
#define Msa2amask(x) ((x) == 3 ? 4 : (x))
#define MSA_NONE 0 /* unaligned or multiple alignments */
#define MSA_LAWFUL 1
#define MSA_NEUTRAL 2
#define MSA_CHAOTIC 3
typedef struct mapseen_feat {
/* feature knowledge that must be calculated from levl array */
Bitfield(nfount, 2);
Bitfield(nsink, 2);
Bitfield(naltar, 2);
Bitfield(msalign, 2); /* corresponds to MSA_* above */
Bitfield(nthrone, 2);
Bitfield(ntree, 2);
/* water, lava, ice are too verbose so commented out for now */
/*
Bitfield(water, 1);
Bitfield(lava, 1);
Bitfield(ice, 1);
*/
/* calculated from rooms array */
Bitfield(nshop, 2);
Bitfield(ntemple, 2);
Bitfield(shoptype, 5);
Bitfield(forgot, 1); /* player has forgotten about this level? */
} mapseen_feat;
/* for mapseen->rooms */
#define MSR_SEEN 1
/* what the player knows about a single dungeon level */
/* initialized in mklev() */
typedef struct mapseen {
struct mapseen *next; /* next map in the chain */
branch *br; /* knows about branch via taking it in goto_level */
d_level lev; /* corresponding dungeon level */
mapseen_feat feat;
/* custom naming */
char *custom;
unsigned custom_lth;
/* maybe this should just be in struct mkroom? */
schar rooms[(MAXNROFROOMS+1)*2];
} mapseen;
#endif /* DUNGEON_OVERVIEW */
#endif /* DUNGEON_H */

View File

@@ -549,6 +549,15 @@ E schar FDECL(lev_by_name, (const char *));
#ifdef WIZARD
E schar FDECL(print_dungeon, (BOOLEAN_P,schar *,xchar *));
#endif
#ifdef DUNGEON_OVERVIEW
E int NDECL(donamelevel);
E int NDECL(dooverview);
E void FDECL(forget_mapseen, (int));
E void FDECL(init_mapseen, (d_level *));
E void NDECL(recalc_mapseen);
E void FDECL(recbranch_mapseen, (d_level *, d_level *));
E void FDECL(remdun_mapseen, (int));
#endif /* DUNGEON_OVERVIEW */
/* ### eat.c ### */

View File

@@ -338,9 +338,15 @@ struct rm {
Bitfield(horizontal,1); /* wall/door/etc is horiz. (more typ info) */
Bitfield(lit,1); /* speed hack for lit rooms */
Bitfield(waslit,1); /* remember if a location was lit */
Bitfield(roomno,6); /* room # for special rooms */
Bitfield(edge,1); /* marks boundaries for special rooms*/
Bitfield(candig,1); /* Exception to Can_dig_down; was a trapdoor */
#ifdef DUNGEON_OVERVIEW
Bitfield(styp, 6); /* last seen/touched dungeon typ */
/* 2 free bits */
#endif /* DUNGEON_OVERVIEW */
};
/*