summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-28 05:31:36 +0000
committerennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-28 05:31:36 +0000
commit17d51dec2e404928c52bd4358c66703285f1eb0f (patch)
tree0dfd58f79f2359a887fbb94a65c68d33b426f324 /crawl-ref
parente7c257339952a377b86b78e88397e35c12851a87 (diff)
downloadcrawl-ref-17d51dec2e404928c52bd4358c66703285f1eb0f.tar.gz
crawl-ref-17d51dec2e404928c52bd4358c66703285f1eb0f.zip
* Monster list is now placed to the left of the view if the terminal is wide enough to make better use of available space.
* Added init.txt options for monster list placement. mlist_min_height - minimum items in the monster list (default: 5) mlist_force_inline - force the monster list to be between hud and messages * Fixed some (but not all) problems with the monster list being updated properly when monsters appear. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3909 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/docs/crawl_options.txt41
-rw-r--r--crawl-ref/init.txt2
-rw-r--r--crawl-ref/source/delay.cc2
-rw-r--r--crawl-ref/source/direct.h4
-rw-r--r--crawl-ref/source/externs.h2
-rw-r--r--crawl-ref/source/initfile.cc12
-rw-r--r--crawl-ref/source/output.cc20
-rw-r--r--crawl-ref/source/output.h3
-rw-r--r--crawl-ref/source/state.cc3
-rw-r--r--crawl-ref/source/view.cc57
10 files changed, 110 insertions, 36 deletions
diff --git a/crawl-ref/docs/crawl_options.txt b/crawl-ref/docs/crawl_options.txt
index 2b6b93c97a..f09e5d0093 100644
--- a/crawl-ref/docs/crawl_options.txt
+++ b/crawl-ref/docs/crawl_options.txt
@@ -11,7 +11,7 @@ The contents of this text are:
1- Starting Screen.
name, remember_name, use_old_selection_order,
- weapon, book, chaos_knight, death_knight, priest,
+ weapon, book, chaos_knight, death_knight, priest,
race, class, random_pick
2- File System and Sound.
crawl_dir, morgue_dir, save_dir, sound
@@ -177,9 +177,9 @@ remember_name = true
use_old_selection_order = false
If set to true, the character selection screen will offer
- species and classes in the order of version 0.3 and earlier.
- Note that this needs to be set before the "race" or "class"
- options (see below), or they won't be interpreted correctly.
+ species and classes in the order of version 0.3 and earlier.
+ Note that this needs to be set before the "race" or "class"
+ options (see below), or they won't be interpreted correctly.
weapon = (random | short sword | hand axe | spear | mace | trident)
Specifying the weapon option allows you to bypass the weapon
@@ -518,7 +518,7 @@ neutral_brand = none
E.g.
neutral_brand = hi:darkgrey
shows neutrals with a dark grey background. Since there are
- no darkgrey monster glyphs anymore, this works fine.
+ no darkgrey monster glyphs anymore, this works fine.
stab_brand = none
Some deities object to you stabbing monsters. Certain classes
@@ -540,9 +540,9 @@ heap_brand = reverse
feature_item_brand = reverse
Brands features (stairs, shops, altars) that would otherwise be
- hidden by items. If you use this brand, the items on the square
- are hidden by the feature symbol and the feature symbol is
- branded.
+ hidden by items. If you use this brand, the items on the square
+ are hidden by the feature symbol and the feature symbol is
+ branded.
trap_item_brand = none
Brands traps that would otherwise be hidden by items. If you
@@ -767,9 +767,9 @@ trapwalk_safe_hp = <trap_name>:<minimum_hp>, ...
trap_prompt = true
If trap_prompt is set to true Crawl will use the trapwalk_safe_hp
- values to decide whether the player should be prompted before
- stepping on a mechanical trap. Note that you'll always be prompted
- for non-mechanical traps.
+ values to decide whether the player should be prompted before
+ stepping on a mechanical trap. Note that you'll always be prompted
+ for non-mechanical traps.
4-h Stashes.
----------------
@@ -1044,11 +1044,22 @@ item_stack_summary_minimum = 5
list_rotten = true
Setting this to true will print a list of inventory slots for
- all corpses and chunks that have become rotten along with the
- rotting message, in the form of
- "You smell something rotten. (slots f and m)"
+ all corpses and chunks that have become rotten along with the
+ rotting message, in the form of
+ "You smell something rotten. (slots f and m)"
Additionally, this option will make a default message appear
- for Trolls, as well.
+ for Trolls, as well.
+
+mlist_min_height = 5
+ This option controls the minimum number of monsters to display
+ in the monster list. The number displayed may be smaller than
+ this option if the terminal size is not large enough.
+
+mlist_force_inline = false
+ By default, if the terminal size is large enough, the monster
+ list will be placed to the left of the view. If this option is
+ set to true, the monster list will only appear between the
+ status hud and the message pane.
menu_colour = <match>:<colour>:<regex>
This prints a line (of the inventory, a menu, or the discoveries
diff --git a/crawl-ref/init.txt b/crawl-ref/init.txt
index d0b9f62b7a..53101ad103 100644
--- a/crawl-ref/init.txt
+++ b/crawl-ref/init.txt
@@ -209,6 +209,8 @@ trapwalk_safe_hp = dart:20,needle:15,arrow:35,bolt:45,spear:40,axe:45,blade:95
# show_beam = true
# item_stack_summary_minimum = 5
# list_rotten = false
+# mlist_min_height = 5
+# mlist_force_inline = true
# Colouring for the inventory
menu_colour = inventory:lightred: cursed.*(worn|neck|hand|weapon)\)
diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc
index d54fcdfe41..b050df9a03 100644
--- a/crawl-ref/source/delay.cc
+++ b/crawl-ref/source/delay.cc
@@ -1406,6 +1406,8 @@ inline static void monster_warning(activity_interrupt_type ai,
see_grid(mon->x, mon->y)? "yes" : "no");
formatted_mpr(fs, MSGCH_WARN);
#endif
+
+ update_monster_pane();
}
}
diff --git a/crawl-ref/source/direct.h b/crawl-ref/source/direct.h
index 8caedfa583..896cb6d60c 100644
--- a/crawl-ref/source/direct.h
+++ b/crawl-ref/source/direct.h
@@ -49,6 +49,7 @@ public:
coord_def msgsz; // Size of the message pane.
coord_def mlistp; // Left-top pos of the monster list.
coord_def mlistsz; // Size of the monster list.
+ bool mlist_inline; // Is the mlist inline or in its own column?
crawl_view_buffer vbuf; // Buffer for drawing the main game map.
@@ -66,6 +67,9 @@ public:
static const int hud_min_width = 41;
static const int hud_min_gutter = 3;
static const int hud_max_gutter = 6;
+ static const int mlist_gutter = 1;
+ static const int mlist_min_width = 14;
+ static const int mlist_max_width = 26;
private:
coord_def last_player_pos;
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 1b3d2b8cf1..d8bb41f6d6 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -1542,6 +1542,8 @@ public:
int view_max_width;
int view_max_height;
+ int mlist_min_height;
+ bool mlist_force_inline;
// The view lock variables force centering the viewport around the PC @
// at all times (the default). If view locking is not enabled, the viewport
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index 61687f486a..296d30fdba 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -612,6 +612,8 @@ void game_options::reset_options()
view_max_width = VIEW_BASE_WIDTH;
view_max_height = VIEW_MIN_HEIGHT;
+ mlist_min_height = 5;
+ mlist_force_inline = false;
view_lock_x = true;
view_lock_y = true;
@@ -2140,6 +2142,16 @@ void game_options::read_option_line(const std::string &str, bool runscript)
else if (view_max_height > GYM + 1)
view_max_height = GYM + 1;
}
+ else if (key == "mlist_min_height")
+ {
+ mlist_min_height = atoi(field.c_str());
+ if (mlist_min_height < 0)
+ view_max_height = 0;
+ }
+ else if (key == "mlist_force_inline")
+ {
+ mlist_force_inline = _read_bool(field, mlist_force_inline);
+ }
else if (key == "view_lock_x")
{
view_lock_x = _read_bool(field, view_lock_x);
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index ee5fa16d7f..46e3349ce7 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -827,7 +827,7 @@ _print_next_monster_desc(const std::vector<monsters*>& mons, int& start)
textcolor(LIGHTGREY);
}
-static void _print_stats_monster_pane()
+void update_monster_pane()
{
// TODO:
// - display rough health (color, or text?)
@@ -848,9 +848,15 @@ static void _print_stats_monster_pane()
// Print the monsters!
for (int i_print = 0, i_mons=0; i_print < max_print; ++i_print)
{
- // i_mons is incremented by _print_next_monster_desc
+ // Can't clear to end of line, as the monster pane
+ // may be to the left of the hud or view pane.
+ for (int x = 1; x <= crawl_view.mlistsz.x; x++)
+ {
+ cgotoxy(x, start_row+i_print, GOTO_MLIST);
+ putch(' ');
+ }
cgotoxy(1, start_row+i_print, GOTO_MLIST);
- clear_to_end_of_line();
+ // i_mons is incremented by _print_next_monster_desc
if (i_mons < (int)mons.size())
{
cgotoxy(1, start_row+i_print, GOTO_MLIST);
@@ -858,6 +864,9 @@ static void _print_stats_monster_pane()
}
}
}
+#else
+// FIXME: implement this for tiles
+void update_monster_pane() {}
#endif
void print_stats(void)
@@ -927,13 +936,10 @@ void print_stats(void)
if (you.redraw_status_flags & REDRAW_LINE_3_MASK)
_print_stats_line3();
-#ifndef USE_TILE
- // FIXME: implement this for tiles
// XXX: better check? I think this skips the update at the very end
// of a delay
if (you.delay_queue.empty())
- _print_stats_monster_pane();
-#endif
+ update_monster_pane();
you.redraw_status_flags = 0;
diff --git a/crawl-ref/source/output.h b/crawl-ref/source/output.h
index 357f829cf7..e3f78f6c31 100644
--- a/crawl-ref/source/output.h
+++ b/crawl-ref/source/output.h
@@ -53,7 +53,8 @@ void draw_hp_bar(int val, int max_val);
void draw_mp_bar(int val, int max_val);
#endif
-void print_stats(void);
+void print_stats();
+void update_monster_pane();
std::vector<formatted_string> get_full_detail(bool calc_unid, long score = -1);
diff --git a/crawl-ref/source/state.cc b/crawl-ref/source/state.cc
index 1d86dc1862..b3c21da5ce 100644
--- a/crawl-ref/source/state.cc
+++ b/crawl-ref/source/state.cc
@@ -19,6 +19,7 @@
#include "menu.h" // For print_formatted_paragraph()
#include "message.h"
#include "mon-util.h"
+#include "output.h"
#include "player.h"
#include "state.h"
#include "tutorial.h"
@@ -205,6 +206,8 @@ bool interrupt_cmd_repeat( activity_interrupt_type ai,
formatted_mpr(fs, MSGCH_WARN);
#endif
+ update_monster_pane();
+
return true;
}
diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc
index 7707818c74..48ebbcfbf0 100644
--- a/crawl-ref/source/view.cc
+++ b/crawl-ref/source/view.cc
@@ -4504,11 +4504,11 @@ void viewwindow(bool draw_it, bool do_updates)
if (flash_colour == BLACK)
flash_colour = viewmap_flash_colour();
- for (count_y = crawl_view.viewp.y; count_y <= crawl_view.viewsz.y;
- count_y++)
+ for (count_y = crawl_view.viewp.y;
+ count_y < crawl_view.viewp.y + crawl_view.viewsz.y; count_y++)
{
- for (count_x = crawl_view.viewp.x; count_x <= crawl_view.viewsz.x;
- count_x++)
+ for (count_x = crawl_view.viewp.x;
+ count_x < crawl_view.viewp.x + crawl_view.viewsz.x; count_x++)
{
// in grid coords
const coord_def gc(view2grid(coord_def(count_x, count_y)));
@@ -4877,11 +4877,13 @@ void crawl_view_geometry::init_geometry()
if (viewsz.y < VIEW_MIN_HEIGHT)
viewsz.y = VIEW_MIN_HEIGHT;
- // The message pane takes all lines not used by the viewport.
- msgp = coord_def(1, viewsz.y + 1);
- msgsz = coord_def(termsz.x, termsz.y - viewsz.y);
+ // Determine if the monster list can have its own column.
+ int freewidth = termsz.x - (viewsz.x + mlist_gutter +
+ mlist_min_width + hud_min_gutter + hudsz.x);
+ mlist_inline = (freewidth < 0) || Options.mlist_force_inline;
+ if (mlist_inline)
+ freewidth = termsz.x - (hud_min_width + hud_min_gutter);
- int freewidth = termsz.x - (hud_min_width + hud_min_gutter);
// Make the viewport as wide as possible.
viewsz.x = freewidth < Options.view_max_width?
freewidth : Options.view_max_width;
@@ -4894,8 +4896,17 @@ void crawl_view_geometry::init_geometry()
vbuf.size(viewsz);
- // The hud appears after the viewport + gutter.
- hudp = coord_def(viewsz.x + 1 + hud_min_gutter, 1);
+ if (!mlist_inline)
+ {
+ mlistp = coord_def(1, 1);
+ mlistsz = coord_def(mlist_max_width, viewsz.y);
+ mlistsz.x = std::min(mlist_min_width + freewidth, mlistsz.x);
+
+ viewp.x = mlistp.x + mlistsz.x;
+ }
+
+ // The hud appears after the viewport + gutter and possibly the mlist.
+ hudp = coord_def(viewp.x + viewsz.x + hud_min_gutter, 1);
// HUD size never changes, but we may increase the gutter size (up to
// the current max of 6).
@@ -4906,9 +4917,29 @@ void crawl_view_geometry::init_geometry()
hudp.x += hudmarg > hud_increase_max? hud_increase_max : hudmarg;
}
- // Monster list takes up all space between the hud and the message pane
- mlistp = coord_def(hudp.x, hudp.y + hudsz.y);
- mlistsz = coord_def(termsz.x - mlistp.x, msgp.y - mlistp.y);
+ if (mlist_inline)
+ {
+ // Monster list takes up all space between the hud and the message pane
+ mlistp = coord_def(hudp.x, hudp.y + hudsz.y);
+
+ // Try to grow the length of the monster list based on the options,
+ // but only grow if there's room for the minimum message lines.
+ int len = 1 + viewsz.y - mlistp.y;
+ len = std::max(len, Options.mlist_min_height);
+ len = std::min(len, 1 + termsz.y - message_min_lines - (hudp.y + hudsz.y));
+ mlistsz = coord_def(termsz.x - mlistp.x - 1, len);
+
+ // The message pane takes all lines not used by the viewport and
+ // the mlist.
+ int msgstart = mlistp.y + mlistsz.y;
+ msgp = coord_def(1, msgstart);
+ msgsz = coord_def(termsz.x, termsz.y - msgstart - 1);
+ }
+ else
+ {
+ msgp = coord_def(1, viewsz.y + 1);
+ msgsz = coord_def(termsz.x, termsz.y - viewsz.y);
+ }
#ifdef USE_TILE
// libgui may redefine these based on its own settings