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

Method ParseTextureDef

source/common/textures/texturemanager.cpp:698–872  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

696}
697
698void FTextureManager::ParseTextureDef(int lump, FMultipatchTextureBuilder &build)
699{
700 TArray<FTextureID> tlist;
701
702 FScanner sc(lump);
703 while (sc.GetString())
704 {
705 if (sc.Compare("remap")) // remap an existing texture
706 {
707 sc.MustGetString();
708
709 // allow selection by type
710 int mode;
711 ETextureType type;
712 if (sc.Compare("wall")) type=ETextureType::Wall, mode=FTextureManager::TEXMAN_Overridable;
713 else if (sc.Compare("flat")) type=ETextureType::Flat, mode=FTextureManager::TEXMAN_Overridable;
714 else if (sc.Compare("sprite")) type=ETextureType::Sprite, mode=0;
715 else type = ETextureType::Any, mode = 0;
716
717 if (type != ETextureType::Any) sc.MustGetString();
718
719 sc.String[8]=0;
720
721 tlist.Clear();
722 ListTextures(sc.String, tlist);
723 FName texname = sc.String;
724
725 sc.MustGetString();
726 int lumpnum = fileSystem.CheckNumForFullName(sc.String, true, ns_patches);
727 if (lumpnum == -1) lumpnum = fileSystem.CheckNumForFullName(sc.String, true, ns_graphics);
728
729 if (tlist.Size() == 0)
730 {
731 Printf("Attempting to remap non-existent texture %s to %s\n",
732 texname.GetChars(), sc.String);
733 }
734 else if (lumpnum == -1)
735 {
736 Printf("Attempting to remap texture %s to non-existent lump %s\n",
737 texname.GetChars(), sc.String);
738 }
739 else
740 {
741 for(unsigned int i = 0; i < tlist.Size(); i++)
742 {
743 auto oldtex = Textures[tlist[i].GetIndex()].Texture;
744 int sl;
745
746 // only replace matching types. For sprites also replace any MiscPatches
747 // based on the same lump. These can be created for icons.
748 if (oldtex->GetUseType() == type || type == ETextureType::Any ||
749 (mode == TEXMAN_Overridable && oldtex->GetUseType() == ETextureType::Override) ||
750 (type == ETextureType::Sprite && oldtex->GetUseType() == ETextureType::MiscPatch &&
751 (sl=oldtex->GetSourceLump()) >= 0 && fileSystem.GetFileNamespace(sl) == ns_sprites)
752 )
753 {
754 FTexture * newtex = CreateTextureFromLump(lumpnum);
755 if (newtex != NULL)

Callers

nothing calls this directly

Calls 15

PrintfFunction · 0.85
CreateTextureFromLumpFunction · 0.85
MakeGameTextureFunction · 0.85
ExtractFileBaseFunction · 0.85
MustGetStringMethod · 0.80
CheckNumForFullNameMethod · 0.80
GetUseTypeMethod · 0.80
GetFileNamespaceMethod · 0.80
SetWorldPanningMethod · 0.80
SetDisplaySizeMethod · 0.80
GetDisplayWidthMethod · 0.80
GetDisplayHeightMethod · 0.80

Tested by

no test coverage detected