Clears out all the level specific stuff from memory
| 1828 | extern void FreeTextureBumpmaps(int); |
| 1829 | // Clears out all the level specific stuff from memory |
| 1830 | void FlushDataCache() { |
| 1831 | int i; |
| 1832 | |
| 1833 | // This must be done before we free polymodels |
| 1834 | FreeAllObjects(); |
| 1835 | |
| 1836 | #ifdef EDITOR |
| 1837 | if (Network_up) |
| 1838 | return; |
| 1839 | #endif |
| 1840 | |
| 1841 | int texfreed = 0; |
| 1842 | int modelsfreed = 0; |
| 1843 | int soundsfreed = 0; |
| 1844 | |
| 1845 | for (i = 0; i < MAX_TEXTURES; i++) { |
| 1846 | if (Textures_to_free[i] != 0) { |
| 1847 | if (!(GameTextures[i].flags & TF_ANIMATED)) { |
| 1848 | if (GameTextures[i].bumpmap != -1) |
| 1849 | FreeTextureBumpmaps(i); |
| 1850 | |
| 1851 | bm_FreeBitmapData(GameTextures[i].bm_handle); |
| 1852 | } |
| 1853 | |
| 1854 | texfreed++; |
| 1855 | } |
| 1856 | } |
| 1857 | for (i = 0; i < MAX_POLY_MODELS; i++) { |
| 1858 | if (Models_to_free[i] != 0) { |
| 1859 | FreePolymodelData(i); |
| 1860 | modelsfreed++; |
| 1861 | } |
| 1862 | } |
| 1863 | |
| 1864 | for (i = 0; i < MAX_SOUNDS; i++) { |
| 1865 | if (Sounds_to_free[i] != 0) |
| 1866 | { |
| 1867 | soundsfreed++; |
| 1868 | int index = Sounds[i].sample_index; |
| 1869 | if (SoundFiles[index].sample_16bit) { |
| 1870 | mem_free(SoundFiles[index].sample_16bit); |
| 1871 | SoundFiles[index].sample_16bit = NULL; |
| 1872 | } |
| 1873 | if (SoundFiles[index].sample_8bit) { |
| 1874 | mem_free(SoundFiles[index].sample_8bit); |
| 1875 | SoundFiles[index].sample_8bit = NULL; |
| 1876 | } |
| 1877 | } |
| 1878 | } |
| 1879 | |
| 1880 | mprintf(0, "Freed %d textures, %d models, and %d sounds.\n", texfreed, modelsfreed, soundsfreed); |
| 1881 | // the renderer is never initialized in dedicated server mode, so don't try to reset things either |
| 1882 | if (!Dedicated_server) { |
| 1883 | rend_ResetCache(); |
| 1884 | } |
| 1885 | } |
| 1886 | |
| 1887 | /////////////////////////////////////////////////////////////////////////////// |
no test coverage detected