summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-04-11 20:03:20 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-04-11 20:03:20 +0000
commite80122a2ce9321aaa14f1c80321525fb580182dd (patch)
treeb6e9fc250f364719ad25bdbedbff70a3443b64a7 /crawl-ref
parent294794073634d4aa598858ba8f577b95f606356d (diff)
downloadcrawl-ref-e80122a2ce9321aaa14f1c80321525fb580182dd.tar.gz
crawl-ref-e80122a2ce9321aaa14f1c80321525fb580182dd.zip
* Fix 2744875 (mutation screen assert).
* Rename KeymapContext KC_* -> KMC_* to avoid overlap with kill_category KC_*. * Increase odds for chaos brands mimicking brands that hurt the defender. * Tweak chaos_affects_attacker(). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9595 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/acr.cc4
-rw-r--r--crawl-ref/source/arena.cc2
-rw-r--r--crawl-ref/source/cio.h2
-rw-r--r--crawl-ref/source/debug.cc4
-rw-r--r--crawl-ref/source/delay.cc18
-rw-r--r--crawl-ref/source/delay.h1
-rw-r--r--crawl-ref/source/enum.h19
-rw-r--r--crawl-ref/source/externs.h3
-rw-r--r--crawl-ref/source/fight.cc145
-rw-r--r--crawl-ref/source/files.cc4
-rw-r--r--crawl-ref/source/food.cc8
-rw-r--r--crawl-ref/source/item_use.cc2
-rw-r--r--crawl-ref/source/macro.cc72
-rw-r--r--crawl-ref/source/menu.cc7
-rw-r--r--crawl-ref/source/mon-util.cc20
-rw-r--r--crawl-ref/source/mutation.cc13
-rw-r--r--crawl-ref/source/player.cc12
-rw-r--r--crawl-ref/source/stuff.cc4
-rw-r--r--crawl-ref/source/transfor.h1
-rw-r--r--crawl-ref/source/travel.cc4
-rw-r--r--crawl-ref/source/xom.cc4
21 files changed, 235 insertions, 114 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc
index 261b328e44..c069315785 100644
--- a/crawl-ref/source/acr.cc
+++ b/crawl-ref/source/acr.cc
@@ -1451,7 +1451,7 @@ void process_command( command_type cmd )
mpr("Change to (d)efault, (n)othing, (f)riend-dropped, (p)layer, "
"or (a)ll? ", MSGCH_PROMPT);
- char type = (char) getchm(KC_DEFAULT);
+ char type = (char) getchm(KMC_DEFAULT);
type = tolower(type);
if (type == 'd')
@@ -2885,7 +2885,7 @@ static command_type _keycode_to_command( keycode_type key )
case KEY_REPEAT_KEYS: return CMD_REPEAT_KEYS;
default:
- return key_to_command(key, KC_DEFAULT);
+ return key_to_command(key, KMC_DEFAULT);
}
}
diff --git a/crawl-ref/source/arena.cc b/crawl-ref/source/arena.cc
index bf950840c9..8d02636812 100644
--- a/crawl-ref/source/arena.cc
+++ b/crawl-ref/source/arena.cc
@@ -703,7 +703,7 @@ namespace arena
return;
}
- const command_type cmd = key_to_command(ch, KC_DEFAULT);
+ const command_type cmd = key_to_command(ch, KMC_DEFAULT);
// We only allow a short list of commands to be used in the arena.
switch(cmd)
diff --git a/crawl-ref/source/cio.h b/crawl-ref/source/cio.h
index b8d5420d39..b91fc2e6d5 100644
--- a/crawl-ref/source/cio.h
+++ b/crawl-ref/source/cio.h
@@ -52,7 +52,7 @@ int c_getch();
// Converts a key to a direction key, converting keypad and other sequences
// to vi key sequences (shifted/control key directions are also handled). Non
// direction keys (hopefully) pass through unmangled.
-int unmangle_direction_keys(int keyin, KeymapContext keymap = KC_DEFAULT,
+int unmangle_direction_keys(int keyin, KeymapContext keymap = KMC_DEFAULT,
bool fake_ctrl = true, bool fake_shift = true);
void get_input_line( char *const buff, int len );
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index 1fd4cd306f..ee85fb6c58 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -5164,7 +5164,7 @@ void debug_make_monster_shout(monsters* mon)
{
mpr("Make the monster (S)hout or (T)alk?", MSGCH_PROMPT);
- char type = (char) getchm(KC_DEFAULT);
+ char type = (char) getchm(KMC_DEFAULT);
type = tolower(type);
if (type != 's' && type != 't')
@@ -5228,7 +5228,7 @@ void wizard_apply_monster_blessing(monsters* mon)
mpr("Apply blessing of (B)eogh, The (S)hining One, or (R)andomly?",
MSGCH_PROMPT);
- char type = (char) getchm(KC_DEFAULT);
+ char type = (char) getchm(KMC_DEFAULT);
type = tolower(type);
if (type != 'b' && type != 's' && type != 'r')
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index 5af430ddd0..f0ec367717 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -547,6 +547,15 @@ void stop_butcher_delay()
stop_delay();
}
+void maybe_clear_weapon_swap()
+{
+ if (transformation_can_wield(static_cast<transformation_type>(
+ you.attribute[ATTR_TRANSFORMATION])))
+ {
+ you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED] = 0;
+ }
+}
+
void handle_interrupted_swap(bool swap_if_safe, bool force_unsafe,
bool transform)
{
@@ -1968,8 +1977,8 @@ bool interrupt_activity( activity_interrupt_type ai,
if (_should_stop_activity(item, ai, at))
{
- // no monster will attack you inside a sanctuary,
- // so presence of monsters won't matter
+ // No monster will attack you inside a sanctuary,
+ // so presence of monsters won't matter.
if (is_sanctuary(you.pos()))
return (false);
@@ -1997,9 +2006,8 @@ bool interrupt_activity( activity_interrupt_type ai,
{
if (is_run_delay( you.delay_queue[j].type ))
{
- was_monst =
- _monster_warning(ai, at, you.delay_queue[j].type)
- || was_monst;
+ was_monst = was_monst ||
+ _monster_warning(ai, at, you.delay_queue[j].type);
stop_delay(ai == AI_TELEPORT);
if (was_monst)
diff --git a/crawl-ref/source/delay.h b/crawl-ref/source/delay.h
index d5b9363679..cafde33717 100644
--- a/crawl-ref/source/delay.h
+++ b/crawl-ref/source/delay.h
@@ -78,6 +78,7 @@ bool is_being_butchered(const item_def &item, bool just_first = true);
bool is_vampire_feeding();
bool player_stair_delay();
void stop_butcher_delay();
+void maybe_clear_weapon_swap();
void handle_interrupted_swap(bool swap_if_safe = false,
bool force_unsafe = false,
bool transform = false);
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 8420349fb3..757f20aa82 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -1449,20 +1449,21 @@ enum job_type
JOB_UNKNOWN = 100
};
-enum KeymapContext {
- KC_DEFAULT, // For no-arg getchm(), must be zero.
- KC_LEVELMAP, // When in the 'X' level map
- KC_TARGETING, // Only during 'x' and other targeting modes
- KC_CONFIRM, // When being asked y/n/q questions
- KC_MENU, // For menus
+enum KeymapContext
+{
+ KMC_DEFAULT, // For no-arg getchm(), must be zero.
+ KMC_LEVELMAP, // When in the 'X' level map
+ KMC_TARGETING, // Only during 'x' and other targeting modes
+ KMC_CONFIRM, // When being asked y/n/q questions
+ KMC_MENU, // For menus
#ifdef USE_TILE
- KC_TILE, // For context_for_command()
+ KMC_TILE, // For context_for_command()
#endif
- KC_CONTEXT_COUNT, // Must always be the last real context
+ KMC_CONTEXT_COUNT, // Must always be the last real context
- KC_NONE
+ KMC_NONE
};
// This order is *critical*. Don't mess with it (see mon_enchant)
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 14793f2abb..0e773c455f 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -325,6 +325,7 @@ public:
virtual bool visible_to(const actor *looker) const = 0;
virtual bool can_see(const actor *target) const = 0;
virtual bool is_icy() const = 0;
+ virtual bool is_fiery() const = 0;
virtual void go_berserk(bool intentional) = 0;
virtual bool can_mutate() const = 0;
virtual bool can_safely_mutate() const = 0;
@@ -991,6 +992,7 @@ public:
bool visible_to(const actor *looker) const;
bool can_see(const actor *target) const;
bool is_icy() const;
+ bool is_fiery() const;
bool light_flight() const;
bool travelling_light() const;
@@ -1480,6 +1482,7 @@ public:
bool mon_see_grid(const coord_def& pos, bool reach = false) const;
bool can_see(const actor *target) const;
bool is_icy() const;
+ bool is_fiery() const;
bool paralysed() const;
bool cannot_move() const;
bool cannot_act() const;
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index ac73a80723..ab50ad6471 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -24,6 +24,7 @@ REVISION("$Rev$");
#include "beam.h"
#include "cloud.h"
+#include "database.h"
#include "debug.h"
#include "delay.h"
#include "effects.h"
@@ -493,9 +494,9 @@ std::string melee_attack::wep_name(description_level_type desc,
}
if (possessive)
- name = apostrophise(atk_name(desc));
+ name = apostrophise(atk_name(desc)) + " ";
- name += weapon->name(desc, false, false, false, false, ignore_flags);
+ name += weapon->name(DESC_PLAIN, false, false, false, false, ignore_flags);
return (name);
}
@@ -2259,7 +2260,7 @@ enum chaos_type
CHAOS_HASTE,
CHAOS_INVIS,
CHAOS_SLOW,
- CHAOS_PARA,
+ CHAOS_PARALYSIS,
CHAOS_PETRIFY,
NUM_CHAOS_TYPES
};
@@ -2328,7 +2329,7 @@ void melee_attack::chaos_affects_defender()
10, // CHAOS_INVIS
10, // CHAOS_SLOW
- 10, // CHAOS_PARA
+ 10, // CHAOS_PARALYSIS
10, // CHAOS_PETRIFY
};
@@ -2389,12 +2390,14 @@ void melee_attack::chaos_affects_defender()
{
int level = defender->get_experience_level();
- // At level == 27 there's a 20.3% chance of a level 3 miscast.
- int level1_chance = level;
- int level2_chance = std::max( 0, level - 7);
- int level3_chance = std::max( 0, level - 15);
+ // At level == 27 there's a 13.9% chance of a level 3 miscast.
+ int level0_chance = level;
+ int level1_chance = std::max( 0, level - 7);
+ int level2_chance = std::max( 0, level - 12);
+ int level3_chance = std::max( 0, level - 17);
level = random_choose_weighted(
+ level0_chance, 0,
level1_chance, 1,
level2_chance, 2,
level3_chance, 3,
@@ -2403,7 +2406,6 @@ void melee_attack::chaos_affects_defender()
miscast_level = level;
miscast_type = SPTYP_RANDOM;
miscast_target = coinflip() ? attacker : defender;
-
break;
}
@@ -2429,7 +2431,7 @@ void melee_attack::chaos_affects_defender()
beam.flavour = BEAM_SLOW;
break;
- case CHAOS_PARA:
+ case CHAOS_PARALYSIS:
beam.flavour = BEAM_PARALYSIS;
break;
@@ -2535,21 +2537,44 @@ void melee_attack::chaos_affects_attacker()
DID_AFFECT();
}
+ // Create a colourful cloud.
+ if (weapon && one_chance_in(1000))
+ {
+ mprf("Smoke pours forth from %s!", wep_name(DESC_NOCAP_YOUR).c_str());
+ big_cloud(random_smoke_type(), KC_OTHER, attacker->pos(), 20,
+ 8 + random2(4));
+ DID_AFFECT();
+ }
+
// Make a loud noise.
if (weapon && player_can_hear(attacker->pos())
- && one_chance_in(1000))
+ && one_chance_in(200))
{
- std::string msg = wep_name(DESC_CAP_YOUR);
- msg += " twangs alarmingly!";
-
+ std::string msg = "";
if (!you.can_see(attacker))
- msg = "You hear a loud twang.";
+ {
+ std::string noise = getSpeakString("weapon_noise");
+ if (!noise.empty())
+ msg = "You hear " + noise;
+ }
+ else
+ {
+ msg = getSpeakString("weapon_noises");
+ std::string wepname = wep_name(DESC_CAP_YOUR);
+ if (!msg.empty())
+ {
+ msg = replace_all(msg, "@Your_weapon@", wepname);
+ msg = replace_all(msg, "@The_weapon@", wepname);
+ }
+ }
- noisy(15, attacker->pos(), msg.c_str());
- DID_AFFECT();
+ if (!msg.empty())
+ {
+ mpr(msg.c_str(), MSGCH_SOUND);
+ noisy(15, attacker->pos());
+ DID_AFFECT();
+ }
}
-
- return;
}
static void _find_remains(monsters* mon, int &corpse_class, int &corpse_index,
@@ -2778,19 +2803,75 @@ void melee_attack::do_miscast()
// by the non-chaos brands/flavours they return.
int melee_attack::random_chaos_brand()
{
- return (random_choose_weighted(
- 15, SPWPN_NORMAL,
- 10, SPWPN_FLAMING,
- 10, SPWPN_FREEZING,
- 10, SPWPN_ELECTROCUTION,
- 10, SPWPN_VENOM,
- 10, SPWPN_CHAOS,
- 5, SPWPN_VORPAL,
- 5, SPWPN_DRAINING,
- 5, SPWPN_VAMPIRICISM,
- 2, SPWPN_CONFUSE,
- 2, SPWPN_DISTORTION,
- 0));
+ int brand = SPWPN_NORMAL;
+ // Assuming the chaos to be mildly intelligent, try to avoid brands
+ // that clash with the most basic resists of the defender,
+ // i.e. its holiness.
+ while (true)
+ {
+ brand = (random_choose_weighted(
+ 5, SPWPN_VORPAL,
+ 10, SPWPN_FLAMING,
+ 10, SPWPN_FREEZING,
+ 10, SPWPN_ELECTROCUTION,
+ 10, SPWPN_VENOM,
+ 10, SPWPN_CHAOS,
+ 5, SPWPN_DRAINING,
+ 5, SPWPN_VAMPIRICISM,
+ 5, SPWPN_HOLY_WRATH,
+ 2, SPWPN_CONFUSE,
+ 2, SPWPN_DISTORTION,
+ 0));
+
+ if (one_chance_in(3))
+ break;
+
+ bool susceptible = true;
+ switch (brand)
+ {
+ case SPWPN_FLAMING:
+ if (defender->is_fiery())
+ susceptible = false;
+ break;
+ case SPWPN_FREEZING:
+ if (defender->is_icy())
+ susceptible = false;
+ break;
+ case SPWPN_ELECTROCUTION:
+ if (defender->airborne())
+ susceptible = false;
+ break;
+ case SPWPN_VENOM:
+ if (defender->holiness() == MH_UNDEAD)
+ susceptible = false;
+ break;
+ case SPWPN_DRAINING:
+ case SPWPN_VAMPIRICISM:
+ if (defender->holiness() != MH_NATURAL)
+ susceptible = false;
+ break;
+ case SPWPN_HOLY_WRATH:
+ if (defender->holiness() != MH_UNDEAD
+ && defender->holiness() != MH_DEMONIC)
+ {
+ susceptible = false;
+ }
+ break;
+ case SPWPN_CONFUSE:
+ if (defender->holiness() != MH_NONLIVING
+ && defender->holiness() != MH_PLANT)
+ {
+ susceptible = false;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (susceptible)
+ break;
+ }
+ return (brand);
}
mon_attack_flavour melee_attack::random_chaos_attack_flavour()
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index 472c2558cb..107a86b710 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -1396,7 +1396,9 @@ bool load( dungeon_feature_type stair_taken, load_mode_type load_mode,
// Forget about interrupted butchering, since we probably aren't going
// to get back to the corpse in time to finish things.
- you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED] = 0;
+ // But do not reset the weapon swap if we swapped weapons
+ // because of a transformation.
+ maybe_clear_weapon_swap();
}
return just_created_level;
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index 13c0c3d4a7..f725a01440 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -624,7 +624,7 @@ bool butchery(int which_corpse)
corpse_name.c_str());
repeat_prompt = false;
- keyin = tolower(getchm(KC_CONFIRM));
+ keyin = tolower(getchm(KMC_CONFIRM));
switch (keyin)
{
case 'b':
@@ -1293,7 +1293,7 @@ int eat_from_floor(bool skip_chunks)
((item->quantity > 1) ? "one of " : ""),
item_name.c_str());
- int keyin = tolower(getchm(KC_CONFIRM));
+ int keyin = tolower(getchm(KMC_CONFIRM));
switch (keyin)
{
case ESCAPE:
@@ -1445,7 +1445,7 @@ bool eat_from_inventory()
((item->quantity > 1) ? "one of " : ""),
item_name.c_str());
- int keyin = tolower(getchm(KC_CONFIRM));
+ int keyin = tolower(getchm(KMC_CONFIRM));
switch (keyin)
{
case ESCAPE:
@@ -1607,7 +1607,7 @@ int prompt_eat_chunks()
item_name.c_str());
}
- int keyin = autoeat ? 'y' : tolower(getchm(KC_CONFIRM));
+ int keyin = autoeat ? 'y' : tolower(getchm(KMC_CONFIRM));
switch (keyin)
{
case ESCAPE:
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 619598edc3..52e6a64cf9 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -4910,7 +4910,7 @@ void read_scroll(int slot)
case SCR_FOG:
mpr("The scroll dissolves into smoke.");
- big_cloud(random_smoke_type(), KC_YOU, you.pos(), 50, 8 + random2(8));
+ big_cloud(random_smoke_type(), KC_OTHER, you.pos(), 50, 8 + random2(8));
break;
case SCR_MAGIC_MAPPING:
diff --git a/crawl-ref/source/macro.cc b/crawl-ref/source/macro.cc
index a2cb695cb4..c024a9181a 100644
--- a/crawl-ref/source/macro.cc
+++ b/crawl-ref/source/macro.cc
@@ -53,18 +53,18 @@ REVISION("$Rev$");
typedef std::deque<int> keybuf;
typedef std::map<keyseq,keyseq> macromap;
-static macromap Keymaps[KC_CONTEXT_COUNT];
+static macromap Keymaps[KMC_CONTEXT_COUNT];
static macromap Macros;
static macromap *all_maps[] =
{
- &Keymaps[KC_DEFAULT],
- &Keymaps[KC_LEVELMAP],
- &Keymaps[KC_TARGETING],
- &Keymaps[KC_CONFIRM],
+ &Keymaps[KMC_DEFAULT],
+ &Keymaps[KMC_LEVELMAP],
+ &Keymaps[KMC_TARGETING],
+ &Keymaps[KMC_CONFIRM],
#ifdef USE_TILE
- &Keymaps[KC_TILE],
+ &Keymaps[KMC_TILE],
#endif
&Macros,
@@ -106,8 +106,8 @@ static default_binding _default_binding_list[] = {
typedef std::map<int, int> key_to_cmd_map;
typedef std::map<int, int> cmd_to_key_map;
-static key_to_cmd_map _keys_to_cmds[KC_CONTEXT_COUNT];
-static cmd_to_key_map _cmds_to_keys[KC_CONTEXT_COUNT];
+static key_to_cmd_map _keys_to_cmds[KMC_CONTEXT_COUNT];
+static cmd_to_key_map _cmds_to_keys[KMC_CONTEXT_COUNT];
inline int userfunc_index(int key)
{
@@ -458,7 +458,7 @@ void macro_buf_add( int key, bool reverse )
* O(N^2) analysis to the sequence to replace macros.
*/
static void macro_buf_add_long( keyseq actions,
- macromap &keymap = Keymaps[KC_DEFAULT] )
+ macromap &keymap = Keymaps[KMC_DEFAULT] )
{
keyseq tmp;
@@ -610,7 +610,7 @@ void macro_save()
f << "# WARNING: This file is entirely auto-generated." << std::endl
<< std::endl << "# Key Mappings:" << std::endl;
- for (int mc = KC_DEFAULT; mc < KC_CONTEXT_COUNT; ++mc)
+ for (int mc = KMC_DEFAULT; mc < KMC_CONTEXT_COUNT; ++mc)
{
char keybuf[30] = "K:";
if (mc)
@@ -664,7 +664,7 @@ static keyseq getch_mul( int (*rgetch)() = NULL )
int getchm( int (*rgetch)() )
{
flush_prev_message();
- return getchm( KC_DEFAULT, rgetch );
+ return getchm( KMC_DEFAULT, rgetch );
}
int getchm(KeymapContext mc, int (*rgetch)())
@@ -677,7 +677,7 @@ int getchm(KeymapContext mc, int (*rgetch)())
// Read some keys...
keyseq keys = getch_mul(rgetch);
- if (mc == KC_NONE)
+ if (mc == KMC_NONE)
macro_buf_add(keys);
else
macro_buf_add_long(keys, Keymaps[mc]);
@@ -747,7 +747,7 @@ void macro_add_query( void )
{
int input;
bool keymap = false;
- KeymapContext keymc = KC_DEFAULT;
+ KeymapContext keymc = KMC_DEFAULT;
mesclr();
mpr("(m)acro, keymap "
@@ -759,27 +759,27 @@ void macro_add_query( void )
if (input == 'k')
{
keymap = true;
- keymc = KC_DEFAULT;
+ keymc = KMC_DEFAULT;
}
else if (input == 'x')
{
keymap = true;
- keymc = KC_LEVELMAP;
+ keymc = KMC_LEVELMAP;
}
else if (input == 't')
{
keymap = true;
- keymc = KC_TARGETING;
+ keymc = KMC_TARGETING;
}
else if (input == 'c')
{
keymap = true;
- keymc = KC_CONFIRM;
+ keymc = KMC_CONFIRM;
}
else if (input == 'e')
{
keymap = true;
- keymc = KC_MENU;
+ keymc = KMC_MENU;
}
else if (input == 'm')
keymap = false;
@@ -799,12 +799,12 @@ void macro_add_query( void )
macromap &mapref = (keymap ? Keymaps[keymc] : Macros);
mprf(MSGCH_PROMPT, "Input %s%s trigger key: ",
- keymap ? (keymc == KC_DEFAULT ? "default " :
- keymc == KC_LEVELMAP ? "level-map " :
- keymc == KC_TARGETING ? "targeting " :
- keymc == KC_CONFIRM ? "confirm " :
- keymc == KC_MENU ? "menu " :
- "buggy") : "",
+ keymap ? (keymc == KMC_DEFAULT ? "default " :
+ keymc == KMC_LEVELMAP ? "level-map " :
+ keymc == KMC_TARGETING ? "targeting " :
+ keymc == KMC_CONFIRM ? "confirm " :
+ keymc == KMC_MENU ? "menu "
+ : "buggy") : "",
(keymap ? "keymap" : "macro") );
keyseq key;
@@ -865,7 +865,7 @@ static void _read_macros_from(const char* filename)
std::ifstream f;
keyseq key, action;
bool keymap = false;
- KeymapContext keymc = KC_DEFAULT;
+ KeymapContext keymc = KMC_DEFAULT;
f.open( filename );
@@ -879,12 +879,12 @@ static void _read_macros_from(const char* filename)
{
key = parse_keyseq(s.substr(2));
keymap = true;
- keymc = KC_DEFAULT;
+ keymc = KMC_DEFAULT;
}
else if (s.length() >= 3 && s[0] == 'K' && s[2] == ':')
{
- keymc = KeymapContext( KC_DEFAULT + s[1] - '0' );
- if (keymc >= KC_DEFAULT && keymc < KC_CONTEXT_COUNT)
+ keymc = KeymapContext( KMC_DEFAULT + s[1] - '0' );
+ if (keymc >= KMC_DEFAULT && keymc < KMC_CONTEXT_COUNT)
{
key = parse_keyseq(s.substr(3));
keymap = true;
@@ -1065,7 +1065,7 @@ void init_keybindings()
KeymapContext context = context_for_command(data.cmd);
- ASSERT(context < KC_CONTEXT_COUNT);
+ ASSERT(context < KMC_CONTEXT_COUNT);
key_to_cmd_map &key_map = _keys_to_cmds[context];
cmd_to_key_map &cmd_map = _cmds_to_keys[context];
@@ -1120,7 +1120,7 @@ int command_to_key(command_type cmd)
{
KeymapContext context = context_for_command(cmd);
- if (context == KC_NONE)
+ if (context == KMC_NONE)
return ('\0');
cmd_to_key_map &cmd_map = _cmds_to_keys[context];
@@ -1136,19 +1136,19 @@ KeymapContext context_for_command(command_type cmd)
{
#ifdef USE_TILE
if (cmd >= CMD_MIN_TILE && cmd <= CMD_MAX_TILE)
- return KC_TILE;
+ return KMC_TILE;
#endif
if (cmd > CMD_NO_CMD && cmd <= CMD_MAX_NORMAL)
- return KC_DEFAULT;
+ return KMC_DEFAULT;
if (cmd >= CMD_MIN_OVERMAP && cmd <= CMD_MAX_OVERMAP)
- return KC_LEVELMAP;
+ return KMC_LEVELMAP;
if (cmd >= CMD_MIN_TARGET && cmd <= CMD_MAX_TARGET)
- return KC_TARGETING;
+ return KMC_TARGETING;
- return KC_NONE;
+ return KMC_NONE;
}
void bind_command_to_key(command_type cmd, int key)
@@ -1156,7 +1156,7 @@ void bind_command_to_key(command_type cmd, int key)
KeymapContext context = context_for_command(cmd);
std::string command_name = command_to_name(cmd);
- if (context == KC_NONE || command_name == "CMD_NO_CMD"
+ if (context == KMC_NONE || command_name == "CMD_NO_CMD"
|| !VALID_BIND_COMMAND(cmd))
{
if (command_name == "CMD_NO_CMD")
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index 163170aa95..25b02bcb10 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -93,8 +93,8 @@ void MenuDisplayTile::set_num_columns(int columns)
Menu::Menu( int _flags, const std::string& tagname, bool text_only )
: f_selitem(NULL), f_drawitem(NULL), f_keyfilter(NULL), allow_toggle(false),
- menu_action(ACT_EXAMINE), title(NULL), flags(_flags), tag(tagname),
- first_entry(0), y_offset(0), pagesize(0), max_pagesize(0),
+ menu_action(ACT_EXAMINE), title(NULL), title2(NULL), flags(_flags),
+ tag(tagname), first_entry(0), y_offset(0), pagesize(0), max_pagesize(0),
more("-more-", true), items(), sel(), select_filter(),
highlighter(new MenuHighlighter), num(-1), lastch(0), alive(false),
last_selected(-1)
@@ -112,7 +112,8 @@ Menu::Menu( int _flags, const std::string& tagname, bool text_only )
}
Menu::Menu( const formatted_string &fs )
- : f_selitem(NULL), f_drawitem(NULL), f_keyfilter(NULL), title(NULL),
+ : f_selitem(NULL), f_drawitem(NULL), f_keyfilter(NULL), allow_toggle(false),
+ menu_action(ACT_EXAMINE), title(NULL), title2(NULL),
// This is a text-viewer menu, init flags to be easy on the user.
flags(MF_NOSELECT | MF_EASY_EXIT),
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 33f462769a..f5aab7b4db 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -7678,6 +7678,26 @@ bool monsters::is_icy() const
return (mons_is_icy(type));
}
+static bool _mons_is_fiery(int mc)
+{
+ return (mc == MONS_FIRE_VORTEX
+ || mc == MONS_FIRE_ELEMENTAL
+ || mc == MONS_FLAMING_CORPSE
+ || mc == MONS_EFREET
+ || mc == MONS_AZRAEL
+ || mc == MONS_LAVA_WORM
+ || mc == MONS_LAVA_FISH
+ || mc == MONS_LAVA_SNAKE
+ || mc == MONS_SALAMANDER
+ || mc == MONS_MOLTEN_GARGOYLE
+ || mc == MONS_ORB_OF_FIRE);
+}
+
+bool monsters::is_fiery() const
+{
+ return (_mons_is_fiery(type));
+}
+
bool monsters::has_action_energy() const
{
return (speed_increment >= 80);
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc
index cf01dc25be..b7c7650cca 100644
--- a/crawl-ref/source/mutation.cc
+++ b/crawl-ref/source/mutation.cc
@@ -1530,6 +1530,8 @@ formatted_string describe_mutations()
static void _display_vampire_attributes()
{
+ ASSERT(you.species == SP_VAMPIRE);
+
clrscr();
cgotoxy(1,1);
@@ -1623,13 +1625,10 @@ static void _display_vampire_attributes()
const formatted_string vp_props = formatted_string::parse_string(result);
vp_props.display();
- if (you.species == SP_VAMPIRE)
- {
- mouse_control mc(MOUSE_MODE_MORE);
- const int keyin = getch();
- if (keyin == '!' || keyin == CK_MOUSE_CMD)
- display_mutations();
- }
+ mouse_control mc(MOUSE_MODE_MORE);
+ const int keyin = getch();
+ if (keyin == '!' || keyin == CK_MOUSE_CMD)
+ display_mutations();
}
void display_mutations()
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 84cd21750d..c8bceea2f8 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -7169,6 +7169,11 @@ bool player::is_icy() const
return (attribute[ATTR_TRANSFORMATION] == TRAN_ICE_BEAST);
}
+bool player::is_fiery() const
+{
+ return (false);
+}
+
void player::base_moveto(const coord_def &c)
{
ASSERT(!crawl_state.arena);
@@ -7509,12 +7514,11 @@ bool player::do_shaft()
return (false);
}
+ mpr("A shaft briefly opens up underneath you!");
+ handle_items_on_shaft(you.pos(), false);
+
if (airborne() || total_weight() == 0)
- {
- mpr("A shaft briefly opens up underneath you!");
- handle_items_on_shaft(you.pos(), false);
return (true);
- }
force_stair = DNGN_TRAP_NATURAL;
}
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc
index 463534060f..d7dbcd38e1 100644
--- a/crawl-ref/source/stuff.cc
+++ b/crawl-ref/source/stuff.cc
@@ -1054,7 +1054,7 @@ bool yesno( const char *str, bool safe, int safeanswer, bool clear_after,
if (!noprompt)
mpr(prompt.c_str(), MSGCH_PROMPT);
- int tmp = getchm(KC_CONFIRM);
+ int tmp = getchm(KMC_CONFIRM);
if (map && map->find(tmp) != map->end())
tmp = map->find(tmp)->second;
@@ -1155,7 +1155,7 @@ int yesnoquit( const char* str, bool safe, int safeanswer, bool allow_all,
{
mpr(prompt.c_str(), MSGCH_PROMPT);
- int tmp = getchm(KC_CONFIRM);
+ int tmp = getchm(KMC_CONFIRM);
if (tmp == CK_ESCAPE || tmp == CONTROL('G') || tmp == 'q' || tmp == 'Q')
return -1;
diff --git a/crawl-ref/source/transfor.h b/crawl-ref/source/transfor.h
index e037b0d5c8..3d2abedb3d 100644
--- a/crawl-ref/source/transfor.h
+++ b/crawl-ref/source/transfor.h
@@ -28,6 +28,7 @@ enum transformation_type
NUM_TRANSFORMATIONS // must remain last member {dlb}
};
+bool transformation_can_wield(transformation_type trans);
bool transform_can_butcher_barehanded(transformation_type tt);
void untransform(bool skip_wielding = false);
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index 8e14c27a8a..7636330f22 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -2562,7 +2562,7 @@ void start_translevel_travel(bool prompt_for_destination)
if (level_target.p.id.depth > 0)
{
// Forget interrupted butchering.
- you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED] = 0;
+ maybe_clear_weapon_swap();
you.running = RMODE_INTERLEVEL;
you.running.pos.reset();
@@ -2977,7 +2977,7 @@ void start_explore(bool grab_items)
return;
// Forget interrupted butchering.
- you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED] = 0;
+ maybe_clear_weapon_swap();
you.running = (grab_items? RMODE_EXPLORE_GREEDY : RMODE_EXPLORE);
if (you.running == RMODE_EXPLORE_GREEDY
diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc
index 9516a68c85..3a05f1e2e3 100644
--- a/crawl-ref/source/xom.cc
+++ b/crawl-ref/source/xom.cc
@@ -500,7 +500,7 @@ static void _try_brand_switch(const int item_index)
{
// Only switch already branded items.
if (get_weapon_brand(item) == SPWPN_NORMAL)
- return;
+ return;
brand = (int) SPWPN_CHAOS;
}
@@ -508,7 +508,7 @@ static void _try_brand_switch(const int item_index)
{
// Only switch already branded items.
if (get_ammo_brand(item) == SPWPN_NORMAL)
- return;
+ return;
brand = (int) SPMSL_CHAOS;
}