diff --git a/specs/udmf_zdoom.txt b/specs/udmf_zdoom.txt index 1a4dbeffa..6c2fde912 100644 --- a/specs/udmf_zdoom.txt +++ b/specs/udmf_zdoom.txt @@ -1,5 +1,5 @@ =============================================================================== -Universal Doom Map Format ZDoom extensions v1.10 - 25.04.2010 +Universal Doom Map Format ZDoom extensions v1.15 - 14.12.2010 Copyright (c) 2008 Christoph Oelckers. @@ -84,6 +84,12 @@ field to 'strifeally', even for the 'Doom' namespace. In addition to the standard fields, ZDoom defines the following: Note: All fields default to false unless mentioned otherwise. + vertex + { + zfloor = ; // Floor height at this vertex. Only applies to triangular sectors + zceiling = ; // Ceiling height at this vertex. Only applies to triangular sectors + } + linedef { alpha = ; // Translucency of this line, default is 1.0 @@ -283,6 +289,9 @@ Added 'hidden' sector property. 1.14 19.09.2010 Added 'countsecret' actor property. +1.15 14.12.2010 +Added vertex floor and ceiling height properties + =============================================================================== EOF =============================================================================== diff --git a/src/namedef.h b/src/namedef.h index 684d447f6..d9573b747 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -280,6 +280,8 @@ xx(Communicator) // Textmap properties //xx(X) //xx(Y) +xx(ZFloor) +xx(ZCeiling) xx(Height) //xx(Tid) //xx(Angle) diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 4dec4a95c..b2e385286 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -102,6 +102,8 @@ bool P_IsBuildMap(MapData *map); // int numvertexes; vertex_t* vertexes; +int numvertexdatas; +vertexdata_t* vertexdatas; int numsegs; seg_t* segs; @@ -755,6 +757,7 @@ void P_LoadVertexes (MapData * map) // Determine number of vertices: // total lump length / vertex record length. numvertexes = map->MapLumps[ML_VERTEXES].Size / sizeof(mapvertex_t); + numvertexdatas = 0; if (numvertexes == 0) { @@ -763,6 +766,7 @@ void P_LoadVertexes (MapData * map) // Allocate memory for buffer. vertexes = new vertex_t[numvertexes]; + vertexdatas = NULL; map->Seek(ML_VERTEXES); diff --git a/src/p_slopes.cpp b/src/p_slopes.cpp index 3ebaef144..7cf6c5fbe 100644 --- a/src/p_slopes.cpp +++ b/src/p_slopes.cpp @@ -309,6 +309,27 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt) mt->type = 0; } } + + for(int i = 0; i < numvertexdatas; i++) + { + if (vertexdatas[i].flags & VERTEXFLAG_ZCeilingEnabled) + { + vt_heights[1][i] = vertexdatas[i].zCeiling; + vt_found = true; + } + + if (vertexdatas[i].flags & VERTEXFLAG_ZFloorEnabled) + { + vt_heights[0][i] = vertexdatas[i].zFloor; + vt_found = true; + } + } + + // If vertexdata_t is ever extended for non-slope usage, this will obviously have to be deferred or removed. + delete[] vertexdatas; + vertexdatas = NULL; + numvertexdatas = 0; + if (vt_found) { for (int i = 0; i < numsectors; i++) diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 0fba825b0..72c3cb24c 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -390,6 +390,7 @@ class UDMFParser : public UDMFParserBase TArray ParsedSideTextures; TArray ParsedSectors; TArray ParsedVertices; + TArray ParsedVertexDatas; FDynamicColormap *fogMap, *normMap; @@ -1303,9 +1304,10 @@ public: // //=========================================================================== - void ParseVertex(vertex_t *vt) + void ParseVertex(vertex_t *vt, vertexdata_t *vd) { vt->x = vt->y = 0; + vd->zCeiling = vd->zFloor = vd->flags = 0; sc.MustGetStringName("{"); while (!sc.CheckString("}")) { @@ -1320,9 +1322,21 @@ public: case NAME_X: vt->x = FLOAT2FIXED(strtod(value, NULL)); break; + case NAME_Y: vt->y = FLOAT2FIXED(strtod(value, NULL)); break; + + case NAME_ZCeiling: + vd->zCeiling = FLOAT2FIXED(strtod(value, NULL)); + vd->flags |= VERTEXFLAG_ZCeilingEnabled; + break; + + case NAME_ZFloor: + vd->zFloor = FLOAT2FIXED(strtod(value, NULL)); + vd->flags |= VERTEXFLAG_ZFloorEnabled; + break; + default: break; } @@ -1520,8 +1534,10 @@ public: else if (sc.Compare("vertex")) { vertex_t vt; - ParseVertex(&vt); + vertexdata_t vd; + ParseVertex(&vt, &vd); ParsedVertices.Push(vt); + ParsedVertexDatas.Push(vd); } else { @@ -1534,6 +1550,11 @@ public: vertexes = new vertex_t[numvertexes]; memcpy(vertexes, &ParsedVertices[0], numvertexes * sizeof(*vertexes)); + // Create the real vertex datas + numvertexdatas = ParsedVertexDatas.Size(); + vertexdatas = new vertexdata_t[numvertexdatas]; + memcpy(vertexdatas, &ParsedVertexDatas[0], numvertexdatas * sizeof(*vertexdatas)); + // Create the real sectors numsectors = ParsedSectors.Size(); sectors = new sector_t[numsectors]; diff --git a/src/r_defs.h b/src/r_defs.h index 22745f54c..9d2822c33 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -67,6 +67,16 @@ extern size_t MaxDrawSegs; // Note: transformed values not buffered locally, // like some DOOM-alikes ("wt", "WebView") did. // +enum +{ + VERTEXFLAG_ZCeilingEnabled = 0x01, + VERTEXFLAG_ZFloorEnabled = 0x02 +}; +struct vertexdata_t +{ + fixed_t zCeiling, zFloor; + DWORD flags; +}; struct vertex_t { fixed_t x, y; diff --git a/src/r_state.h b/src/r_state.h index 9044da72b..652968385 100644 --- a/src/r_state.h +++ b/src/r_state.h @@ -55,6 +55,8 @@ extern DWORD NumStdSprites; extern int numvertexes; extern vertex_t* vertexes; +extern int numvertexdatas; +extern vertexdata_t* vertexdatas; extern int numsegs; extern seg_t* segs;