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K3VHFCFZUGGCGRT3R7BZB36IZPN7OSQC
TP5EDQXPVPTKQYTAMN3VQYHM4WRT2RNIR4EDLWLDAV2OQGKSB6KAC
void TilesFramework::calculate_default_options()
{
// Find which set of _screen_sizes to use.
int auto_size = 0;
int num_screen_sizes = sizeof(_screen_sizes) / sizeof(_screen_sizes[0]);
do
{
if (m_windowsz.x >= _screen_sizes[auto_size][0]
&& m_windowsz.y >= _screen_sizes[auto_size][1])
{
break;
}
} while (++auto_size < num_screen_sizes - 1);
// Auto pick map and font sizes if option is zero.
#define AUTO(x,y) (x = (x) ? (x) : _screen_sizes[auto_size][(y)])
AUTO(Options.tile_map_pixels, 2);
AUTO(Options.tile_font_crt_size, 3);
AUTO(Options.tile_font_stat_size, 4);
AUTO(Options.tile_font_msg_size, 5);
AUTO(Options.tile_font_tip_size, 6);
AUTO(Options.tile_font_lbl_size, 7);
#undef AUTO
}
// Find which set of _screen_sizes to use.
int auto_size = 0;
int num_screen_sizes = sizeof(_screen_sizes) / sizeof(_screen_sizes[0]);
do
{
if (m_windowsz.x >= _screen_sizes[auto_size][0]
&& m_windowsz.y >= _screen_sizes[auto_size][1])
{
break;
}
} while (++auto_size < num_screen_sizes - 1);
// Auto pick map and font sizes if option is zero.
#define AUTO(x,y) (x = (x) ? (x) : _screen_sizes[auto_size][(y)])
AUTO(Options.tile_map_pixels, 2);
AUTO(Options.tile_font_crt_size, 3);
AUTO(Options.tile_font_stat_size, 4);
AUTO(Options.tile_font_msg_size, 5);
AUTO(Options.tile_font_tip_size, 6);
AUTO(Options.tile_font_lbl_size, 7);
#undef AUTO
calculate_default_options();
int hud_width = std::min(50, (int)m_region_stat->mx);
// Determine the maximum width.
m_region_stat->resize_to_fit(m_windowsz.x - m_region_stat->sx,
m_region_stat->wy);
// Grow HUD horizontally if there's room.
const int max_hud_width = 50;
int hud_width = std::min(m_region_stat->mx, max_hud_width);
// If show_gold_turns isn't turned on, try turning it on if there's room.
if (!Options.show_gold_turns)
{
if (layout_statcol(message_overlay, true))
Options.show_gold_turns = true;
else
layout_statcol(message_overlay, false);
}
else
{
layout_statcol(message_overlay, true);
}
// Place regions for crt layer
m_region_crt->place(0, 0, margin);
m_region_crt->resize_to_fit(m_windowsz.x, m_windowsz.y);
m_region_menu->place(0, 0, margin);
m_region_menu->resize_to_fit(m_windowsz.x, m_windowsz.y);
crawl_view.init_view();
}
bool TilesFramework::layout_statcol(bool message_overlay, bool show_gold_turns)
{
// Assumes that the region_stat has already been placed.
int hud_height = 12 + (show_gold_turns ? 1 : 0);
m_region_stat->resize(m_region_stat->mx, hud_height);
crawl_view.hudsz.y = hud_height;
m_region_map->place(m_region_stat->sx, m_region_stat->ey, map_margin);
m_region_self_inv->place(inv_col, m_region_map->ey, 0);
m_region_self_inv->resize_to_fit(m_windowsz.x -
m_region_self_inv->sx,
m_region_inv->place(inv_col, m_region_map->ey, 0);
m_region_inv->resize_to_fit(m_windowsz.x -
m_region_inv->sx,
int map_cen_x = m_region_self_inv->sx + (m_region_self_inv->wx) / 2;
map_cen_x = std::min(map_cen_x, (int)(m_windowsz.x - m_region_map->wx));
m_region_map->place(map_cen_x - m_region_map->wy / 2, m_region_map->sy,
int map_cen_x = (m_region_inv->sx + m_region_inv->ex) / 2;
map_cen_x = std::min(map_cen_x, (int)(m_windowsz.x - m_region_map->wx/2));
m_region_map->place(map_cen_x - m_region_map->wx/2, m_region_map->sy,
// Place regions for crt layer
m_region_crt->place(0, 0, margin);
m_region_crt->resize_to_fit(m_windowsz.x, m_windowsz.y);
m_region_menu->place(0, 0, margin);
m_region_menu->resize_to_fit(m_windowsz.x, m_windowsz.y);