mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
- added DavidPH's submission for specifying vertex heights directly in UDMF.
SVN r3037 (trunk)
This commit is contained in:
parent
f0f17e531c
commit
79c5080dda
7 changed files with 72 additions and 3 deletions
|
@ -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 <bool> fields default to false unless mentioned otherwise.
|
||||
|
||||
vertex
|
||||
{
|
||||
zfloor = <float>; // Floor height at this vertex. Only applies to triangular sectors
|
||||
zceiling = <float>; // Ceiling height at this vertex. Only applies to triangular sectors
|
||||
}
|
||||
|
||||
linedef
|
||||
{
|
||||
alpha = <float>; // 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
|
||||
===============================================================================
|
||||
|
|
|
@ -280,6 +280,8 @@ xx(Communicator)
|
|||
// Textmap properties
|
||||
//xx(X)
|
||||
//xx(Y)
|
||||
xx(ZFloor)
|
||||
xx(ZCeiling)
|
||||
xx(Height)
|
||||
//xx(Tid)
|
||||
//xx(Angle)
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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++)
|
||||
|
|
|
@ -390,6 +390,7 @@ class UDMFParser : public UDMFParserBase
|
|||
TArray<mapsidedef_t> ParsedSideTextures;
|
||||
TArray<sector_t> ParsedSectors;
|
||||
TArray<vertex_t> ParsedVertices;
|
||||
TArray<vertexdata_t> 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];
|
||||
|
|
10
src/r_defs.h
10
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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue