mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-18 01:21:32 +00:00
- add #include support to TEXTURES lump
This commit is contained in:
parent
cce6c9a085
commit
cadc4f2a30
2 changed files with 151 additions and 132 deletions
|
@ -607,12 +607,6 @@ void FTextureManager::AddHiresTextures (int wadnum)
|
|||
void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
|
||||
{
|
||||
int remapLump, lastLump;
|
||||
FString src;
|
||||
bool is32bit;
|
||||
int width, height;
|
||||
ETextureType type;
|
||||
int mode;
|
||||
TArray<FTextureID> tlist;
|
||||
|
||||
lastLump = 0;
|
||||
|
||||
|
@ -620,7 +614,16 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
|
|||
{
|
||||
if (Wads.GetLumpFile(remapLump) == wadnum)
|
||||
{
|
||||
FScanner sc(remapLump);
|
||||
ParseTextureDef(remapLump);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FTextureManager::ParseTextureDef(int lump)
|
||||
{
|
||||
TArray<FTextureID> tlist;
|
||||
|
||||
FScanner sc(lump);
|
||||
while (sc.GetString())
|
||||
{
|
||||
if (sc.Compare("remap")) // remap an existing texture
|
||||
|
@ -628,6 +631,8 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
|
|||
sc.MustGetString();
|
||||
|
||||
// allow selection by type
|
||||
int mode;
|
||||
ETextureType type;
|
||||
if (sc.Compare("wall")) type=ETextureType::Wall, mode=FTextureManager::TEXMAN_Overridable;
|
||||
else if (sc.Compare("flat")) type=ETextureType::Flat, mode=FTextureManager::TEXMAN_Overridable;
|
||||
else if (sc.Compare("sprite")) type=ETextureType::Sprite, mode=0;
|
||||
|
@ -693,19 +698,19 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
|
|||
FString base = ExtractFileBase(sc.String, false);
|
||||
if (!base.IsEmpty())
|
||||
{
|
||||
src = base.Left(8);
|
||||
FString src = base.Left(8);
|
||||
|
||||
int lumpnum = Wads.CheckNumForFullName(sc.String, true, ns_patches);
|
||||
if (lumpnum == -1) lumpnum = Wads.CheckNumForFullName(sc.String, true, ns_graphics);
|
||||
|
||||
sc.GetString();
|
||||
is32bit = !!sc.Compare("force32bit");
|
||||
bool is32bit = !!sc.Compare("force32bit");
|
||||
if (!is32bit) sc.UnGet();
|
||||
|
||||
sc.MustGetNumber();
|
||||
width = sc.Number;
|
||||
int width = sc.Number;
|
||||
sc.MustGetNumber();
|
||||
height = sc.Number;
|
||||
int height = sc.Number;
|
||||
|
||||
if (lumpnum>=0)
|
||||
{
|
||||
|
@ -750,13 +755,26 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
|
|||
{
|
||||
ParseXTexture(sc, ETextureType::MiscPatch);
|
||||
}
|
||||
else if (sc.Compare("#include"))
|
||||
{
|
||||
sc.MustGetString();
|
||||
|
||||
// This is not using sc.Open because it can print a more useful error message when done here
|
||||
int includelump = Wads.CheckNumForFullName(sc.String, true);
|
||||
if (includelump == -1)
|
||||
{
|
||||
sc.ScriptError("Lump '%s' not found", sc.String);
|
||||
}
|
||||
else
|
||||
{
|
||||
ParseTextureDef(includelump);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.ScriptError("Texture definition expected, found '%s'", sc.String);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -584,6 +584,7 @@ public:
|
|||
void AddPatches (int lumpnum);
|
||||
void AddHiresTextures (int wadnum);
|
||||
void LoadTextureDefs(int wadnum, const char *lumpname);
|
||||
void ParseTextureDef(int remapLump);
|
||||
void ParseXTexture(FScanner &sc, ETextureType usetype);
|
||||
void SortTexturesByType(int start, int end);
|
||||
bool AreTexturesCompatible (FTextureID picnum1, FTextureID picnum2);
|
||||
|
|
Loading…
Reference in a new issue