- fixed: FMultiPatchTexture::MakeTexture was missing a range check for the

special colormap index.


SVN r1928 (trunk)
This commit is contained in:
Christoph Oelckers 2009-10-18 14:08:32 +00:00
parent dcd4c7fe7a
commit 8390184839
5 changed files with 20 additions and 2 deletions

View file

@ -1,3 +1,7 @@
October 18, 2009 (Changes by Graf Zahl)
- fixed: FMultiPatchTexture::MakeTexture was missing a range check for the
special colormap index.
October 17, 2009 (Changes by Graf Zahl) October 17, 2009 (Changes by Graf Zahl)
- Fixed: 3DMidtex checks were treating the Null texture as a valid texture. - Fixed: 3DMidtex checks were treating the Null texture as a valid texture.
- Fixed: The rail sound's position was not clamped to the actual range between - Fixed: The rail sound's position was not clamped to the actual range between

View file

@ -429,7 +429,7 @@ BYTE *GetBlendMap(PalEntry blend, BYTE *blendwork)
return TranslationToTable(TRANSLATION(TRANSLATION_Standard, 7))->Remap; return TranslationToTable(TRANSLATION(TRANSLATION_Standard, 7))->Remap;
default: default:
if (blend >= BLEND_SPECIALCOLORMAP1) if (blend >= BLEND_SPECIALCOLORMAP1 && blend < BLEND_SPECIALCOLORMAP1 + SpecialColormaps.Size())
{ {
return SpecialColormaps[blend - BLEND_SPECIALCOLORMAP1].Colormap; return SpecialColormaps[blend - BLEND_SPECIALCOLORMAP1].Colormap;
} }

View file

@ -146,6 +146,7 @@ FTexture::FTexture (const char *name, int lumpnum)
bMasked(true), bAlphaTexture(false), bHasCanvas(false), bWarped(0), bComplex(false), bMasked(true), bAlphaTexture(false), bHasCanvas(false), bWarped(0), bComplex(false),
Rotations(0xFFFF), Width(0), Height(0), WidthMask(0), Native(NULL) Rotations(0xFFFF), Width(0), Height(0), WidthMask(0), Native(NULL)
{ {
id.SetInvalid();
if (name != NULL) if (name != NULL)
{ {
uppercopy(Name, name); uppercopy(Name, name);

View file

@ -320,7 +320,7 @@ FTextureID FTextureManager::AddTexture (FTexture *texture)
int trans = Textures.Push (hasher); int trans = Textures.Push (hasher);
Translation.Push (trans); Translation.Push (trans);
if (bucket >= 0) HashFirst[bucket] = trans; if (bucket >= 0) HashFirst[bucket] = trans;
return FTextureID(trans); return (texture->id = FTextureID(trans));
} }
//========================================================================== //==========================================================================
@ -365,10 +365,15 @@ void FTextureManager::ReplaceTexture (FTextureID picnum, FTexture *newtexture, b
newtexture->UseType = oldtexture->UseType; newtexture->UseType = oldtexture->UseType;
Textures[index].Texture = newtexture; Textures[index].Texture = newtexture;
newtexture->id = oldtexture->id;
if (free) if (free)
{ {
delete oldtexture; delete oldtexture;
} }
else
{
oldtexture->id.SetInvalid();
}
} }
//========================================================================== //==========================================================================

View file

@ -100,6 +100,7 @@ public:
fixed_t yScale; fixed_t yScale;
int SourceLump; int SourceLump;
FTextureID id;
union union
{ {
@ -156,6 +157,7 @@ public:
virtual bool UseBasePalette(); virtual bool UseBasePalette();
virtual int GetSourceLump() { return SourceLump; } virtual int GetSourceLump() { return SourceLump; }
virtual FTexture *GetRedirect(bool wantwarped); virtual FTexture *GetRedirect(bool wantwarped);
FTextureID GetID() const { return id; }
virtual void Unload () = 0; virtual void Unload () = 0;
@ -278,6 +280,12 @@ public:
return Textures[Translation[texnum.texnum]].Texture; return Textures[Translation[texnum.texnum]].Texture;
} }
FTexture *ByIndexTranslated(int i)
{
if (unsigned(i) >= Textures.Size()) return NULL;
return Textures[Translation[i]].Texture;
}
void SetTranslation (FTextureID fromtexnum, FTextureID totexnum) void SetTranslation (FTextureID fromtexnum, FTextureID totexnum)
{ {
if ((size_t)fromtexnum.texnum < Translation.Size()) if ((size_t)fromtexnum.texnum < Translation.Size())