diff options
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/docs/level-design.txt | 8 | ||||
-rw-r--r-- | crawl-ref/source/dungeon.cc | 17 | ||||
-rw-r--r-- | crawl-ref/source/mapdef.cc | 12 | ||||
-rw-r--r-- | crawl-ref/source/mapdef.h | 3 |
4 files changed, 33 insertions, 7 deletions
diff --git a/crawl-ref/docs/level-design.txt b/crawl-ref/docs/level-design.txt index dfb2028eae..1605340de8 100644 --- a/crawl-ref/docs/level-design.txt +++ b/crawl-ref/docs/level-design.txt @@ -477,7 +477,13 @@ MONS: (list of monsters) You can use weights as for ITEM: lines. Individual monsters may be prefixed with the "generate_awake" - (without the quotes). Use this sparingly. + (without the quotes). Use this sparingly: + MONS: generate_awake giant beetle + + Monsters can also be given colours that override their default + colour. Use this *very* sparingly: + MONS: col:darkgrey fungus + Note that 8, 9, 0 also place monsters (see the table). diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 09f8b43ecb..23daf0d16c 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -4002,11 +4002,18 @@ bool dgn_place_monster(const mons_spec &mspec, grd[vx][vy] = habitat; } - int not_used; - return (place_monster( not_used, mid, monster_level, - m_generate_awake? BEH_WANDER : BEH_SLEEP, - MHITNOT, true, vx, vy, false, - PROX_ANYWHERE, mspec.monnum)); + int mindex = NON_MONSTER; + const bool placed = + place_monster( mindex, mid, monster_level, + m_generate_awake? BEH_WANDER : BEH_SLEEP, + MHITNOT, true, vx, vy, false, + PROX_ANYWHERE, mspec.monnum); + if (placed && mindex != -1 && mindex != NON_MONSTER + && mspec.colour != BLACK) + { + menv[mindex].colour = mspec.colour; + } + return (placed); } return (false); } diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc index 8dadc81c8f..c446f6d969 100644 --- a/crawl-ref/source/mapdef.cc +++ b/crawl-ref/source/mapdef.cc @@ -1907,6 +1907,18 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec) mspec.fix_mons = strip_tag(s, "fix_mons"); mspec.generate_awake = strip_tag(s, "generate_awake"); + std::string colour = strip_tag_prefix(s, "col:"); + if (!colour.empty()) + { + mspec.colour = str_to_colour(colour, BLACK); + if (mspec.colour == BLACK) + { + error = make_stringf("bad monster colour \"%s\" in \"%s\"", + colour.c_str(), specs[i].c_str()); + return (slot); + } + } + trim_string(s); if (s == "8") diff --git a/crawl-ref/source/mapdef.h b/crawl-ref/source/mapdef.h index 9d2e7e2b57..de6ead6047 100644 --- a/crawl-ref/source/mapdef.h +++ b/crawl-ref/source/mapdef.h @@ -333,12 +333,13 @@ struct mons_spec int genweight, mlevel; bool fix_mons; bool generate_awake; + int colour; mons_spec(int id = RANDOM_MONSTER, int num = 250, int gw = 10, int ml = 0, bool _fixmons = false, bool awaken = false) : mid(id), monnum(num), genweight(gw), mlevel(ml), fix_mons(_fixmons), - generate_awake(awaken) + generate_awake(awaken), colour(BLACK) { } }; |