| 1865 | } |
| 1866 | |
| 1867 | void CWorldTexturesDialog::OnAddNewTiny() { |
| 1868 | char filename[255], dir[255], fname[128], ext[32]; |
| 1869 | char cur_name[100]; |
| 1870 | int bm_handle, tex_handle; |
| 1871 | int c = 1, finding_name = 1; |
| 1872 | int anim = 0; |
| 1873 | |
| 1874 | if (!Network_up) { |
| 1875 | OutrageMessageBox("Sorry babe, the network is down. This action is a no-no.\n"); |
| 1876 | return; |
| 1877 | } |
| 1878 | |
| 1879 | int alt_format = IsDlgButtonChecked(IDC_IMPORT_4444); |
| 1880 | int format = 0; |
| 1881 | |
| 1882 | if (alt_format) { |
| 1883 | int answer = MessageBox("Are you sure you wish to import this texture with a 4444 format?", "Question", MB_YESNO); |
| 1884 | if (answer == IDNO) |
| 1885 | return; |
| 1886 | |
| 1887 | format = BITMAP_FORMAT_4444; |
| 1888 | } |
| 1889 | |
| 1890 | CString filter = |
| 1891 | "Descent III files " |
| 1892 | "(*.itl,*.tga,*.bbm,*.lbm,*.ogf,*.oaf,*.ilf,*.pcx)|*.pcx;*.tga;*.bbm;*.lbm;*.ogf;*.oaf;*.ifl;*.itl||"; |
| 1893 | |
| 1894 | if (!OpenFileDialog(this, (LPCSTR)filter, filename, Current_bitmap_dir, sizeof(Current_bitmap_dir))) |
| 1895 | return; |
| 1896 | |
| 1897 | ddio_SplitPath(filename, dir, fname, ext); |
| 1898 | |
| 1899 | // Okay, we selected a file. Lets do what needs to be done here. |
| 1900 | if (!strnicmp(ext, "ITL", 3)) { |
| 1901 | LoadITLFile(filename, TINY_TEXTURE); |
| 1902 | UpdateDialog(); |
| 1903 | return; |
| 1904 | } |
| 1905 | |
| 1906 | bm_handle = LoadTextureImage(filename, &anim, TINY_TEXTURE, 0, 0, format); |
| 1907 | |
| 1908 | if (bm_handle < 0) { |
| 1909 | OutrageMessageBox("Couldn't open that bitmap/anim file."); |
| 1910 | return; |
| 1911 | } |
| 1912 | |
| 1913 | tex_handle = AllocTexture(); |
| 1914 | |
| 1915 | while (finding_name) { |
| 1916 | if (c == 1) |
| 1917 | sprintf(cur_name, "%s", fname); |
| 1918 | else |
| 1919 | sprintf(cur_name, "%s%d", fname, c); |
| 1920 | if (FindTextureName(cur_name) != -1) |
| 1921 | c++; |
| 1922 | else |
| 1923 | finding_name = 0; |
| 1924 | } |
nothing calls this directly
no test coverage detected