Attached Files |
0001-Enabled-aptitudes-and-species-info-hotkeys-to-work-w.patch [^] (2,987 bytes) 2013-04-18 22:50 [Show Content] [Hide Content]From ee98b05de5c293f9ff4a012391a213834116f5c2 Mon Sep 17 00:00:00 2001
From: Kyle Fox <kylejfox@gmail.com>
Date: Wed, 17 Apr 2013 12:05:29 -0500
Subject: [PATCH 1/2] Enabled aptitudes and species info hotkeys to work when
selecting character.
The start and end values for the webtiles menus were not being updated
correctly when a jump_to was used before the menu actually appeared.
---
crawl-ref/source/menu.cc | 38 ++++++++++++++++++++++----------------
crawl-ref/source/menu.h | 2 ++
2 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index 3de382b..21b58fb 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -1603,6 +1603,26 @@ void Menu::webtiles_write_item(int index, const MenuEntry* me) const
tiles.json_close_object();
}
+
+void Menu::webtiles_new_first_entry()
+{
+ if (first_entry < webtiles_section_start()
+ || webtiles_section_end() <= first_entry)
+ {
+ _webtiles_section_start = first_entry;
+ while (_webtiles_section_start > 0
+ && items[_webtiles_section_start]->level != MEL_TITLE)
+ {
+ _webtiles_section_start--;
+ }
+ _webtiles_section_end = first_entry + 1;
+ while (_webtiles_section_end < (int) items.size()
+ && items[_webtiles_section_end]->level != MEL_TITLE)
+ {
+ _webtiles_section_end++;
+ }
+ }
+}
#endif // USE_TILE_WEB
/////////////////////////////////////////////////////////////////
@@ -1859,22 +1879,7 @@ bool formatted_scroller::jump_to(int i)
first_entry = i - 1;
#ifdef USE_TILE_WEB
- if (first_entry < webtiles_section_start()
- || webtiles_section_end() <= first_entry)
- {
- _webtiles_section_start = first_entry;
- while (_webtiles_section_start > 0
- && items[_webtiles_section_start]->level != MEL_TITLE)
- {
- _webtiles_section_start--;
- }
- _webtiles_section_end = first_entry + 1;
- while (_webtiles_section_end < (int) items.size()
- && items[_webtiles_section_end]->level != MEL_TITLE)
- {
- _webtiles_section_end++;
- }
- }
+ webtiles_new_first_entry();
webtiles_write_menu(true);
#endif
@@ -1966,6 +1971,7 @@ vector<MenuEntry *> formatted_scroller::show(bool reuse_selections)
{
_webtiles_section_end++;
}
+ webtiles_new_first_entry();
#endif
return Menu::show(reuse_selections);
}
diff --git a/crawl-ref/source/menu.h b/crawl-ref/source/menu.h
index c918239..88f1663 100644
--- a/crawl-ref/source/menu.h
+++ b/crawl-ref/source/menu.h
@@ -438,6 +438,8 @@ protected:
virtual void webtiles_write_title() const;
virtual void webtiles_write_item(int index, const MenuEntry *me) const;
+ void webtiles_new_first_entry();
+
int _webtiles_section_start;
int _webtiles_section_end;
--
1.7.12.4 (Apple Git-37)
0002-Reset-to-original-webtiles-layer-after-exitting-top-.patch [^] (2,763 bytes) 2013-04-18 22:51 [Show Content] [Hide Content]From aa984e8ae8cadddb492ec6d7b1af7040b78b6da9 Mon Sep 17 00:00:00 2001
From: Kyle Fox <kylejfox@gmail.com>
Date: Thu, 18 Apr 2013 12:03:36 -0500
Subject: [PATCH 2/2] Reset to original webtiles layer after exitting top
level menu.
Drawing menus was setting the webtile layer to "normal." This change
resets the layer back to what it was before menus were drawn. It fixes
an issue where exiting the help menu during character selection left
the player with a blank screen.
---
crawl-ref/source/webserver/game_data/static/menu.js | 10 ++++++++++
crawl-ref/source/webserver/static/scripts/client.js | 6 ++++++
2 files changed, 16 insertions(+)
diff --git a/crawl-ref/source/webserver/game_data/static/menu.js b/crawl-ref/source/webserver/game_data/static/menu.js
index c8c03fd..bb7a0d5 100644
--- a/crawl-ref/source/webserver/game_data/static/menu.js
+++ b/crawl-ref/source/webserver/game_data/static/menu.js
@@ -57,6 +57,7 @@ function ($, comm, client, enums, dungeon_renderer, cr, util) {
var menu_stack = [];
var menu = null;
+ var bottom_layer = "";
function display_menu()
{
@@ -448,6 +449,8 @@ function ($, comm, client, enums, dungeon_renderer, cr, util) {
function open_menu(data)
{
+ if (menu_stack.length == 0)
+ bottom_layer = client.get_layer();
if (data.replace) menu_stack.pop();
menu_stack.push(data);
menu = data;
@@ -467,7 +470,14 @@ function ($, comm, client, enums, dungeon_renderer, cr, util) {
// (e.g. when looking at an item from the inventory)
setTimeout(function () {
if (menu_stack.length == 0)
+ {
client.hide_dialog();
+ if (bottom_layer != "")
+ {
+ client.set_layer(bottom_layer);
+ bottom_layer = "";
+ }
+ }
}, 50);
}
else
diff --git a/crawl-ref/source/webserver/static/scripts/client.js b/crawl-ref/source/webserver/static/scripts/client.js
index b288450..d46c702 100644
--- a/crawl-ref/source/webserver/static/scripts/client.js
+++ b/crawl-ref/source/webserver/static/scripts/client.js
@@ -129,6 +129,11 @@ function (exports, $, key_conversion, chat, comm) {
lobby(layer == "lobby");
}
+ function get_layer()
+ {
+ return current_layer;
+ }
+
function register_layer(name)
{
if (layers.indexOf(name) == -1)
@@ -136,6 +141,7 @@ function (exports, $, key_conversion, chat, comm) {
}
exports.set_layer = set_layer;
+ exports.get_layer = get_layer;
exports.register_layer = register_layer;
function do_layout()
--
1.7.12.4 (Apple Git-37)
|