summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-08-09 11:03:22 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-08-09 11:03:22 +0000
commite6a12403170aa719f2ae597c3b251a7f25ddbb94 (patch)
treecfce32d539e420d57f216f076561123b159b4d75
parent2783491ec3f7c58c6d9872f8cafd74511091a198 (diff)
downloadcrawl-ref-e6a12403170aa719f2ae597c3b251a7f25ddbb94.tar.gz
crawl-ref-e6a12403170aa719f2ae597c3b251a7f25ddbb94.zip
[1770625] Allow generated monster names in &M.
Removed sealed entry vaults. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1982 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/dat/entry.des53
-rw-r--r--crawl-ref/source/debug.cc60
-rw-r--r--crawl-ref/source/dungeon.cc49
-rw-r--r--crawl-ref/source/dungeon.h5
-rw-r--r--crawl-ref/source/monplace.h1
5 files changed, 73 insertions, 95 deletions
diff --git a/crawl-ref/source/dat/entry.des b/crawl-ref/source/dat/entry.des
index 3abb9ddbfa..8a850b5565 100644
--- a/crawl-ref/source/dat/entry.des
+++ b/crawl-ref/source/dat/entry.des
@@ -3391,59 +3391,6 @@ MAP
..............................
ENDMAP
-##############################################################################
-# Being Mean Is Cool
-
-NAME: erik_entry_006_a
-TAGS: entry
-ORIENT: float
-CHANCE: 5
-ITEM: scroll of curse armour
-ITEM: scroll of teleportation
-MAP
-xxxxx
-xxexx
-xd{ex
-xxdxx
-xxxxx
-ENDMAP
-
-NAME: erik_entry_006_b
-TAGS: entry
-ORIENT: float
-CHANCE: 4
-ITEM: scroll of curse armour, scroll of random uselessness, scroll of identify
-ITEM: scroll of curse armour, scroll of fear, scroll of teleportation
-SHUFFLE: def, ghi
-MAP
-@.....@
-.xx=xx.
-.xxgxx.
-.=d{g=.
-.xxdxx.
-.xx=xx.
-@.....@
-ENDMAP
-
-NAME: erik_entry_006_c
-TAGS: entry
-ORIENT: float
-CHANCE: 1
-SHUFFLE: uU / vV / wW / zZ
-SUBST: u==, v==, V=~, w=x, W=x, z==, Z=~.
-ITEM: scroll of curse armour, scroll of random uselessness, scroll of identify
-ITEM: scroll of curse armour, scroll of fear, scroll of teleportation
-KFEAT: U = teleport trap
-MAP
-xxxxxxx
-xZxxxWx
-xxzgwxx
-xxd{gxx
-xxudvxx
-xUxxxVx
-xxxxxxx
-ENDMAP
-
##############################################################################
# Matt's vaults
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index 64843bc131..3f929b4d1a 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -150,14 +150,15 @@ static int debug_prompt_for_monster( void )
{
char specs[80];
- mpr( "(Hint: 'generated' names, eg 'orc zombie', won't work)", MSGCH_PROMPT );
mpr( "Which monster by name? ", MSGCH_PROMPT );
- get_input_line( specs, sizeof( specs ) );
-
- if (specs[0] == '\0')
- return (-1);
+ if (!cancelable_get_line(specs, sizeof specs))
+ {
+ if (specs[0] == '\0')
+ return (-1);
- return (get_monster_by_name(specs));
+ return (get_monster_by_name(specs));
+ }
+ return (-1);
}
#endif
@@ -374,27 +375,42 @@ void create_spec_monster(void)
#ifdef WIZARD
void create_spec_monster_name(int x, int y)
{
- int mon = debug_prompt_for_monster();
-
- if (mon == -1 || mon == MONS_PROGRAM_BUG)
+ char specs[100];
+ mpr( "Which monster by name? ", MSGCH_PROMPT );
+ if (cancelable_get_line(specs, sizeof specs) || !*specs)
{
- mpr("I couldn't find that monster.");
+ canned_msg(MSG_OK);
+ return;
+ }
- if (one_chance_in(20))
- mpr("Maybe it's hiding.");
+ mons_list mlist;
+ std::string err = mlist.add_mons(specs);
+
+ if (!err.empty())
+ {
+ mpr(err.c_str());
+ return;
}
- else
+
+ const bool force_place = x != -1 && y != -1;
+ if (x == -1)
+ x = you.x_pos;
+ if (y == -1)
+ y = you.y_pos;
+
+ const mons_spec mspec = mlist.get_monster(0);
+ if (!force_place && mspec.mid != -1)
{
- const bool force_place = x != -1 && y != -1;
- if (x == -1)
- x = you.x_pos;
- if (y == -1)
- y = you.y_pos;
-
- create_monster(mon, 0, BEH_SLEEP, x, y,
- MHITNOT, 250, false, force_place);
+ coord_def place = find_newmons_square(mspec.mid, x, y);
+ if (in_bounds(place))
+ {
+ x = place.x;
+ y = place.y;
+ }
}
-} // end create_spec_monster_name()
+
+ dgn_place_monster(mspec, you.your_level, x, y, false);
+}
#endif
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 549f5b136d..8c4aacb04b 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -3702,7 +3702,7 @@ static bool build_vaults(int level_number, int force_vault, int rune_subst,
return (true);
} // end build_vaults()
-static void dngn_place_item_explicit(const item_spec &spec,
+static void dgn_place_item_explicit(const item_spec &spec,
int x, int y, int level)
{
// Dummy object?
@@ -3738,15 +3738,15 @@ static void dngn_place_item_explicit(const item_spec &spec,
}
}
-static void dngn_place_multiple_items(item_list &list,
+static void dgn_place_multiple_items(item_list &list,
int x, int y, int level)
{
const int size = list.size();
for (int i = 0; i < size; ++i)
- dngn_place_item_explicit(list.get_item(i), x, y, level);
+ dgn_place_item_explicit(list.get_item(i), x, y, level);
}
-static void dngn_place_item_explicit(int index, int x, int y,
+static void dgn_place_item_explicit(int index, int x, int y,
vault_placement &place,
int level)
{
@@ -3762,20 +3762,17 @@ static void dngn_place_item_explicit(int index, int x, int y,
}
const item_spec spec = sitems.get_item(index);
- dngn_place_item_explicit(spec, x, y, level);
+ dgn_place_item_explicit(spec, x, y, level);
}
-static bool dngn_place_monster(
- const vault_placement &place,
- const mons_spec &mspec,
- int monster_level,
- int vx, int vy)
+bool dgn_place_monster(const mons_spec &mspec,
+ int monster_level, int vx, int vy,
+ bool generate_awake)
{
if (mspec.mid != -1)
{
const int mid = mspec.mid;
- const bool generate_awake =
- mspec.generate_awake || place.map.has_tag("generate_awake");
+ const bool m_generate_awake = generate_awake || mspec.generate_awake;
const int mlev = mspec.mlevel;
if (mlev)
@@ -3800,14 +3797,26 @@ static bool dngn_place_monster(
int not_used;
return (place_monster( not_used, mid, monster_level,
- generate_awake? BEH_WANDER : BEH_SLEEP,
+ m_generate_awake? BEH_WANDER : BEH_SLEEP,
MHITNOT, true, vx, vy, false,
PROX_ANYWHERE, mspec.monnum));
}
- return (false);
+ return (false);
+}
+
+static bool dgn_place_monster(
+ const vault_placement &place,
+ const mons_spec &mspec,
+ int monster_level,
+ int vx, int vy)
+{
+ const bool generate_awake =
+ mspec.generate_awake || place.map.has_tag("generate_awake");
+ return dgn_place_monster(mspec, monster_level, vx, vy,
+ generate_awake);
}
-static bool dngn_place_one_monster(
+static bool dgn_place_one_monster(
const vault_placement &place,
mons_list &mons,
int monster_level,
@@ -3815,7 +3824,7 @@ static bool dngn_place_one_monster(
{
for (int i = 0, size = mons.size(); i < size; ++i)
{
- if (dngn_place_monster(place, mons.get_monster(i),
+ if (dgn_place_monster(place, mons.get_monster(i),
monster_level, vx, vy))
{
return (true);
@@ -3940,10 +3949,10 @@ static int vault_grid( vault_placement &place,
grd[vx][vy] = DNGN_FLOOR;
mons_list &mons = mapsp->get_monsters();
- dngn_place_one_monster(place, mons, level_number, vx, vy);
+ dgn_place_one_monster(place, mons, level_number, vx, vy);
item_list &items = mapsp->get_items();
- dngn_place_multiple_items(items, vx, vy, level_number);
+ dgn_place_multiple_items(items, vx, vy, level_number);
return (altar_count);
}
@@ -4118,7 +4127,7 @@ static int vault_grid( vault_placement &place,
// defghijk - items
if (vgrid >= 'd' && vgrid <= 'k')
{
- dngn_place_item_explicit(vgrid - 'd', vx, vy, place, level_number);
+ dgn_place_item_explicit(vgrid - 'd', vx, vy, place, level_number);
}
if (grid == DNGN_ORANGE_CRYSTAL_STATUE
@@ -4149,7 +4158,7 @@ static int vault_grid( vault_placement &place,
if (vgrid != '8' && vgrid != '9' && vgrid != '0')
monster_type_thing = place.map.mons.get_monster(vgrid - '1');
- dngn_place_monster(place, monster_type_thing, monster_level, vx, vy);
+ dgn_place_monster(place, monster_type_thing, monster_level, vx, vy);
}
// again, this seems odd, given that this is just one of many
diff --git a/crawl-ref/source/dungeon.h b/crawl-ref/source/dungeon.h
index 36cf1e0e28..09308c7914 100644
--- a/crawl-ref/source/dungeon.h
+++ b/crawl-ref/source/dungeon.h
@@ -284,4 +284,9 @@ bool unforbidden(const coord_def &c, unsigned mask);
coord_def dgn_find_nearby_stair(dungeon_feature_type stair_to_find,
bool find_closest);
+class mons_spec;
+bool dgn_place_monster(const mons_spec &mspec,
+ int monster_level, int vx, int vy,
+ bool generate_awake);
+
#endif
diff --git a/crawl-ref/source/monplace.h b/crawl-ref/source/monplace.h
index 8f85014741..5a125c03e9 100644
--- a/crawl-ref/source/monplace.h
+++ b/crawl-ref/source/monplace.h
@@ -96,5 +96,6 @@ bool monster_habitable_grid(int monster_class, int actual_grid,
int flies = -1, bool paralysed = false);
bool monster_habitable_grid(const monsters *m, int actual_grid);
bool monster_can_submerge(int monster_class, int grid);
+coord_def find_newmons_square(int mons_class, int x, int y);
#endif // MONPLACE_H