diff options
author | Michael Gagno <evilmike@gmail.com> | 2012-03-07 17:16:22 -0800 |
---|---|---|
committer | Michael Gagno <evilmike@gmail.com> | 2012-03-07 17:23:45 -0800 |
commit | ff9fb87a6f8b8d9b918d9bd96f3266299cdd212c (patch) | |
tree | 65c0d2f9f50c9d74d0b26c561f4a8caabb68d28e /crawl-ref/source/colour.cc | |
parent | d79679de2d885717e7bbade44237acfd1be188fe (diff) | |
download | crawl-ref-ff9fb87a6f8b8d9b918d9bd96f3266299cdd212c.tar.gz crawl-ref-ff9fb87a6f8b8d9b918d9bd96f3266299cdd212c.zip |
New ctrl+V command to show monster HP, and other HP colouring improvements. (nfogravity)
https://crawl.develz.org/mantis/view.php?id=5376
Pressing ctrl+v in console will colour all monsters based on their HP. This
can be useful when fighting large groups. This mode deactivates itself the
next turn, or you can toggle it off manually by pressing ctrl+v again.
Zombies and skeletons are given lightgrey colouring, since you can't
determine their HP.
There is also a new option, enemy_hp_colour, which lets you define custom
colours (applies to the ctrl+v display and the regular monster list).
The old ctrl+v command (show equipped weapons) has been removed.
Diffstat (limited to 'crawl-ref/source/colour.cc')
-rw-r--r-- | crawl-ref/source/colour.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/crawl-ref/source/colour.cc b/crawl-ref/source/colour.cc index 4133bcc109..77af9628d0 100644 --- a/crawl-ref/source/colour.cc +++ b/crawl-ref/source/colour.cc @@ -7,6 +7,10 @@ #include "dgn-height.h" #include "env.h" #include "libutil.h" +#include "mon-stuff.h" +#include "mon-info.h" +#include "mon-info.h" +#include "mon-util.h" #include "options.h" #include "player.h" #include "random.h" @@ -253,6 +257,24 @@ static int _etc_orb_glow(int, const coord_def& loc) return get_orb_phase(loc) ? LIGHTMAGENTA : MAGENTA; } +int dam_colour(const monster_info& mi) +{ + if (!mons_class_can_display_wounds(mi.type)) + return Options.enemy_hp_colour[6]; // undead and whatnot + + switch (mi.dam) + { + case MDAM_OKAY: return Options.enemy_hp_colour[0]; + case MDAM_LIGHTLY_DAMAGED: return Options.enemy_hp_colour[1]; + case MDAM_MODERATELY_DAMAGED: return Options.enemy_hp_colour[2]; + case MDAM_HEAVILY_DAMAGED: return Options.enemy_hp_colour[3]; + case MDAM_SEVERELY_DAMAGED: return Options.enemy_hp_colour[4]; + case MDAM_ALMOST_DEAD: return Options.enemy_hp_colour[5]; + case MDAM_DEAD: return BLACK; // this should never happen + default: return CYAN; // this should really never happen + } +} + static int _etc_random(int, const coord_def&) { return random_colour(); |