summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-03-08 21:23:15 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-03-08 21:23:15 +0000
commit89cc8c5fc577431da1bf48c79be1726d3ec095ba (patch)
treed7f42f14bb9ae940045551484295f103afc1d60d /crawl-ref/source
parent6760ab3170033b2ecceb6ced51e2de7a5d78d6fe (diff)
downloadcrawl-ref-89cc8c5fc577431da1bf48c79be1726d3ec095ba.tar.gz
crawl-ref-89cc8c5fc577431da1bf48c79be1726d3ec095ba.zip
Tiles:
* (Re?)allow mouseclicks in menus (Tiles, only): L-click = scroll down, R-click = Esc * Clear last_clicked_grid if you move your mouse. * When entering a new level, draw the map before handling monster shouts. Enne, please review the changes. Thanks! git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9386 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/command.cc16
-rw-r--r--crawl-ref/source/files.cc2
-rw-r--r--crawl-ref/source/items.cc8
-rw-r--r--crawl-ref/source/menu.cc12
-rw-r--r--crawl-ref/source/output.cc8
-rw-r--r--crawl-ref/source/tilereg.cc57
-rw-r--r--crawl-ref/source/tilesdl.cc2
7 files changed, 67 insertions, 38 deletions
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 605c6de968..072fae928a 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -215,8 +215,13 @@ static void _print_version(void)
// FIXME: Allow for hiding Page down when at the end of the listing, ditto
// for page up at start of listing.
cmd_version.set_more( formatted_string::parse_string(
+#ifdef USE_TILE
+ "<cyan>[ +/L-click : Page down. - : Page up."
+ " Esc/R-click exits.]"));
+#else
"<cyan>[ + : Page down. - : Page up."
- " Esc exits.]") );
+ " Esc exits.]"));
+#endif
cmd_version.add_text(_get_version_information());
cmd_version.add_text(_get_version_features());
@@ -1828,8 +1833,13 @@ static int _show_keyhelp_menu(const std::vector<formatted_string> &lines,
// FIXME: Allow for hiding Page down when at the end of the listing, ditto
// for page up at start of listing.
cmd_help.set_more( formatted_string::parse_string(
- "<cyan>[ + : Page down. - : Page up."
- " Esc exits.]"));
+#ifdef USE_TILE
+ "<cyan>[ +/L-click : Page down. - : Page up."
+ " Esc/R-click exits.]"));
+#else
+ "<cyan>[ + : Page down. - : Page up."
+ " Esc exits.]"));
+#endif
if (with_manual)
{
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index f32aca888f..35f2cbdbd2 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -1278,9 +1278,7 @@ bool load( dungeon_feature_type stair_taken, load_mode_type load_mode,
if (timeval > 0)
{
you.time_taken = timeval;
-#ifndef USE_TILE
viewwindow(true, false);
-#endif
handle_monsters();
}
}
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 50fca9f162..566fb08874 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -1252,7 +1252,13 @@ void pickup()
if (keyin != 'a')
{
- mprf(MSGCH_PROMPT, "Pick up %s? (y/n/a/*?g,/q)",
+ std::string prompt = "Pick up %s? ("
+#ifdef USE_TILE
+ "Left-click to enter menu, or press "
+#endif
+ "y/n/a/*?g,/q)";
+
+ mprf(MSGCH_PROMPT, prompt.c_str(),
get_message_colour_tags(mitm[o], DESC_NOCAP_A,
MSGCH_PROMPT).c_str());
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index 982df74791..6c5c41c67b 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -298,7 +298,13 @@ void Menu::do_menu()
alive = true;
while (alive)
{
- int keyin = getchm(KC_MENU, c_getch);
+ mouse_control mc(MOUSE_MODE_MORE);
+ int keyin =
+#ifndef USE_TILE
+ getchm(KC_MENU, c_getch);
+#else
+ getch();
+#endif
if (!process_key( keyin ))
return;
@@ -343,11 +349,13 @@ bool Menu::process_key( int keyin )
return (false);
case CK_ESCAPE:
case CK_MOUSE_B2:
+ case CK_MOUSE_CMD:
sel.clear();
lastch = keyin;
return (false);
case ' ': case CK_PGDN: case '>': case '\'':
case CK_MOUSE_B1:
+ case CK_MOUSE_CLICK:
nav = true;
repaint = page_down();
if (!repaint && !is_set(MF_EASY_EXIT) && !is_set(MF_NOWRAP))
@@ -1694,9 +1702,11 @@ bool formatted_scroller::process_key( int keyin )
return (true);
case -1:
case CK_ESCAPE:
+ case CK_MOUSE_CMD:
return (false);
case ' ': case '+': case '=': case CK_PGDN: case '>': case '\'':
case CK_MOUSE_B5:
+ case CK_MOUSE_CLICK:
repaint = page_down();
break;
case '-': case CK_PGUP: case '<': case ';':
diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc
index 5b295f3aef..3c4bae4073 100644
--- a/crawl-ref/source/output.cc
+++ b/crawl-ref/source/output.cc
@@ -2106,7 +2106,13 @@ char _get_overview_screen_results()
// Set flags, and don't use easy exit.
overview.set_flags(MF_SINGLESELECT | MF_ALWAYS_SHOW_MORE | MF_NOWRAP, false);
overview.set_more( formatted_string::parse_string(
- "<cyan>[ + : Page down. - : Page up. Esc exits.]"));
+#ifdef USE_TILE
+ "<cyan>[ +/L-click : Page down. - : Page up."
+ " Esc/R-click exits.]"));
+#else
+ "<cyan>[ + : Page down. - : Page up."
+ " Esc exits.]"));
+#endif
overview.set_tag("resists");
overview.add_text(_overview_screen_title());
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index 98ae845dbf..8b62f13ac4 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -875,6 +875,8 @@ int DungeonRegion::handle_mouse(MouseEvent &event)
if (event.event != MouseEvent::PRESS)
return 0;
+ you.last_clicked_grid = m_cursor[CURSOR_MOUSE];
+
if (you.pos() == gc)
{
switch (event.button)
@@ -922,7 +924,6 @@ int DungeonRegion::handle_mouse(MouseEvent &event)
if (event.button != MouseEvent::LEFT)
return 0;
- you.last_clicked_grid = m_cursor[CURSOR_MOUSE];
return _click_travel(gc, event);
}
@@ -955,6 +956,8 @@ int DungeonRegion::get_buffer_index(const coord_def &gc)
void DungeonRegion::place_cursor(cursor_type type, const coord_def &gc)
{
+ coord_def result = gc;
+
// If we're only looking for a direction, put the mouse
// cursor next to the player to let them know that their
// spell/wand will only go one square.
@@ -966,8 +969,7 @@ void DungeonRegion::place_cursor(cursor_type type, const coord_def &gc)
int ax = abs(delta.x);
int ay = abs(delta.y);
- coord_def result = you.pos();
-
+ result = you.pos();
if (1000 * ay < 414 * ax)
result += (delta.x > 0) ? coord_def(1, 0) : coord_def(-1, 0);
else if (1000 * ax < 414 * ay)
@@ -976,20 +978,15 @@ void DungeonRegion::place_cursor(cursor_type type, const coord_def &gc)
result += (delta.y > 0) ? coord_def(1, 1) : coord_def(1, -1);
else if (delta.x < 0)
result += (delta.y > 0) ? coord_def(-1, 1) : coord_def(-1, -1);
-
- if (m_cursor[type] != result)
- {
- m_dirty = true;
- m_cursor[type] = result;
- }
}
- else
+
+ if (m_cursor[type] != result)
{
- if (m_cursor[type] != gc)
- {
- m_dirty = true;
- m_cursor[type] = gc;
- }
+ m_dirty = true;
+ coord_def old_cursor = m_cursor[type];
+ m_cursor[type] = result;
+ if (type == CURSOR_MOUSE)
+ you.last_clicked_grid = coord_def();
}
}
@@ -1701,7 +1698,7 @@ bool InventoryRegion::update_tip_text(std::string& tip)
tip += "\n[Ctrl-L-Click] Fire (f)";
break;
case OBJ_WEAPONS + EQUIP_OFFSET:
- tip += "Unwield";
+ tip += "Unwield (w-)";
if (is_throwable(&you, item))
tip += "\n[Ctrl-L-Click] Fire (f)";
break;
@@ -1709,14 +1706,14 @@ bool InventoryRegion::update_tip_text(std::string& tip)
if (item.sub_type >= MISC_DECK_OF_ESCAPE
&& item.sub_type <= MISC_DECK_OF_DEFENCE)
{
- tip += "Draw a card (v)";
- tip += "\n[Ctrl-L-Click] Unwield";
+ tip += "Draw a card (v)\n";
+ tip += "[Ctrl-L-Click] Unwield (w-)";
break;
}
// else fall-through
case OBJ_STAVES + EQUIP_OFFSET: // rods - other staves handled above
- tip += "Evoke (v)";
- tip += "\n[Ctrl-L-Click] Unwield";
+ tip += "Evoke (v)\n";
+ tip += "[Ctrl-L-Click] Unwield (w-)";
break;
case OBJ_ARMOUR:
tip += "Wear (W)";
@@ -1734,7 +1731,7 @@ bool InventoryRegion::update_tip_text(std::string& tip)
tip += "Fire (f)";
if (wielded)
- tip += "\n[Ctrl-L-Click] Unwield";
+ tip += "\n[Ctrl-L-Click] Unwield (w-)";
else if (item.sub_type == MI_STONE
&& player_knows_spell(SPELL_SANDBLAST)
|| item.sub_type == MI_ARROW
@@ -1748,7 +1745,7 @@ bool InventoryRegion::update_tip_text(std::string& tip)
case OBJ_WANDS:
tip += "Zap (Z)";
if (wielded)
- tip += "\n[Ctrl-L-Click] Unwield";
+ tip += "\n[Ctrl-L-Click] Unwield (w-)";
break;
case OBJ_BOOKS:
if (item_type_known(item)
@@ -1757,20 +1754,20 @@ bool InventoryRegion::update_tip_text(std::string& tip)
{
tip += "Memorise (M)";
if (wielded)
- tip += "\n[Ctrl-L-Click] Unwield";
+ tip += "\n[Ctrl-L-Click] Unwield (w-)";
break;
}
// else fall-through
case OBJ_SCROLLS:
tip += "Read (r)";
if (wielded)
- tip += "\n[Ctrl-L-Click] Unwield";
+ tip += "\n[Ctrl-L-Click] Unwield (w-)";
break;
case OBJ_POTIONS:
tip += "Quaff (q)";
// For Sublimation of Blood.
if (wielded)
- tip += "\n[Ctrl-L-Click] Unwield";
+ tip += "\n[Ctrl-L-Click] Unwield (w-)";
else if (item_type_known(item)
&& is_blood_potion(item)
&& player_knows_spell(SPELL_SUBLIMATION_OF_BLOOD))
@@ -1782,7 +1779,7 @@ bool InventoryRegion::update_tip_text(std::string& tip)
tip += "Eat (e)";
// For Sublimation of Blood.
if (wielded)
- tip += "\n[Ctrl-L-Click] Unwield";
+ tip += "\n[Ctrl-L-Click] Unwield (w-)";
else if (item.sub_type == FOOD_CHUNK
&& player_knows_spell(
SPELL_SUBLIMATION_OF_BLOOD))
@@ -1798,7 +1795,7 @@ bool InventoryRegion::update_tip_text(std::string& tip)
{
if (you.species == SP_VAMPIRE)
tip += EOL;
- tip += "[Ctrl-L-Click] Unwield";
+ tip += "[Ctrl-L-Click] Unwield (w-)";
}
break;
default:
@@ -1838,9 +1835,11 @@ bool InventoryRegion::update_alt_text(std::string &alt)
if (item_idx >= m_items.size() || m_items[item_idx].empty())
return (false);
- if (item_idx == you.last_clicked_item)
+ if (you.last_clicked_item >= 0
+ && item_idx == (unsigned int) you.last_clicked_item)
+ {
return (false);
-
+ }
int idx = m_items[item_idx].idx;
const item_def *item;
diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc
index edcbf16516..4eb4549b76 100644
--- a/crawl-ref/source/tilesdl.cc
+++ b/crawl-ref/source/tilesdl.cc
@@ -592,7 +592,7 @@ static int _translate_keysym(SDL_keysym &keysym)
int TilesFramework::handle_mouse(MouseEvent &event)
{
- m_region_tile->place_cursor(CURSOR_MOUSE, Region::NO_CURSOR);
+// m_region_tile->place_cursor(CURSOR_MOUSE, Region::NO_CURSOR);
// Note: the mouse event goes to all regions in the active layer because
// we want to be able to start some GUI event (e.g. far viewing) and