From 04d5776a5cd366a0812dec39f23a2dd8867f47c0 Mon Sep 17 00:00:00 2001 From: zelgadis Date: Sun, 28 Dec 2008 06:53:07 +0000 Subject: The entry gates to portal vaults can now set their long feature description via the desc_long property of the Lua marker. The lets the portal vault code be enitrely self contained, rather than having to have a portion of the description in dat/descript/features.txt. Also, in theory each different entry vault could have its own version of the description, or it could even programatically vary after the entry vault had been generated (since it can be a function in addition to a string). Also, since the gate's short feature description is no longer needed as a key into the features database, the short description doesn't need to be the same for each entry vault. The way I put the descriptions into the .des files is a bit clunky, but when I tried to use the Lua multi-line string quote ([[string]]) each line displayed by Crawl was indented one space. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8001 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/dat/bazaar.des | 15 ++++++++++++++- crawl-ref/source/dat/clua/lm_pdesc.lua | 4 ++++ crawl-ref/source/dat/descript/features.txt | 28 ---------------------------- crawl-ref/source/dat/icecave.des | 5 +++++ crawl-ref/source/dat/sewer.des | 9 +++++++++ crawl-ref/source/describe.cc | 25 ++++++++++++++++++++++++- crawl-ref/source/mapmark.cc | 10 ++++++++++ crawl-ref/source/mapmark.h | 2 ++ 8 files changed, 68 insertions(+), 30 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/dat/bazaar.des b/crawl-ref/source/dat/bazaar.des index e063de01f6..47d6cf3e1a 100644 --- a/crawl-ref/source/dat/bazaar.des +++ b/crawl-ref/source/dat/bazaar.des @@ -11,6 +11,19 @@ lua {{ function bazaar_portal() + local desc_long = +"Aside from the vendors who've set up their stores at various places in the ".. +"dungeon, there are others trying to make a living by traveling from place".. +"to place. Bazaars feature a number of different shops and often have better".. +"stock than the sedentary ones, sometimes even at a bargain.".. +"Once you hear the clinking of coins, be sure to hurry up and find the".. +"impromptu marketplace before the caravan moves on!".. +"\n\n".. +"Also be warned that their nomadic lifestyle has taught these sellers to".. +"appropriate any items an adventurer might leave behind, and then leave".. +"quickly, probably to sell them elsewhere." + + local messager = timed_msg { initmsg = { "You hear coins being counted.", @@ -28,7 +41,7 @@ function bazaar_portal() return timed_marker { low=blow, high=bhigh, msg=messager, disappear='The gate to the bazaar disappears!', - desc = pdesc, dst = 'bazaar', + desc = pdesc, desc_long = desc_long, dst = 'bazaar', floor = 'stone_arch' } else diff --git a/crawl-ref/source/dat/clua/lm_pdesc.lua b/crawl-ref/source/dat/clua/lm_pdesc.lua index 32ae8e49a8..4d3fc4b28a 100644 --- a/crawl-ref/source/dat/clua/lm_pdesc.lua +++ b/crawl-ref/source/dat/clua/lm_pdesc.lua @@ -36,6 +36,10 @@ function PortalDescriptor:feature_description(marker) return self:unmangle(self.props.desc) end +function PortalDescriptor:feature_description_long(marker) + return self:unmangle(self.props.desc_long) +end + function PortalDescriptor:property(marker, pname) return self:unmangle(self.props and self.props[pname] or '') end diff --git a/crawl-ref/source/dat/descript/features.txt b/crawl-ref/source/dat/descript/features.txt index 3a916ee90b..5f344e5488 100644 --- a/crawl-ref/source/dat/descript/features.txt +++ b/crawl-ref/source/dat/descript/features.txt @@ -15,25 +15,6 @@ A deep blue altar of Sif Muna %%%% A dry fountain %%%% -A flickering gateway to a bazaar - -Aside from the vendors who've set up their stores at various places in the -dungeon, there are others trying to make a living by traveling from place -to place. Bazaars feature a number of different shops and often have better -stock than the sedentary ones, sometimes even at a bargain. -Once you hear the clinking of coins, be sure to hurry up and find the -impromptu marketplace before the caravan moves on! - -Also be warned that their nomadic lifestyle has taught these sellers to -appropriate any items an adventurer might leave behind, and then leave -quickly, probably to sell them elsewhere. -%%%% -A frozen archway - -A permanent cold front seems to surround this portal. Whatever lives on the -other side, they will be full of grim and arctic fury. You note that the -archway is melting away. -%%%% A fountain of clear blue water 'q'uaff to drink from this fountain. But it's far more pretty than useful, unless you're trying to fetch the Orb without eating, I guess. @@ -52,15 +33,6 @@ A gate leading out of Pandemonium %%%% A gate leading to another region of Pandemonium %%%% -A glowing drain - -Every settlement brings forth the unpleasant sewers and drains, ignored by -most but hideaways for others. Old tales speak of dangerous creatures, -bathing in disgustingly green water, preying on each other without mercy. -The tales also tell of the valuable items left by daring and unfortunate -visitors, left to collect dust in the damp caverns. You have an uncanny -feeling that the drain will fall apart rather soon. -%%%% A one-way gate leading to the halls of Pandemonium Tales about successful loots of these netherworlds are rare. Even the strongest diff --git a/crawl-ref/source/dat/icecave.des b/crawl-ref/source/dat/icecave.des index 533f348e1b..336b3768ce 100644 --- a/crawl-ref/source/dat/icecave.des +++ b/crawl-ref/source/dat/icecave.des @@ -15,6 +15,10 @@ {{ function ice_cave_portal(e) + local desc_long = "A permanent cold front seems to surround this " .. + "portal. Whatever lives on the other side, they will be full of " .. + "grim and arctic fury. You note that the archway is melting away." + local timeout_turns = crawl.random_range(1200, 1700) local messager = @@ -33,6 +37,7 @@ function ice_cave_portal(e) timed_marker { disappear = "The archway melts and disappears.", desc = "A frozen archway", + desc_long = desc_long, entity = 'archway', dst = "ice_cave", dstname_abbrev = "IceCv", diff --git a/crawl-ref/source/dat/sewer.des b/crawl-ref/source/dat/sewer.des index a3df380171..239cc03cf7 100644 --- a/crawl-ref/source/dat/sewer.des +++ b/crawl-ref/source/dat/sewer.des @@ -15,6 +15,14 @@ {{ function sewer_portal(e) + local desc_long = +"Every settlement brings forth the unpleasant sewers and drains, ignored by ".. +"most but hideaways for others. Old tales speak of dangerous creatures, ".. +"bathing in disgustingly green water, preying on each other without mercy. ".. +"The tales also tell of the valuable items left by daring and unfortunate ".. +"visitors, left to collect dust in the damp caverns. You have an uncanny ".. +"feeling that the drain will fall apart rather soon." + local timeout_turns = crawl.random_range(1500, 2000) local messager = @@ -33,6 +41,7 @@ function sewer_portal(e) timed_marker { disappear = "The drain falls to bits.", desc = "glowing drain", + desc_long = desc_long, entity = 'drain', dst = "sewer", dstorigin = "in the sewers", diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index 3764151469..42bf6aa797 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -33,6 +33,7 @@ #include "itemname.h" #include "itemprop.h" #include "macro.h" +#include "mapmark.h" #include "menu.h" #include "message.h" #include "monstuff.h" @@ -1990,6 +1991,18 @@ std::string get_item_description( const item_def &item, bool verbose, return description.str(); } // end get_item_description() +static std::string _marker_feature_description(const coord_def &pos) +{ + std::vector markers = env.markers.get_markers_at(pos); + for (int i = 0, size = markers.size(); i < size; ++i) + { + const std::string desc = markers[i]->feature_description_long(); + if (!desc.empty()) + return (desc); + } + return (""); +} + static std::string _get_feature_description_wide(int feat) { return std::string(); @@ -2017,8 +2030,18 @@ void describe_feature_wide(int x, int y) bool custom_desc = false; + if (feat == DNGN_ENTER_PORTAL_VAULT) + { + std::string _desc = _marker_feature_description(pos); + if (!_desc.empty()) + { + long_desc = _desc; + custom_desc = true; + } + } + const CrawlHashTable &props = env.properties; - if (props.exists(LONG_DESC_KEY)) + if (!custom_desc && props.exists(LONG_DESC_KEY)) { const CrawlHashTable &desc_table = props[LONG_DESC_KEY].get_table(); diff --git a/crawl-ref/source/mapmark.cc b/crawl-ref/source/mapmark.cc index 7399515473..0f5afa95b6 100644 --- a/crawl-ref/source/mapmark.cc +++ b/crawl-ref/source/mapmark.cc @@ -71,6 +71,11 @@ std::string map_marker::feature_description() const return (""); } +std::string map_marker::feature_description_long() const +{ + return (""); +} + std::string map_marker::property(const std::string &pname) const { return (""); @@ -382,6 +387,11 @@ std::string map_lua_marker::feature_description() const return (call_str_fn("feature_description")); } +std::string map_lua_marker::feature_description_long() const +{ + return (call_str_fn("feature_description_long")); +} + std::string map_lua_marker::property(const std::string &pname) const { lua_stack_cleaner cln(dlua); diff --git a/crawl-ref/source/mapmark.h b/crawl-ref/source/mapmark.h index 67b2c23f75..c21cb1e30c 100644 --- a/crawl-ref/source/mapmark.h +++ b/crawl-ref/source/mapmark.h @@ -43,6 +43,7 @@ public: virtual void read(reader &); virtual std::string debug_describe() const = 0; virtual std::string feature_description() const; + virtual std::string feature_description_long() const; virtual std::string property(const std::string &pname) const; static map_marker *read_marker(reader &); @@ -115,6 +116,7 @@ public: map_marker *clone() const; std::string debug_describe() const; std::string feature_description() const; + std::string feature_description_long() const; std::string property(const std::string &pname) const; bool notify_dgn_event(const dgn_event &e); -- cgit v1.2.3-54-g00ecf