From 054e5411bd9cd996a35b177b84ceb20636076d20 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 18 Mar 2010 01:07:50 +0000 Subject: [PATCH] - Fixed: Checking for BUILD maps only worked if they came from unencrypted and uncompressed sources. SVN r2216 (trunk) --- src/p_buildmap.cpp | 6 ++++-- src/p_setup.cpp | 17 ++++++++++------- src/resourcefiles/file_rff.cpp | 10 ++++++++-- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/p_buildmap.cpp b/src/p_buildmap.cpp index 5799ef563..2ea8632b3 100644 --- a/src/p_buildmap.cpp +++ b/src/p_buildmap.cpp @@ -145,8 +145,10 @@ static void Decrypt (void *to, const void *from, int len, int key); bool P_IsBuildMap(MapData *map) { DWORD len = map->Size(ML_LABEL); - if (len < 4) return false; - + if (len < 4) + { + return false; + } BYTE *data = new BYTE[len]; map->Seek(ML_LABEL); diff --git a/src/p_setup.cpp b/src/p_setup.cpp index c1a345d8e..f4d2fb379 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -294,8 +294,10 @@ MapData *P_OpenMapData(const char * mapname) { // 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. - map->MapLumps[0].FilePos = Wads.GetLumpOffset(lump_name); + map->MapLumps[0].FilePos = 0; map->MapLumps[0].Size = Wads.LumpLength(lump_name); + map->file = Wads.ReopenLumpNum(lump_name); + map->CloseOnDestruct = true; if (!P_IsBuildMap(map)) { delete map; @@ -312,6 +314,9 @@ MapData *P_OpenMapData(const char * mapname) if (map->Encrypted) { // 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)) { delete map; @@ -322,7 +327,7 @@ MapData *P_OpenMapData(const char * mapname) 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++) { @@ -3380,7 +3385,7 @@ void P_SetupLevel (char *lumpname, int position) P_FreeLevelData (); interpolator.ClearInterpolations(); // [RH] Nothing to interpolate on a fresh level. - MapData * map = P_OpenMapData(lumpname); + MapData *map = P_OpenMapData(lumpname); if (map == NULL) { 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]; map->Seek(0); map->file->Read(mapdata, map->MapLumps[0].Size); - if (map->Encrypted) - { - BloodCrypt (mapdata, 0, MIN (map->MapLumps[0].Size, 256)); - } + times[0].Clock(); buildmap = P_LoadBuildMap (mapdata, map->MapLumps[0].Size, &buildthings, &numbuildthings); + times[0].Unclock(); delete[] mapdata; } diff --git a/src/resourcefiles/file_rff.cpp b/src/resourcefiles/file_rff.cpp index bb2616c2b..f2854031c 100644 --- a/src/resourcefiles/file_rff.cpp +++ b/src/resourcefiles/file_rff.cpp @@ -197,8 +197,14 @@ FileReader *FRFFLump::GetReader() { // Don't return the reader if this lump is encrypted // In that case always force caching of the lump - if (!(Flags & LUMPF_BLOODCRYPT)) return FUncompressedLump::GetReader(); - else return NULL; + if (!(Flags & LUMPF_BLOODCRYPT)) + { + return FUncompressedLump::GetReader(); + } + else + { + return NULL; + } } //==========================================================================