diff options
author | ennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-08-16 20:02:26 +0000 |
---|---|---|
committer | ennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-08-16 20:02:26 +0000 |
commit | b61cd875b2cd9a860a4374b87a6480ec6d1f6c04 (patch) | |
tree | b8543251de36cbaf019c6096b194640efc6492f9 | |
parent | 532f752e15cdc213606954c8650504437fff7def (diff) | |
download | crawl-ref-b61cd875b2cd9a860a4374b87a6480ec6d1f6c04.tar.gz crawl-ref-b61cd875b2cd9a860a4374b87a6480ec6d1f6c04.zip |
Improved tiles inventory window handling. Cases with lots of floor items or lots of pack items are handled better.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6827 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/docs/options_guide.txt | 19 | ||||
-rw-r--r-- | crawl-ref/source/tilesdl.cc | 90 |
2 files changed, 70 insertions, 39 deletions
diff --git a/crawl-ref/docs/options_guide.txt b/crawl-ref/docs/options_guide.txt index b484cb0a19..6c71498782 100644 --- a/crawl-ref/docs/options_guide.txt +++ b/crawl-ref/docs/options_guide.txt @@ -1477,8 +1477,7 @@ In non-tile games the tile options are ignored. tile_show_items = <glyphs> This option controls the order and presence of items in the tiles - inventory. By default, its value is !?/%=([)x}+\_. The underscore - represents empty slots, the dot items on the floor. + inventory. By default, its value is !?/%=([)x}+\ title_screen = true When this is set to true, the graphical title screen will be @@ -1503,6 +1502,7 @@ tile_water_col = grey tile_lava_col = grey tile_excluded_col = darkcyan tile_excl_centre_col = darkblue +tile_window_col = yellow These options allow configuring the colours used for the minimap of the dungeon level. @@ -1528,8 +1528,23 @@ the dungeon level. (will only override tile_floor_col colour) tile_excl_centre_col - colour of exclusion centre (overrides tile_floor_col and tile_item_col, only) + tile_window_col - colour of the rectangular view window +tile_tooltip_ms = 1000 + The number of milliseconds before a tooltip appears when hovering the + mouse over part of the screen. + +tile_window_width = 1024 +tile_window_height = 768 + The width and height of the window, in pixels. + +tile_map_pixels = 4 + The number of pixels each minimap square should take up. + +tile_full_screen = false + Setting this option to true will start Crawl in full screen mode. + 5- Character Dump. =================== diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc index b768c8abf9..9a31fd29ba 100644 --- a/crawl-ref/source/tilesdl.cc +++ b/crawl-ref/source/tilesdl.cc @@ -1015,23 +1015,22 @@ void TilesFramework::update_inventory() if (!Options.tile_show_items) return; - unsigned int max_pack_row = (ENDOFPACK-1) / m_region_self_inv->mx + 1; - max_pack_row = std::min(m_region_self_inv->my - 1, max_pack_row); - unsigned int max_pack_items = max_pack_row * m_region_self_inv->mx; - - // TODO enne - document that '.' and '_' no longer work + // item.base_type <-> char conversion table + const static char *obj_syms = ")([/%#?=!#+\\0}x"; - // TODO enne - if all inventory and ground can't fit, allow ground - // and inventory items on the same row. + const unsigned int mx = m_region_self_inv->mx; + const unsigned int my = m_region_self_inv->my; - // TODO enne - if inventory fills up all squares, add up to one row - // of ground, depending. + unsigned int max_pack_row = (ENDOFPACK-1) / mx + 1; + unsigned int max_pack_items = max_pack_row * mx; - // TODO enne - only fill up 52 squares of inventory, then start - // showing floor. + unsigned int num_ground = 0; + for (int i = igrd(you.pos()); i != NON_ITEM; i = mitm[i].link) + num_ground++; - // item.base_type <-> char conversion table - const static char *obj_syms = ")([/%#?=!#+\\0}x"; + // If the inventory is full, show at least one row of the ground. + unsigned int min_ground = std::min(num_ground, mx); + max_pack_items = std::min(max_pack_items, mx * my - min_ground); for (unsigned int c = 0; c < strlen(Options.tile_show_items); c++) { @@ -1046,6 +1045,9 @@ void TilesFramework::update_inventory() // First, normal inventory for (int i = 0; i < ENDOFPACK; i++) { + if (inv.size() >= max_pack_items) + break; + if (!is_valid_item(you.inv[i]) || you.inv[i].quantity == 0) continue; @@ -1069,35 +1071,50 @@ void TilesFramework::update_inventory() } } - // Finish out this row - while (inv.size() % m_region_self_inv->mx != 0) - { - InventoryTile desc; - inv.push_back(desc); - } - - // How many ground items do we have? - unsigned int num_ground = 0; - for (int i = igrd(you.pos()); i != NON_ITEM; i = mitm[i].link) - num_ground++; - - // Add extra rows, if needed. - unsigned int ground_rows = - std::max(((int)num_ground-1) / (int)m_region_self_inv->mx + 1, 1); + int remaining = mx*my- inv.size(); + int empty_on_this_row = mx - inv.size() % mx; - while (inv.size() / m_region_self_inv->mx + ground_rows < m_region_self_inv->my) + // If we're not on the last row... + if (inv.size() < mx * (my-1)) { - for (unsigned int i = 0; i < m_region_self_inv->mx; i++) + if ((int)num_ground > remaining - empty_on_this_row) { - InventoryTile desc; - inv.push_back(desc); + // Fill out part of this row. + int fill = remaining - num_ground; + for (int i = 0; i < fill; i++) + { + InventoryTile desc; + inv.push_back(desc); + } + } + else + { + // Fill out the rest of this row. + while (inv.size() % mx != 0) + { + InventoryTile desc; + inv.push_back(desc); + } + + // Add extra rows, if needed. + unsigned int ground_rows = + std::max(((int)num_ground-1) / (int)mx + 1, 1); + + while (inv.size() / mx + ground_rows < my) + { + for (unsigned int i = 0; i < mx; i++) + { + InventoryTile desc; + inv.push_back(desc); + } + } } } - // Then, ground items... + // Then, as many ground items as we can fit. for (unsigned int c = 0; c < strlen(Options.tile_show_items); c++) { - if (inv.size() >= m_region_self_inv->mx * m_region_self_inv->my) + if (inv.size() >= mx * my) break; const char *find = strchr(obj_syms, Options.tile_show_items[c]); @@ -1107,7 +1124,7 @@ void TilesFramework::update_inventory() for (int i = igrd(you.pos()); i != NON_ITEM; i = mitm[i].link) { - if (inv.size() >= m_region_self_inv->mx * m_region_self_inv->my) + if (inv.size() >= mx * my) break; if (mitm[i].base_type != type) @@ -1121,8 +1138,7 @@ void TilesFramework::update_inventory() } } - // Finish out ground inventory - while (inv.size() < m_region_self_inv->mx * m_region_self_inv->my) + while (inv.size() < mx * my) { InventoryTile desc; desc.flag = TILEI_FLAG_FLOOR; |