- 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)
- 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

View File

@ -429,7 +429,7 @@ BYTE *GetBlendMap(PalEntry blend, BYTE *blendwork)
return TranslationToTable(TRANSLATION(TRANSLATION_Standard, 7))->Remap;
default:
if (blend >= BLEND_SPECIALCOLORMAP1)
if (blend >= BLEND_SPECIALCOLORMAP1 && blend < BLEND_SPECIALCOLORMAP1 + SpecialColormaps.Size())
{
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),
Rotations(0xFFFF), Width(0), Height(0), WidthMask(0), Native(NULL)
{
id.SetInvalid();
if (name != NULL)
{
uppercopy(Name, name);

View File

@ -320,7 +320,7 @@ FTextureID FTextureManager::AddTexture (FTexture *texture)
int trans = Textures.Push (hasher);
Translation.Push (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;
Textures[index].Texture = newtexture;
newtexture->id = oldtexture->id;
if (free)
{
delete oldtexture;
}
else
{
oldtexture->id.SetInvalid();
}
}
//==========================================================================

View File

@ -100,6 +100,7 @@ public:
fixed_t yScale;
int SourceLump;
FTextureID id;
union
{
@ -156,6 +157,7 @@ public:
virtual bool UseBasePalette();
virtual int GetSourceLump() { return SourceLump; }
virtual FTexture *GetRedirect(bool wantwarped);
FTextureID GetID() const { return id; }
virtual void Unload () = 0;
@ -278,6 +280,12 @@ public:
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)
{
if ((size_t)fromtexnum.texnum < Translation.Size())