diff --git a/specs/udmf_zdoom.txt b/specs/udmf_zdoom.txt index 15512d9f..7db91f30 100644 --- a/specs/udmf_zdoom.txt +++ b/specs/udmf_zdoom.txt @@ -1,5 +1,5 @@ =============================================================================== -Universal Doom Map Format ZDoom extensions v1.8 - 16.07.2009 +Universal Doom Map Format ZDoom extensions v1.9 - 17.04.2010 Copyright (c) 2008 Christoph Oelckers. @@ -38,7 +38,8 @@ between the TEXTMAP and ENDMAP lumps: BEHAVIOR = contains compiled ACS code DIALOGUE = contains compiled Strife conversation scripts. - ZNODES = Nodes (must be stored as compressed GL nodes) + ZNODES = Nodes (must be stored as extended GL nodes. Compression is allowed + but deprecated for portability reasons.) BLOCKMAP = blockmap. It is recommended not to include this lump in UDMF maps. REJECT = reject table. Recommended use is for special effects only. @@ -255,6 +256,9 @@ Added sidedef scaling properties and side specific clipmidtex and wrapmidtex. Added NoDecals sidedef option Fixed conversion specifications for TranslucentLine special. +1.9 17.04.2010 +Changed node specifications to deprecate compression of node lump. + =============================================================================== EOF =============================================================================== diff --git a/src/files.h b/src/files.h index 5ee70e3f..ebe9665a 100644 --- a/src/files.h +++ b/src/files.h @@ -8,7 +8,56 @@ #include "doomtype.h" #include "m_swap.h" -class FileReader +class FileReaderBase +{ +public: + virtual ~FileReaderBase() {} + virtual long Read (void *buffer, long len) = 0; + + FileReaderBase &operator>> (BYTE &v) + { + Read (&v, 1); + return *this; + } + + FileReaderBase &operator>> (SBYTE &v) + { + Read (&v, 1); + return *this; + } + + FileReaderBase &operator>> (WORD &v) + { + Read (&v, 2); + v = LittleShort(v); + return *this; + } + + FileReaderBase &operator>> (SWORD &v) + { + Read (&v, 2); + v = LittleShort(v); + return *this; + } + + FileReaderBase &operator>> (DWORD &v) + { + Read (&v, 4); + v = LittleLong(v); + return *this; + } + + FileReaderBase &operator>> (fixed_t &v) + { + Read (&v, 4); + v = LittleLong(v); + return *this; + } + +}; + + +class FileReader : public FileReaderBase { public: FileReader (); @@ -82,13 +131,13 @@ protected: }; // Wraps around a FileReader to decompress a zlib stream -class FileReaderZ +class FileReaderZ : public FileReaderBase { public: FileReaderZ (FileReader &file, bool zip=false); ~FileReaderZ (); - long Read (void *buffer, long len); + virtual long Read (void *buffer, long len); FileReaderZ &operator>> (BYTE &v) { @@ -144,7 +193,7 @@ private: }; // Wraps around a FileReader to decompress a bzip2 stream -class FileReaderBZ2 +class FileReaderBZ2 : public FileReaderBase { public: FileReaderBZ2 (FileReader &file); @@ -206,7 +255,7 @@ private: }; // Wraps around a FileReader to decompress a lzma stream -class FileReaderLZMA +class FileReaderLZMA : public FileReaderBase { public: FileReaderLZMA (FileReader &file, size_t uncompressed_size, bool zip); diff --git a/src/gl/data/gl_nodes.cpp b/src/gl/data/gl_nodes.cpp index d9ae5786..7906a15b 100644 --- a/src/gl/data/gl_nodes.cpp +++ b/src/gl/data/gl_nodes.cpp @@ -1234,12 +1234,12 @@ errorout: //========================================================================== // // I am keeping both the original nodes from the WAD and the ones -// created for the GL renderer. THe original set is only being used +// created for the GL renderer. The original set is only being used // to get the sector for in-game positioning of actors but not for rendering. // // Unfortunately this is necessary because ZDBSP is much more sensitive // to sloppy mapping practices that produce overlapping sectors. -// The crane in P:AR E1M3 is a good example that would be broken If +// The crane in P:AR E1M3 is a good example that would be broken if // I didn't do this. // //========================================================================== diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 278fd27a..36788849 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1055,8 +1055,8 @@ bool AActor::Grind(bool items) // ZDoom behavior differs from standard as crushed corpses cannot be raised. // The reason for the change was originally because of a problem with players, // see rh_log entry for February 21, 1999. Don't know if it is still relevant. - if (state == NULL // Only use the default crushed state if: - && !(flags & MF_NOBLOOD) // 1. the monster bleeeds, + if (state == NULL // Only use the default crushed state if: + && !(flags & MF_NOBLOOD) // 1. the monster bleeds, && (i_compatflags & COMPATF_CORPSEGIBS) // 2. the compat setting is on, && player == NULL) // 3. and the thing isn't a player. { diff --git a/src/p_setup.cpp b/src/p_setup.cpp index dd17a676..3ee2a5ed 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -833,7 +833,7 @@ void P_LoadVertexes (MapData * map) // //=========================================================================== -void P_LoadZSegs (FileReaderZ &data) +void P_LoadZSegs (FileReaderBase &data) { for (int i = 0; i < numsegs; ++i) { @@ -870,7 +870,7 @@ void P_LoadZSegs (FileReaderZ &data) // //=========================================================================== -void P_LoadGLZSegs (FileReaderZ &data, DWORD id) +void P_LoadGLZSegs (FileReaderBase &data, DWORD id) { for (int i = 0; i < numsubsectors; ++i) { @@ -945,14 +945,12 @@ void P_LoadGLZSegs (FileReaderZ &data, DWORD id) // //=========================================================================== -void P_LoadZNodes (FileReader &dalump, DWORD id) +void LoadZNodes(FileReaderBase &data, int glnodes) { - FileReaderZ data (dalump); - DWORD i; - // Read extra vertices added during node building DWORD orgVerts, newVerts; vertex_t *newvertarray; + unsigned int i; data >> orgVerts >> newVerts; if (orgVerts + newVerts == (DWORD)numvertexes) @@ -1017,13 +1015,13 @@ void P_LoadZNodes (FileReader &dalump, DWORD id) segs = new seg_t[numsegs]; memset (segs, 0, numsegs*sizeof(seg_t)); - if (id == MAKE_ID('Z','N','O','D')) + if (glnodes == 0) { P_LoadZSegs (data); } else { - P_LoadGLZSegs (data, id); + P_LoadGLZSegs (data, glnodes); } // Read nodes @@ -1069,6 +1067,60 @@ void P_LoadZNodes (FileReader &dalump, DWORD id) } +void P_LoadZNodes (FileReader &dalump, DWORD id) +{ + int type; + bool compressed; + + switch (id) + { + case MAKE_ID('Z','N','O','D'): + type = 0; + compressed = true; + break; + + case MAKE_ID('Z','G','L','N'): + type = 1; + compressed = true; + break; + + case MAKE_ID('Z','G','L','2'): + type = 2; + compressed = true; + break; + + case MAKE_ID('X','N','O','D'): + type = 0; + compressed = false; + break; + + case MAKE_ID('X','G','L','N'): + type = 1; + compressed = false; + break; + + case MAKE_ID('X','G','L','2'): + type = 2; + compressed = false; + break; + + default: + return; + } + + if (compressed) + { + FileReaderZ data (dalump); + LoadZNodes(data, type); + } + else + { + LoadZNodes(dalump, type); + } +} + + + //=========================================================================== // // P_CheckV4Nodes @@ -3602,12 +3654,13 @@ void P_SetupLevel (char *lumpname, int position) { // Check for compressed nodes first, then uncompressed nodes FWadLump test; - DWORD id = MAKE_ID('X','x','X','x'), idcheck = 0, idcheck2 = 0; + DWORD id = MAKE_ID('X','x','X','x'), idcheck = 0, idcheck2 = 0, idcheck3 = 0, idcheck4 = 0; if (map->MapLumps[ML_ZNODES].Size != 0 && !UsingGLNodes) { map->Seek(ML_ZNODES); idcheck = MAKE_ID('Z','N','O','D'); + idcheck2 = MAKE_ID('X','N','O','D'); } else if (map->MapLumps[ML_GLZNODES].Size != 0) { @@ -3615,10 +3668,12 @@ void P_SetupLevel (char *lumpname, int position) map->Seek(ML_GLZNODES); idcheck = MAKE_ID('Z','G','L','N'); idcheck2 = MAKE_ID('Z','G','L','2'); + idcheck3 = MAKE_ID('X','G','L','N'); + idcheck4 = MAKE_ID('X','G','L','2'); } map->file->Read (&id, 4); - if (id == idcheck || id == idcheck2) + if (id == idcheck || id == idcheck2 || id == idcheck3 || id == idcheck4) { try { diff --git a/src/svnrevision.h b/src/svnrevision.h index 612fb4f1..7ff9a1ae 100644 --- a/src/svnrevision.h +++ b/src/svnrevision.h @@ -3,5 +3,5 @@ // This file was automatically generated by the // updaterevision tool. Do not edit by hand. -#define ZD_SVN_REVISION_STRING "2285" -#define ZD_SVN_REVISION_NUMBER 2285 +#define ZD_SVN_REVISION_STRING "2288" +#define ZD_SVN_REVISION_NUMBER 2288