summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-03-06 09:29:24 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-03-06 09:29:24 +0000
commit1a3922fd4a76605598293aff58591a77f37c0bb1 (patch)
tree965c54dc6423154ff382c729809ad60ddbb27078 /crawl-ref
parentcd3044ce7a7ad2f693ee52a4b3b194de34d36d9e (diff)
downloadcrawl-ref-1a3922fd4a76605598293aff58591a77f37c0bb1.tar.gz
crawl-ref-1a3922fd4a76605598293aff58591a77f37c0bb1.zip
Tiles again:
* Store index of last cell clicked on in inventory and suppress item description if you just clicked on it, so you can see the messages describing whatever you just did (should fix 2660578). * Allow right-click as a synonym for '!' when toggling ^, A, m. * Let shift left-click on avatar standing on altar = prayer. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9343 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/describe.cc19
-rw-r--r--crawl-ref/source/externs.h1
-rw-r--r--crawl-ref/source/items.cc9
-rw-r--r--crawl-ref/source/mutation.cc27
-rw-r--r--crawl-ref/source/player.cc1
-rw-r--r--crawl-ref/source/religion.cc17
-rw-r--r--crawl-ref/source/religion.h1
-rw-r--r--crawl-ref/source/skills2.cc19
-rw-r--r--crawl-ref/source/tilereg.cc53
-rw-r--r--crawl-ref/source/tilesdl.cc6
-rw-r--r--crawl-ref/source/travel.h1
11 files changed, 117 insertions, 37 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 1f0f006e4c..c7e92a6740 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -3357,13 +3357,18 @@ static void _detailed_god_description(god_type which_god)
cgotoxy(1, bottom_line);
formatted_string::parse_string(
- "Press '<w>!</w>' to toggle between the overview and the more detailed "
+#ifndef USE_TILE
+ "Press '<w>!</w>'"
+#else
+ "<w>Right-click</w>"
+#endif
+ " to toggle between the overview and the more detailed "
"description.").display();
mouse_control mc(MOUSE_MODE_MORE);
const int keyin = getch();
- if (keyin == '!')
+ if (keyin == '!' || keyin == CK_MOUSE_CMD)
describe_god(which_god, true);
}
@@ -3594,13 +3599,17 @@ void describe_god( god_type which_god, bool give_title )
cgotoxy(1, bottom_line);
textcolor(LIGHTGREY);
formatted_string::parse_string(
- "Press '<w>!</w>' to toggle between the overview and the more detailed "
+#ifndef USE_TILE
+ "Press '<w>!</w>'"
+#else
+ "<w>Right-click</w>"
+#endif
+ " to toggle between the overview and the more detailed "
"description.").display();
mouse_control mc(MOUSE_MODE_MORE);
-
const int keyin = getch();
- if (keyin == '!')
+ if (keyin == '!' || keyin == CK_MOUSE_CMD)
_detailed_god_description(which_god);
}
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index 2baac38d86..9f9edf78bc 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -945,6 +945,7 @@ public:
int water_in_sight; // Is there deep water in LoS?
#ifdef USE_TILE
coord_def last_clicked_grid; // The map position the player last clicked on.
+ int last_clicked_item; // The inventory cell the player last clicked on.
#endif
// Warning: these two are quite different.
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index e0fec19f33..47cccee2a7 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -1255,12 +1255,9 @@ void pickup()
mprf(MSGCH_PROMPT, "Pick up %s? (y/n/a/*?g,/q)",
get_message_colour_tags(mitm[o], DESC_NOCAP_A,
MSGCH_PROMPT).c_str());
-#ifndef USE_TILE
- keyin = get_ch();
-#else
- // TODO enne - why?
- keyin = getch_ck();
-#endif
+
+ mouse_control mc(MOUSE_MODE_MORE);
+ keyin = getch();
}
if (keyin == '*' || keyin == '?' || keyin == ',' || keyin == 'g'
diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc
index d0dc286ae2..1748f8f0aa 100644
--- a/crawl-ref/source/mutation.cc
+++ b/crawl-ref/source/mutation.cc
@@ -26,6 +26,7 @@ REVISION("$Rev$");
#include "externs.h"
+#include "cio.h"
#include "defines.h"
#include "effects.h"
#include "format.h"
@@ -1547,8 +1548,14 @@ formatted_string describe_mutations()
{
result += EOL EOL;
result += EOL EOL;
- result += "Press '<w>!</w>' to toggle between mutations and "
- "properties depending on your" EOL "hunger status." EOL;
+ result +=
+#ifndef USE_TILE
+ "Press '<w>!</w>'"
+#else
+ "<w>Right-click</w>"
+#endif
+ " to toggle between mutations and properties depending on your" EOL
+ "hunger status." EOL;
}
return formatted_string::parse_string(result);
@@ -1637,16 +1644,23 @@ static void _display_vampire_attributes()
}
result += EOL;
- result += "Press '<w>!</w>' to toggle between mutations and properties depending on your " EOL
- "hunger status." EOL;
+ result +=
+#ifndef USE_TILE
+ "Press '<w>!</w>'"
+#else
+ "<w>Right-click</w>"
+#endif
+ " to toggle between mutations and properties depending on your" EOL
+ "hunger status." EOL;
const formatted_string vp_props = formatted_string::parse_string(result);
vp_props.display();
if (you.species == SP_VAMPIRE)
{
+ mouse_control mc(MOUSE_MODE_MORE);
const int keyin = getch();
- if (keyin == '!')
+ if (keyin == '!' || keyin == CK_MOUSE_CMD)
display_mutations();
}
}
@@ -1661,8 +1675,9 @@ void display_mutations()
if (you.species == SP_VAMPIRE)
{
mutation_fs.display();
+ mouse_control mc(MOUSE_MODE_MORE);
const int keyin = getch();
- if (keyin == '!')
+ if (keyin == '!' || keyin == CK_MOUSE_CMD)
_display_vampire_attributes();
}
else
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 47ecf9cc32..e86bc5a5cb 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -5894,6 +5894,7 @@ void player::init()
#ifdef USE_TILE
last_clicked_grid = coord_def();
+ last_clicked_item = -1;
#endif
if (m_quiver)
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index dcb6d64fe3..a04111cf06 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -6518,6 +6518,20 @@ void offer_items()
}
}
+bool player_can_join_god(god_type which_god)
+{
+ if (you.species == SP_DEMIGOD)
+ return (false);
+
+ if (player_is_unholy() && is_good_god(which_god))
+ return (false);
+
+ if (which_god == GOD_BEOGH && you.species != SP_HILL_ORC)
+ return (false);
+
+ return (true);
+}
+
void god_pitch(god_type which_god)
{
mprf("You %s the altar of %s.",
@@ -6530,8 +6544,7 @@ void god_pitch(god_type which_god)
// return, or not allow worshippers from other religions. -- bwr
// Gods can be racist...
- if (player_is_unholy() && is_good_god(which_god)
- || which_god == GOD_BEOGH && you.species != SP_HILL_ORC)
+ if (!player_can_join_god(which_god))
{
you.turn_is_over = false;
simple_god_message(" does not accept worship from those such as you!",
diff --git a/crawl-ref/source/religion.h b/crawl-ref/source/religion.h
index 7a922030be..9f59c1a685 100644
--- a/crawl-ref/source/religion.h
+++ b/crawl-ref/source/religion.h
@@ -82,6 +82,7 @@ void pray();
void end_prayer();
void handle_god_time(void);
int god_colour(god_type god);
+bool player_can_join_god(god_type which_god);
void god_pitch(god_type which_god);
int piety_rank(int piety = -1);
void offer_items();
diff --git a/crawl-ref/source/skills2.cc b/crawl-ref/source/skills2.cc
index 3364cf334c..aacb6c817a 100644
--- a/crawl-ref/source/skills2.cc
+++ b/crawl-ref/source/skills2.cc
@@ -23,6 +23,7 @@ REVISION("$Rev$");
#include <conio.h>
#endif
+#include "cio.h"
#include "describe.h"
#include "externs.h"
#include "fight.h"
@@ -1543,7 +1544,7 @@ const int spec_skills[ NUM_SPECIES ][40] =
// SP_GREY_ELF placeholder.
{
},
-
+
// SP_GNOME placeholder.
{
}
@@ -1765,10 +1766,14 @@ static void _display_skill_table(bool show_aptitudes, bool show_description)
if (_player_knows_aptitudes())
{
cgotoxy(1, bottom_line);
- formatted_string::parse_string("Press '<w>!</w>' to toggle between "
- "<cyan>progress</cyan> and "
- "<red>aptitude</red> "
- "display.").display();
+ formatted_string::parse_string(
+#ifndef USE_TILE
+ "Press '<w>!</w>'"
+#else
+ "<w>Right-click</w>"
+#endif
+ " to toggle between <cyan>progress</cyan> and "
+ "<red>aptitude</red> display.").display();
}
}
}
@@ -1782,8 +1787,10 @@ void show_skills()
{
_display_skill_table(show_aptitudes, show_description);
+ mouse_control mc(MOUSE_MODE_MORE);
const int keyin = getch();
- if (keyin == '!' && _player_knows_aptitudes())
+ if ((keyin == '!' || keyin == CK_MOUSE_CMD)
+ && _player_knows_aptitudes())
{
show_aptitudes = !show_aptitudes;
continue;
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index 042945d912..7ff7b35ca0 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -23,6 +23,7 @@ REVISION("$Rev$");
#include "newgame.h"
#include "mon-util.h"
#include "player.h"
+#include "religion.h"
#include "spells3.h"
#include "stuff.h"
#include "terrain.h"
@@ -879,19 +880,26 @@ int DungeonRegion::handle_mouse(MouseEvent &event)
switch (event.button)
{
case MouseEvent::LEFT:
+ {
if (!(event.mod & MOD_SHIFT))
return 'g';
- switch (grid_stair_direction(grd(gc)))
+ const dungeon_feature_type grid = grd(gc);
+ switch (grid_stair_direction(grid))
{
- case CMD_GO_DOWNSTAIRS:
- return ('>');
- case CMD_GO_UPSTAIRS:
- return ('<');
- default:
- return 0;
+ case CMD_GO_DOWNSTAIRS:
+ return ('>');
+ case CMD_GO_UPSTAIRS:
+ return ('<');
+ default:
+ if (is_altar(grid)
+ && player_can_join_god(grid_altar_god(grid)))
+ {
+ return ('p');
+ }
+ return 0;
}
-
+ }
case MouseEvent::RIGHT:
if (!(event.mod & MOD_SHIFT))
return '%'; // Character overview.
@@ -1011,8 +1019,25 @@ bool DungeonRegion::update_tip_text(std::string& tip)
if (igrd(m_cursor[CURSOR_MOUSE]) != NON_ITEM)
tip += "\n[L-Click] Pick up items (g)";
- if (grid_stair_direction(grd(m_cursor[CURSOR_MOUSE])) != CMD_NO_CMD)
- tip += "\n[Shift-L-Click] use stairs (</>)";
+ const dungeon_feature_type grid = grd(m_cursor[CURSOR_MOUSE]);
+ const command_type dir = grid_stair_direction(grid);
+ if (dir != CMD_NO_CMD)
+ {
+ tip += "\n[Shift-L-Click] ";
+ if (grid == DNGN_ENTER_SHOP)
+ tip += "enter shop";
+ else if (is_gate(grid))
+ tip += "enter gate";
+ else
+ tip += "use stairs";
+
+ if (dir == CMD_GO_DOWNSTAIRS)
+ tip += " (>)";
+ else
+ tip += " (<)";
+ }
+ else if (is_altar(grid) && player_can_join_god(grid_altar_god(grid)))
+ tip += "\n[Shift-L-Click] pray on altar (p)";
// Character overview.
tip += "\n[R-Click] Overview (%)";
@@ -1441,6 +1466,9 @@ void InventoryRegion::place_cursor(const coord_def &cursor)
m_dirty = true;
}
+ if (m_cursor != cursor)
+ you.last_clicked_item = -1;
+
m_cursor = cursor;
if (m_cursor == NO_CURSOR || cursor_index() >= m_items.size())
@@ -1502,6 +1530,7 @@ int InventoryRegion::handle_mouse(MouseEvent &event)
else
tile_item_use(idx);
}
+ you.last_clicked_item = item_idx;
// TODO enne - need to redraw inventory here?
return CK_MOUSE_CMD;
}
@@ -1512,6 +1541,7 @@ int InventoryRegion::handle_mouse(MouseEvent &event)
if (event.mod & MOD_SHIFT)
{
tile_item_eat_floor(idx);
+ you.last_clicked_item = item_idx;
}
else
{
@@ -1808,6 +1838,9 @@ 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)
+ 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 ea16bd47c4..edcbf16516 100644
--- a/crawl-ref/source/tilesdl.cc
+++ b/crawl-ref/source/tilesdl.cc
@@ -613,10 +613,12 @@ int TilesFramework::handle_mouse(MouseEvent &event)
// Handle "more" mode globally here, rather than duplicate across regions.
if (mouse_control::current_mode() == MOUSE_MODE_MORE
- && event.button == MouseEvent::LEFT
&& event.event == MouseEvent::PRESS)
{
- return CK_MOUSE_CLICK;
+ if (event.button == MouseEvent::LEFT)
+ return CK_MOUSE_CLICK;
+ else if (event.button == MouseEvent::RIGHT)
+ return CK_MOUSE_CMD;
}
// TODO enne - in what cases should the buttons be returned?
diff --git a/crawl-ref/source/travel.h b/crawl-ref/source/travel.h
index 4dbde13a77..7f3a7702a3 100644
--- a/crawl-ref/source/travel.h
+++ b/crawl-ref/source/travel.h
@@ -70,6 +70,7 @@ bool is_stair(dungeon_feature_type gridc);
bool is_travelable_stair(dungeon_feature_type gridc);
bool is_gate(dungeon_feature_type gridc);
command_type direction_to_command( char x, char y );
+bool is_altar(dungeon_feature_type gridc);
bool is_resting( void );
#ifdef CLUA_BINDINGS
const char *trap_name(const coord_def &p);