mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-16 09:11:17 +00:00
- Fixed: Checking for BUILD maps only worked if they came from unencrypted and
uncompressed sources. SVN r2216 (trunk)
This commit is contained in:
parent
970cf6f71b
commit
054e5411bd
3 changed files with 22 additions and 11 deletions
|
@ -145,8 +145,10 @@ static void Decrypt (void *to, const void *from, int len, int key);
|
||||||
bool P_IsBuildMap(MapData *map)
|
bool P_IsBuildMap(MapData *map)
|
||||||
{
|
{
|
||||||
DWORD len = map->Size(ML_LABEL);
|
DWORD len = map->Size(ML_LABEL);
|
||||||
if (len < 4) return false;
|
if (len < 4)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
BYTE *data = new BYTE[len];
|
BYTE *data = new BYTE[len];
|
||||||
|
|
||||||
map->Seek(ML_LABEL);
|
map->Seek(ML_LABEL);
|
||||||
|
|
|
@ -294,8 +294,10 @@ MapData *P_OpenMapData(const char * mapname)
|
||||||
{
|
{
|
||||||
// The following lump is from a different file so whatever this is,
|
// The following lump is from a different file so whatever this is,
|
||||||
// it is not a multi-lump Doom level so let's assume it is a Build map.
|
// it is not a multi-lump Doom level so let's assume it is a Build map.
|
||||||
map->MapLumps[0].FilePos = Wads.GetLumpOffset(lump_name);
|
map->MapLumps[0].FilePos = 0;
|
||||||
map->MapLumps[0].Size = Wads.LumpLength(lump_name);
|
map->MapLumps[0].Size = Wads.LumpLength(lump_name);
|
||||||
|
map->file = Wads.ReopenLumpNum(lump_name);
|
||||||
|
map->CloseOnDestruct = true;
|
||||||
if (!P_IsBuildMap(map))
|
if (!P_IsBuildMap(map))
|
||||||
{
|
{
|
||||||
delete map;
|
delete map;
|
||||||
|
@ -312,6 +314,9 @@ MapData *P_OpenMapData(const char * mapname)
|
||||||
|
|
||||||
if (map->Encrypted)
|
if (map->Encrypted)
|
||||||
{ // If it's encrypted, then it's a Blood file, presumably a map.
|
{ // If it's encrypted, then it's a Blood file, presumably a map.
|
||||||
|
map->file = Wads.ReopenLumpNum(lump_name);
|
||||||
|
map->CloseOnDestruct = true;
|
||||||
|
map->MapLumps[0].FilePos = 0;
|
||||||
if (!P_IsBuildMap(map))
|
if (!P_IsBuildMap(map))
|
||||||
{
|
{
|
||||||
delete map;
|
delete map;
|
||||||
|
@ -322,7 +327,7 @@ MapData *P_OpenMapData(const char * mapname)
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
if (stricmp(Wads.GetLumpFullName(lump_name + 1), "TEXTMAP"))
|
if (stricmp(Wads.GetLumpFullName(lump_name + 1), "TEXTMAP") != 0)
|
||||||
{
|
{
|
||||||
for(int i = 1;; i++)
|
for(int i = 1;; i++)
|
||||||
{
|
{
|
||||||
|
@ -3380,7 +3385,7 @@ void P_SetupLevel (char *lumpname, int position)
|
||||||
P_FreeLevelData ();
|
P_FreeLevelData ();
|
||||||
interpolator.ClearInterpolations(); // [RH] Nothing to interpolate on a fresh level.
|
interpolator.ClearInterpolations(); // [RH] Nothing to interpolate on a fresh level.
|
||||||
|
|
||||||
MapData * map = P_OpenMapData(lumpname);
|
MapData *map = P_OpenMapData(lumpname);
|
||||||
if (map == NULL)
|
if (map == NULL)
|
||||||
{
|
{
|
||||||
I_Error("Unable to open map '%s'\n", lumpname);
|
I_Error("Unable to open map '%s'\n", lumpname);
|
||||||
|
@ -3396,11 +3401,9 @@ void P_SetupLevel (char *lumpname, int position)
|
||||||
BYTE *mapdata = new BYTE[map->MapLumps[0].Size];
|
BYTE *mapdata = new BYTE[map->MapLumps[0].Size];
|
||||||
map->Seek(0);
|
map->Seek(0);
|
||||||
map->file->Read(mapdata, map->MapLumps[0].Size);
|
map->file->Read(mapdata, map->MapLumps[0].Size);
|
||||||
if (map->Encrypted)
|
times[0].Clock();
|
||||||
{
|
|
||||||
BloodCrypt (mapdata, 0, MIN<int> (map->MapLumps[0].Size, 256));
|
|
||||||
}
|
|
||||||
buildmap = P_LoadBuildMap (mapdata, map->MapLumps[0].Size, &buildthings, &numbuildthings);
|
buildmap = P_LoadBuildMap (mapdata, map->MapLumps[0].Size, &buildthings, &numbuildthings);
|
||||||
|
times[0].Unclock();
|
||||||
delete[] mapdata;
|
delete[] mapdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -197,8 +197,14 @@ FileReader *FRFFLump::GetReader()
|
||||||
{
|
{
|
||||||
// Don't return the reader if this lump is encrypted
|
// Don't return the reader if this lump is encrypted
|
||||||
// In that case always force caching of the lump
|
// In that case always force caching of the lump
|
||||||
if (!(Flags & LUMPF_BLOODCRYPT)) return FUncompressedLump::GetReader();
|
if (!(Flags & LUMPF_BLOODCRYPT))
|
||||||
else return NULL;
|
{
|
||||||
|
return FUncompressedLump::GetReader();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
Loading…
Reference in a new issue