summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/abl-show.cc22
-rw-r--r--crawl-ref/source/abyss.cc4
-rw-r--r--crawl-ref/source/actor.cc5
-rw-r--r--crawl-ref/source/beam.cc44
-rw-r--r--crawl-ref/source/delay.cc6
-rw-r--r--crawl-ref/source/dungeon.cc43
-rw-r--r--crawl-ref/source/effects.cc4
-rw-r--r--crawl-ref/source/fight.cc35
-rw-r--r--crawl-ref/source/files.cc4
-rw-r--r--crawl-ref/source/godabil.cc4
-rw-r--r--crawl-ref/source/item_use.cc18
-rw-r--r--crawl-ref/source/l_dgn.cc4
-rw-r--r--crawl-ref/source/makeitem.cc4
-rw-r--r--crawl-ref/source/maps.cc4
-rw-r--r--crawl-ref/source/message.cc10
-rw-r--r--crawl-ref/source/misc.cc14
-rw-r--r--crawl-ref/source/misc.h2
-rw-r--r--crawl-ref/source/mon-abil.cc4
-rw-r--r--crawl-ref/source/mon-cast.cc5
-rw-r--r--crawl-ref/source/mon-project.cc18
-rw-r--r--crawl-ref/source/mon-stuff.cc23
-rw-r--r--crawl-ref/source/monster.cc4
-rw-r--r--crawl-ref/source/mpr.h7
-rw-r--r--crawl-ref/source/mutation.cc5
-rw-r--r--crawl-ref/source/ouch.cc20
-rw-r--r--crawl-ref/source/output.cc40
-rw-r--r--crawl-ref/source/player.cc29
-rw-r--r--crawl-ref/source/player.h2
-rw-r--r--crawl-ref/source/religion.cc13
-rw-r--r--crawl-ref/source/shout.cc18
-rw-r--r--crawl-ref/source/skills.cc7
-rw-r--r--crawl-ref/source/spells1.cc9
-rw-r--r--crawl-ref/source/spells2.cc4
-rw-r--r--crawl-ref/source/spells3.cc30
-rw-r--r--crawl-ref/source/spells4.cc9
-rw-r--r--crawl-ref/source/spl-cast.cc9
-rw-r--r--crawl-ref/source/spl-mis.cc4
-rw-r--r--crawl-ref/source/stuff.cc9
-rw-r--r--crawl-ref/source/traps.cc4
39 files changed, 158 insertions, 342 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index bb69c1b8d8..a16fdf3ca6 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -702,6 +702,8 @@ static talent _get_talent(ability_type ability, bool check_confused)
case ABIL_TROG_BERSERK: // piety >= 30
invoc = true;
failure = 30 - you.piety; // starts at 0%
+ if (player_mental_clarity(true))
+ failure += 80;
break;
case ABIL_TROG_REGEN_MR: // piety >= 50
@@ -975,11 +977,8 @@ static bool _check_ability_possible(const ability_def& abil,
if (hungerCheck && you.species != SP_VAMPIRE)
{
const int expected_hunger = you.hunger - abil.food_cost * 2;
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
- "hunger: %d, max. food_cost: %d, expected hunger: %d",
+ dprf("hunger: %d, max. food_cost: %d, expected hunger: %d",
you.hunger, abil.food_cost * 2, expected_hunger);
-#endif
// Safety margin for natural hunger, mutations etc.
if (expected_hunger <= 150)
{
@@ -1102,7 +1101,8 @@ static bool _check_ability_possible(const ability_def& abil,
mpr("You're too hungry to berserk.");
return (false);
}
- return (you.can_go_berserk(true) && berserk_check_wielded_weapon());
+ return (you.can_go_berserk(true, abil.ability == ABIL_TROG_BERSERK)
+ && berserk_check_wielded_weapon());
case ABIL_FLY_II:
if (you.duration[DUR_EXHAUSTED])
@@ -1161,7 +1161,7 @@ static bool _activate_talent(const talent& tal)
}
if ((tal.which == ABIL_EVOKE_BERSERK || tal.which == ABIL_TROG_BERSERK)
- && !you.can_go_berserk(true))
+ && !you.can_go_berserk(true, tal.which == ABIL_TROG_BERSERK))
{
crawl_state.zero_turns_taken();
return (false);
@@ -1745,7 +1745,7 @@ static bool _do_ability(const ability_def& abil)
case ABIL_TROG_BERSERK:
// Trog abilities don't use or train invocations.
- go_berserk(true);
+ go_berserk(true, true);
break;
case ABIL_TROG_REGEN_MR:
@@ -2080,9 +2080,7 @@ static bool _do_ability(const ability_def& abil)
case ABIL_CHEIBRIADOS_SLOUCH:
mpr("You can feel time thicken.");
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "your speed is %d", player_movement_speed());
-#endif
+ dprf("your speed is %d", player_movement_speed());
exercise(SK_INVOCATIONS, 4 + random2(4));
cheibriados_slouch(0);
break;
@@ -2118,10 +2116,8 @@ static void _pay_ability_costs(const ability_def& abil)
const int piety_cost = abil.piety_cost.cost();
const int hp_cost = abil.hp_cost.cost(you.hp_max);
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Cost: mp=%d; hp=%d; food=%d; piety=%d",
+ dprf("Cost: mp=%d; hp=%d; food=%d; piety=%d",
abil.mp_cost, hp_cost, food_cost, piety_cost );
-#endif
if (abil.mp_cost)
{
diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc
index 562f93729c..edde4516bc 100644
--- a/crawl-ref/source/abyss.cc
+++ b/crawl-ref/source/abyss.cc
@@ -674,9 +674,7 @@ static void _initialise_level_corrupt_seeds(int power)
const int low = power / 2, high = power * 3 / 2;
int nseeds = random_range(1, std::min(2 + power / 110, 4));
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Placing %d corruption seeds", nseeds);
-#endif
+ dprf("Placing %d corruption seeds", nseeds);
// The corruption centered on the player is free.
_place_corruption_seed(you.pos(), high + 300);
diff --git a/crawl-ref/source/actor.cc b/crawl-ref/source/actor.cc
index c42c9965d3..3cdeeb9c50 100644
--- a/crawl-ref/source/actor.cc
+++ b/crawl-ref/source/actor.cc
@@ -103,11 +103,8 @@ bool actor::check_res_magic(int power)
const int mrchance = (100 + mrs) - power;
const int mrch2 = random2(100) + random2(101);
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
- "Power: %d, MR: %d, target: %d, roll: %d",
+ dprf("Power: %d, MR: %d, target: %d, roll: %d",
power, mrs, mrchance, mrch2);
-#endif
return (mrch2 < mrchance);
}
diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc
index a37fe4b70d..23f727ddec 100644
--- a/crawl-ref/source/beam.cc
+++ b/crawl-ref/source/beam.cc
@@ -226,9 +226,7 @@ static void _ench_animation(int flavour, const monsters *mon, bool force)
bool zapping(zap_type ztype, int power, bolt &pbolt,
bool needs_tracer, const char* msg)
{
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "zapping: power=%d", power);
-#endif
+ dprf("zapping: power=%d", power);
pbolt.thrower = KILL_YOU_MISSILE;
@@ -307,9 +305,7 @@ bool player_tracer( zap_type ztype, int power, bolt &pbolt, int range)
// "Fire through friendly?" prompts.
if (pbolt.beam_cancelled)
{
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "%s", "Beam cancelled.");
-#endif
+ dprf("%s", "Beam cancelled.");
canned_msg(MSG_OK);
you.turn_is_over = false;
return (false);
@@ -3539,9 +3535,7 @@ static bool _test_beam_hit(int attack, int defence, bool is_beam,
attack = r[0].random2(attack);
}
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Beam attack: %d, defence: %d", attack, defence);
-#endif
+ dprf("Beam attack: %d, defence: %d", attack, defence);
// Reproducing old behavior here; magic dart is dodgable with DMsl
if (attack == AUTOMATIC_HIT)
return (true);
@@ -3549,9 +3543,7 @@ static bool _test_beam_hit(int attack, int defence, bool is_beam,
attack = r[1].random2(attack);
defence = r[2].random2avg(defence, 2);
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Beam new attack: %d, defence: %d", attack, defence);
-#endif
+ dprf("Beam new attack: %d, defence: %d", attack, defence);
return (attack >= defence);
}
@@ -3614,9 +3606,7 @@ bool bolt::is_harmless(const monsters *mon) const
bool bolt::harmless_to_player() const
{
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "beam flavour: %d", flavour);
-#endif
+ dprf("beam flavour: %d", flavour);
switch (flavour)
{
@@ -3794,10 +3784,7 @@ bool bolt::misses_player()
const int block = you.shield_bonus();
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Beamshield: hit: %d, block %d",
- testhit, block);
-#endif
+ dprf("Beamshield: hit: %d, block %d", testhit, block);
if (testhit < block)
{
if (is_reflectable(you.shield()))
@@ -4328,9 +4315,7 @@ void bolt::affect_player()
expose_player_to_element(BEAM_SPORE, burn_power);
}
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Damage: %d", hurted );
-#endif
+ dprf("Damage: %d", hurted );
was_affected = apply_hit_funcs(&you, hurted) || was_affected;
@@ -5267,10 +5252,7 @@ mon_resist_type bolt::apply_enchantment_to_monster(monsters* mon)
const god_type god =
(crawl_state.is_god_acting()) ? crawl_state.which_god_acting()
: GOD_NO_GOD;
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
- "HD: %d; pow: %d", mon->hit_dice, ench_power);
-#endif
+ dprf("HD: %d; pow: %d", mon->hit_dice, ench_power);
obvious_effect = true;
if (player_will_anger_monster(mon))
@@ -5292,10 +5274,7 @@ mon_resist_type bolt::apply_enchantment_to_monster(monsters* mon)
case BEAM_ENSLAVE_SOUL:
{
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
- "HD: %d; pow: %d", mon->hit_dice, ench_power);
-#endif
+ dprf("HD: %d; pow: %d", mon->hit_dice, ench_power);
if (!mons_can_be_zombified(mon) || mons_intel(mon) < I_NORMAL)
{
@@ -5319,10 +5298,7 @@ mon_resist_type bolt::apply_enchantment_to_monster(monsters* mon)
}
case BEAM_ENSLAVE_DEMON:
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
- "HD: %d; pow: %d", mon->hit_dice, ench_power);
-#endif
+ dprf("HD: %d; pow: %d", mon->hit_dice, ench_power);
if (mon->hit_dice * 11 / 2 >= random2(ench_power)
|| mons_is_unique(mon->type))
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index 5a02bbccf8..a3a6ca6d5d 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -739,12 +739,10 @@ int check_recital_audience()
return (1);
}
-#ifdef DEBUG_DIAGNOSTICS
if (!found_monsters)
- mprf(MSGCH_DIAGNOSTICS, "No audience found!");
+ dprf("No audience found!");
else
- mprf(MSGCH_DIAGNOSTICS, "No sensible audience found!");
-#endif
+ dprf("No sensible audience found!");
// No use preaching to the choir, nor to common animals.
if (found_monsters)
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 0926c5f9ce..f8d614d73f 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -1196,19 +1196,13 @@ static void _fixup_misplaced_items()
if (feat >= DNGN_MINITEM)
continue;
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
- "Item buggily placed in feature at (%d, %d).",
+ dprf("Item buggily placed in feature at (%d, %d).",
item.pos.x, item.pos.y);
-#endif
}
else
{
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
- "Item buggily placed out of bounds at (%d, %d).",
+ dprf("Item buggily placed out of bounds at (%d, %d).",
item.pos.x, item.pos.y);
-#endif
}
// Can't just unlink item because it might not have been linked yet.
@@ -1406,9 +1400,7 @@ static bool _fixup_stone_stairs(bool preserve_vault_stairs)
gc.y = random2(GYM);
}
while (grd(gc) != DNGN_FLOOR);
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "add stair %d at pos(%d, %d)", s, gc.x, gc.y);
-#endif
+ dprf("add stair %d at pos(%d, %d)", s, gc.x, gc.y);
// base gets fixed up to be the right stone stair below...
grd(gc) = base;
stair_list[num_stairs++] = gc;
@@ -1598,9 +1590,7 @@ static void _dgn_verify_connectivity(unsigned nvaults)
if (!_fixup_stone_stairs(true))
{
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Warning: failed to preserve vault stairs.");
-#endif
+ dprf("Warning: failed to preserve vault stairs.");
if (!_fixup_stone_stairs(false))
{
dgn_level_vetoed = true;
@@ -2982,9 +2972,7 @@ static builder_rc_type _builder_basic(int level_number)
_make_trail( 50, 20, 40, 20, corrlength, intersect_chance, no_corr,
xbegin, ybegin, xend, yend);
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Placing shaft trail...");
-#endif
+ dprf("Placing shaft trail...");
if (!one_chance_in(3)) // 2/3 chance it ends in a shaft
{
trap_def& ts(env.trap[0]);
@@ -2994,16 +2982,12 @@ static builder_rc_type _builder_basic(int level_number)
grd[xend][yend] = DNGN_UNDISCOVERED_TRAP;
if (shaft_known(level_number, false))
ts.reveal();
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Trail ends in shaft.");
-#endif
+ dprf("Trail ends in shaft.");
}
else
{
grd[xend][yend] = DNGN_FLOOR;
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Trail does not end in shaft..");
-#endif
+ dprf("Trail does not end in shaft..");
}
}
@@ -3316,10 +3300,7 @@ static void _place_branch_entrances(int dlevel, char level_type)
&& player_branch_depth() == branches[i].startdepth)
{
// Place a stair.
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Placing stair to %s",
- branches[i].shortname);
-#endif
+ dprf("Placing stair to %s", branches[i].shortname);
std::string entry_tag = std::string(branches[i].abbrevname);
entry_tag += "_entry";
@@ -5793,9 +5774,7 @@ static void _place_altars()
if (random2(100) >= prob)
break;
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Placing an altar");
-#endif
+ dprf("Placing an altar");
_place_altar();
// Reduce the chance and try to place another.
prob /= 5;
@@ -8004,9 +7983,7 @@ coord_def dgn_find_nearby_stair(dungeon_feature_type stair_to_find,
return (pos);
// Couldn't find a good place, warn, and use old behaviour.
-#ifdef DEBUG_DIAGNOSTICS
- mpr("Oops, couldn't find labyrinth entry marker.", MSGCH_DIAGNOSTICS);
-#endif
+ dprf("Oops, couldn't find labyrinth entry marker.");
stair_to_find = DNGN_FLOOR;
}
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index 1c98e6e611..e9894917b0 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -4180,9 +4180,7 @@ static void _catchup_monster_moves(monsters *mon, int turns)
}
}
-#if DEBUG_DIAGNOSTICS
- mpr("backing off...", MSGCH_DIAGNOSTICS);
-#endif
+ dprf("backing off...");
}
else
{
diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc
index dc1410a5a6..fe28e2ade4 100644
--- a/crawl-ref/source/fight.cc
+++ b/crawl-ref/source/fight.cc
@@ -1480,10 +1480,7 @@ bool melee_attack::player_hits_monster()
const int evasion = defender->melee_evasion(attacker);
const int evasion_helpful
= defender->melee_evasion(attacker, EV_IGNORE_HELPLESS);
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "your to-hit: %d; defender effective EV: %d",
- to_hit, evasion);
-#endif
+ dprf("your to-hit: %d; defender effective EV: %d", to_hit, evasion);
if (to_hit >= evasion_helpful || one_chance_in(20))
{
@@ -2037,11 +2034,8 @@ bool melee_attack::player_monattk_hit_effects(bool mondied)
// More than if not killed.
const int heal = 1 + random2(damage_done);
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
- "Vampiric healing: damage %d, healed %d",
+ dprf("Vampiric healing: damage %d, healed %d",
damage_done, heal);
-#endif
inc_hp(heal, false);
if (you.hunger_state != HS_ENGORGED)
@@ -3776,10 +3770,8 @@ bool melee_attack::player_check_monster_died()
{
if (!defender->alive())
{
-#if DEBUG_DIAGNOSTICS
// note: doesn't take account of special weapons, etc.
- mprf(MSGCH_DIAGNOSTICS, "Hit for %d.", damage_done);
-#endif
+ dprf("Hit for %d.", damage_done);
player_monattk_hit_effects(true);
@@ -3928,8 +3920,7 @@ int melee_attack::player_to_hit(bool random_factor)
your_to_hit = maybe_random2(your_to_hit, random_factor);
#if DEBUG_DIAGNOSTICS
- mprf( MSGCH_DIAGNOSTICS,
- "to hit die: %d; rolled value: %d; base: %d",
+ dprf( "to hit die: %d; rolled value: %d; base: %d",
roll_hit, your_to_hit, base_to_hit );
#endif
@@ -4058,11 +4049,8 @@ void melee_attack::player_apply_attack_delay()
you.time_taken =
std::max(2, div_rand_round(you.time_taken * final_attack_delay, 10));
-#if DEBUG_DIAGNOSTICS
- mprf( MSGCH_DIAGNOSTICS,
- "Weapon speed: %d; min: %d; attack time: %d",
+ dprf( "Weapon speed: %d; min: %d; attack time: %d",
final_attack_delay, min_delay, you.time_taken );
-#endif
}
int melee_attack::player_weapon_speed()
@@ -4264,10 +4252,7 @@ bool melee_attack::mons_attack_mons()
// Non-friendly monsters should never violate sanctuary.
else
{
-#ifdef DEBUG_DIAGNOSTICS
- mpr("Preventing hostile violation of sanctuary.",
- MSGCH_DIAGNOSTICS);
-#endif
+ dprf("Preventing hostile violation of sanctuary.");
cancel_attack = true;
return (false);
}
@@ -5020,9 +5005,7 @@ void melee_attack::mons_apply_attack_flavour(const mon_attack_def &attk)
special_attack_punctuation().c_str());
}
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Shock damage: %d", special_damage);
-#endif
+ dprf("Shock damage: %d", special_damage);
break;
case AF_VAMPIRIC:
@@ -5460,10 +5443,8 @@ void melee_attack::mons_perform_attack_rounds()
if (damage_done > 0)
{
-#ifdef DEBUG_DIAGNOSTICS
if (shield_blocked)
- mpr("ERROR: Non-zero damage after shield block!");
-#endif
+ dprf("ERROR: Non-zero damage after shield block!");
mons_announce_hit(attk);
check_defender_train_armour();
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index 45a0664a5b..f44cf20d76 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -1442,9 +1442,7 @@ bool load( dungeon_feature_type stair_taken, load_mode_type load_mode,
timeval -= (stepdown_value( check_stealth(), 50, 50, 150, 150 ) / 10);
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "arrival time: %d", timeval );
-#endif
+ dprf("arrival time: %d", timeval );
if (timeval > 0)
{
diff --git a/crawl-ref/source/godabil.cc b/crawl-ref/source/godabil.cc
index f9280b3948..edb1b723fb 100644
--- a/crawl-ref/source/godabil.cc
+++ b/crawl-ref/source/godabil.cc
@@ -158,9 +158,7 @@ bool trog_burn_spellbooks()
else
totalpiety++;
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Burned book rarity: %d", rarity);
-#endif
+ dprf("Burned book rarity: %d", rarity);
destroy_item(si.link());
count++;
}
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 8e70a848f8..4553465d97 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -2577,13 +2577,10 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
if (wepClass == OBJ_MISSILES && wepType == MI_NEEDLE)
pbolt.ench_power = AUTOMATIC_HIT;
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
- "Base hit == %d; Base damage == %d "
+ dprf( "Base hit == %d; Base damage == %d "
"(item %d + launcher %d)",
baseHit, baseDam,
item_base_dam, lnch_base_dam);
-#endif
// Fix ammo damage bonus, since missiles only use inv_plus.
ammoDamBonus = ammoHitBonus;
@@ -2625,9 +2622,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
effSkill = shoot_skill;
const int speed = launcher_final_speed(launcher, you.shield());
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Final launcher speed: %d", speed);
-#endif
+ dprf("Final launcher speed: %d", speed);
you.time_taken = speed * you.time_taken / 100;
// [dshaligram] Improving missile weapons:
@@ -3031,10 +3026,8 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
// blowguns.
exHitBonus -= (30 - you.skills[SK_DARTS]) / 3;
baseHit -= (30 - you.skills[SK_DARTS]) / 3;
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Needle base hit = %d, exHitBonus = %d",
+ dprf("Needle base hit = %d, exHitBonus = %d",
baseHit, exHitBonus);
-#endif
}
}
@@ -3065,13 +3058,10 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus,
scale_dice(pbolt.damage);
-#if DEBUG_DIAGNOSTICS
- mprf( MSGCH_DIAGNOSTICS,
- "H:%d+%d;a%dl%d. D:%d+%d;a%dl%d -> %d,%dd%d",
+ dprf( "H:%d+%d;a%dl%d. D:%d+%d;a%dl%d -> %d,%dd%d",
baseHit, exHitBonus, ammoHitBonus, lnchHitBonus,
baseDam, exDamBonus, ammoDamBonus, lnchDamBonus,
pbolt.hit, pbolt.damage.num, pbolt.damage.size );
-#endif
// Create message.
mprf( "%s %s%s %s.",
diff --git a/crawl-ref/source/l_dgn.cc b/crawl-ref/source/l_dgn.cc
index 4ef1cae954..99035d37f0 100644
--- a/crawl-ref/source/l_dgn.cc
+++ b/crawl-ref/source/l_dgn.cc
@@ -1355,10 +1355,8 @@ static bool _lua_map_place_valid(const map_def &map,
const coord_def &c,
const coord_def &size)
{
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "lua_map_place_invalid: (%d,%d) (%d,%d)",
+ dprf("lua_map_place_invalid: (%d,%d) (%d,%d)",
c.x, c.y, size.x, size.y);
-#endif
lua_stack_cleaner clean(_dgn_map_safe_bounds_fn->lua);
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index 1e8f2a6147..3d8421ade8 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -884,9 +884,7 @@ static weapon_type _determine_weapon_subtype(int item_level)
static bool _try_make_item_special_unrand(item_def& item, int force_type,
int item_level)
{
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Making special unrand artefact.");
-#endif
+ dprf("Making special unrand artefact.");
bool abyss = item_level == level_id(LEVEL_ABYSS).absdepth();
int idx = find_okay_unrandart(item.base_type, force_type,
diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc
index 1d009e6c6c..42006436f7 100644
--- a/crawl-ref/source/maps.cc
+++ b/crawl-ref/source/maps.cc
@@ -478,10 +478,8 @@ static bool apply_vault_grid(map_def &def,
if (check_place && !_safe_vault_place(def, start, size))
{
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Bad vault place: (%d,%d) dim (%d,%d)",
+ dprf("Bad vault place: (%d,%d) dim (%d,%d)",
start.x, start.y, size.x, size.y);
-#endif
return (false);
}
diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc
index c2fce04242..6a3d36c487 100644
--- a/crawl-ref/source/message.cc
+++ b/crawl-ref/source/message.cc
@@ -446,6 +446,16 @@ void mprf( const char *format, ... )
va_end( argp );
}
+#ifdef DEBUG_DIAGNOSTICS
+void dprf( const char *format, ... )
+{
+ va_list argp;
+ va_start( argp, format );
+ do_message_print( MSGCH_DIAGNOSTICS, 0, format, argp );
+ va_end( argp );
+}
+#endif
+
static bool _updating_view = false;
void mpr(const char *inf, msg_channel_type channel, int param)
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index b528df7766..5697133c4a 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -1109,11 +1109,8 @@ static void _maybe_bloodify_square(const coord_def& where, int amount,
if (x_chance_in_y(amount, 20))
{
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
- "might bleed now; square: (%d, %d); amount = %d",
+ dprf("might bleed now; square: (%d, %d); amount = %d",
where.x, where.y, amount);
-#endif
if (may_bleed)
{
env.pgrid(where) |= FPROP_BLOODY;
@@ -1299,10 +1296,7 @@ void search_around(bool only_adjacent)
// Maybe we shouldn't kill the trap for debugging
// purposes - oh well.
grd(*ri) = DNGN_FLOOR;
-#if DEBUG_DIAGNOSTICS
- mpr("You found a buggy trap! It vanishes!",
- MSGCH_DIAGNOSTICS);
-#endif
+ dprf("You found a buggy trap! It vanishes!");
}
}
}
@@ -2701,11 +2695,11 @@ bool scramble(void)
return (true);
}
-bool go_berserk(bool intentional)
+bool go_berserk(bool intentional, bool no_clarity)
{
ASSERT(!crawl_state.arena);
- if (!you.can_go_berserk(intentional))
+ if (!you.can_go_berserk(intentional, no_clarity))
return (false);
if (Tutorial.tutorial_left)
diff --git a/crawl-ref/source/misc.h b/crawl-ref/source/misc.h
index 9f75955885..3c5cee6cbf 100644
--- a/crawl-ref/source/misc.h
+++ b/crawl-ref/source/misc.h
@@ -13,7 +13,7 @@ struct bolt;
struct dist;
struct activity_interrupt_data;
-bool go_berserk(bool intentional);
+bool go_berserk(bool intentional, bool no_clarity = false);
void search_around(bool only_adjacent = false);
void down_stairs(int old_level,
dungeon_feature_type force_stair = DNGN_UNSEEN,
diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc
index e1fa72f6a5..32a764bcb1 100644
--- a/crawl-ref/source/mon-abil.cc
+++ b/crawl-ref/source/mon-abil.cc
@@ -1164,9 +1164,7 @@ bool mon_special_ability(monsters *monster, bolt & beem)
if (delay.type == DELAY_ASCENDING_STAIRS
|| delay.type == DELAY_DESCENDING_STAIRS)
{
-#ifdef DEBUG_DIAGNOSTICS
- mpr("Taking stairs, don't mesmerise.", MSGCH_DIAGNOSTICS);
-#endif
+ dprf("Taking stairs, don't mesmerise.");
break;
}
}
diff --git a/crawl-ref/source/mon-cast.cc b/crawl-ref/source/mon-cast.cc
index 25864af558..4f86ede2f8 100644
--- a/crawl-ref/source/mon-cast.cc
+++ b/crawl-ref/source/mon-cast.cc
@@ -1377,10 +1377,7 @@ static int _monster_abjure_square(const coord_def &pos,
shielded = true;
}
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Abj: dur: %d, pow: %d, ndur: %d",
- duration, pow, duration - pow);
-#endif
+ dprf("Abj: dur: %d, pow: %d, ndur: %d", duration, pow, duration - pow);
mon_enchant abj = target->get_ench(ENCH_ABJ);
if (!target->lose_ench_duration(abj, pow))
diff --git a/crawl-ref/source/mon-project.cc b/crawl-ref/source/mon-project.cc
index ffcfb8a8a2..32259e6b10 100644
--- a/crawl-ref/source/mon-project.cc
+++ b/crawl-ref/source/mon-project.cc
@@ -87,9 +87,7 @@ static bool _in_front(float vx, float vy, float dx, float dy, float angle)
void _iood_dissipate(monsters &mon)
{
simple_monster_message(&mon, " dissipates.");
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "iood: dissipating");
-#endif
+ dprf("iood: dissipating");
monster_die(&mon, KILL_DISMISSED, NON_MONSTER);
}
@@ -118,13 +116,6 @@ bool _iood_hit(monsters &mon, const coord_def &pos, bool big_boom = false)
return (true);
}
-#ifdef DEBUG_DIAGNOSTICS
-#define dprf(...) mprf(MSGCH_DIAGNOSTICS, __VA_ARGS__)
-#else
-static void nada();
-#define dprf(...) nada()
-#endif
-
// returns true if the orb is gone
bool iood_act(monsters &mon, bool no_trail)
{
@@ -135,12 +126,9 @@ bool iood_act(monsters &mon, bool no_trail)
float vx = mon.props["iood_vx"];
float vy = mon.props["iood_vy"];
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
- "iood_act: pos (%d,%d) rpos (%f,%f) v (%f,%f)",
+ dprf("iood_act: pos (%d,%d) rpos (%f,%f) v (%f,%f)",
mon.pos().x, mon.pos().y,
x, y, vx, vy);
-#endif
if (!vx && !vy) // not initialized
{
@@ -195,8 +183,6 @@ bool iood_act(monsters &mon, bool no_trail)
ax = vy, ay = -vx, dprf("iood: veering left");
else
ax = -vy, ay = vx, dprf("iood: veering right");
- mprf(MSGCH_DIAGNOSTICS, "iood: veering %s", (dy*vx < dx*vy) ?
- "left" : "right");
vx += ax * 0.3;
vy += ay * 0.3;
}
diff --git a/crawl-ref/source/mon-stuff.cc b/crawl-ref/source/mon-stuff.cc
index 9b54cac979..76f964fe20 100644
--- a/crawl-ref/source/mon-stuff.cc
+++ b/crawl-ref/source/mon-stuff.cc
@@ -403,10 +403,7 @@ bool explode_corpse(item_def& corpse, const coord_def& where)
cp.x += random_range(-LOS_RADIUS, LOS_RADIUS);
cp.y += random_range(-LOS_RADIUS, LOS_RADIUS);
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Trying to scatter chunk to %d, %d...",
- cp.x, cp.y);
-#endif
+ dprf("Trying to scatter chunk to %d, %d...", cp.x, cp.y);
if (! in_bounds(cp))
continue;
@@ -414,9 +411,7 @@ bool explode_corpse(item_def& corpse, const coord_def& where)
if (! ld.see_cell(cp))
continue;
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Cell is visible...");
-#endif
+ dprf("Cell is visible...");
if (feat_is_solid(grd(cp)) || actor_at(cp))
continue;
@@ -431,9 +426,7 @@ bool explode_corpse(item_def& corpse, const coord_def& where)
continue;
}
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Success");
-#endif
+ dprf("Success");
copy_item_to_grid(corpse, cp);
}
@@ -730,18 +723,12 @@ static bool _ely_heal_monster(monsters *monster, killer_type killer, int i)
else if (!YOU_KILL(killer))
return (false);
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "monster hp: %d, max hp: %d",
- monster->hit_points, monster->max_hit_points);
-#endif
+ dprf("monster hp: %d, max hp: %d", monster->hit_points, monster->max_hit_points);
monster->hit_points = std::min(1 + random2(ely_penance/3),
monster->max_hit_points);
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "new hp: %d, ely penance: %d",
- monster->hit_points, ely_penance);
-#endif
+ dprf("new hp: %d, ely penance: %d", monster->hit_points, ely_penance);
snprintf(info, INFO_SIZE, "%s heals %s%s",
god_name(god, false).c_str(),
diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc
index b5d6716eb5..b71b2a4558 100644
--- a/crawl-ref/source/monster.cc
+++ b/crawl-ref/source/monster.cc
@@ -5035,9 +5035,7 @@ void monsters::apply_enchantment(const mon_enchant &me)
// Don't clean up the monster in order to credit properly.
hurt(NULL, dam, BEAM_NAPALM, false);
-#if DEBUG_DIAGNOSTICS
- mprf( MSGCH_DIAGNOSTICS, "sticky flame damage: %d", dam );
-#endif
+ dprf("sticky flame damage: %d", dam);
// Credit the kill.
if (hit_points < 1)
diff --git a/crawl-ref/source/mpr.h b/crawl-ref/source/mpr.h
index e2eb48451d..5676e5d197 100644
--- a/crawl-ref/source/mpr.h
+++ b/crawl-ref/source/mpr.h
@@ -77,4 +77,11 @@ void mprf( msg_channel_type channel, int param, const char *format, ... );
void mprf( msg_channel_type channel, const char *format, ... );
void mprf( const char *format, ... );
+// Yay for C89 and lack of variadic #defines...
+#ifdef DEBUG_DIAGNOSTICS
+void dprf( const char *format, ... );
+#else
+static inline void dprf( const char *format, ... ) {}
+#endif
+
#endif
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc
index 4c01425f4d..b7934cca2a 100644
--- a/crawl-ref/source/mutation.cc
+++ b/crawl-ref/source/mutation.cc
@@ -3043,10 +3043,7 @@ int how_mutated(bool all, bool levels)
}
}
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "how_mutated(): all = %u, levels = %u, j = %d",
- all, levels, j);
-#endif
+ dprf("how_mutated(): all = %u, levels = %u, j = %d", all, levels, j);
return (j);
}
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc
index 1c7d94cf1f..40352ecc0c 100644
--- a/crawl-ref/source/ouch.cc
+++ b/crawl-ref/source/ouch.cc
@@ -80,9 +80,7 @@ int check_your_resists(int hurted, beam_type flavour)
int resist;
int original = hurted;
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "checking resistance: flavour=%d", flavour );
-#endif
+ dprf("checking resistance: flavour=%d", flavour );
if (flavour == BEAM_FIRE || flavour == BEAM_LAVA
|| flavour == BEAM_HELLFIRE || flavour == BEAM_FRAG)
@@ -310,9 +308,7 @@ void _item_corrode(int slot)
// Anti-corrosion items protect against 90% of corrosion.
if (wearing_amulet(AMU_RESIST_CORROSION) && !one_chance_in(10))
{
-#if DEBUG_DIAGNOSTICS
- mpr( "Amulet protects.", MSGCH_DIAGNOSTICS );
-#endif
+ dprf("Amulet protects.");
return;
}
@@ -747,10 +743,8 @@ bool drain_exp(bool announce_full)
you.exp_available = std::max(0, you.exp_available);
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "You lose %ld experience points, %ld from pool.",
+ dprf("You lose %ld experience points, %ld from pool.",
exp_drained, pool_drained);
-#endif
you.redraw_experience = true;
@@ -1013,9 +1007,7 @@ void ouch(int dam, int death_source, kill_method_type death_type,
{
// Deep Dwarves get to shave _any_ hp loss.
int shave = 1 + random2(2 + random2(1 + you.experience_level / 3));
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "HP shaved: %d.", shave);
-#endif
+ dprf("HP shaved: %d.", shave);
dam -= shave;
if (dam <= 0)
return;
@@ -1174,9 +1166,7 @@ void ouch(int dam, int death_source, kill_method_type death_type,
= se.death_description(scorefile_entry::DDV_VERBOSE);
#ifdef USE_OPTIONAL_WIZARD_DEATH
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Damage: %d; Hit points: %d", dam, you.hp);
-#endif
+ dprf("Damage: %d; Hit points: %d", dam, you.hp);
if (crawl_state.test || !yesno("Die?", false, 'n'))
{
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index ccad9bd3d9..04d4b9a7ca 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -497,39 +497,37 @@ static void _print_stats_ev(int x, int y)
static void _print_stats_wp(int y)
{
- cgotoxy(1, y, GOTO_STAT);
- textcolor(Options.status_caption_colour);
- cprintf("Wp: ");
+ int col;
+ std::string text;
if (you.weapon())
{
const item_def& wpn = *you.weapon();
- textcolor(wpn.colour);
+ col = wpn.colour;
const std::string prefix = menu_colour_item_prefix(wpn);
const int prefcol = menu_colour(wpn.name(DESC_INVENTORY), prefix);
if (prefcol != -1)
- textcolor(prefcol);
+ col = prefcol;
- cprintf("%s",
- wpn.name(DESC_INVENTORY, true, false, true)
- .substr(0, crawl_view.hudsz.x - 4).c_str());
- textcolor(LIGHTGREY);
+ text = wpn.name(DESC_INVENTORY, true, false, true);
+ }
+ else if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BLADE_HANDS)
+ {
+ col = RED;
+ text = "Blade Hands";
}
else
{
- if (you.attribute[ATTR_TRANSFORMATION] == TRAN_BLADE_HANDS)
- {
- textcolor(RED);
- cprintf("Blade Hands");
- textcolor(LIGHTGREY);
- }
- else
- {
- textcolor(LIGHTGREY);
- cprintf("Nothing wielded");
- }
+ col = LIGHTGREY;
+ text = "Nothing wielded";
}
- clear_to_end_of_line();
+ cgotoxy(1, y, GOTO_STAT);
+ textcolor(Options.status_caption_colour);
+ cprintf("Wp: ");
+ textcolor(col);
+ int w = crawl_view.hudsz.x - 4;
+ cprintf("%-*s", w, text.substr(0, w).c_str());
+ textcolor(LIGHTGREY);
}
static void _print_stats_qv(int y)
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 126a7539b1..fb6b425834 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -2506,9 +2506,7 @@ void gain_exp( unsigned int exp_gained, unsigned int* actual_gain,
const unsigned long old_exp = you.experience;
const int old_avail = you.exp_available;
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "gain_exp: %d", exp_gained );
-#endif
+ dprf("gain_exp: %d", exp_gained );
if (you.experience + exp_gained > (unsigned int)MAX_EXP_TOTAL)
you.experience = MAX_EXP_TOTAL;
@@ -3810,9 +3808,7 @@ void display_char_status()
// character evaluates their ability to sneak around:
mprf("You feel %s.", stealth_desc(check_stealth()).c_str());
-#if DEBUG_DIAGNOSTICS
- mprf("stealth: %d", check_stealth());
-#endif
+ dprf("stealth: %d", check_stealth());
}
bool player_item_conserve(bool calc_unid)
@@ -5977,7 +5973,7 @@ bool player::can_go_berserk() const
return (can_go_berserk(false));
}
-bool player::can_go_berserk(bool verbose) const
+bool player::can_go_berserk(bool verbose, bool no_clarity) const
{
if (berserk())
{
@@ -6013,6 +6009,25 @@ bool player::can_go_berserk(bool verbose) const
return (false);
}
+ if (!no_clarity && player_mental_clarity(true))
+ {
+ if (verbose)
+ {
+ mpr("You're too calm and focused to rage.");
+ item_def *amu;
+ if (!player_mental_clarity(false) && wearing_amulet(AMU_CLARITY)
+ && (amu = &you.inv[you.equip[EQ_AMULET]]) && !item_type_known(*amu))
+ {
+ set_ident_type(amu->base_type, amu->sub_type, ID_KNOWN_TYPE);
+ set_ident_flags(*amu, ISFLAG_KNOW_PROPERTIES);
+ mprf("You are wearing: %s",
+ amu->name(DESC_INVENTORY_EQUIP).c_str());
+ }
+ }
+
+ return (false);
+ }
+
return (true);
}
diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h
index aebace1a3e..285d438c0c 100644
--- a/crawl-ref/source/player.h
+++ b/crawl-ref/source/player.h
@@ -412,7 +412,7 @@ public:
void attacking(actor *other);
bool can_go_berserk() const;
- bool can_go_berserk(bool verbose) const;
+ bool can_go_berserk(bool verbose, bool no_clarity = false) const;
void go_berserk(bool intentional);
bool berserk() const;
bool can_mutate() const;
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index d4bdf9c2d6..3ec55a07cc 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -2467,9 +2467,7 @@ void pray()
if (!was_praying)
_do_god_gift(true);
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "piety: %d (-%d)", you.piety, you.piety_hysteresis );
-#endif
+ dprf("piety: %d (-%d)", you.piety, you.piety_hysteresis );
}
void end_prayer(void)
@@ -3284,10 +3282,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known,
// melee). This means high level spells probably work
// pretty much like they used to (use spell, get piety).
piety_change = div_rand_round(level + 10, 80);
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Spell practise, level: %d, dpiety: %d",
- level, piety_change);
-#endif
+ dprf("Spell practise, level: %d, dpiety: %d", level, piety_change);
retval = true;
}
break;
@@ -3839,9 +3834,7 @@ bool ely_destroy_weapons()
// item_value() multiplies by quantity.
const int value = item_value(item, true) / item.quantity;
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Destroyed weapon value: %d", value);
-#endif
+ dprf("Destroyed weapon value: %d", value);
piety_gain_t pgain = PIETY_NONE;
const bool unholy_weapon = is_unholy_item(item);
diff --git a/crawl-ref/source/shout.cc b/crawl-ref/source/shout.cc
index d7d21af7a4..561313a09c 100644
--- a/crawl-ref/source/shout.cc
+++ b/crawl-ref/source/shout.cc
@@ -470,11 +470,8 @@ static const char* _player_vampire_smells_blood(int dist)
void blood_smell(int strength, const coord_def& where)
{
const int range = strength * strength;
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
- "blood stain at (%d, %d), range of smell = %d",
+ dprf("blood stain at (%d, %d), range of smell = %d",
where.x, where.y, range);
-#endif
// Of the player species, only Vampires can smell blood.
if (you.species == SP_VAMPIRE)
@@ -489,11 +486,8 @@ void blood_smell(int strength, const coord_def& where)
if (player_distance <= vamp_range)
{
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
- "Player smells blood, pos: (%d, %d), dist = %d)",
+ dprf("Player smells blood, pos: (%d, %d), dist = %d)",
you.pos().x, you.pos().y, player_distance);
-#endif
you.check_awaken(range - player_distance);
// Don't message if you can see the square.
if (!you.see_cell(where))
@@ -523,21 +517,17 @@ void blood_smell(int strength, const coord_def& where)
{
if (coinflip())
{
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "disturbing %s (%d, %d)",
+ dprf("disturbing %s (%d, %d)",
mi->name(DESC_PLAIN).c_str(),
mi->pos().x, mi->pos().y);
-#endif
behaviour_event(*mi, ME_DISTURB, MHITNOT, where);
}
continue;
}
}
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "alerting %s (%d, %d)",
+ dprf("alerting %s (%d, %d)",
mi->name(DESC_PLAIN).c_str(),
mi->pos().x, mi->pos().y);
-#endif
behaviour_event(*mi, ME_ALERT, MHITNOT, where);
if (mi->type == MONS_SHARK)
diff --git a/crawl-ref/source/skills.cc b/crawl-ref/source/skills.cc
index d39635531a..608ebca844 100644
--- a/crawl-ref/source/skills.cc
+++ b/crawl-ref/source/skills.cc
@@ -156,13 +156,8 @@ int exercise(int exsk, int deg)
deg--;
}
-#ifdef DEBUG_DIAGNOSTICS
if (ret)
- {
- mprf(MSGCH_DIAGNOSTICS, "Exercised %s (deg: %d) by %d",
- skill_name(exsk), deg, ret);
- }
-#endif
+ dprf("Exercised %s (deg: %d) by %d", skill_name(exsk), deg, ret);
return (ret);
} // end exercise()
diff --git a/crawl-ref/source/spells1.cc b/crawl-ref/source/spells1.cc
index af80900803..647077f2f4 100644
--- a/crawl-ref/source/spells1.cc
+++ b/crawl-ref/source/spells1.cc
@@ -737,12 +737,9 @@ static bool _can_pacify_monster(const monsters *mon, const int healed)
const int random_factor = random2((you.skills[SK_INVOCATIONS] + 1) *
healed / divisor);
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
- "pacifying %s? max hp: %d, factor: %d, Inv: %d, healed: %d, rnd: %d",
+ dprf("pacifying %s? max hp: %d, factor: %d, Inv: %d, healed: %d, rnd: %d",
mon->name(DESC_PLAIN).c_str(), mon->max_hit_points, factor,
you.skills[SK_INVOCATIONS], healed, random_factor);
-#endif
if (mon->max_hit_points < factor * random_factor)
return (true);
@@ -1142,10 +1139,8 @@ void abjuration(int pow)
if (mon->is_summoned(&duration))
{
int sockage = std::max(fuzz_value(abjdur, 60, 30), 40);
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "%s abj: dur: %d, abj: %d",
+ dprf("%s abj: dur: %d, abj: %d",
mon->name(DESC_PLAIN).c_str(), duration, sockage);
-#endif
bool shielded = false;
// TSO and Trog's abjuration protection.
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc
index 0e3dcb1aea..b4e15848b8 100644
--- a/crawl-ref/source/spells2.cc
+++ b/crawl-ref/source/spells2.cc
@@ -100,9 +100,7 @@ int detect_items(int pow)
static void _fuzz_detect_creatures(int pow, int *fuzz_radius, int *fuzz_chance)
{
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "dc_fuzz: Power is %d", pow);
-#endif
+ dprf("dc_fuzz: Power is %d", pow);
pow = std::max(1, pow);
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index d774db49e2..26747c1f07 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -655,10 +655,8 @@ bool cast_summon_horrible_things(int pow, god_type god)
bool receive_corpses(int pow, coord_def where)
{
-#if DEBUG_DIAGNOSTICS
// pow = invocations * 4, ranges from 0 to 108
- mprf(MSGCH_DIAGNOSTICS, "receive_corpses() power: %d", pow);
-#endif
+ dprf("receive_corpses() power: %d", pow);
// Kiku gives branch-appropriate corpses (like shadow creatures).
int expected_extra_corpses = 3 + pow / 18; // 3 at 0 Inv, 9 at 27 Inv.
@@ -1200,9 +1198,7 @@ bool cast_twisted_resurrection(int pow, god_type god)
return (false);
}
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Mass for abomination: %d", total_mass);
-#endif
+ dprf("Mass for abomination: %d", total_mass);
// This is what the old statement pretty much boils down to,
// the average will be approximately 10 * pow (or about 1000
@@ -1211,9 +1207,7 @@ bool cast_twisted_resurrection(int pow, god_type god)
// material components are far more important to this spell. - bwr
total_mass += roll_dice(20, pow);
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Mass including power bonus: %d", total_mass);
-#endif
+ dprf("Mass including power bonus: %d", total_mass);
if (total_mass < 400 + roll_dice(2, 500)
|| how_many_corpses < (coinflip() ? 3 : 2))
@@ -1561,9 +1555,7 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area, bool wizar
}
#endif
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Target square (%d,%d)", pos.x, pos.y );
-#endif
+ dprf("Target square (%d,%d)", pos.x, pos.y );
if (pos == you.pos() || pos == coord_def(-1,-1))
{
@@ -1602,10 +1594,7 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area, bool wizar
pos.x += random2(3) - 1;
pos.y += random2(3) - 1;
}
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
- "Scattered target square (%d, %d)", pos.x, pos.y);
-#endif
+ dprf("Scattered target square (%d, %d)", pos.x, pos.y);
}
if (!in_bounds(pos))
@@ -1622,10 +1611,7 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area, bool wizar
// Merfolk should be able to control-tele into deep water.
if (_cell_vetoes_teleport(pos))
{
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS,
- "Target square (%d, %d) vetoed, now random teleport.", pos.x, pos.y);
-#endif
+ dprf("Target square (%d, %d) vetoed, now random teleport.", pos.x, pos.y);
is_controlled = false;
large_change = false;
}
@@ -1910,9 +1896,7 @@ bool project_noise(void)
redraw_screen();
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Target square (%d,%d)", pos.x, pos.y );
-#endif
+ dprf("Target square (%d,%d)", pos.x, pos.y );
if (!silenced( pos ))
{
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index 992b768ed5..6819599ee5 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -575,10 +575,7 @@ static int _ignite_poison_monsters(coord_def where, int pow, int, actor *)
damage = mons_adjust_flavoured(mon, beam, damage);
simple_monster_message(mon, " seems to burn from within!");
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Dice: %dd%d; Damage: %d",
- dam_dice.num, dam_dice.size, damage);
-#endif
+ dprf("Dice: %dd%d; Damage: %d", dam_dice.num, dam_dice.size, damage);
if (!_player_hurt_monster(*mon, damage))
{
@@ -820,9 +817,7 @@ void cast_discharge(int pow)
dam = apply_random_around_square(_discharge_monsters, you.pos(),
true, pow, num_targs);
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Arcs: %d Damage: %d", num_targs, dam);
-#endif
+ dprf("Arcs: %d Damage: %d", num_targs, dam);
if (dam == 0)
{
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index efb8386ee0..21f7c7f290 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -1339,9 +1339,7 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
}
}
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Spell #%d, power=%d", spell, powc);
-#endif
+ dprf("Spell #%d, power=%d", spell, powc);
switch (spell)
{
@@ -1796,10 +1794,7 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail)
{
const int sleep_power =
stepdown_value(powc * 9 / 10, 5, 35, 45, 50);
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Sleep power stepdown: %d -> %d",
- powc, sleep_power);
-#endif
+ dprf("Sleep power stepdown: %d -> %d", powc, sleep_power);
if (!zapping(ZAP_HIBERNATION, sleep_power, beam, true))
return (SPRET_ABORT);
break;
diff --git a/crawl-ref/source/spl-mis.cc b/crawl-ref/source/spl-mis.cc
index 71de742b40..16a3599e70 100644
--- a/crawl-ref/source/spl-mis.cc
+++ b/crawl-ref/source/spl-mis.cc
@@ -291,10 +291,8 @@ void MiscastEffect::do_miscast()
// killed a target which was alive when the object was created.
if (!target->alive())
{
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Miscast target '%s' already dead",
+ dprf("Miscast target '%s' already dead",
target->name(DESC_PLAIN, true).c_str());
-#endif
return;
}
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc
index 2e55a337ab..ccff7125aa 100644
--- a/crawl-ref/source/stuff.cc
+++ b/crawl-ref/source/stuff.cc
@@ -221,10 +221,8 @@ static bool _tag_follower_at(const coord_def &pos)
fmenv->travel_path.clear();
fmenv->travel_target = MTRAV_NONE;
-#if DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "%s is marked for following.",
+ dprf("%s is marked for following.",
fmenv->name(DESC_CAP_THE, true).c_str() );
-#endif
return (true);
}
@@ -905,10 +903,9 @@ void zap_los_monsters(bool items_also)
if (mon == NULL || mons_class_flag(mon->type, M_NO_EXP_GAIN))
continue;
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "Dismissing %s",
+ dprf("Dismissing %s",
mon->name(DESC_PLAIN, true).c_str() );
-#endif
+
// Do a hard reset so the monster's items will be discarded.
mon->flags |= MF_HARD_RESET;
// Do a silent, wizard-mode monster_die() just to be extra sure the
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc
index 20ed72e4fd..e8b8d92bce 100644
--- a/crawl-ref/source/traps.cc
+++ b/crawl-ref/source/traps.cc
@@ -998,10 +998,8 @@ void free_self_from_net()
int hold = mitm[net].plus;
int do_what = damage_or_escape_net(hold);
-#ifdef DEBUG_DIAGNOSTICS
- mprf(MSGCH_DIAGNOSTICS, "net.plus: %d, ATTR_HELD: %d, do_what: %d",
+ dprf("net.plus: %d, ATTR_HELD: %d, do_what: %d",
hold, you.attribute[ATTR_HELD], do_what);
-#endif
if (do_what <= 0) // You try to destroy the net
{