| 1214 | } |
| 1215 | |
| 1216 | void FTextureManager::AddTextures(void (*progressFunc_)(), void (*checkForHacks)(BuildInfo&), void (*customtexturehandler)()) |
| 1217 | { |
| 1218 | progressFunc = progressFunc_; |
| 1219 | //if (BuildTileFiles.Size() == 0) CountBuildTiles (); |
| 1220 | |
| 1221 | int wadcnt = fileSystem.GetNumWads(); |
| 1222 | |
| 1223 | FMultipatchTextureBuilder build(*this, progressFunc_, checkForHacks); |
| 1224 | |
| 1225 | for(int i = 0; i< wadcnt; i++) |
| 1226 | { |
| 1227 | AddTexturesForWad(i, build); |
| 1228 | } |
| 1229 | build.ResolveAllPatches(); |
| 1230 | |
| 1231 | // Add one marker so that the last WAD is easier to handle and treat |
| 1232 | // custom textures as a completely separate block. |
| 1233 | FirstTextureForFile.Push(Textures.Size()); |
| 1234 | if (customtexturehandler) customtexturehandler(); |
| 1235 | FirstTextureForFile.Push(Textures.Size()); |
| 1236 | |
| 1237 | DefaultTexture = CheckForTexture ("-NOFLAT-", ETextureType::Override, 0); |
| 1238 | |
| 1239 | InitPalettedVersions(); |
| 1240 | AdjustSpriteOffsets(); |
| 1241 | // Add auto materials to each texture after everything has been set up. |
| 1242 | // Textures array can be reallocated in process, so ranged for loop is not suitable. |
| 1243 | // There is no need to process discovered material textures here, |
| 1244 | // CheckForTexture() did this already. |
| 1245 | for (unsigned int i = 0, count = Textures.Size(); i < count; ++i) |
| 1246 | { |
| 1247 | Textures[i].Texture->AddAutoMaterials(); |
| 1248 | } |
| 1249 | |
| 1250 | glPart2 = TexMan.CheckForTexture("glstuff/glpart2.png", ETextureType::MiscPatch); |
| 1251 | glPart = TexMan.CheckForTexture("glstuff/glpart.png", ETextureType::MiscPatch); |
| 1252 | mirrorTexture = TexMan.CheckForTexture("glstuff/mirror.png", ETextureType::MiscPatch); |
| 1253 | AddLocalizedVariants(); |
| 1254 | |
| 1255 | // Make sure all ID's are correct by resetting them here to the proper index. |
| 1256 | for (unsigned int i = 0, count = Textures.Size(); i < count; ++i) |
| 1257 | { |
| 1258 | Textures[i].Texture->SetID(i); |
| 1259 | } |
| 1260 | |
| 1261 | } |
| 1262 | |
| 1263 | //========================================================================== |
| 1264 | // |
no test coverage detected