summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/beam.cc14
-rw-r--r--crawl-ref/source/makeitem.cc16
-rw-r--r--crawl-ref/source/message.cc6
-rw-r--r--crawl-ref/source/mon-util.cc39
-rw-r--r--crawl-ref/source/mstuff2.cc2
-rw-r--r--crawl-ref/source/ouch.cc24
-rw-r--r--crawl-ref/source/output.cc65
7 files changed, 96 insertions, 70 deletions
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index bc8f19d7f9..e7fa203a2b 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -5209,7 +5209,7 @@ static void _explosion1(bolt &pbolt)
if (!pbolt.is_tracer && *seeMsg && *hearMsg)
{
- // check for see/hear/no msg
+ // Check for see/hear/no msg.
if (see_grid(x,y) || x == you.x_pos && y == you.y_pos)
mpr(seeMsg);
else
@@ -5399,10 +5399,10 @@ void explosion( bolt &beam, bool hole_in_the_middle,
// new-- delay after every 'ring' {gdl}
// If we don't refresh curses we won't
- // guarantee that the explosion is visible
+ // guarantee that the explosion is visible.
if (drawing)
update_screen();
- // only delay on real explosion
+ // Only delay on real explosion.
if (!beam.is_tracer && drawing)
delay(50);
}
@@ -5426,7 +5426,7 @@ void explosion( bolt &beam, bool hole_in_the_middle,
set_buffering(oldValue);
#endif
- // duplicate old behaviour - pause after entire explosion
+ // Duplicate old behaviour - pause after entire explosion
// has been drawn.
if (!beam.is_tracer && seen_anything && show_more)
more();
@@ -5440,10 +5440,10 @@ static void _explosion_cell(bolt &beam, int x, int y, bool drawOnly)
if (!drawOnly)
{
- // Random beams: randomize before affect.
+ // Random beams: randomize before affect().
if (beam.flavour == BEAM_RANDOM)
{
- random_beam = true;
+ random_beam = true;
beam.flavour = static_cast<beam_type>(
random_range(BEAM_FIRE, BEAM_ACID) );
}
@@ -5463,7 +5463,7 @@ static void _explosion_cell(bolt &beam, int x, int y, bool drawOnly)
int drawx = grid2viewX(realx);
int drawy = grid2viewY(realy);
- if (see_grid(realx, realy) || (realx == you.x_pos && realy == you.y_pos))
+ if (see_grid(realx, realy) || realx == you.x_pos && realy == you.y_pos)
{
#ifdef USE_TILE
if (in_los_bounds(drawx, drawy))
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index df03895983..b885d764f8 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -2905,6 +2905,11 @@ static void _give_monster_item(monsters *mon, int thing,
{
item_def &mthing = mitm[thing];
+#ifdef DEBUG_DIAGNOSTICS
+ mprf("Giving %s to %s...", mthing.name(DESC_PLAIN).c_str(),
+ mon->name(DESC_PLAIN).c_str());
+#endif
+
mthing.x = 0;
mthing.y = 0;
mthing.link = NON_ITEM;
@@ -3674,11 +3679,12 @@ static item_make_species_type _give_weapon(monsters *mon, int level,
return (item_race);
}
+// Hands out ammunition fitting the monster's launcher (if any), or else any
+// throwable weapon depending on the monster type.
static void _give_ammo(monsters *mon, int level,
item_make_species_type item_race)
{
- // mv: gives ammunition
- // note that item_race is not reset for this section
+ // Note that item_race is not reset for this section.
if (const item_def *launcher = mon->launcher())
{
const object_class_type xitc = OBJ_MISSILES;
@@ -3691,8 +3697,6 @@ static void _give_ammo(monsters *mon, int level,
if (thing_created == NON_ITEM)
return;
- // monsters will always have poisoned needles -- otherwise
- // they are just going to behave badly --GDL
if (xitt == MI_NEEDLE)
{
set_item_ego_type(mitm[thing_created], OBJ_MISSILES,
@@ -3705,7 +3709,7 @@ static void _give_ammo(monsters *mon, int level,
mitm[thing_created].quantity *= 2;
_give_monster_item(mon, thing_created);
- } // end if needs ammo
+ }
else
{
// Give some monsters throwing weapons.
@@ -4146,7 +4150,7 @@ void give_item(int mid, int level_number) //mv: cleanup+minor changes
jewellery_type get_random_amulet_type()
{
return (jewellery_type)
- (AMU_FIRST_AMULET + random2(NUM_JEWELLERY - AMU_FIRST_AMULET));
+ (AMU_FIRST_AMULET + random2(NUM_JEWELLERY - AMU_FIRST_AMULET));
}
static jewellery_type _get_raw_random_ring_type()
diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc
index 72a381bafb..dfc4baad0c 100644
--- a/crawl-ref/source/message.cc
+++ b/crawl-ref/source/message.cc
@@ -696,7 +696,7 @@ static void base_mpr(const char *inf, msg_channel_type channel, int param)
}
mpr_store_messages(imsg, channel, param);
-} // end mpr()
+}
static void mpr_formatted_output(formatted_string fs, int colour)
@@ -818,7 +818,7 @@ void mesclr( bool force )
{
New_Message_Count = 0;
- // if no messages, return.
+ // If no messages, return.
if (!any_messages())
return;
@@ -875,7 +875,9 @@ void more(void)
#endif
do
+ {
keypress = getch();
+ }
while (keypress != ' ' && keypress != '\r' && keypress != '\n'
&& keypress != -1);
}
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 620b0e30ec..e6b522f2d0 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -1892,7 +1892,7 @@ static std::string _str_monam(const monsters& mon, description_level_type desc,
std::string mons_type_name(int type, description_level_type desc )
{
std::string result;
- if ( !mons_is_unique(type) )
+ if (!mons_is_unique(type))
{
switch (desc)
{
@@ -1914,6 +1914,7 @@ std::string mons_type_name(int type, description_level_type desc )
{
result.insert(1, "n");
}
+
return result;
}
@@ -3883,26 +3884,30 @@ bool monsters::pickup_missile(item_def &item, int near, bool force)
{
const item_def *miss = missiles();
- if (item.sub_type == MI_THROWING_NET)
- {
- // Monster may not pick up trapping net.
- if (mons_is_caught(this) && item_is_stationary(item))
- return (false);
- }
- else // None of these exceptions hold for throwing nets.
+ if (!force)
{
- // Spellcasters should not waste time with ammunition.
- if (mons_has_ranged_spell(this))
- return (false);
-
- // Monsters in a fight will only pick up missiles if doing so
- // is worthwhile.
- if (!mons_is_wandering(this) && (!mons_friendly(this) || foe != MHITYOU)
- && (item.quantity < 5 || miss && miss->quantity >= 7))
+ if (item.sub_type == MI_THROWING_NET)
{
- return (false);
+ // Monster may not pick up trapping net.
+ if (mons_is_caught(this) && item_is_stationary(item))
+ return (false);
+ }
+ else // None of these exceptions hold for throwing nets.
+ {
+ // Spellcasters should not waste time with ammunition.
+ if (mons_has_ranged_spell(this))
+ return (false);
+
+ // Monsters in a fight will only pick up missiles if doing so
+ // is worthwhile.
+ if (!mons_is_wandering(this) && (!mons_friendly(this) || foe != MHITYOU)
+ && (item.quantity < 5 || miss && miss->quantity >= 7))
+ {
+ return (false);
+ }
}
}
+
if (miss && items_stack(*miss, item))
return (pickup(item, MSLOT_MISSILE, near));
diff --git a/crawl-ref/source/mstuff2.cc b/crawl-ref/source/mstuff2.cc
index 8e20b2dd09..65d471311f 100644
--- a/crawl-ref/source/mstuff2.cc
+++ b/crawl-ref/source/mstuff2.cc
@@ -1572,7 +1572,7 @@ bool mons_thrown_object_destroyed( item_def *item, int x, int y,
return destroyed;
}
-// should really do something about mons_hit, but can't be bothered
+// XXX: Should really do something about mons_hit, but can't be bothered.
void spore_goes_pop(struct monsters *monster)
{
bolt beam;
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index 172fdc8088..588c4bdd8e 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -488,8 +488,8 @@ static void _expose_invent_to_element(beam_type flavour, int strength)
if (is_valid_item(you.inv[i])
&& (you.inv[i].base_type == target_class
- || (target_class == OBJ_FOOD
- && you.inv[i].base_type == OBJ_CORPSES)))
+ || target_class == OBJ_FOOD
+ && you.inv[i].base_type == OBJ_CORPSES))
{
if (player_item_conserve() && !one_chance_in(10))
continue;
@@ -634,7 +634,7 @@ void expose_player_to_element(beam_type flavour, int strength)
void lose_level()
{
- // because you.experience is unsigned long, if it's going to be -ve
+ // Because you.experience is unsigned long, if it's going to be -ve
// must die straightaway.
if (you.experience_level == 1)
{
@@ -758,10 +758,10 @@ static void xom_checks_damage(kill_method_type death_type,
xom_is_stimulated(255);
return;
}
- else if ((death_type != KILLED_BY_MONSTER && death_type != KILLED_BY_BEAM)
+ else if (death_type != KILLED_BY_MONSTER && death_type != KILLED_BY_BEAM
|| death_source < 0 || death_source >= MAX_MONSTERS)
{
- return ;
+ return;
}
int amusementvalue = 1;
@@ -875,7 +875,7 @@ void ouch( int dam, int death_source, kill_method_type death_type,
} // else hp <= 0
}
- // construct scorefile entry.
+ // Construct scorefile entry.
scorefile_entry se(dam, death_source, death_type, aux);
#ifdef WIZARD
@@ -913,8 +913,7 @@ void ouch( int dam, int death_source, kill_method_type death_type,
}
#endif // WIZARD
- //okay, so you're dead:
-
+ // Okay, so you're dead.
crawl_state.need_save = false;
crawl_state.updating_scores = true;
@@ -922,17 +921,17 @@ void ouch( int dam, int death_source, kill_method_type death_type,
se.death_description(scorefile_entry::DDV_NORMAL).c_str()),
true);
- // prevent bogus notes
+ // Prevent bogus notes.
activate_notes(false);
#ifdef SCORE_WIZARD_CHARACTERS
- // add this highscore to the score file.
+ // Add this highscore to the score file.
hiscores_new_entry(se);
logfile_new_entry(se);
#else
- // only add non-wizards to the score file.
- // never generate bones files of wizard characters -- bwr
+ // Only add non-wizards to the score file.
+ // Never generate bones files of wizard characters -- bwr
if (!you.wizard)
{
hiscores_new_entry(se);
@@ -945,7 +944,6 @@ void ouch( int dam, int death_source, kill_method_type death_type,
save_ghost();
}
}
-
#endif
end_game(se);
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 9baf1439e9..0b80630bbe 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -1192,7 +1192,7 @@ class monster_pane_info
{
public:
static bool less_than(const monster_pane_info& m1,
- const monster_pane_info& m2);
+ const monster_pane_info& m2, bool zombified = true);
monster_pane_info(const monsters* m)
: m_mon(m)
@@ -1229,23 +1229,31 @@ class monster_pane_info
// brand
bool // static
monster_pane_info::less_than(const monster_pane_info& m1,
- const monster_pane_info& m2)
+ const monster_pane_info& m2, bool zombified)
{
if (m1.m_attitude < m2.m_attitude)
- return true;
+ return (true);
else if (m1.m_attitude > m2.m_attitude)
- return false;
+ return (false);
// By descending difficulty
if (m1.m_difficulty > m2.m_difficulty)
- return true;
+ return (true);
else if (m1.m_difficulty < m2.m_difficulty)
- return false;
+ return (false);
if (m1.m_mon->type < m2.m_mon->type)
- return true;
+ return (true);
else if (m1.m_mon->type > m2.m_mon->type)
- return false;
+ return (false);
+
+ // Because of the type checks above, if one of the two is zombified, so is
+ // the other, and of the same type.
+ if (zombified && mons_is_zombified(m1.m_mon)
+ && m1.m_mon->base_monster < m2.m_mon->base_monster)
+ {
+ return (true);
+ }
if (m1.m_fullname && m2.m_fullname)
return (m1.m_mon->name(DESC_PLAIN) < m1.m_mon->name(DESC_PLAIN));
@@ -1258,7 +1266,7 @@ monster_pane_info::less_than(const monster_pane_info& m1,
return false;
#endif
- return false;
+ return (false);
}
void monster_pane_info::to_string( int count, std::string& desc,
@@ -1276,11 +1284,15 @@ void monster_pane_info::to_string( int count, std::string& desc,
else
{
if (m_fullname)
+ {
out << count << " "
<< pluralise(m_mon->name(DESC_PLAIN));
+ }
else
+ {
out << count << " "
<< pluralise(mons_type_name(m_mon->type, DESC_PLAIN));
+ }
}
#if DEBUG_DIAGNOSTICS
@@ -1321,15 +1333,16 @@ void monster_pane_info::to_string( int count, std::string& desc,
desc = out.str();
}
-static void
-_print_next_monster_desc(const std::vector<monster_pane_info>& mons, int& start)
+static void _print_next_monster_desc(
+ const std::vector<monster_pane_info>& mons, int& start,
+ bool zombified = false)
{
// Skip forward to past the end of the range of identical monsters.
unsigned int end;
- for (end=start+1; end < mons.size(); ++end)
+ for (end = start + 1; end < mons.size(); ++end)
{
// Array is sorted, so if !(m1 < m2), m1 and m2 are "equal".
- if (monster_pane_info::less_than(mons[start], mons[end]))
+ if (monster_pane_info::less_than(mons[start], mons[end], zombified))
break;
}
// Postcondition: all monsters in [start, end) are "equal"
@@ -1339,7 +1352,7 @@ _print_next_monster_desc(const std::vector<monster_pane_info>& mons, int& start)
int printed = 0;
// One glyph for each monster.
- for (unsigned int i_mon=start; i_mon<end; i_mon++)
+ for (unsigned int i_mon = start; i_mon < end; i_mon++)
{
unsigned int glyph;
unsigned short glyph_color;
@@ -1350,7 +1363,8 @@ _print_next_monster_desc(const std::vector<monster_pane_info>& mons, int& start)
cprintf("%%");
else
cprintf( stringize_glyph(glyph).c_str() );
- ++ printed;
+ ++printed;
+
// Printing too many looks pretty bad, though.
if (i_mon > 6)
break;
@@ -1444,22 +1458,25 @@ void update_monster_pane()
// Count how many groups of monsters there are
unsigned int lines_needed = mons.size();
- for (unsigned int i=1; i < mons.size(); i++)
- if (! monster_pane_info::less_than(mons[i-1], mons[i]))
- -- lines_needed;
+ for (unsigned int i = 1; i < mons.size(); i++)
+ if (!monster_pane_info::less_than(mons[i-1], mons[i]))
+ --lines_needed;
+ bool zombified = true;
if (lines_needed > (unsigned int) max_print)
{
+ zombified = false;
+
// Use type names rather than full names ("small zombie" vs
// "rat zombie") in order to take up less lines.
- for (unsigned int i=1; i < mons.size(); i++)
+ for (unsigned int i = 0; i < mons.size(); i++)
mons[i].m_fullname = false;
std::sort(mons.begin(), mons.end(), monster_pane_info::less_than);
lines_needed = mons.size();
- for (unsigned int i=1; i < mons.size(); i++)
- if (! monster_pane_info::less_than(mons[i-1], mons[i]))
- -- lines_needed;
+ for (unsigned int i = 1; i < mons.size(); i++)
+ if (!monster_pane_info::less_than(mons[i-1], mons[i], false))
+ --lines_needed;
}
#if BOTTOM_JUSTIFY_MONSTER_LIST
@@ -1477,12 +1494,12 @@ void update_monster_pane()
cgotoxy(1, 1+i_print, GOTO_MLIST);
// i_mons is incremented by _print_next_monster_desc
if ((i_print >= skip_lines) && (i_mons < (int)mons.size()))
- _print_next_monster_desc(mons, i_mons);
+ _print_next_monster_desc(mons, i_mons, zombified);
else
cprintf("%s", blank.c_str());
}
- if (i_mons < (int)mons.size())
+ if (i_mons < (int) mons.size())
{
// Didn't get to all of them.
cgotoxy(crawl_view.mlistsz.x-4, crawl_view.mlistsz.y, GOTO_MLIST);