Merge branch 'master' into gonesolong
Conflicts: src/CMakeLists.txt src/actor.h src/g_heretic/a_hereticmisc.cpp src/g_heretic/a_hereticweaps.cpp src/g_heretic/a_ironlich.cpp src/info.h src/namedef.h src/p_buildmap.cpp src/p_enemy.cpp src/p_map.cpp src/p_mobj.cpp src/thingdef/thingdef_codeptr.cpp zdoom.vcproj
This commit is contained in:
commit
2d87eb0ba2
457 changed files with 13703 additions and 9290 deletions
|
|
@ -231,8 +231,8 @@ void FTextureManager::InitAnimated (void)
|
|||
if (debuganimated)
|
||||
{
|
||||
Printf("Defining animation '%s' (texture %d, lump %d, file %d) to '%s' (texture %d, lump %d, file %d)\n",
|
||||
tex1->Name, pic1.GetIndex(), tex1->GetSourceLump(), Wads.GetLumpFile(tex1->GetSourceLump()),
|
||||
tex2->Name, pic2.GetIndex(), tex2->GetSourceLump(), Wads.GetLumpFile(tex2->GetSourceLump()));
|
||||
tex1->Name.GetChars(), pic1.GetIndex(), tex1->GetSourceLump(), Wads.GetLumpFile(tex1->GetSourceLump()),
|
||||
tex2->Name.GetChars(), pic2.GetIndex(), tex2->GetSourceLump(), Wads.GetLumpFile(tex2->GetSourceLump()));
|
||||
}
|
||||
|
||||
if (pic1 == pic2)
|
||||
|
|
@ -551,7 +551,7 @@ void FTextureManager::ParseTime (FScanner &sc, DWORD &min, DWORD &max)
|
|||
|
||||
void FTextureManager::ParseWarp(FScanner &sc)
|
||||
{
|
||||
const BITFIELD texflags = TEXMAN_Overridable | TEXMAN_TryAny;
|
||||
const BITFIELD texflags = TEXMAN_Overridable | TEXMAN_TryAny | TEXMAN_ShortNameOnly;
|
||||
bool isflat = false;
|
||||
bool type2 = sc.Compare ("warp2"); // [GRB]
|
||||
sc.MustGetString ();
|
||||
|
|
@ -616,7 +616,7 @@ void FTextureManager::ParseWarp(FScanner &sc)
|
|||
|
||||
void FTextureManager::ParseCameraTexture(FScanner &sc)
|
||||
{
|
||||
const BITFIELD texflags = TEXMAN_Overridable | TEXMAN_TryAny;
|
||||
const BITFIELD texflags = TEXMAN_Overridable | TEXMAN_TryAny | TEXMAN_ShortNameOnly;
|
||||
int width, height;
|
||||
int fitwidth, fitheight;
|
||||
FString picname;
|
||||
|
|
@ -659,6 +659,17 @@ void FTextureManager::ParseCameraTexture(FScanner &sc)
|
|||
sc.UnGet ();
|
||||
}
|
||||
}
|
||||
if (sc.GetString())
|
||||
{
|
||||
if (sc.Compare("WorldPanning"))
|
||||
{
|
||||
viewer->bWorldPanning = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.UnGet();
|
||||
}
|
||||
}
|
||||
viewer->SetScaledSize(fitwidth, fitheight);
|
||||
}
|
||||
|
||||
|
|
@ -738,8 +749,11 @@ void FTextureManager::ParseAnimatedDoor(FScanner &sc)
|
|||
{
|
||||
error = true;
|
||||
}
|
||||
|
||||
while (sc.GetString ())
|
||||
else
|
||||
{
|
||||
Texture(anim.BaseTexture)->bNoDecals = true;
|
||||
}
|
||||
while (sc.GetString())
|
||||
{
|
||||
if (sc.Compare ("opensound"))
|
||||
{
|
||||
|
|
@ -765,8 +779,12 @@ void FTextureManager::ParseAnimatedDoor(FScanner &sc)
|
|||
{
|
||||
sc.ScriptError ("Unknown texture %s", sc.String);
|
||||
}
|
||||
frames.Push (v);
|
||||
}
|
||||
frames.Push(v);
|
||||
}
|
||||
else if (sc.Compare("allowdecals"))
|
||||
{
|
||||
if (anim.BaseTexture.Exists()) Texture(anim.BaseTexture)->bNoDecals = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ FBuildTexture::FBuildTexture (int tilenum, const BYTE *pixels, int width, int he
|
|||
LeftOffset = left;
|
||||
TopOffset = top;
|
||||
CalcBitSize ();
|
||||
mysnprintf (Name, countof(Name), "BTIL%04d", tilenum);
|
||||
Name.Format("BTIL%04d", tilenum);
|
||||
UseType = TEX_Build;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,8 +41,7 @@
|
|||
|
||||
FCanvasTexture::FCanvasTexture (const char *name, int width, int height)
|
||||
{
|
||||
strncpy (Name, name, 8);
|
||||
Name[8] = 0;
|
||||
Name = name;
|
||||
Width = width;
|
||||
Height = height;
|
||||
LeftOffset = TopOffset = 0;
|
||||
|
|
|
|||
|
|
@ -106,7 +106,6 @@ FIMGZTexture::FIMGZTexture (int lumpnum, WORD w, WORD h, SWORD l, SWORD t)
|
|||
: FTexture(NULL, lumpnum), Pixels(0), Spans(0)
|
||||
{
|
||||
Wads.GetLumpName (Name, lumpnum);
|
||||
Name[8] = 0;
|
||||
Width = w;
|
||||
Height = h;
|
||||
LeftOffset = l;
|
||||
|
|
|
|||
|
|
@ -448,7 +448,7 @@ void FJPEGTexture::MakeTexture ()
|
|||
}
|
||||
catch (int)
|
||||
{
|
||||
Printf (TEXTCOLOR_ORANGE " in texture %s\n", Name);
|
||||
Printf (TEXTCOLOR_ORANGE " in texture %s\n", Name.GetChars());
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
}
|
||||
if (buff != NULL)
|
||||
|
|
@ -532,7 +532,7 @@ int FJPEGTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FC
|
|||
}
|
||||
catch(int)
|
||||
{
|
||||
Printf (TEXTCOLOR_ORANGE " in JPEG texture %s\n", Name);
|
||||
Printf (TEXTCOLOR_ORANGE " in JPEG texture %s\n", Name.GetChars());
|
||||
}
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
if (buff != NULL) delete [] buff;
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@
|
|||
#include "colormatcher.h"
|
||||
#include "v_palette.h"
|
||||
#include "v_video.h"
|
||||
#include "v_text.h"
|
||||
#include "m_fixed.h"
|
||||
#include "textures/textures.h"
|
||||
#include "r_data/colormaps.h"
|
||||
|
|
@ -136,7 +137,7 @@ struct strifemaptexture_t
|
|||
|
||||
struct FPatchLookup
|
||||
{
|
||||
char Name[9];
|
||||
FString Name;
|
||||
FTexture *Texture;
|
||||
};
|
||||
|
||||
|
|
@ -242,9 +243,7 @@ FMultiPatchTexture::FMultiPatchTexture (const void *texdef, FPatchLookup *patchl
|
|||
Parts = NumParts > 0 ? new TexPart[NumParts] : NULL;
|
||||
Width = SAFESHORT(mtexture.d->width);
|
||||
Height = SAFESHORT(mtexture.d->height);
|
||||
strncpy (Name, (const char *)mtexture.d->name, 8);
|
||||
Name[8] = 0;
|
||||
|
||||
Name = (char *)mtexture.d->name;
|
||||
CalcBitSize ();
|
||||
|
||||
xScale = mtexture.d->ScaleX ? mtexture.d->ScaleX*(FRACUNIT/8) : FRACUNIT;
|
||||
|
|
@ -269,17 +268,21 @@ FMultiPatchTexture::FMultiPatchTexture (const void *texdef, FPatchLookup *patchl
|
|||
if (unsigned(LittleShort(mpatch.d->patch)) >= unsigned(maxpatchnum))
|
||||
{
|
||||
I_FatalError ("Bad PNAMES and/or texture directory:\n\nPNAMES has %d entries, but\n%s wants to use entry %d.",
|
||||
maxpatchnum, Name, LittleShort(mpatch.d->patch)+1);
|
||||
maxpatchnum, Name.GetChars(), LittleShort(mpatch.d->patch)+1);
|
||||
}
|
||||
Parts[i].OriginX = LittleShort(mpatch.d->originx);
|
||||
Parts[i].OriginY = LittleShort(mpatch.d->originy);
|
||||
Parts[i].Texture = patchlookup[LittleShort(mpatch.d->patch)].Texture;
|
||||
if (Parts[i].Texture == NULL)
|
||||
{
|
||||
Printf ("Unknown patch %s in texture %s\n", patchlookup[LittleShort(mpatch.d->patch)].Name, Name);
|
||||
Printf(TEXTCOLOR_RED "Unknown patch %s in texture %s\n", patchlookup[LittleShort(mpatch.d->patch)].Name.GetChars(), Name.GetChars());
|
||||
NumParts--;
|
||||
i--;
|
||||
}
|
||||
else
|
||||
{
|
||||
Parts[i].Texture->bKeepAround = true;
|
||||
}
|
||||
if (strife)
|
||||
mpatch.s++;
|
||||
else
|
||||
|
|
@ -287,7 +290,7 @@ FMultiPatchTexture::FMultiPatchTexture (const void *texdef, FPatchLookup *patchl
|
|||
}
|
||||
if (NumParts == 0)
|
||||
{
|
||||
Printf ("Texture %s is left without any patches\n", Name);
|
||||
Printf ("Texture %s is left without any patches\n", Name.GetChars());
|
||||
}
|
||||
|
||||
CheckForHacks ();
|
||||
|
|
@ -820,7 +823,7 @@ FMultiPatchTexture::TexPart::TexPart()
|
|||
|
||||
void FTextureManager::AddTexturesLump (const void *lumpdata, int lumpsize, int deflumpnum, int patcheslump, int firstdup, bool texture1)
|
||||
{
|
||||
FPatchLookup *patchlookup;
|
||||
FPatchLookup *patchlookup = NULL;
|
||||
int i;
|
||||
DWORD numpatches;
|
||||
|
||||
|
|
@ -853,13 +856,13 @@ void FTextureManager::AddTexturesLump (const void *lumpdata, int lumpsize, int d
|
|||
|
||||
// Catalog the patches these textures use so we know which
|
||||
// textures they represent.
|
||||
patchlookup = (FPatchLookup *)alloca (numpatches * sizeof(*patchlookup));
|
||||
|
||||
patchlookup = new FPatchLookup[numpatches];
|
||||
for (DWORD i = 0; i < numpatches; ++i)
|
||||
{
|
||||
pnames.Read (patchlookup[i].Name, 8);
|
||||
patchlookup[i].Name[8] = 0;
|
||||
|
||||
char pname[9];
|
||||
pnames.Read(pname, 8);
|
||||
pname[8] = '\0';
|
||||
patchlookup[i].Name = pname;
|
||||
FTextureID j = CheckForTexture (patchlookup[i].Name, FTexture::TEX_WallPatch);
|
||||
if (j.isValid())
|
||||
{
|
||||
|
|
@ -889,6 +892,7 @@ void FTextureManager::AddTexturesLump (const void *lumpdata, int lumpsize, int d
|
|||
if (maxoff < DWORD(numtextures+1)*4)
|
||||
{
|
||||
Printf ("Texture directory is too short");
|
||||
delete[] patchlookup;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -899,6 +903,7 @@ void FTextureManager::AddTexturesLump (const void *lumpdata, int lumpsize, int d
|
|||
if (offset > maxoff)
|
||||
{
|
||||
Printf ("Bad texture directory");
|
||||
delete[] patchlookup;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -934,6 +939,7 @@ void FTextureManager::AddTexturesLump (const void *lumpdata, int lumpsize, int d
|
|||
if (offset > maxoff)
|
||||
{
|
||||
Printf ("Bad texture directory");
|
||||
delete[] patchlookup;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -957,6 +963,7 @@ void FTextureManager::AddTexturesLump (const void *lumpdata, int lumpsize, int d
|
|||
StartScreen->Progress();
|
||||
}
|
||||
}
|
||||
delete[] patchlookup;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -999,21 +1006,7 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part, bool silent, i
|
|||
|
||||
if (!texno.isValid())
|
||||
{
|
||||
int lumpnum = Wads.CheckNumForFullName(sc.String);
|
||||
if (lumpnum >= 0)
|
||||
{
|
||||
texno = TexMan.FindTextureByLumpNum(lumpnum);
|
||||
if (texno.isValid ())
|
||||
{
|
||||
part.Texture = TexMan[texno];
|
||||
}
|
||||
else
|
||||
{
|
||||
part.Texture = FTexture::CreateTexture("", lumpnum, usetype);
|
||||
TexMan.AddTexture(part.Texture);
|
||||
}
|
||||
}
|
||||
else if (strlen(sc.String) <= 8 && !strpbrk(sc.String, "./"))
|
||||
if (strlen(sc.String) <= 8 && !strpbrk(sc.String, "./"))
|
||||
{
|
||||
int lumpnum = Wads.CheckNumForName(sc.String, usetype == TEX_MiscPatch? ns_graphics : ns_patches);
|
||||
if (lumpnum >= 0)
|
||||
|
|
@ -1030,7 +1023,7 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part, bool silent, i
|
|||
}
|
||||
if (part.Texture == NULL)
|
||||
{
|
||||
if (!silent) Printf("Unknown patch '%s' in texture '%s'\n", sc.String, Name);
|
||||
if (!silent) Printf(TEXTCOLOR_RED "Unknown patch '%s' in texture '%s'\n", sc.String, Name.GetChars());
|
||||
}
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetNumber();
|
||||
|
|
@ -1232,8 +1225,8 @@ FMultiPatchTexture::FMultiPatchTexture (FScanner &sc, int usetype)
|
|||
bSilent = false;
|
||||
}
|
||||
}
|
||||
uppercopy(Name, !textureName ? sc.String : textureName);
|
||||
Name[8] = 0;
|
||||
Name = !textureName ? sc.String : textureName;
|
||||
Name.ToUpper();
|
||||
sc.MustGetStringName(",");
|
||||
sc.MustGetNumber();
|
||||
Width = sc.Number;
|
||||
|
|
@ -1251,13 +1244,13 @@ FMultiPatchTexture::FMultiPatchTexture (FScanner &sc, int usetype)
|
|||
{
|
||||
sc.MustGetFloat();
|
||||
xScale = FLOAT2FIXED(sc.Float);
|
||||
if (xScale == 0) sc.ScriptError("Texture %s is defined with null x-scale\n", Name);
|
||||
if (xScale == 0) sc.ScriptError("Texture %s is defined with null x-scale\n", Name.GetChars());
|
||||
}
|
||||
else if (sc.Compare("YScale"))
|
||||
{
|
||||
sc.MustGetFloat();
|
||||
yScale = FLOAT2FIXED(sc.Float);
|
||||
if (yScale == 0) sc.ScriptError("Texture %s is defined with null y-scale\n", Name);
|
||||
if (yScale == 0) sc.ScriptError("Texture %s is defined with null y-scale\n", Name.GetChars());
|
||||
}
|
||||
else if (sc.Compare("WorldPanning"))
|
||||
{
|
||||
|
|
@ -1325,7 +1318,7 @@ FMultiPatchTexture::FMultiPatchTexture (FScanner &sc, int usetype)
|
|||
if (Width <= 0 || Height <= 0)
|
||||
{
|
||||
UseType = FTexture::TEX_Null;
|
||||
Printf("Texture %s has invalid dimensions (%d, %d)\n", Name, Width, Height);
|
||||
Printf("Texture %s has invalid dimensions (%d, %d)\n", Name.GetChars(), Width, Height);
|
||||
Width = Height = 1;
|
||||
}
|
||||
CalcBitSize ();
|
||||
|
|
|
|||
|
|
@ -137,7 +137,10 @@ FTexture * FTexture::CreateTexture (int lumpnum, int usetype)
|
|||
FTexture * FTexture::CreateTexture (const char *name, int lumpnum, int usetype)
|
||||
{
|
||||
FTexture *tex = CreateTexture(lumpnum, usetype);
|
||||
if (tex != NULL && name != NULL) uppercopy(tex->Name, name);
|
||||
if (tex != NULL && name != NULL) {
|
||||
tex->Name = name;
|
||||
tex->Name.ToUpper();
|
||||
}
|
||||
return tex;
|
||||
}
|
||||
|
||||
|
|
@ -146,27 +149,29 @@ FTexture::FTexture (const char *name, int lumpnum)
|
|||
: LeftOffset(0), TopOffset(0),
|
||||
WidthBits(0), HeightBits(0), xScale(FRACUNIT), yScale(FRACUNIT), SourceLump(lumpnum),
|
||||
UseType(TEX_Any), bNoDecals(false), bNoRemap0(false), bWorldPanning(false),
|
||||
bMasked(true), bAlphaTexture(false), bHasCanvas(false), bWarped(0), bComplex(false), bMultiPatch(false),
|
||||
bMasked(true), bAlphaTexture(false), bHasCanvas(false), bWarped(0), bComplex(false), bMultiPatch(false), bKeepAround(false),
|
||||
Rotations(0xFFFF), SkyOffset(0), Width(0), Height(0), WidthMask(0), Native(NULL)
|
||||
{
|
||||
id.SetInvalid();
|
||||
if (name != NULL)
|
||||
{
|
||||
uppercopy(Name, name);
|
||||
Name = name;
|
||||
Name.ToUpper();
|
||||
}
|
||||
else if (lumpnum < 0)
|
||||
{
|
||||
*Name = 0;
|
||||
Name = FString();
|
||||
}
|
||||
else
|
||||
{
|
||||
Wads.GetLumpName (Name, lumpnum);
|
||||
Name[8] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
FTexture::~FTexture ()
|
||||
{
|
||||
FTexture *link = Wads.GetLinkedTexture(SourceLump);
|
||||
if (link == this) Wads.SetLinkedTexture(SourceLump, NULL);
|
||||
KillNative();
|
||||
}
|
||||
|
||||
|
|
@ -572,7 +577,6 @@ FDummyTexture::FDummyTexture ()
|
|||
HeightBits = 6;
|
||||
WidthBits = 6;
|
||||
WidthMask = 63;
|
||||
Name[0] = 0;
|
||||
UseType = TEX_Null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -220,8 +220,38 @@ FTextureID FTextureManager::CheckForTexture (const char *name, int usetype, BITF
|
|||
{
|
||||
if (firsttype == FTexture::TEX_Null) return FTextureID(0);
|
||||
if (firsttype == FTexture::TEX_FirstDefined && !(flags & TEXMAN_ReturnFirst)) return FTextureID(0);
|
||||
return FTextureID(firstfound);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!(flags & TEXMAN_ShortNameOnly))
|
||||
{
|
||||
// We intentionally only look for textures in subdirectories.
|
||||
// Any graphic being placed in the zip's root directory can not be found by this.
|
||||
if (strchr(name, '/'))
|
||||
{
|
||||
FTexture *const NO_TEXTURE = (FTexture*)-1;
|
||||
int lump = Wads.CheckNumForFullName(name);
|
||||
if (lump >= 0)
|
||||
{
|
||||
FTexture *tex = Wads.GetLinkedTexture(lump);
|
||||
if (tex == NO_TEXTURE) return FTextureID(-1);
|
||||
if (tex != NULL) return tex->id;
|
||||
if (flags & TEXMAN_DontCreate) return FTextureID(-1); // we only want to check, there's no need to create a texture if we don't have one yet.
|
||||
tex = FTexture::CreateTexture("", lump, FTexture::TEX_Override);
|
||||
if (tex != NULL)
|
||||
{
|
||||
Wads.SetLinkedTexture(lump, tex);
|
||||
return AddTexture(tex);
|
||||
}
|
||||
else
|
||||
{
|
||||
// mark this lump as having no valid texture so that we don't have to retry creating one later.
|
||||
Wads.SetLinkedTexture(lump, NO_TEXTURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
return FTextureID(firstfound);
|
||||
}
|
||||
|
||||
return FTextureID(-1);
|
||||
|
|
@ -273,30 +303,6 @@ int FTextureManager::ListTextures (const char *name, TArray<FTextureID> &list)
|
|||
return list.Size();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FTextureManager :: FindTextureByLumpNum
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FTextureID FTextureManager::FindTextureByLumpNum (int lumpnum)
|
||||
{
|
||||
if (lumpnum < 0)
|
||||
{
|
||||
return FTextureID(-1);
|
||||
}
|
||||
// This can't use hashing because using ReplaceTexture would break the hash chains. :(
|
||||
for(unsigned i = 0; i <Textures.Size(); i++)
|
||||
{
|
||||
if (Textures[i].Texture->SourceLump == lumpnum)
|
||||
{
|
||||
return FTextureID(i);
|
||||
}
|
||||
}
|
||||
return FTextureID(-1);
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FTextureManager :: GetTextures
|
||||
|
|
@ -367,7 +373,7 @@ FTextureID FTextureManager::AddTexture (FTexture *texture)
|
|||
// Later textures take precedence over earlier ones
|
||||
|
||||
// Textures without name can't be looked for
|
||||
if (texture->Name[0] != 0)
|
||||
if (texture->Name[0] != '\0')
|
||||
{
|
||||
bucket = int(MakeKey (texture->Name) % HASH_SIZE);
|
||||
hash = HashFirst[bucket];
|
||||
|
|
@ -423,12 +429,12 @@ void FTextureManager::ReplaceTexture (FTextureID picnum, FTexture *newtexture, b
|
|||
|
||||
FTexture *oldtexture = Textures[index].Texture;
|
||||
|
||||
strcpy (newtexture->Name, oldtexture->Name);
|
||||
newtexture->Name = oldtexture->Name;
|
||||
newtexture->UseType = oldtexture->UseType;
|
||||
Textures[index].Texture = newtexture;
|
||||
|
||||
newtexture->id = oldtexture->id;
|
||||
if (free)
|
||||
if (free && !oldtexture->bKeepAround)
|
||||
{
|
||||
delete oldtexture;
|
||||
}
|
||||
|
|
@ -482,9 +488,7 @@ void FTextureManager::AddGroup(int wadnum, int ns, int usetype)
|
|||
{
|
||||
int firsttx = Wads.GetFirstLump(wadnum);
|
||||
int lasttx = Wads.GetLastLump(wadnum);
|
||||
char name[9];
|
||||
|
||||
name[8] = 0;
|
||||
FString Name;
|
||||
|
||||
// Go from first to last so that ANIMDEFS work as expected. However,
|
||||
// to avoid duplicates (and to keep earlier entries from overriding
|
||||
|
|
@ -495,9 +499,9 @@ void FTextureManager::AddGroup(int wadnum, int ns, int usetype)
|
|||
{
|
||||
if (Wads.GetLumpNamespace(firsttx) == ns)
|
||||
{
|
||||
Wads.GetLumpName (name, firsttx);
|
||||
Wads.GetLumpName (Name, firsttx);
|
||||
|
||||
if (Wads.CheckNumForName (name, ns) == firsttx)
|
||||
if (Wads.CheckNumForName (Name, ns) == firsttx)
|
||||
{
|
||||
CreateTexture (firsttx, usetype);
|
||||
}
|
||||
|
|
@ -505,7 +509,7 @@ void FTextureManager::AddGroup(int wadnum, int ns, int usetype)
|
|||
}
|
||||
else if (ns == ns_flats && Wads.GetLumpFlags(firsttx) & LUMPF_MAYBEFLAT)
|
||||
{
|
||||
if (Wads.CheckNumForName (name, ns) < firsttx)
|
||||
if (Wads.CheckNumForName (Name, ns) < firsttx)
|
||||
{
|
||||
CreateTexture (firsttx, usetype);
|
||||
}
|
||||
|
|
@ -525,7 +529,7 @@ void FTextureManager::AddHiresTextures (int wadnum)
|
|||
int firsttx = Wads.GetFirstLump(wadnum);
|
||||
int lasttx = Wads.GetLastLump(wadnum);
|
||||
|
||||
char name[9];
|
||||
FString Name;
|
||||
TArray<FTextureID> tlist;
|
||||
|
||||
if (firsttx == -1 || lasttx == -1)
|
||||
|
|
@ -533,18 +537,16 @@ void FTextureManager::AddHiresTextures (int wadnum)
|
|||
return;
|
||||
}
|
||||
|
||||
name[8] = 0;
|
||||
|
||||
for (;firsttx <= lasttx; ++firsttx)
|
||||
{
|
||||
if (Wads.GetLumpNamespace(firsttx) == ns_hires)
|
||||
{
|
||||
Wads.GetLumpName (name, firsttx);
|
||||
Wads.GetLumpName (Name, firsttx);
|
||||
|
||||
if (Wads.CheckNumForName (name, ns_hires) == firsttx)
|
||||
if (Wads.CheckNumForName (Name, ns_hires) == firsttx)
|
||||
{
|
||||
tlist.Clear();
|
||||
int amount = ListTextures(name, tlist);
|
||||
int amount = ListTextures(Name, tlist);
|
||||
if (amount == 0)
|
||||
{
|
||||
// A texture with this name does not yet exist
|
||||
|
|
@ -588,14 +590,13 @@ void FTextureManager::AddHiresTextures (int wadnum)
|
|||
void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
|
||||
{
|
||||
int remapLump, lastLump;
|
||||
char src[9];
|
||||
FString src;
|
||||
bool is32bit;
|
||||
int width, height;
|
||||
int type, mode;
|
||||
TArray<FTextureID> tlist;
|
||||
|
||||
lastLump = 0;
|
||||
src[8] = '\0';
|
||||
|
||||
while ((remapLump = Wads.FindLump(lumpname, &lastLump)) != -1)
|
||||
{
|
||||
|
|
@ -672,7 +673,7 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
|
|||
FString base = ExtractFileBase(sc.String, false);
|
||||
if (!base.IsEmpty())
|
||||
{
|
||||
strncpy(src, base, 8);
|
||||
src = base.Left(8);
|
||||
|
||||
int lumpnum = Wads.CheckNumForFullName(sc.String, true, ns_patches);
|
||||
if (lumpnum == -1) lumpnum = Wads.CheckNumForFullName(sc.String, true, ns_graphics);
|
||||
|
|
@ -695,7 +696,7 @@ void FTextureManager::LoadTextureDefs(int wadnum, const char *lumpname)
|
|||
// Replace the entire texture and adjust the scaling and offset factors.
|
||||
newtex->bWorldPanning = true;
|
||||
newtex->SetScaledSize(width, height);
|
||||
memcpy(newtex->Name, src, sizeof(newtex->Name));
|
||||
newtex->Name = src;
|
||||
|
||||
FTextureID oldtex = TexMan.CheckForTexture(src, FTexture::TEX_MiscPatch);
|
||||
if (oldtex.isValid())
|
||||
|
|
@ -751,7 +752,7 @@ void FTextureManager::AddPatches (int lumpnum)
|
|||
char name[9];
|
||||
|
||||
*file >> numpatches;
|
||||
name[8] = 0;
|
||||
name[8] = '\0';
|
||||
|
||||
for (i = 0; i < numpatches; ++i)
|
||||
{
|
||||
|
|
@ -833,9 +834,8 @@ void FTextureManager::AddTexturesForWad(int wadnum)
|
|||
for (int i= firsttx; i <= lasttx; i++)
|
||||
{
|
||||
bool skin = false;
|
||||
char name[9];
|
||||
Wads.GetLumpName(name, i);
|
||||
name[8]=0;
|
||||
FString Name;
|
||||
Wads.GetLumpName(Name, i);
|
||||
|
||||
// Ignore anything not in the global namespace
|
||||
int ns = Wads.GetLumpNamespace(i);
|
||||
|
|
@ -861,20 +861,20 @@ void FTextureManager::AddTexturesForWad(int wadnum)
|
|||
if (Wads.CheckLumpName(i, "BEHAVIOR")) continue;
|
||||
|
||||
// Don't bother looking at this lump if something later overrides it.
|
||||
if (Wads.CheckNumForName(name, ns_graphics) != i) continue;
|
||||
if (Wads.CheckNumForName(Name, ns_graphics) != i) continue;
|
||||
|
||||
// skip this if it has already been added as a wall patch.
|
||||
if (CheckForTexture(name, FTexture::TEX_WallPatch, 0).Exists()) continue;
|
||||
if (CheckForTexture(Name, FTexture::TEX_WallPatch, 0).Exists()) continue;
|
||||
}
|
||||
else if (ns == ns_graphics)
|
||||
{
|
||||
// Don't bother looking this lump if something later overrides it.
|
||||
if (Wads.CheckNumForName(name, ns_graphics) != i) continue;
|
||||
if (Wads.CheckNumForName(Name, ns_graphics) != i) continue;
|
||||
}
|
||||
else if (ns >= ns_firstskin)
|
||||
{
|
||||
// Don't bother looking this lump if something later overrides it.
|
||||
if (Wads.CheckNumForName(name, ns) != i) continue;
|
||||
if (Wads.CheckNumForName(Name, ns) != i) continue;
|
||||
skin = true;
|
||||
}
|
||||
else continue;
|
||||
|
|
@ -949,7 +949,7 @@ void FTextureManager::SortTexturesByType(int start, int end)
|
|||
{
|
||||
if (newtextures[j] != NULL)
|
||||
{
|
||||
Printf("Texture %s has unknown type!\n", newtextures[j]->Name);
|
||||
Printf("Texture %s has unknown type!\n", newtextures[j]->Name.GetChars());
|
||||
AddTexture(newtextures[j]);
|
||||
}
|
||||
}
|
||||
|
|
@ -964,6 +964,7 @@ void FTextureManager::SortTexturesByType(int start, int end)
|
|||
void FTextureManager::Init()
|
||||
{
|
||||
DeleteAll();
|
||||
SpriteFrames.Clear();
|
||||
// Init Build Tile data if it hasn't been done already
|
||||
if (BuildTileFiles.Size() == 0) CountBuildTiles ();
|
||||
FTexture::InitGrayMap();
|
||||
|
|
@ -1004,7 +1005,7 @@ void FTextureManager::Init()
|
|||
{
|
||||
if (wadlevelinfos[i].flags & LEVEL_DOUBLESKY)
|
||||
{
|
||||
FTextureID picnum = CheckForTexture (wadlevelinfos[i].skypic1, FTexture::TEX_Wall, false);
|
||||
FTextureID picnum = CheckForTexture (wadlevelinfos[i].SkyPic1, FTexture::TEX_Wall, false);
|
||||
if (picnum.isValid())
|
||||
{
|
||||
Textures[picnum.GetIndex()].Texture->SetFrontSkyLayer ();
|
||||
|
|
@ -1093,8 +1094,15 @@ void FTextureManager::WriteTexture (FArchive &arc, int picnum)
|
|||
pic = Textures[picnum].Texture;
|
||||
}
|
||||
|
||||
arc.WriteName (pic->Name);
|
||||
arc.WriteCount (pic->UseType);
|
||||
if (Wads.GetLinkedTexture(pic->SourceLump) == pic)
|
||||
{
|
||||
arc.WriteName(Wads.GetLumpFullName(pic->SourceLump));
|
||||
}
|
||||
else
|
||||
{
|
||||
arc.WriteName(pic->Name);
|
||||
}
|
||||
arc.WriteCount(pic->UseType);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
|||
|
|
@ -107,8 +107,6 @@ struct FDoorAnimation
|
|||
FName CloseSound;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Patches.
|
||||
// A patch holds one or more columns.
|
||||
// Patches are used for sprites and all masked pictures, and we compose
|
||||
|
|
@ -119,7 +117,7 @@ struct patch_t
|
|||
SWORD height;
|
||||
SWORD leftoffset; // pixels to the left of origin
|
||||
SWORD topoffset; // pixels below the origin
|
||||
DWORD columnofs[8]; // only [width] used
|
||||
DWORD columnofs[]; // only [width] used
|
||||
// the [0] is &columnofs[width]
|
||||
};
|
||||
|
||||
|
|
@ -159,11 +157,7 @@ public:
|
|||
int SourceLump;
|
||||
FTextureID id;
|
||||
|
||||
union
|
||||
{
|
||||
char Name[9];
|
||||
DWORD dwName; // Used with sprites
|
||||
};
|
||||
FString Name;
|
||||
BYTE UseType; // This texture's primary purpose
|
||||
|
||||
BYTE bNoDecals:1; // Decals should not stick to texture
|
||||
|
|
@ -177,6 +171,7 @@ public:
|
|||
// fully composited before subjected to any kind of postprocessing instead of
|
||||
// doing it per patch.
|
||||
BYTE bMultiPatch:1; // This is a multipatch texture (we really could use real type info for textures...)
|
||||
BYTE bKeepAround:1; // This texture was used as part of a multi-patch texture. Do not free it.
|
||||
|
||||
WORD Rotations;
|
||||
SWORD SkyOffset;
|
||||
|
|
@ -218,7 +213,6 @@ public:
|
|||
virtual int GetSourceLump() { return SourceLump; }
|
||||
virtual FTexture *GetRedirect(bool wantwarped);
|
||||
virtual FTexture *GetRawTexture(); // for FMultiPatchTexture to override
|
||||
FTextureID GetID() const { return id; }
|
||||
|
||||
virtual void Unload () = 0;
|
||||
|
||||
|
|
@ -364,12 +358,13 @@ public:
|
|||
TEXMAN_TryAny = 1,
|
||||
TEXMAN_Overridable = 2,
|
||||
TEXMAN_ReturnFirst = 4,
|
||||
TEXMAN_AllowSkins = 8
|
||||
TEXMAN_AllowSkins = 8,
|
||||
TEXMAN_ShortNameOnly = 16,
|
||||
TEXMAN_DontCreate = 32
|
||||
};
|
||||
|
||||
FTextureID CheckForTexture (const char *name, int usetype, BITFIELD flags=TEXMAN_TryAny);
|
||||
FTextureID GetTexture (const char *name, int usetype, BITFIELD flags=0);
|
||||
FTextureID FindTextureByLumpNum (int lumpnum);
|
||||
int ListTextures (const char *name, TArray<FTextureID> &list);
|
||||
|
||||
void AddTexturesLump (const void *lumpdata, int lumpsize, int deflumpnum, int patcheslump, int firstdup=0, bool texture1=false);
|
||||
|
|
|
|||
|
|
@ -145,7 +145,6 @@ FTGATexture::FTGATexture (int lumpnum, TGAHeader * hdr)
|
|||
: FTexture(NULL, lumpnum), Pixels(0), Spans(0)
|
||||
{
|
||||
Wads.GetLumpName (Name, lumpnum);
|
||||
Name[8] = 0;
|
||||
Width = hdr->width;
|
||||
Height = hdr->height;
|
||||
// Alpha channel is used only for 32 bit RGBA and paletted images with RGBA palettes.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue