MCPcopy Create free account
hub / github.com/ZDoom/Raze / AddTexturesForWad

Method AddTexturesForWad

source/common/textures/texturemanager.cpp:937–1046  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

935//==========================================================================
936
937void FTextureManager::AddTexturesForWad(int wadnum, FMultipatchTextureBuilder &build)
938{
939 int firsttexture = Textures.Size();
940 bool iwad = wadnum >= fileSystem.GetIwadNum() && wadnum <= fileSystem.GetMaxIwadNum();
941
942 FirstTextureForFile.Push(firsttexture);
943
944 // First step: Load sprites
945 AddGroup(wadnum, ns_sprites, ETextureType::Sprite);
946
947 // When loading a Zip, all graphics in the patches/ directory should be
948 // added as well.
949 AddGroup(wadnum, ns_patches, ETextureType::WallPatch);
950
951 // Second step: TEXTUREx lumps
952 LoadTextureX(wadnum, build);
953
954 // Third step: Flats
955 AddGroup(wadnum, ns_flats, ETextureType::Flat);
956
957 // Fourth step: Textures (TX_)
958 AddGroup(wadnum, ns_newtextures, ETextureType::Override);
959
960 // Sixth step: Try to find any lump in the WAD that may be a texture and load as a TEX_MiscPatch
961 int firsttx = fileSystem.GetFirstEntry(wadnum);
962 int lasttx = fileSystem.GetLastEntry(wadnum);
963
964 for (int i= firsttx; i <= lasttx; i++)
965 {
966 bool skin = false;
967 auto Name = fileSystem.GetFileShortName(i);
968
969 // Ignore anything not in the global namespace
970 int ns = fileSystem.GetFileNamespace(i);
971 if (ns == ns_global)
972 {
973 // In Zips all graphics must be in a separate namespace.
974 if (fileSystem.GetFileFlags(i) & RESFF_FULLPATH) continue;
975
976 // Ignore lumps with empty names.
977 if (fileSystem.CheckFileName(i, "")) continue;
978
979 // Ignore anything belonging to a map
980 if (fileSystem.CheckFileName(i, "THINGS")) continue;
981 if (fileSystem.CheckFileName(i, "LINEDEFS")) continue;
982 if (fileSystem.CheckFileName(i, "SIDEDEFS")) continue;
983 if (fileSystem.CheckFileName(i, "VERTEXES")) continue;
984 if (fileSystem.CheckFileName(i, "SEGS")) continue;
985 if (fileSystem.CheckFileName(i, "SSECTORS")) continue;
986 if (fileSystem.CheckFileName(i, "NODES")) continue;
987 if (fileSystem.CheckFileName(i, "SECTORS")) continue;
988 if (fileSystem.CheckFileName(i, "REJECT")) continue;
989 if (fileSystem.CheckFileName(i, "BLOCKMAP")) continue;
990 if (fileSystem.CheckFileName(i, "BEHAVIOR")) continue;
991
992 bool force = false;
993 // Don't bother looking at this lump if something later overrides it.
994 if (fileSystem.CheckNumForName(Name, ns_graphics) != i)

Callers

nothing calls this directly

Calls 15

CheckForTextureFunction · 0.85
MakeGameTextureFunction · 0.85
CreateTextureFromLumpFunction · 0.85
GetIwadNumMethod · 0.80
GetMaxIwadNumMethod · 0.80
GetLastEntryMethod · 0.80
GetFileShortNameMethod · 0.80
GetFileNamespaceMethod · 0.80
GetFileFlagsMethod · 0.80
CheckFileNameMethod · 0.80
ExistsMethod · 0.80
SizeMethod · 0.45

Tested by

no test coverage detected