summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/libgui.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-17 14:23:07 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-17 14:23:07 +0000
commita64069c6cb00d8eee7655ee1b6162b9b6ab0dbf7 (patch)
treead642fb767ca9c9a299c7a98fefa116aea0d3543 /crawl-ref/source/libgui.cc
parent3ab3303612aa604874cc44addfcbf49257f8676b (diff)
downloadcrawl-ref-a64069c6cb00d8eee7655ee1b6162b9b6ab0dbf7.tar.gz
crawl-ref-a64069c6cb00d8eee7655ee1b6162b9b6ab0dbf7.zip
Add a number of (hopefully useful) mouse-click shortcuts for tiles.
shift-L-click on player: follow stairs (up or down as necessary) shift-R-click on player: show religion screen (if religious) click on stat area: call '5' (100 turn resting) and add mouse-over information for these commands. Do we need a seperate documentary or is this enough? git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3294 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/libgui.cc')
-rw-r--r--crawl-ref/source/libgui.cc85
1 files changed, 78 insertions, 7 deletions
diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc
index 612042594e..e1210adcbf 100644
--- a/crawl-ref/source/libgui.cc
+++ b/crawl-ref/source/libgui.cc
@@ -1183,8 +1183,9 @@ static int handle_mouse_motion(int mouse_x, int mouse_y, bool init)
toggle_telescope = false;
}
- bool valid_tip_region = (mode == REGION_MAP || mode == REGION_DNGN ||
- mode == REGION_INV1 || mode == REGION_INV2 || mode == REGION_MSG);
+ bool valid_tip_region = (mode == REGION_MAP || mode == REGION_DNGN
+ || mode == REGION_INV1 || mode == REGION_INV2
+ || mode == REGION_MSG || mode == REGION_STAT);
if (valid_tip_region && mode != oldmode)
{
@@ -1343,6 +1344,9 @@ static int handle_mouse_motion(int mouse_x, int mouse_y, bool init)
if (mode==REGION_TDNGN || mode==REGION_DNGN)
{
+ if (mode == oldmode && oldcx == DCX && oldcy == DCY)
+ update_tip_text("");
+
oldcx = cx;
oldcy = cy;
oldmode = mode;
@@ -1355,10 +1359,35 @@ static int handle_mouse_motion(int mouse_x, int mouse_y, bool init)
gotoxy(cx+2, cy+1, GOTO_DNGN);
}
- int gx = view2gridX(cx) + 1;
- int gy = view2gridY(cy) + 1;
+ const int gx = view2gridX(cx) + 1;
+ const int gy = view2gridY(cy) + 1;
+
tip_grid(gx, gy);
+ // mouse-over info on player
+ if (cx == DCX && cy == DCY)
+ {
+ std::string desc = you.your_name;
+ desc += " (";
+ desc += get_species_abbrev(you.species);
+ desc += get_class_abbrev(you.char_class);
+ desc += ")" EOL;
+
+ desc += EOL "[L-Click] *Search 1 turn(s)";
+
+ if (grid_stair_direction( grd[gx][gy] ) != CMD_NO_CMD)
+ desc += EOL "[Shift-L-Click] use stairs (</>)";
+
+ // character overview
+ desc += EOL "[R-Click] Overview(%)";
+
+ // Religion
+ if (you.religion != GOD_NO_GOD)
+ desc += EOL "[Shift-R-Click] Religion (^)";
+
+ update_tip_text(desc.c_str());
+ }
+
return 0;
}
@@ -1382,13 +1411,23 @@ static int handle_mouse_motion(int mouse_x, int mouse_y, bool init)
if (mode == REGION_MSG && mouse_mode == MOUSE_MODE_COMMAND)
{
- if (oldmode != REGION_MSG)
+ if (oldmode != REGION_MSG)
update_tip_text("[L-Click] Browse message history");
oldmode = mode;
oldcx = cx;
oldcy = cy;
return 0;
}
+
+ if (mode == REGION_STAT && mouse_mode == MOUSE_MODE_COMMAND)
+ {
+ if (oldmode != REGION_STAT)
+ update_tip_text("[L-Click] Rest/Search for a while");
+ oldmode = mode;
+ oldcx = cx;
+ oldcy = cy;
+ return 0;
+ }
return 0;
}
@@ -1505,14 +1544,46 @@ static int handle_mouse_button(int mx, int my, int button,
return CONTROL('P');
}
+ if (mode == REGION_STAT && mouse_mode == MOUSE_MODE_COMMAND)
+ {
+ return '5';
+ }
+
if((mouse_mode==MOUSE_MODE_COMMAND || mouse_mode == MOUSE_MODE_MACRO) &&
(mode == REGION_DNGN || mode == REGION_TDNGN))
{
+ if (button == 1 && cx == DCX && cy == DCY)
+ {
+ // spend one turn resting/searching
+ if (!shift)
+ return 's';
+
+ // else attempt to use stairs on square
+ const int gx = view2gridX(cx) + 1;
+ const int gy = view2gridY(cy) + 1;
+ switch (grid_stair_direction( grd[gx][gy] ))
+ {
+ case CMD_GO_DOWNSTAIRS:
+ return ('>');
+ case CMD_GO_UPSTAIRS:
+ return ('<');
+ default:
+ break;
+ }
+ }
+
if (button == 2)
{
- // describe yourself (char info)
- if (cx == DCX && cy == DCY) return '%';
+ // describe yourself
+ if (cx == DCX && cy == DCY)
+ {
+ if (!shift)
+ return '%'; // character overview
+ if (you.religion != GOD_NO_GOD)
+ return '^'; // religion screen
+ }
+
// trigger
if (mouse_mode == MOUSE_MODE_MACRO)
return trig;