Bump the lightmap lump version to invalidate really old (ZDRay) lightmaps.

This commit is contained in:
nashmuhandes 2024-12-21 18:43:07 +08:00
commit f455990b7b
3 changed files with 10 additions and 6 deletions

View file

@ -3033,12 +3033,12 @@ bool MapLoader::LoadLightmap(MapData* map)
return false;
int version = fr.ReadInt32();
if (version < 3)
if (version < LIGHTMAPVER)
{
Printf(PRINT_HIGH, "LoadLightmap: This is an old unsupported version of the lightmap lump. Please rebuild the map with a newer version of zdray.\n");
Printf(PRINT_HIGH, "LoadLightmap: This is an old unsupported version of the lightmap lump. Please rebuild the map with the console commands 'deletelightmap', and then 'savelightmap'.\n");
return false;
}
else if (version != 3)
else if (version != LIGHTMAPVER)
{
Printf(PRINT_HIGH, "LoadLightmap: unsupported lightmap lump version\n");
return false;

View file

@ -2002,11 +2002,13 @@ void SaveMapLumps(FileWriter* writer, const TArray<MapLump>& lumps, const char*
void DoomLevelMesh::SaveLightmapLump(FLevelLocals& doomMap)
{
/*
// LIGHTMAP V3 pseudo-C specification:
// LIGHTMAP version 4 pseudo-C specification:
(Please update LIGHTMAPVER in version.h when upgrading this)
struct LightmapLump
{
int version = 2;
int version;
uint32_t tileCount;
uint32_t pixelCount;
uint32_t uvCount;
@ -2046,7 +2048,7 @@ void DoomLevelMesh::SaveLightmapLump(FLevelLocals& doomMap)
}
}
const int version = 3;
const int version = LIGHTMAPVER;
const uint32_t headerSize = sizeof(int) + 2 * sizeof(uint32_t);
const uint32_t bytesPerTileEntry = sizeof(uint32_t) * 4 + sizeof(uint16_t) * 2 + sizeof(float) * 9;

View file

@ -127,5 +127,7 @@ const int SAVEPICHEIGHT = 162;
const int VID_MIN_WIDTH = 320;
const int VID_MIN_HEIGHT = 200;
// Lightmap lump version
#define LIGHTMAPVER 4
#endif //__VERSION_H__