Attached Files |
abyss_return.patch [^] (6,375 bytes) 2011-08-31 22:29 [Show Content] [Hide Content]From b42fe8404e7ef5ea1e3df672188d904ea2ce5722 Mon Sep 17 00:00:00 2001
From: Aaron Becker <akbecker@gmail.com>
Date: Wed, 31 Aug 2011 14:30:27 -0500
Subject: [PATCH] When you escape from the Abyss, return to where you came from.
Currently if you are banished from Pan or from a portal vault, when you
return from the Abyss you're returned to the dungeon. This is somewhat
weird behavior, and prevents collecting all runes if you're banished on
a unique Pan level.
Now instead you will always be returned to the level you came from. To
compensate for the inability to escape Pan through the Abyss, increase
the odds of a Pan exit gate enough that you should see one approximately
every 5 levels instead of every 20-ish.
---
crawl-ref/source/directn.cc | 2 +-
crawl-ref/source/dungeon.cc | 2 +-
crawl-ref/source/effects.cc | 6 ++++++
crawl-ref/source/player.h | 9 +++++++++
crawl-ref/source/stairs.cc | 12 +++++++++++-
crawl-ref/source/travel.cc | 15 +++++++++++++--
6 files changed, 41 insertions(+), 5 deletions(-)
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc
index 9283b96..04a1b40 100644
--- a/crawl-ref/source/directn.cc
+++ b/crawl-ref/source/directn.cc
@@ -3094,7 +3094,7 @@ static std::string _base_feature_desc(dungeon_feature_type grid,
// is the description for a portal of unknown type.
return ("gate leading to a distant place");
case DNGN_EXIT_PORTAL_VAULT:
- return ("gate leading back to the Dungeon");
+ return ("gate leading back out of here");
case DNGN_MALIGN_GATEWAY:
return ("portal to somewhere");
case DNGN_RETURN_FROM_DWARVEN_HALL:
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index adc644f..8c8dd8d 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -940,7 +940,7 @@ static void _fixup_pandemonium_stairs()
if (grd(*ri) >= DNGN_STONE_STAIRS_UP_I
&& grd(*ri) <= DNGN_ESCAPE_HATCH_UP)
{
- if (one_chance_in(50))
+ if (one_chance_in(15))
grd(*ri) = DNGN_EXIT_PANDEMONIUM;
else
grd(*ri) = DNGN_FLOOR;
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index d407c10..34822e1 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -550,6 +550,12 @@ void banished(dungeon_feature_type gate_type, const std::string &who)
return;
}
cast_into = "the Abyss";
+ you.abyss_return_info.name = you.level_type_name;
+ you.abyss_return_info.name_abbrev = you.level_type_name_abbrev;
+ you.abyss_return_info.origin = you.level_type_origin;
+ you.abyss_return_info.tag = you.level_type_tag;
+ you.abyss_return_info.ext = you.level_type_ext;
+ you.abyss_return_info.description = level_id::current().describe();
break;
case DNGN_EXIT_ABYSS:
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index 5dd60a6..1afee52 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -314,6 +314,15 @@ public:
// If true, player is headed to the Abyss.
bool banished;
std::string banished_by;
+ struct abyss_return_info_struct {
+ std::string description;
+ std::string name;
+ std::string name_abbrev;
+ std::string origin;
+ std::string tag;
+ std::string ext;
+ };
+ abyss_return_info_struct abyss_return_info;
bool wield_change; // redraw weapon
bool redraw_quiver; // redraw quiver
diff --git a/crawl-ref/source/stairs.cc b/crawl-ref/source/stairs.cc
index dab3156..82e1001 100644
--- a/crawl-ref/source/stairs.cc
+++ b/crawl-ref/source/stairs.cc
@@ -110,8 +110,10 @@ static void _player_change_level_reset()
static level_id _stair_destination_override()
{
- const std::string force_place =
+ const std::string force_place = (grd(you.pos()) == DNGN_EXIT_ABYSS) ?
+ you.abyss_return_info.description :
env.markers.property_at(you.pos(), MAT_ANY, "dstplace");
+
if (!force_place.empty())
{
try
@@ -461,6 +463,14 @@ static void _leaving_level_now(dungeon_feature_type stair_used)
}
_clear_golubria_traps();
+
+ if (grd(you.pos()) == DNGN_EXIT_ABYSS) {
+ you.level_type_name = you.abyss_return_info.name;
+ you.level_type_name_abbrev = you.abyss_return_info.name_abbrev;
+ you.level_type_origin = you.abyss_return_info.origin;
+ you.level_type_tag = you.abyss_return_info.tag;
+ you.level_type_ext = you.abyss_return_info.ext;
+ }
}
static void _set_entry_cause(entry_cause_type default_cause,
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index 238a137..da9755e 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -125,6 +125,8 @@ const int8_t FORBIDDEN = -1;
// Map of terrain types that are traversable.
static FixedVector<int8_t,NUM_FEATURES> traversable_terrain;
+static std::set<std::string> portal_names;
+
/*
* Warn if interlevel travel is going to take you outside levels in
* the range [src,dest].
@@ -3100,7 +3102,15 @@ unsigned short level_id::packed_place() const
std::string level_id::describe(bool long_name, bool with_number) const
{
- return place_name(this->packed_place(), long_name, with_number);
+ std::string description = place_name(this->packed_place(),
+ long_name, with_number);
+ if (level_type == LEVEL_PORTAL_VAULT) {
+ std::string::size_type cpos = description.find(':');
+ const std::string brname = (cpos != std::string::npos ?
+ description.substr(0, cpos) : description);
+ portal_names.insert(brname);
+ }
+ return description;
}
level_id level_id::parse_level_id(const std::string &s) throw (std::string)
@@ -3115,7 +3125,8 @@ level_id level_id::parse_level_id(const std::string &s) throw (std::string)
return (level_id(LEVEL_PANDEMONIUM));
else if (brname == "Lab")
return (level_id(LEVEL_LABYRINTH));
- else if (brname == "Port")
+ else if (brname == "Port" ||
+ portal_names.find(brname) != portal_names.end())
return (level_id(LEVEL_PORTAL_VAULT));
const branch_type br = str_to_branch(brname);
--
1.7.4.1
abyss_followup.patch [^] (4,657 bytes) 2011-09-01 01:05 [Show Content] [Hide Content]From a8a90eca848c6a19fc24fcbf09bbba77f6b7d5ab Mon Sep 17 00:00:00 2001
From: Aaron Becker <akbecker@gmail.com>
Date: Wed, 31 Aug 2011 17:30:54 -0500
Subject: [PATCH 3/3] Move abyss saved data to props and decrease pan portal chance
---
crawl-ref/source/dungeon.cc | 2 +-
crawl-ref/source/effects.cc | 12 ++++++------
crawl-ref/source/player.h | 9 ---------
crawl-ref/source/stairs.cc | 23 +++++++++++++++++------
4 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index abd5d4b..253c7e7 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -940,7 +940,7 @@ static void _fixup_pandemonium_stairs()
if (grd(*ri) >= DNGN_STONE_STAIRS_UP_I
&& grd(*ri) <= DNGN_ESCAPE_HATCH_UP)
{
- if (one_chance_in(15))
+ if (one_chance_in(20))
grd(*ri) = DNGN_EXIT_PANDEMONIUM;
else
grd(*ri) = DNGN_FLOOR;
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index af73e48..65f88b4 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -550,12 +550,12 @@ void banished(dungeon_feature_type gate_type, const std::string &who)
return;
}
cast_into = "the Abyss";
- you.abyss_return_info.name = you.level_type_name;
- you.abyss_return_info.name_abbrev = you.level_type_name_abbrev;
- you.abyss_return_info.origin = you.level_type_origin;
- you.abyss_return_info.tag = you.level_type_tag;
- you.abyss_return_info.ext = you.level_type_ext;
- you.abyss_return_info.description = level_id::current().describe();
+ you.props["abyss_return_name"] = you.level_type_name;
+ you.props["abyss_return_abbrev"] = you.level_type_name_abbrev;
+ you.props["abyss_return_origin"] = you.level_type_origin;
+ you.props["abyss_return_tag"] = you.level_type_tag;
+ you.props["abyss_return_ext"] = you.level_type_ext;
+ you.props["abyss_return_desc"] = level_id::current().describe();
break;
case DNGN_EXIT_ABYSS:
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index c6c2686..e215cbd 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -314,15 +314,6 @@ public:
// If true, player is headed to the Abyss.
bool banished;
std::string banished_by;
- struct abyss_return_info_struct {
- std::string description;
- std::string name;
- std::string name_abbrev;
- std::string origin;
- std::string tag;
- std::string ext;
- };
- abyss_return_info_struct abyss_return_info;
bool wield_change; // redraw weapon
bool redraw_quiver; // redraw quiver
diff --git a/crawl-ref/source/stairs.cc b/crawl-ref/source/stairs.cc
index 82e1001..fe1c3c8 100644
--- a/crawl-ref/source/stairs.cc
+++ b/crawl-ref/source/stairs.cc
@@ -111,7 +111,7 @@ static void _player_change_level_reset()
static level_id _stair_destination_override()
{
const std::string force_place = (grd(you.pos()) == DNGN_EXIT_ABYSS) ?
- you.abyss_return_info.description :
+ static_cast<std::string>(you.props["abyss_return_desc"]) :
env.markers.property_at(you.pos(), MAT_ANY, "dstplace");
if (!force_place.empty())
@@ -465,11 +465,22 @@ static void _leaving_level_now(dungeon_feature_type stair_used)
_clear_golubria_traps();
if (grd(you.pos()) == DNGN_EXIT_ABYSS) {
- you.level_type_name = you.abyss_return_info.name;
- you.level_type_name_abbrev = you.abyss_return_info.name_abbrev;
- you.level_type_origin = you.abyss_return_info.origin;
- you.level_type_tag = you.abyss_return_info.tag;
- you.level_type_ext = you.abyss_return_info.ext;
+ you.level_type_name =
+ static_cast<std::string>(you.props["abyss_return_name"]);
+ you.level_type_name_abbrev =
+ static_cast<std::string>(you.props["abyss_return_abbrev"]);
+ you.level_type_origin =
+ static_cast<std::string>(you.props["abyss_return_origin"]);
+ you.level_type_tag =
+ static_cast<std::string>(you.props["abyss_return_tag"]);
+ you.level_type_ext =
+ static_cast<std::string>(you.props["abyss_return_ext"]);
+ you.props.erase("abyss_return_desc");
+ you.props.erase("abyss_return_name");
+ you.props.erase("abyss_return_abbrev");
+ you.props.erase("abyss_return_origin");
+ you.props.erase("abyss_return_tag");
+ you.props.erase("abyss_return_ext");
}
}
--
1.7.4.1
|