| 695 | #define TEXTURES_PER_ROW 4 |
| 696 | |
| 697 | void CMegacellDialog::UpdateTextureView() { |
| 698 | int n = D3EditState.texdlg_texture; |
| 699 | CWnd *texwnd; |
| 700 | RECT rect; |
| 701 | int x, y, bm_handle, w, h; |
| 702 | int update_listbox = 1; |
| 703 | |
| 704 | Desktop_surf->attach_to_window((unsigned)m_hWnd); |
| 705 | |
| 706 | if (1 || update_listbox) { |
| 707 | |
| 708 | texwnd = GetDlgItem(IDC_TEXTURE_LISTBOX); |
| 709 | texwnd->GetWindowRect(&rect); |
| 710 | ScreenToClient(&rect); |
| 711 | w = rect.right - rect.left; |
| 712 | h = rect.bottom - rect.top; |
| 713 | |
| 714 | int texwidth = (w - 1) / 4; |
| 715 | int texheight = (h - 1) / 8; |
| 716 | |
| 717 | Desktop_surf->clear(rect.left, rect.top, w, h); |
| 718 | |
| 719 | int texnum = m_TexStart; |
| 720 | int count = 0, done = 0; |
| 721 | |
| 722 | while (!done) { |
| 723 | m_TextureSurf.create(texwidth, texheight, BPP_16); |
| 724 | |
| 725 | bm_handle = GetTextureBitmap(texnum, 0); |
| 726 | m_TextureSurf.load(bm_handle); |
| 727 | |
| 728 | x = 1 + rect.left + ((count % TEXTURES_PER_ROW) * texwidth); |
| 729 | y = 1 + rect.top + ((count / TEXTURES_PER_ROW) * texheight); |
| 730 | |
| 731 | if (m_CheckForTextureList) { |
| 732 | |
| 733 | if (m_CheckX >= x && m_CheckX <= (x + texwidth) && m_CheckY >= y && m_CheckY <= (y + texheight)) { |
| 734 | m_CheckForTextureList = 0; |
| 735 | D3EditState.texdlg_texture = texnum; |
| 736 | m_TextureSurf.free(); |
| 737 | Desktop_surf->attach_to_window((unsigned)NULL); |
| 738 | UpdateDialog(); |
| 739 | return; |
| 740 | } |
| 741 | } |
| 742 | |
| 743 | if (texnum == n) // draw a white box if this is the current texture |
| 744 | { |
| 745 | grViewport *vport = new grViewport(&m_TextureSurf); |
| 746 | |
| 747 | int x = 0, y = 0; |
| 748 | |
| 749 | vport->lock(); |
| 750 | vport->line(GR_RGB(255, 255, 255), x, y, x + vport->width() - 1, y); |
| 751 | vport->line(GR_RGB(255, 255, 255), x + vport->width() - 1, y, x + vport->width() - 1, y + vport->height() - 1); |
| 752 | vport->line(GR_RGB(255, 255, 255), x + vport->width() - 1, y + vport->height() - 1, x, y + vport->height() - 1); |
| 753 | vport->line(GR_RGB(255, 255, 255), x, y + vport->height() - 1, x, y); |
| 754 | vport->unlock(); |
nothing calls this directly
no test coverage detected