From c64036c97bd2ac579aaecabdb9a036c9b5cc5d04 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 4 Jul 2015 20:06:31 -0700 Subject: [PATCH] \#overview quest feedback Implement the requested feature to have an automatic annotation on the dungeon level with the quest entry portal where you sense the leader summoning you. It stays even after entering the portal (which results in another automatic annotation of "portal to quest"), up until you return to that level after having completed the quest. Add a second one for the quest home level once the leader has given you the go ahead to start the quest. After completing the quest that one remains but its wording is changed. This ought to haved incremented EDITLEVEL but I decided to risk leaving current save files viable. That should work ok for anyone who isn't overriding the default definition of Bitfield(), although odd behavior could conceivably occur. New games have nothing to worry about. --- include/dungeon.h | 7 ++++++- src/dungeon.c | 29 +++++++++++++++++++++++------ 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/include/dungeon.h b/include/dungeon.h index 636abbe4f..c039814a5 100644 --- a/include/dungeon.h +++ b/include/dungeon.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 dungeon.h $NHDT-Date: 1432512778 2015/05/25 00:12:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.20 $ */ +/* NetHack 3.6 dungeon.h $NHDT-Date: 1436065581 2015/07/05 03:06:21 $ $NHDT-Branch: master $:$NHDT-Revision: 1.21 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -235,6 +235,11 @@ typedef struct mapseen { Bitfield(msanctum, 1); Bitfield(ludios, 1); Bitfield(roguelevel, 1); + /* quest annotations: quest_summons is for main dungeon level + with entry portal and is reset once quest has been finished; + questing is for quest home (level 1) */ + Bitfield(quest_summons, 1); /* heard summons from leader */ + Bitfield(questing, 1); /* quest leader has unlocked quest stairs */ } flags; /* custom naming */ char *custom; diff --git a/src/dungeon.c b/src/dungeon.c index 9d6777d0a..4f6e12731 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dungeon.c $NHDT-Date: 1434330836 2015/06/15 01:13:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.59 $ */ +/* NetHack 3.6 dungeon.c $NHDT-Date: 1436065584 2015/07/05 03:06:24 $ $NHDT-Branch: master $:$NHDT-Revision: 1.60 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2171,11 +2171,14 @@ mapseen *mptr; return FALSE; /* level is of interest if it has an auto-generated annotation */ if (mptr->flags.oracle || mptr->flags.bigroom || mptr->flags.roguelevel - || mptr->flags.castle || mptr->flags.valley || mptr->flags.msanctum) + || mptr->flags.castle || mptr->flags.valley || mptr->flags.msanctum + || mptr->flags.quest_summons || mptr->flags.questing) return TRUE; /* when in Sokoban, list all sokoban levels visited; when not in it, - list any visited Sokoban level which remains unsolved (could only - be furthest one reached, unless level teleporting in wizard mode) */ + list any visited Sokoban level which remains unsolved (will usually + only be furthest one reached, but it's possible to enter pits and + climb out on the far side on the first Sokoban level; also, wizard + mode overrides teleport restrictions) */ if (In_sokoban(&mptr->lev) && (In_sokoban(&u.uz) || !mptr->flags.sokosolved)) return TRUE; @@ -2242,6 +2245,14 @@ recalc_mapseen() mptr->flags.castletune = 0; /* flags.castle, flags.valley, flags.msanctum retain previous value */ mptr->flags.forgot = 0; + /* flags.quest_summons disabled once quest finished */ + mptr->flags.quest_summons = (at_dgn_entrance("The Quest") + && u.uevent.qcalled + && !(u.uevent.qcompleted + || u.uevent.qexpelled + || quest_status.leader_is_dead)); + mptr->flags.questing = (on_level(&u.uz, &qstart_level) + && quest_status.got_quest); /* track rooms the hero is in */ for (i = 0; i < SIZE(u.urooms); ++i) { @@ -2526,8 +2537,8 @@ br_string2(br) branch *br; { /* Special case: quest portal says closed if kicked from quest */ - boolean closed_portal = - (br->end2.dnum == quest_dnum && u.uevent.qexpelled); + boolean closed_portal = (br->end2.dnum == quest_dnum + && u.uevent.qexpelled); switch (br->type) { case BR_PORTAL: @@ -2791,9 +2802,15 @@ boolean printdun; Sprintf(buf, "%sA very big room.", PREFIX); } else if (mptr->flags.roguelevel) { Sprintf(buf, "%sA primitive area.", PREFIX); + } else if (mptr->flags.quest_summons) { + Sprintf(buf, "%sSummoned by %s.", PREFIX, ldrname()); } else if (on_level(&mptr->lev, &qstart_level)) { Sprintf(buf, "%sHome%s.", PREFIX, mptr->flags.unreachable ? " (no way back...)" : ""); + if (u.uevent.qcompleted) + Sprintf(buf, "%sCompleted quest for %s.", PREFIX, ldrname()); + else if (mptr->flags.questing) + Sprintf(buf, "%sGiven quest by %s.", PREFIX, ldrname()); } else if (mptr->flags.ludios) { /* presence of the ludios branch in #overview output indicates that the player has made it onto the level; presence of this annotation