- Timestamp:
- 06/02/04 16:27:54 (21 years ago)
- File:
-
- 1 edited
-
ps/trunk/source/graphics/TextureManager.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/source/graphics/TextureManager.cpp
r322 r344 9 9 #include <algorithm> 10 10 11 const char* SupportedTextureFormats[] = { " png", "dds", "tga", "bmp" };11 const char* SupportedTextureFormats[] = { ".png", ".dds", ".tga", ".bmp" }; 12 12 13 13 … … 74 74 75 75 Handle h=tex_load((const char*) pathname); 76 if (!h) { 76 if (h <= 0) { 77 LOG(ERROR, "CTextureManager::AddTexture(): texture %s failed loading\n", pathname.c_str()); 77 78 return 0; 78 79 } else { … … 142 143 void CTextureManager::LoadTerrainTextures(int terraintype,const char* fileext) 143 144 { 144 #ifdef _WIN32 145 struct _finddata_t file;146 long handle;145 CStr pathname("art/textures/terrain/types/"); 146 pathname+=m_TerrainTextures[terraintype].m_Name; 147 pathname+="/"; 147 148 148 // build pathname 149 CStr pathname("mods\\official\\art\\textures\\terrain\\types\\"); 150 pathname+=m_TerrainTextures[terraintype].m_Name; 151 pathname+="\\"; 149 Handle dir=vfs_open_dir(pathname.c_str()); 150 vfsDirEnt dent; 152 151 153 CStr findname(pathname); 154 findname+="*."; 155 findname+=fileext; 156 157 // Find first matching file in directory for this terrain type 158 if ((handle=_findfirst((const char*) findname,&file))!=-1) { 152 if (dir > 0) 153 { 154 while (vfs_next_dirent(dir, &dent, fileext) == 0) 155 { 156 LOG(NORMAL, "CTextureManager::LoadTerrainTextures(): texture %s added to type %s\n", dent.name, m_TerrainTextures[terraintype].m_Name.c_str()); 157 AddTexture(dent.name, terraintype); 158 } 159 159 160 AddTexture(file.name,terraintype); 161 162 // Find the rest of the matching files 163 while( _findnext(handle,&file)==0) { 164 AddTexture((const char*) file.name,terraintype); 165 } 166 167 _findclose(handle); 160 vfs_close_dir(dir); 168 161 } 169 #endif170 162 } 171 163 172 164 void CTextureManager::BuildTerrainTypes() 173 165 { 174 #ifdef _WIN32 175 struct _finddata_t file; 176 long handle; 166 Handle dir=vfs_open_dir("art/textures/terrain/types/"); 167 vfsDirEnt dent; 177 168 178 // Find first matching directory in terrain\textures 179 if ((handle=_findfirst("mods\\official\\art\\textures\\terrain\\types\\*",&file))!=-1) { 169 if (dir > 0) 170 { 171 while (vfs_next_dirent(dir, &dent, "/") == 0) 172 { 173 AddTextureType(dent.name); 174 } 180 175 181 if ((file.attrib & _A_SUBDIR) && file.name[0]!='.') { 182 AddTextureType(file.name); 183 } 176 vfs_close_dir(dir); 177 } 184 178 185 // Find the rest of the matching files186 while( _findnext(handle,&file)==0) {187 if ((file.attrib & _A_SUBDIR) && file.name[0]!='.') {188 AddTextureType(file.name);189 }190 }191 192 _findclose(handle);193 }194 #endif195 179 } 196 180
Note:
See TracChangeset
for help on using the changeset viewer.
