summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-05-28 03:58:15 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-05-28 03:58:15 +0000
commitbb8e9480efb1259fbb2da1e07bdfc0b613c68eea (patch)
tree39e4212ac5b39bae9c29959cccac479e3df5f414
parent0e9f823830bc5395267bc0eb795d7b1877ae5681 (diff)
downloadcrawl-ref-bb8e9480efb1259fbb2da1e07bdfc0b613c68eea.tar.gz
crawl-ref-bb8e9480efb1259fbb2da1e07bdfc0b613c68eea.zip
Reduce screen-flicker and clearing of the message window when re-doing the
previous command (`) (at least for actions involving selecting an item from inventory, selecting an ability to use, selecting a spell to cast, and selecting a spell to memorize). Not tested with the tiles build. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9839 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/abl-show.cc3
-rw-r--r--crawl-ref/source/invent.cc23
-rw-r--r--crawl-ref/source/menu.cc18
-rw-r--r--crawl-ref/source/message.cc3
-rw-r--r--crawl-ref/source/spl-book.cc18
-rw-r--r--crawl-ref/source/spl-cast.cc6
6 files changed, 53 insertions, 18 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc
index c915c9edfe..207523fd19 100644
--- a/crawl-ref/source/abl-show.cc
+++ b/crawl-ref/source/abl-show.cc
@@ -2008,7 +2008,8 @@ int choose_ability_menu(const std::vector<talent>& talents)
while (true)
{
std::vector<MenuEntry*> sel = abil_menu.show(false);
- redraw_screen();
+ if (!crawl_state.doing_prev_cmd_again)
+ redraw_screen();
if (sel.empty())
return -1;
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index 45b22896c0..be0bbc721d 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -896,7 +896,10 @@ unsigned char get_invent(int invent_type)
else
break;
}
- redraw_screen();
+
+ if (!crawl_state.doing_prev_cmd_again)
+ redraw_screen();
+
return select;
} // end get_invent()
@@ -1206,7 +1209,7 @@ std::vector<SelItem> prompt_invent_items(
int count = -1;
while (true)
{
- if (need_redraw)
+ if (need_redraw && !crawl_state.doing_prev_cmd_again)
{
redraw_screen();
mesclr( true );
@@ -1258,8 +1261,11 @@ std::vector<SelItem> prompt_invent_items(
if (items.size())
{
- redraw_screen();
- mesclr(true);
+ if (!crawl_state.doing_prev_cmd_again)
+ {
+ redraw_screen();
+ mesclr(true);
+ }
for (unsigned int i = 0; i < items.size(); ++i)
items[i].slot = letter_to_index( items[i].slot );
@@ -1566,7 +1572,7 @@ int prompt_invent_item( const char *prompt,
while (true)
{
- if (need_redraw)
+ if (need_redraw && !crawl_state.doing_prev_cmd_again)
{
redraw_screen();
mesclr( true );
@@ -1624,8 +1630,11 @@ int prompt_invent_item( const char *prompt,
if (count)
*count = items[0].quantity;
- redraw_screen();
- mesclr( true );
+ if (!crawl_state.doing_prev_cmd_again)
+ {
+ redraw_screen();
+ mesclr( true );
+ }
}
}
else if (count != NULL && isdigit( keyin ))
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index 3ae400beeb..e4c5a6dc6a 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -40,6 +40,9 @@ MenuDisplayText::MenuDisplayText(Menu *menu) : MenuDisplay(menu), m_starty(1)
void MenuDisplayText::draw_stock_item(int index, const MenuEntry *me)
{
+ if (crawl_state.doing_prev_cmd_again)
+ return;
+
const int col = m_menu->item_colour(index, me);
textattr(col);
if (m_menu->get_flags() & MF_ALLOW_FORMATTING)
@@ -519,6 +522,9 @@ bool Menu::process_key( int keyin )
bool Menu::draw_title_suffix( const std::string &s, bool titlefirst )
{
+ if (crawl_state.doing_prev_cmd_again)
+ return (true);
+
int oldx = wherex(), oldy = wherey();
if (titlefirst)
@@ -545,6 +551,9 @@ bool Menu::draw_title_suffix( const std::string &s, bool titlefirst )
bool Menu::draw_title_suffix( const formatted_string &fs, bool titlefirst )
{
+ if (crawl_state.doing_prev_cmd_again)
+ return (true);
+
int oldx = wherex(), oldy = wherey();
if (titlefirst)
@@ -903,6 +912,9 @@ int Menu::get_entry_index( const MenuEntry *e ) const
void Menu::draw_menu()
{
+ if (crawl_state.doing_prev_cmd_again)
+ return;
+
clrscr();
draw_title();
@@ -981,8 +993,9 @@ bool Menu::in_page(int index) const
void Menu::draw_item( int index ) const
{
- if (!in_page(index))
+ if (!in_page(index) || crawl_state.doing_prev_cmd_again)
return;
+
cgotoxy( 1, y_offset + index - first_entry );
draw_index_item(index, items[index]);
@@ -990,6 +1003,9 @@ void Menu::draw_item( int index ) const
void Menu::draw_index_item(int index, const MenuEntry *me) const
{
+ if (crawl_state.doing_prev_cmd_again)
+ return;
+
if (f_drawitem)
(*f_drawitem)(index, me);
else
diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc
index 6b0f4f111f..b64acfb9dd 100644
--- a/crawl-ref/source/message.cc
+++ b/crawl-ref/source/message.cc
@@ -991,6 +991,9 @@ void mesclr( bool force )
if (!any_messages() && !force)
return;
+ if (crawl_state.doing_prev_cmd_again && !force)
+ return;
+
if (!force && Options.delay_message_clear)
{
need_prefix = true;
diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc
index 2df122862b..5cf25a4ab1 100644
--- a/crawl-ref/source/spl-book.cc
+++ b/crawl-ref/source/spl-book.cc
@@ -892,16 +892,16 @@ int spellbook_contents( item_def &book, read_book_action_type action,
*fs = out;
int keyn = 0;
- if (update_screen)
+ if (update_screen && !crawl_state.is_replaying_keys())
{
cursor_control coff(false);
clrscr();
out.display();
+ }
- //keyn = c_getch();
+ if (update_screen)
keyn = tolower(getchm(KMC_MENU));
- }
return (keyn); // try to figure out that for which this is used {dlb}
}
@@ -1201,7 +1201,8 @@ int read_book( item_def &book, read_book_action_type action )
if (book.base_type == OBJ_BOOKS)
mark_had_book(book);
- redraw_screen();
+ if (!crawl_state.is_replaying_keys())
+ redraw_screen();
// Put special book effects in another function which can be called
// from memorise as well.
@@ -1376,10 +1377,13 @@ bool learn_spell(int book)
return (false);
int spell = read_book( you.inv[book], RBOOK_MEMORISE );
- clrscr();
- mesclr(true);
- redraw_screen();
+ if (!crawl_state.is_replaying_keys())
+ {
+ clrscr();
+ mesclr(true);
+ redraw_screen();
+ }
if ( !isalpha(spell) )
{
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index c525c8093a..37d8e99a2b 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -306,7 +306,8 @@ int list_spells(bool toggle_with_I, bool viewing, int minRange)
while (true)
{
std::vector<MenuEntry*> sel = spell_menu.show();
- redraw_screen();
+ if (!crawl_state.doing_prev_cmd_again)
+ redraw_screen();
if (sel.empty())
return 0;
@@ -703,7 +704,8 @@ bool cast_a_spell(bool check_range)
if (!keyin)
keyin = ESCAPE;
- redraw_screen();
+ if (!crawl_state.doing_prev_cmd_again)
+ redraw_screen();
if (isalpha(keyin) || keyin == ESCAPE)
break;