From 25827049ebef8e9335375d01a5c77468bd9a3b08 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Tue, 25 Nov 2008 01:01:34 +0000 Subject: Enable vault generation for non-LEVEL_DUNGEON levels, make ziggurat eligible for random gen in main dungeon and Pan; still needs entry portal timing/charging fixes, and ziggurat builder is still incomplete. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7601 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/branch.cc | 21 +++++++++++++++++++++ crawl-ref/source/branch.h | 3 +++ crawl-ref/source/dat/dummy.des | 4 ++-- crawl-ref/source/dat/pan.des | 19 +++++++++++++++++++ crawl-ref/source/dat/ziggurat.des | 4 ++-- crawl-ref/source/dungeon.cc | 3 --- crawl-ref/source/hiscores.cc | 21 --------------------- crawl-ref/source/hiscores.h | 3 --- crawl-ref/source/mapdef.cc | 23 ++++++++++++++--------- crawl-ref/source/mapdef.h | 1 + crawl-ref/source/maps.h | 2 +- 11 files changed, 63 insertions(+), 41 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/branch.cc b/crawl-ref/source/branch.cc index 2df448e731..1aef71e6a9 100644 --- a/crawl-ref/source/branch.cc +++ b/crawl-ref/source/branch.cc @@ -34,6 +34,27 @@ branch_type str_to_branch(const std::string &branch, branch_type err) return (err); } +static const char *level_type_names[] = +{ + "D", "Lab", "Abyss", "Pan", "Port" +}; + +const char *level_area_type_name(int level_type) +{ + if (level_type >= 0 && level_type < NUM_LEVEL_AREA_TYPES) + return level_type_names[level_type]; + return (""); +} + +level_area_type str_to_level_area_type(const std::string &s) +{ + for (int i = 0; i < NUM_LEVEL_AREA_TYPES; ++i) + if (s == level_type_names[i]) + return (static_cast(i)); + + return (LEVEL_DUNGEON); +} + bool set_branch_flags(unsigned long flags, bool silent, branch_type branch) { diff --git a/crawl-ref/source/branch.h b/crawl-ref/source/branch.h index 94222fc689..377e88c3bf 100644 --- a/crawl-ref/source/branch.h +++ b/crawl-ref/source/branch.h @@ -69,6 +69,9 @@ bool at_branch_bottom(); branch_type str_to_branch(const std::string &branch, branch_type err = NUM_BRANCHES); +const char *level_area_type_name(int level_type); +level_area_type str_to_level_area_type(const std::string &s); + bool set_branch_flags(unsigned long flags, bool silent = false, branch_type branch = NUM_BRANCHES); bool unset_branch_flags(unsigned long flags, bool silent = false, diff --git a/crawl-ref/source/dat/dummy.des b/crawl-ref/source/dat/dummy.des index a0474d5b06..01359ec8e1 100644 --- a/crawl-ref/source/dat/dummy.des +++ b/crawl-ref/source/dat/dummy.des @@ -5,7 +5,7 @@ # This represents the old 8/9 chance of *not* placing a regular vault. NAME: primary_dummy TAGS: dummy -DEPTH: 1-100 +DEPTH: 1-100, Pan, Abyss ORIENT: float CHANCE: 10 : 8888 MAP @@ -15,7 +15,7 @@ ENDMAP # This represents the old 2/3 chance of *not* placing a minivault. NAME: primary_mini_dummy TAGS: dummy -DEPTH: 1-100 +DEPTH: 1-100, Pan, Abyss CHANCE: 10 : 6666 MAP x diff --git a/crawl-ref/source/dat/pan.des b/crawl-ref/source/dat/pan.des index 835dafb5fd..e4fcd162af 100644 --- a/crawl-ref/source/dat/pan.des +++ b/crawl-ref/source/dat/pan.des @@ -487,3 +487,22 @@ x....2.2.2....x xxxxxxxxxxxxxxx ENDMAP +############################################################################## +# Random vault and minivault balancers for Pan - no random Pan minivaults yet. + +NAME: pan_mini_dummy_balancer +DEPTH: Pan +TAGS: dummy +WEIGHT: 100 +MAP +x +ENDMAP + +NAME: pan_dummy_balancer +DEPTH: Pan +TAGS: dummy +ORIENT: float +WEIGHT: 100 +MAP +x +ENDMAP diff --git a/crawl-ref/source/dat/ziggurat.des b/crawl-ref/source/dat/ziggurat.des index e2f30776d3..ed2c9132e0 100644 --- a/crawl-ref/source/dat/ziggurat.des +++ b/crawl-ref/source/dat/ziggurat.des @@ -8,8 +8,8 @@ : dofile("clua/ziggurat.lua") NAME: enter_the_ziggurat -# Disabled; ziggurat is still incomplete. -WEIGHT: 0 +# FIXME: Ziggurat is still incomplete - enabled for testing porpoises. +DEPTH: D:20-27, Pan : ziggurat_portal(_G) MAP O diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 8cde1a11b4..668115d8eb 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -2402,9 +2402,6 @@ static void _place_minivaults(const std::string &tag, int lo, int hi, bool force) { const level_id curr = level_id::current(); - // Dungeon-style branches only, thankyouverymuch. - if (curr.level_type != LEVEL_DUNGEON && !force) - return; if (lo == -1) lo = hi = 1; diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc index 14d598fd77..d3d194d554 100644 --- a/crawl-ref/source/hiscores.cc +++ b/crawl-ref/source/hiscores.cc @@ -575,27 +575,6 @@ static const char* _short_branch_name(int branch) return (""); } -static const char *level_type_names[] = -{ - "D", "Lab", "Abyss", "Pan", "Port" -}; - -const char *level_area_type_name(int level_type) -{ - if (level_type >= 0 && level_type < NUM_LEVEL_AREA_TYPES) - return level_type_names[level_type]; - return (""); -} - -level_area_type str_to_level_area_type(const std::string &s) -{ - for (int i = 0; i < NUM_LEVEL_AREA_TYPES; ++i) - if (s == level_type_names[i]) - return (static_cast(i)); - - return (LEVEL_DUNGEON); -} - void scorefile_entry::init_with_fields() { version = fields->str_field("v"); diff --git a/crawl-ref/source/hiscores.h b/crawl-ref/source/hiscores.h index ef16d58da3..39308f0e2c 100644 --- a/crawl-ref/source/hiscores.h +++ b/crawl-ref/source/hiscores.h @@ -39,9 +39,6 @@ std::string hiscores_format_single( const scorefile_entry &se ); std::string hiscores_format_single_long( const scorefile_entry &se, bool verbose = false ); -const char *level_area_type_name(int level_type); -level_area_type str_to_level_area_type(const std::string &s); - #ifdef DGL_MILESTONES void mark_milestone(const std::string &type, const std::string &milestone); #endif diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc index 48fc6fd2d8..8cbe27c026 100644 --- a/crawl-ref/source/mapdef.cc +++ b/crawl-ref/source/mapdef.cc @@ -103,7 +103,8 @@ std::string mapdef_split_key_item(const std::string &s, // level_range::level_range(branch_type br, int s, int d) - : branch(br), shallowest(), deepest(), deny(false) + : level_type(LEVEL_DUNGEON), branch(br), shallowest(), + deepest(), deny(false) { set(s, d); } @@ -116,6 +117,7 @@ level_range::level_range(const raw_range &r) void level_range::write(writer& outf) const { + marshallShort(outf, level_type); marshallShort(outf, branch); marshallShort(outf, shallowest); marshallShort(outf, deepest); @@ -124,6 +126,7 @@ void level_range::write(writer& outf) const void level_range::read(reader& inf) { + level_type = static_cast( unmarshallShort(inf) ); branch = static_cast( unmarshallShort(inf) ); shallowest = unmarshallShort(inf); deepest = unmarshallShort(inf); @@ -168,11 +171,9 @@ void level_range::set(const std::string &br, int s, int d) { if (br == "any" || br == "Any") branch = NUM_BRANCHES; - else - { - if ((branch = str_to_branch(br)) == NUM_BRANCHES) - throw make_stringf("Unknown branch: '%s'", br.c_str()); - } + else if ((branch = str_to_branch(br)) == NUM_BRANCHES + && (level_type = str_to_level_area_type(br)) == LEVEL_DUNGEON) + throw make_stringf("Unknown branch: '%s'", br.c_str()); shallowest = s; deepest = d; @@ -263,12 +264,13 @@ void level_range::set(int s, int d) void level_range::reset() { deepest = shallowest = -1; + level_type = LEVEL_DUNGEON; } bool level_range::matches(const level_id &lid) const { if (lid.level_type != LEVEL_DUNGEON) - return (false); + return (lid.level_type == level_type); if (branch == NUM_BRANCHES) return (matches(absdungeon_depth(lid.branch, lid.depth))); else @@ -285,8 +287,11 @@ bool level_range::matches(int x) const bool level_range::operator == (const level_range &lr) const { - return (deny == lr.deny && shallowest == lr.shallowest - && deepest == lr.deepest && branch == lr.branch); + return (deny == lr.deny && level_type == lr.level_type + && (level_type != LEVEL_DUNGEON + || (shallowest == lr.shallowest + && deepest == lr.deepest + && branch == lr.branch))); } bool level_range::valid() const diff --git a/crawl-ref/source/mapdef.h b/crawl-ref/source/mapdef.h index 585ed6a542..fa28e7f999 100644 --- a/crawl-ref/source/mapdef.h +++ b/crawl-ref/source/mapdef.h @@ -56,6 +56,7 @@ struct raw_range struct level_range { public: + level_area_type level_type; branch_type branch; int shallowest, deepest; bool deny; diff --git a/crawl-ref/source/maps.h b/crawl-ref/source/maps.h index faaeed594f..9ff81cfbf8 100644 --- a/crawl-ref/source/maps.h +++ b/crawl-ref/source/maps.h @@ -55,7 +55,7 @@ extern depth_ranges lc_default_depths; extern dlua_chunk lc_global_prelude; extern bool lc_run_global_prelude; -const int MAP_CACHE_VERSION = 1008; +const int MAP_CACHE_VERSION = 1009; #ifdef DEBUG_DIAGNOSTICS -- cgit v1.2.3-54-g00ecf