mirror of
https://github.com/ZDoom/gzdoom-last-svn.git
synced 2025-05-30 00:41:19 +00:00
* Updated to ZDoom r2288:
- UDMF node format specification change for portability reasons. - Allow loading uncompressed version of compressed nodes. - Extended FileReader hierarchy so that FileReader, FileReaderZ etc. all inherit from one base class so that the same code can be used to read from both uncompressed and compressed streams. However, the function P_LoadZNodes() in p_setup.cpp had to be changed from static to non-static or it caused unresolved externals in gl_nodes.cpp. It's strange because it was static as well before the update, with the exact same signature, and compiled just fine anyway. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@774 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
parent
ed87341537
commit
8c71705ef7
6 changed files with 131 additions and 23 deletions
|
@ -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
|
||||
===============================================================================
|
||||
|
|
59
src/files.h
59
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);
|
||||
|
|
|
@ -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.
|
||||
//
|
||||
//==========================================================================
|
||||
|
|
|
@ -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.
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue