summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-04 10:36:54 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-04 10:36:54 +0000
commit12246839e2efa9f89e5c246cdcb5f0ba4037c4fe (patch)
tree47a99027f2cf2a375f7051e32b767fda1e012b79 /crawl-ref/source
parenta639fc9fa82e60bb38792361e1c2bb3242cbd5fc (diff)
downloadcrawl-ref-12246839e2efa9f89e5c246cdcb5f0ba4037c4fe.tar.gz
crawl-ref-12246839e2efa9f89e5c246cdcb5f0ba4037c4fe.zip
Give transformed players appropriate shouts.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@977 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/effects.cc28
-rw-r--r--crawl-ref/source/externs.h2
-rw-r--r--crawl-ref/source/mon-data.h2
-rw-r--r--crawl-ref/source/player.cc23
-rw-r--r--crawl-ref/source/spells4.cc6
5 files changed, 46 insertions, 15 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 1f304faa06..7c2a4cb9f4 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -1506,14 +1506,26 @@ void yell(void)
int mons_targd = MHITNOT;
struct dist targ;
- if (silenced(you.x_pos, you.y_pos))
+ if (silenced(you.x_pos, you.y_pos) || you.cannot_speak())
{
mpr("You are unable to make a sound!");
return;
}
+ const std::string shout_verb = you.shout_verb();
+ std::string cap_shout = shout_verb;
+ cap_shout[0] = toupper(cap_shout[0]);
+
+ int noise_level = 12;
+
+ // Tweak volume for different kinds of vocalisation.
+ if (shout_verb == "roar")
+ noise_level = 18;
+ else if (shout_verb == "hiss")
+ noise_level = 8;
+
mpr("What do you say?", MSGCH_PROMPT);
- mpr(" ! - Yell");
+ mprf(" ! - %s", cap_shout.c_str());
mpr(" a - Order allies to attack a monster");
if (!(you.prev_targ == MHITNOT || you.prev_targ == MHITYOU))
@@ -1527,21 +1539,17 @@ void yell(void)
}
}
- strcpy(info, " Anything else - Stay silent");
-
- if (one_chance_in(20))
- strcat(info, " (and be thought a fool)");
-
- mpr(info);
+ mprf(" Anything else - Stay silent%s",
+ one_chance_in(20)? " (and be thought a fool)" : "");
unsigned char keyn = get_ch();
switch (keyn)
{
case '!':
- mpr("You yell for attention!", MSGCH_SOUND);
+ mprf(MSGCH_SOUND, "You %s for attention!", shout_verb.c_str());
you.turn_is_over = true;
- noisy( 12, you.x_pos, you.y_pos );
+ noisy( noise_level, you.x_pos, you.y_pos );
return;
case 'a':
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 048782eca5..a80061df10 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -700,10 +700,12 @@ public:
bool in_water() const;
bool can_swim() const;
bool is_levitating() const;
+ bool cannot_speak() const;
bool has_spell(int spell) const;
size_type transform_size(int psize = PSIZE_TORSO) const;
+ std::string shout_verb() const;
item_def *slot_item(equipment_type eq);
diff --git a/crawl-ref/source/mon-data.h b/crawl-ref/source/mon-data.h
index f36d118044..714d38abf0 100644
--- a/crawl-ref/source/mon-data.h
+++ b/crawl-ref/source/mon-data.h
@@ -890,7 +890,7 @@
800, 10, MONS_WOLF_SPIDER, MONS_WOLF_SPIDER, MH_NATURAL, -3,
{ {AT_BITE, AF_POISON_MEDIUM, 20}, {AT_NONE, AF_PLAIN, 0}, {AT_NONE, AF_PLAIN, 0}, {AT_NONE, AF_PLAIN, 0} },
{ 8, 3, 5, 0 },
- 3, 10, 15, 7, MST_NO_SPELLS, CE_POISONOUS, Z_BIG, S_SILENT, I_INSECT,
+ 3, 10, 15, 7, MST_NO_SPELLS, CE_POISONOUS, Z_BIG, S_HISS, I_INSECT,
MONUSE_NOTHING, SIZE_TINY
}
,
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 2b38d25339..cb44baa336 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -4610,6 +4610,29 @@ size_type player::body_size(int psize, bool base) const
return (ret);
}
+bool player::cannot_speak() const
+{
+ if (silenced(x_pos, y_pos))
+ return (true);
+
+ // No transform that prevents the player from speaking yet.
+ return (false);
+}
+
+std::string player::shout_verb() const
+{
+ const int transform = attribute[ATTR_TRANSFORMATION];
+ switch (transform)
+ {
+ case TRAN_DRAGON:
+ return "roar";
+ case TRAN_SPIDER:
+ return "hiss";
+ default:
+ return "yell";
+ }
+}
+
int player::damage_type(int)
{
const int wpn = equip[ EQ_WEAPON ];
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index 91eebad12c..0314200c80 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -1055,10 +1055,8 @@ static int ignite_poison_monsters(int x, int y, int pow, int garbage)
damage = mons_adjust_flavoured( mon, beam, damage );
#if DEBUG_DIAGNOSTICS
- snprintf( info, INFO_SIZE, "Dice: %dd%d; Damage: %d",
- dam_dice.num, dam_dice.size, damage );
-
- mpr( info, MSGCH_DIAGNOSTICS );
+ mprf(MSGCH_DIAGNOSTICS, "Dice: %dd%d; Damage: %d",
+ dam_dice.num, dam_dice.size, damage );
#endif
if (!player_hurt_monster( mon_index, damage ))