diff options
-rw-r--r-- | crawl-ref/docs/level_design.txt | 13 | ||||
-rw-r--r-- | crawl-ref/source/externs.h | 5 | ||||
-rw-r--r-- | crawl-ref/source/files.cc | 11 | ||||
-rw-r--r-- | crawl-ref/source/misc.cc | 13 | ||||
-rw-r--r-- | crawl-ref/source/tags.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/tags.h | 3 |
6 files changed, 41 insertions, 8 deletions
diff --git a/crawl-ref/docs/level_design.txt b/crawl-ref/docs/level_design.txt index 165716de98..8dd1799c24 100644 --- a/crawl-ref/docs/level_design.txt +++ b/crawl-ref/docs/level_design.txt @@ -1330,15 +1330,15 @@ portal vaults in the following steps (no compilation is necessary): Before going into the details of portal vault creation, some words about their uses: Portal vaults are different from branches in that they are -not guaranteed. Also, there is only one go at a portal vault - if you +not guaranteed. Also, there is only one go at a portal vault - if you leave, it's gone for good. You can apply special rules to a portal vault, like enforcing maprot. -Portal vaults can be particulary thematic, using specialised monster +Portal vaults can be particulary thematic, using specialised monster sets, fitting loot, coloured dungeon features etc. Avoid death traps; it is no fun to enter a vault, being unable to leave and be killed outright. In order to provide fun and reduce spoiler effects, randomise. For portal -vaults, it is desirable to have several different layouts (ideally each +vaults, it is desirable to have several different layouts (ideally each of the maps has some randomisation on its own). Often, it is a good idea to skew the map distribution: e.g. with four destination vaults, weights like 40,30,20,10 might be more interesting than 25,25,25,25. @@ -1388,6 +1388,11 @@ that isn't present the "dst" paremeter. It can be set to something else with the "overmap" parameter. A note can be made to accompany the portal's position on the overmap with the "overmap_note" parameter. +Bones files for characters killed in the portal vault will normally +use an extension derived from the first three letters of the 'dst' +property. You can override this by setting the 'dstext' property to +your preferred extension. + This will produce a portal, but attempting to use it will trigger an ASSERT since there's no map for the destination. So we create a destination map like so: @@ -1496,7 +1501,7 @@ end You can then use this line in the map definition to execute the lua block: : sewer_random_monster_list(_G) -You can also set env.spawn_random_rate() to have monsters generated from the +You can also set env.spawn_random_rate() to have monsters generated from the list during play. diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index ab99a99379..850a5ccb37 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -877,6 +877,11 @@ public: // if not explicitly set by the entry portal. std::string level_type_name; + // Three-letter extension for portal vault bones files. Will be set + // to first three letters of level_type_tag if not explicitly set by + // the entry portal. + std::string level_type_ext; + // Abbreviation of portal vault name, for use in notes. If not // explicitly set by the portal vault, will be set from level_type_name // or level_type_tag if either is short enough, or the shorter of the diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index 070076e706..ecaa0c1abf 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -1540,11 +1540,16 @@ void save_game_state() save_game(true); } +static std::string _make_portal_vault_ghost_suffix() +{ + return you.level_type_ext.empty()? "ptl" : you.level_type_ext; +} + static std::string _make_ghost_filename() { if (you.level_type == LEVEL_PORTAL_VAULT) { - std::string suffix = "ptl"; + const std::string suffix = _make_portal_vault_ghost_suffix(); return get_savedir_filename("bones", "", suffix, true); } else @@ -1602,7 +1607,7 @@ void _load_ghost(void) fclose(gfile); #if DEBUG_DIAGNOSTICS - mpr( "Loaded ghost.", MSGCH_DIAGNOSTICS ); + mpr( "Loaded ghost.", MSGCH_DIAGNOSTICS ); #endif // Remove bones file - ghosts are hardly permanent. @@ -1935,7 +1940,7 @@ void save_ghost( bool force ) lk_close(gfile, "wb", cha_fil); #if DEBUG_DIAGNOSTICS - mpr( "Saved ghost.", MSGCH_DIAGNOSTICS ); + mprf(MSGCH_DIAGNOSTICS, "Saved ghost (%s).", cha_fil.c_str() ); #endif DO_CHMOD_PRIVATE(cha_fil.c_str()); diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 5b4300013c..b67114cf6d 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -1304,6 +1304,10 @@ static void leaving_level_now() const std::string newtype = env.markers.property_at(you.pos(), MAT_ANY, "dst"); + // Extension to use for bones files. + const std::string newext = + env.markers.property_at(you.pos(), MAT_ANY, "dstext"); + const std::string oldname = you.level_type_name; std::string newname = env.markers.property_at(you.pos(), MAT_ANY, "dstname"); @@ -1357,6 +1361,7 @@ static void leaving_level_now() { you.level_type_tag = newtype; } + const std::string spaced_tag = replace_all(you.level_type_tag, "_", " "); if (!you.level_type_tag.empty() && you.level_type_name.empty()) @@ -1378,6 +1383,14 @@ static void leaving_level_now() } } + if (!newext.empty()) + you.level_type_ext = newext; + else if (!you.level_type_tag.empty()) + you.level_type_ext = lowercase_string(you.level_type_tag); + + if (you.level_type_ext.length() > 3) + you.level_type_ext = you.level_type_ext.substr(0, 3); + if (!neworigin.empty()) you.level_type_origin = neworigin; else if (!you.level_type_name.empty()) diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc index 071398da15..b494a0031d 100644 --- a/crawl-ref/source/tags.cc +++ b/crawl-ref/source/tags.cc @@ -846,6 +846,7 @@ static void tag_construct_you(writer &th) marshallString(th, you.level_type_name_abbrev); marshallString(th, you.level_type_origin); marshallString(th, you.level_type_tag); + marshallString(th, you.level_type_ext); marshallByte(th, you.entry_cause); marshallByte(th, you.entry_cause_god); marshallByte(th, you.synch_time); @@ -1264,6 +1265,9 @@ static void tag_read_you(reader &th, char minorVersion) you.level_type_name_abbrev = unmarshallString(th); you.level_type_origin = unmarshallString(th); you.level_type_tag = unmarshallString(th); + + if (minorVersion >= TAG_MINOR_PORTEXT) + you.level_type_ext = unmarshallString(th); } you.entry_cause = static_cast<entry_cause_type>( unmarshallByte(th) ); diff --git a/crawl-ref/source/tags.h b/crawl-ref/source/tags.h index 73d3103013..b9ca330b2a 100644 --- a/crawl-ref/source/tags.h +++ b/crawl-ref/source/tags.h @@ -61,7 +61,8 @@ enum tag_minor_version TAG_MINOR_LUADGN = 11, // Allow dungeon Lua to persist data. // Bump version past 12. TAG_MINOR_SVNREV = 13, // Added SVN revision - TAG_MINOR_VERSION = 13 // Current version. (Keep equal to max.) + TAG_MINOR_PORTEXT = 14, // Keep track of portal vault extensions. + TAG_MINOR_VERSION = 14 // Current version. (Keep equal to max.) }; |