| 1773 | } |
| 1774 | |
| 1775 | void CWorldTexturesDialog::OnAddNewSmall() { |
| 1776 | char filename[255], dir[255], fname[128], ext[32]; |
| 1777 | char cur_name[100]; |
| 1778 | int bm_handle, tex_handle; |
| 1779 | int c = 1, finding_name = 1; |
| 1780 | int anim = 0; |
| 1781 | |
| 1782 | if (!Network_up) { |
| 1783 | OutrageMessageBox("Sorry babe, the network is down. This action is a no-no.\n"); |
| 1784 | return; |
| 1785 | } |
| 1786 | |
| 1787 | int alt_format = IsDlgButtonChecked(IDC_IMPORT_4444); |
| 1788 | int format = 0; |
| 1789 | |
| 1790 | if (alt_format) { |
| 1791 | int answer = MessageBox("Are you sure you wish to import this texture with a 4444 format?", "Question", MB_YESNO); |
| 1792 | if (answer == IDNO) |
| 1793 | return; |
| 1794 | |
| 1795 | format = BITMAP_FORMAT_4444; |
| 1796 | } |
| 1797 | |
| 1798 | CString filter = |
| 1799 | "Descent III files " |
| 1800 | "(*.itl,*.tga,*.bbm,*.lbm,*.ogf,*.oaf,*.ilf,*.pcx)|*.pcx;*.tga;*.bbm;*.lbm;*.ogf;*.oaf;*.ifl;*.itl||"; |
| 1801 | |
| 1802 | if (!OpenFileDialog(this, (LPCSTR)filter, filename, Current_bitmap_dir, sizeof(Current_bitmap_dir))) |
| 1803 | return; |
| 1804 | |
| 1805 | ddio_SplitPath(filename, dir, fname, ext); |
| 1806 | |
| 1807 | // Okay, we selected a file. Lets do what needs to be done here. |
| 1808 | if (!strnicmp(ext, "ITL", 3)) { |
| 1809 | LoadITLFile(filename, SMALL_TEXTURE); |
| 1810 | UpdateDialog(); |
| 1811 | return; |
| 1812 | } |
| 1813 | |
| 1814 | bm_handle = LoadTextureImage(filename, &anim, SMALL_TEXTURE, 0, 0, format); |
| 1815 | |
| 1816 | if (bm_handle < 0) { |
| 1817 | OutrageMessageBox("Couldn't open that bitmap/anim file."); |
| 1818 | return; |
| 1819 | } |
| 1820 | |
| 1821 | tex_handle = AllocTexture(); |
| 1822 | |
| 1823 | while (finding_name) { |
| 1824 | if (c == 1) |
| 1825 | sprintf(cur_name, "%s", fname); |
| 1826 | else |
| 1827 | sprintf(cur_name, "%s%d", fname, c); |
| 1828 | |
| 1829 | if (FindTextureName(cur_name) != -1) |
| 1830 | c++; |
| 1831 | else |
| 1832 | finding_name = 0; |
nothing calls this directly
no test coverage detected