From e69f90076d6e60069cf6f3a6405f5d0406ec923c Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 11 Jun 2009 22:58:06 +0000 Subject: [PATCH] - Changed wad namespacing so that wads with a missing end marker will be loaded as if they had one more lump with that end marker. This matches the behaviour of previously released ZDooms. (The warning is still present, so there's no excuse to release more wads like this.) SVN r1667 (trunk) --- docs/rh-log.txt | 4 ++++ src/resourcefiles/file_wad.cpp | 13 ++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 10fbe3d950..b4fe91dceb 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,8 @@ June 10, 2009 +- Changed wad namespacing so that wads with a missing end marker will be + loaded as if they had one more lump with that end marker. This matches the + behaviour of previously released ZDooms. (The warning is still present, so + there's no excuse to release more wads like this.) - Moved Raw Input processing into a seperate method of FInputDevice so that all the devices can share the same setup code. diff --git a/src/resourcefiles/file_wad.cpp b/src/resourcefiles/file_wad.cpp index 6ee0e22cb9..1df3ef2acb 100644 --- a/src/resourcefiles/file_wad.cpp +++ b/src/resourcefiles/file_wad.cpp @@ -224,7 +224,7 @@ void FWadFile::SetNamespace(const char *startmarker, const char *endmarker, name i++; continue; } - // same for x_START markers + // same for x_END markers while (i < markers.Size()-1 && (markers[i].markertype == 1 && markers[i+1].markertype == 1)) { Printf(TEXTCOLOR_YELLOW"WARNING: duplicate %s marker found.\n", endmarker); @@ -235,13 +235,16 @@ void FWadFile::SetNamespace(const char *startmarker, const char *endmarker, name if (i >= markers.Size()) { Printf(TEXTCOLOR_YELLOW"WARNING: %s marker without corresponding %s found.\n", startmarker, endmarker); - return; + end = NumLumps; + } + else + { + end = markers[i++].index; } - end = i++; // we found a marked block - DPrintf("Found %s block at (%d-%d)\n", startmarker, markers[start].index, markers[end].index); - for(int j = markers[start].index+1; j < markers[end].index; j++) + DPrintf("Found %s block at (%d-%d)\n", startmarker, markers[start].index, end); + for(int j = markers[start].index + 1; j < end; j++) { if (Lumps[j].Namespace != ns_global) {