From 18af8a57cf6c84e155f5fec6e3e49abf7f40fdbe Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Wed, 12 Jul 2006 03:35:55 +0000 Subject: [PATCH] - Restored the previous level flag values to avoid needlessly breaking some savegames at this point in time. - Fixed: R_ClearPlanes() did not clear skybox planes for a full clear. - Streamlined zip file loading by delaying the processing of the local file header until it is actually needed. SVN r247 (trunk) --- docs/rh-log.txt | 7 ++++++ src/g_level.h | 18 +++++++-------- src/r_plane.cpp | 7 +++--- src/r_segs.cpp | 1 + src/w_wad.cpp | 58 +++++++++++++++++++++++++++++++++++++------------ 5 files changed, 65 insertions(+), 26 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index d9dc532fc..fa4ed9a74 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,10 @@ +July 11, 2006 +- Restored the previous level flag values to avoid needlessly breaking some + savegames at this point in time. +- Fixed: R_ClearPlanes() did not clear skybox planes for a full clear. +- Streamlined zip file loading by delaying the processing of the local file + header until it is actually needed. + July 11, 2006 (Changes by Graf Zahl) - Changed the additive scrollers option into a compatibility flag so that it can be changed from the menu. diff --git a/src/g_level.h b/src/g_level.h index b73c064ab..c7711aea3 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -93,19 +93,19 @@ #define LEVEL_LAXMONSTERACTIVATION UCONST64(0x400000000) // Monsters can open doors depending on the door speed #define LEVEL_LAXACTIVATIONMAPINFO UCONST64(0x800000000) // LEVEL_LAXMONSTERACTIVATION is not a default. -#define LEVEL_CAVERNS_OF_DARKNESS UCONST64(0x1000000000) // to translate the special sector types of CoD. +#define LEVEL_CAVERNS_OF_DARKNESS UCONST64(0x2000000000) // to translate the special sector types of CoD. -#define LEVEL_KEEPFULLINVENTORY UCONST64(0x2000000000) // doesn't reduce the amount of inventory items to 1 +#define LEVEL_KEEPFULLINVENTORY UCONST64(0x4000000000) // doesn't reduce the amount of inventory items to 1 -#define LEVEL_MUSICDEFINED UCONST64(0x4000000000) // a marker to disable the $map command in SNDINFO for this map -#define LEVEL_MONSTERFALLINGDAMAGE UCONST64(0x8000000000) -#define LEVEL_CLIPMIDTEX UCONST64(0x10000000000) -#define LEVEL_WRAPMIDTEX UCONST64(0x20000000000) +#define LEVEL_MUSICDEFINED UCONST64(0x8000000000) // a marker to disable the $map command in SNDINFO for this map +#define LEVEL_MONSTERFALLINGDAMAGE UCONST64(0x10000000000) +#define LEVEL_CLIPMIDTEX UCONST64(0x20000000000) +#define LEVEL_WRAPMIDTEX UCONST64(0x40000000000) -#define LEVEL_CROUCH_NO UCONST64(0x40000000000) -#define LEVEL_CROUCH_YES UCONST64(0x80000000000) +#define LEVEL_CROUCH_NO UCONST64(0x80000000000) +#define LEVEL_CROUCH_YES UCONST64(0x100000000000) -#define LEVEL_PAUSE_MUSIC_IN_MENUS UCONST64(0x100000000000) +#define LEVEL_PAUSE_MUSIC_IN_MENUS UCONST64(0x200000000000) struct acsdefered_s; diff --git a/src/r_plane.cpp b/src/r_plane.cpp index f02aff714..7aa2f977e 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -456,9 +456,10 @@ extern int ConBottom; void R_ClearPlanes (bool fullclear) { - int i; - - for (i = 0; i < MAXVISPLANES; i++) // new code -- killough + int i, max; + + max = fullclear ? MAXVISPLANES : MAXVISPLANES-1; + for (i = 0; i <= max; i++) // new code -- killough for (*freehead = visplanes[i], visplanes[i] = NULL; *freehead; ) freehead = &(*freehead)->next; diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 03d4ca715..340624fcd 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -1031,6 +1031,7 @@ void R_RenderSegLoop () short bottom = floorclip[x]; if (top < bottom) { + assert (bottom <= viewheight); floorplane->top[x] = top; floorplane->bottom[x] = bottom; } diff --git a/src/w_wad.cpp b/src/w_wad.cpp index c00493a35..d677a9974 100644 --- a/src/w_wad.cpp +++ b/src/w_wad.cpp @@ -96,10 +96,10 @@ struct FWadCollection::LumpRecord enum { - LUMPF_BLOODCRYPT = 1, // Lump uses Blood-style encryption - LUMPF_COMPRESSED = 2, // Zip-compressed - LUMPF_ZIPFILE = 4, // Inside a Zip file - used to enforce use of special directories insize Zips - + LUMPF_BLOODCRYPT = 1, // Lump uses Blood-style encryption + LUMPF_COMPRESSED = 2, // Zip-compressed + LUMPF_ZIPFILE = 4, // Inside a Zip file - used to enforce use of special directories insize Zips + LUMPF_NEEDFILESTART = 8, // Still need to process local file header to find file start inside a zip }; class FWadCollection::WadFileRecord : public FileReader @@ -535,7 +535,6 @@ void FWadCollection::AddFile (const char *filename, const char * data, int lengt FZipFileInfo * zip_fh = (FZipFileInfo*)dirptr; char name[256]; char base[256]; - FZipLocalHeader localHeader; int len = LittleShort(zip_fh->wFileNameSize); strncpy(name, dirptr + sizeof(FZipFileInfo), MIN(len, 255)); @@ -592,7 +591,6 @@ void FWadCollection::AddFile (const char *filename, const char * data, int lengt uppercopy(lump_p->name, base); lump_p->name[8] = 0; lump_p->fullname = copystring(name); - lump_p->position = LittleLong(zip_fh->dwFileOffset) + sizeof(FZipLocalHeader) + LittleShort(zip_fh->wFileNameSize); lump_p->size = zip_fh->dwSize; // Map some directories to WAD namespaces. @@ -637,13 +635,9 @@ void FWadCollection::AddFile (const char *filename, const char * data, int lengt } } - // Now it gets ugly: We must retrieve the actual offset where the data begins. - // Thanks to some bad file format design this has to do some additional steps. - - // Read the local file header, which contains the correct extra field size (Info-ZIP!). - wadinfo->Seek(LittleLong(zip_fh->dwFileOffset), SEEK_SET); - wadinfo->Read(&localHeader, sizeof(localHeader)); - lump_p->position += LittleShort(localHeader.wExtraSize); + // The start of the file will be determined the first time it is accessed. + lump_p->flags |= LUMPF_NEEDFILESTART; + lump_p->position = LittleLong(zip_fh->dwFileOffset); lump_p++; } // Resize the lump record array to its actual size @@ -1663,7 +1657,26 @@ FWadLump FWadCollection::OpenLumpNum (int lump) l = &LumpInfo[lump]; wad = Wads[l->wadnum]; - wad->Seek (l->position, SEEK_SET); + + if (l->flags & LUMPF_NEEDFILESTART) + { + // This file is inside a zip and has not been opened before. + // Position points to the start of the local file header, which we must + // read and skip so that we can get to the actual file data. + FZipLocalHeader localHeader; + int skiplen; + + wad->Seek (l->position, SEEK_SET); + wad->Read (&localHeader, sizeof(localHeader)); + skiplen = LittleShort(localHeader.wFileNameSize) + LittleShort(localHeader.wExtraSize); + l->position += sizeof(localHeader) + skiplen; + wad->Seek (skiplen, SEEK_CUR); + l->flags &= ~LUMPF_NEEDFILESTART; + } + else + { + wad->Seek (l->position, SEEK_SET); + } if (l->flags & LUMPF_COMPRESSED) { @@ -1713,6 +1726,23 @@ FWadLump *FWadCollection::ReopenLumpNum (int lump) l = &LumpInfo[lump]; wad = Wads[l->wadnum]; + if (l->flags & LUMPF_NEEDFILESTART) + { + // This file is inside a zip and has not been opened before. + // Position points to the start of the local file header, which we must + // read and skip so that we can get to the actual file data. + FZipLocalHeader localHeader; + int skiplen; + int address; + + address = wad->Tell(); + wad->Seek (l->position, SEEK_SET); + wad->Read (&localHeader, sizeof(localHeader)); + skiplen = LittleShort(localHeader.wFileNameSize) + LittleShort(localHeader.wExtraSize); + l->position += sizeof(localHeader) + skiplen; + l->flags &= ~LUMPF_NEEDFILESTART; + wad->Seek (address, SEEK_SET); + } if (l->flags & LUMPF_COMPRESSED) {