git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6774 c06c8d41-db1a-0410-9941-cceddc491573
XKNRIFG2ULQLAAQ5GC4RBZPOERV73DLCNILEA5EP37JLIX5EP3OQC X6ULJWV7HNNP7XTRF4LT5OVBE4RARGQZARKJUSU6DR3PTQTR4JOQC QYUAYEGK7WPBJLZRSWZVDWD5SMNAWWIJSQPWYA7BEYXMEBD2SDKAC KFH3JPHHQLBY3V5VEJWME6ZDMI6TZSF2TDYRF726FAYVNYGMPA5AC K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC EB33TUEEJFHMEO6YHEXSYX3MBXHNPEFNMZL2VA75GOGKY6POSF2AC EOMCPVNQLX3IMLC46EAO67DPBH5KEG2FQTPBLGU62HIRWA3UQ7XQC 25CH7HH4LKXFIZ75YNMXS3TSXO6O27DYSOPLOD45K4OCNFWLS4LQC PUZ35HA537R2HZPB7SZ5KLHDOR2DXNQG7CM2UQ7LIHF55GR7LN5QC Q3B3UVMYEVC4YJUPYVSNTR4DJH4E6J4JJDHZNT5LNOCHCPPMEMXAC O6ZMFKDI3XO2SWPNEYHIPYFDWJR4TVDP5BAATK6LVCVETQID6E7AC RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC PL6I2CMSTHY5ZHWVMIQE5YTM5S5VPKBNZM6QJVHZSSKOJGIJ5W4AC UVO3NT3VC5KVZVJXMAHJLEIL2IRHQO6JVBPFKVENXPU3YMACCQFAC PBTLQZHBQK5TAIO7SNSCKSHOQQ65CFFI55OTTETV7FG2FCJOXKHQC m_region_msg->place(0, m_region_tile->ey, margin);
m_region_msg->place(0, m_region_tile->ey - margin, margin);bool message_overlay = false;if (m_windowsz.y < m_region_tile->dy * VIEW_MIN_HEIGHT){crawl_view.viewsz.x = VIEW_MIN_WIDTH;crawl_view.viewsz.y = VIEW_MIN_HEIGHT;m_region_tile->place(0, 0, 0);int factor = m_windowsz.y / crawl_view.viewsz.y;m_viewsc.x = m_viewsc.y = std::min(32, factor);m_region_tile->dx = m_viewsc.x;m_region_tile->dy = m_viewsc.y;m_region_tile->resize(crawl_view.viewsz.x, crawl_view.viewsz.y);m_region_msg->place(0, 0, 0);message_overlay = true;}else{// Shrink viewsz if too wide:while (m_region_tile->wx + m_region_stat->wx > m_windowsz.x&& crawl_view.viewsz.x > VIEW_MIN_WIDTH){crawl_view.viewsz.x -= 2;m_region_tile->mx = crawl_view.viewsz.x;m_region_tile->place(0, 0, margin);m_region_msg->place(0, m_region_tile->ex, margin);}
int stat_col = m_region_tile->ex + map_stat_buffer;
// Shrink viewsz if too tall:while (m_region_tile->wy + m_region_msg->wy > m_windowsz.y&& crawl_view.viewsz.y > VIEW_MIN_HEIGHT){crawl_view.viewsz.y -= 2;m_region_tile->my = crawl_view.viewsz.y;m_region_tile->place(0, 0, margin);m_region_msg->place(0, m_region_tile->ey, margin);}
m_region_stat->place(stat_col, 0, 0);
// Shrink msgsz if too tall:while (m_region_tile->wy + m_region_msg->wy > m_windowsz.y&& crawl_view.msgsz.y > MSG_MIN_HEIGHT){m_region_msg->resize(m_region_msg->mx, --crawl_view.msgsz.y);}if (m_region_tile->wy + m_region_msg->wy > m_windowsz.y){m_region_tile->place(0, 0, 0);m_region_msg->place(0, 0, 0);message_overlay = true;}}if (message_overlay){m_region_msg->resize_to_fit(m_region_tile->ex, m_region_msg->ey);crawl_view.msgsz.x = m_region_msg->mx;crawl_view.msgsz.y = m_region_msg->my;}else{m_region_msg->resize_to_fit(m_region_msg->wx,m_windowsz.y - m_region_msg->sx);int msg_y = std::min(Options.msg_max_height, (int)m_region_msg->my);m_region_msg->resize(m_region_msg->mx, msg_y);}m_region_msg->set_overlay(message_overlay);// Shrink view width if stat window can't fit...int stat_col;crawl_view.viewsz.x += 2;do{crawl_view.viewsz.x -= 2;m_region_tile->mx = crawl_view.viewsz.x;m_region_tile->place(0, 0, margin);stat_col = m_region_tile->ex + map_stat_buffer;m_region_stat->place(stat_col, 0, 0);m_region_stat->resize_to_fit(m_windowsz.x - m_region_stat->sx,m_region_stat->wy);}while (m_region_stat->ex > m_windowsz.x&& crawl_view.viewsz.x > VIEW_MIN_WIDTH);int hud_width = std::min(50, (int)m_region_stat->mx);m_region_stat->resize(hud_width, m_region_stat->my);crawl_view.hudsz.x = m_region_stat->mx;crawl_view.hudsz.y = m_region_stat->my;// Resize map to fit the screenm_region_map->dx = m_region_map->dy = Options.tile_map_pixels;
m_region_self_inv->sx,m_windowsz.y -m_region_self_inv->sy);
m_region_self_inv->sx,m_windowsz.y -m_region_self_inv->sy);m_region_self_inv->resize(std::min(13, (int)m_region_self_inv->mx),std::min(6, (int)m_region_self_inv->my));int self_inv_y = m_windowsz.y - m_region_self_inv->wy - margin;m_region_self_inv->place(inv_col, self_inv_y, 0);// recenter map above inventoryint map_cen_x = m_region_self_inv->sx + (m_region_self_inv->wx) / 2;m_region_map->place(map_cen_x - m_region_map->wy / 2, m_region_map->sy,map_margin);
m_region_menu_inv->sy);
m_region_menu_inv->sy);// Depending on the font, the menu inventory may hold fewer items// than the crt menu can display. Decrease the lines if necessary.const int ex = 3;if (m_region_crt->my - ex > m_region_menu_inv->mx)m_region_crt->resize(m_region_crt->mx, m_region_menu_inv->mx + ex);crawl_view.init_view();
void MessageRegion::set_overlay(bool is_overlay){m_overlay = is_overlay;}struct box_vert{float x;float y;unsigned char r;unsigned char g;unsigned char b;unsigned char a;};void MessageRegion::render(){if (m_overlay){unsigned int height;bool found = false;for (height = my; height > 0; height--){unsigned char *buf = &cbuf[mx * (height - 1)];for (unsigned int x = 0; x < mx; x++){if (buf[x] != ' '){found = true;break;}}
if (found)break;}if (height > 0){height *= m_font->char_height();box_vert verts[4];for (unsigned int i = 0; i < 4; i++){verts[i].r = 100;verts[i].g = 100;verts[i].b = 100;verts[i].a = 100;}verts[0].x = sx;verts[0].y = sy;verts[1].x = sx;verts[1].y = sy + height;verts[2].x = ex;verts[2].y = sy + height;verts[3].x = ex;verts[3].y = sy;glLoadIdentity();GLState state;state.array_vertex = true;state.array_colour = true;state.blend = true;GLStateManager::set(state);glVertexPointer(2, GL_FLOAT, sizeof(box_vert), &verts[0].x);glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(box_vert), &verts[0].r);glDrawArrays(GL_QUADS, 0, sizeof(verts) / sizeof(box_vert));}}m_font->render_textblock(sx + ox, sy + oy, cbuf, abuf, mx, my, m_overlay);}
// TODO enne - fix rtiles so that it can accept PNGs.{size_t image_size = 32 * 32 * 4;unsigned char *mesh = new unsigned char[image_size];for (unsigned int i = 0; i < image_size; i += 4){mesh[i] = mesh[i+1] = mesh[i+2] = 0;mesh[i+3] = 110;}_copy_onto(pixels, width, height, mesh, TILE_MESH, false);for (unsigned int i = 0; i < image_size; i += 4){mesh[i] = 70;mesh[i+1] = 70;mesh[i+2] = 180;mesh[i+3] = 120;}_copy_onto(pixels, width, height, mesh, TILE_MAGIC_MAP_MESH, false);delete[] mesh;}
# tile_window_height = 768# tile_map_pixels = 4# tile_tooltip_ms = 1000
# tile_window_height = 600# tile_map_pixels = 3# tile_full_screen = true# tile_font_crt_size = 14# tile_font_stat_size = 14# tile_font_msg_size = 12# tile_font_tip_size = 13# tile_font_lbl_size = 12### 800 x 600# tile_window_width = 800# tile_window_height = 600# tile_map_pixels = 3# tile_font_crt_size = 14# tile_font_stat_size = 11# tile_font_msg_size = 12# tile_font_tip_size = 13# tile_font_lbl_size = 12