After experiencing some odd situations in Memento Mori 2 which needs this compatibility flag in a few maps I looked at all the code involved.
Then I found this in FTextureManager::AddTexturesLump:
Code: Select all
if (i == 1 && texture1)
{
// The very first texture is just a dummy. Copy its dimensions to texture 0.
// It still needs to be created in case someone uses it by name.
offset = LONG(directory[0]);
const maptexture_t *tex = (const maptexture_t *)((const BYTE *)maptex + offset);
FDummyTexture *tex0 = static_cast<FDummyTexture *>(Textures[0].Texture);
tex0->SetSize (SAFESHORT(tex->width), SAFESHORT(tex->height));
}
It reads the number of textures in the TEXTURE1 lump and treats it as the offset to the first texture. Result: Some random value gets set as height of texture 0 which breaks the compatibility flag.
It should be:
After experiencing some odd situations in Memento Mori 2 which needs this compatibility flag in a few maps I looked at all the code involved.
Then I found this in FTextureManager::AddTexturesLump:
[code]
if (i == 1 && texture1)
{
// The very first texture is just a dummy. Copy its dimensions to texture 0.
// It still needs to be created in case someone uses it by name.
offset = LONG(directory[0]);
const maptexture_t *tex = (const maptexture_t *)((const BYTE *)maptex + offset);
FDummyTexture *tex0 = static_cast<FDummyTexture *>(Textures[0].Texture);
tex0->SetSize (SAFESHORT(tex->width), SAFESHORT(tex->height));
}
[/code]
It reads the number of textures in the TEXTURE1 lump and treats it as the offset to the first texture. Result: Some random value gets set as height of texture 0 which breaks the compatibility flag.
It should be:
[code]
offset = LONG(directory[1]);
[/code]