- added Gez's Plane_Copy submission with some extensions and improvements.

This line special is the last of the slope creation methods being processed so it can copy any other type of slope.


SVN r2147 (trunk)
This commit is contained in:
Christoph Oelckers 2010-01-30 22:53:37 +00:00
commit 3e8435e22c
4 changed files with 73 additions and 17 deletions

View file

@ -118,9 +118,8 @@ static void P_SlopeLineToPoint (int lineid, fixed_t x, fixed_t y, fixed_t z, boo
//
//===========================================================================
static void P_CopyPlane (int tag, fixed_t x, fixed_t y, bool copyCeil)
static void P_CopyPlane (int tag, sector_t *dest, bool copyCeil)
{
sector_t *dest = P_PointInSector (x, y);
sector_t *source;
int secnum;
size_t planeofs;
@ -144,6 +143,12 @@ static void P_CopyPlane (int tag, fixed_t x, fixed_t y, bool copyCeil)
*(secplane_t *)((BYTE *)dest + planeofs) = *(secplane_t *)((BYTE *)source + planeofs);
}
static void P_CopyPlane (int tag, fixed_t x, fixed_t y, bool copyCeil)
{
sector_t *dest = P_PointInSector (x, y);
P_CopyPlane(tag, dest, copyCeil);
}
//===========================================================================
//
// P_SetSlope
@ -571,3 +576,52 @@ void P_SetSlopes ()
}
}
//===========================================================================
//
// P_CopySlopes
//
//===========================================================================
void P_CopySlopes()
{
for (int i = 0; i < numlines; i++)
{
if (lines[i].special == Plane_Copy)
{
// The args are used for the tags of sectors to copy:
// args[0]: front floor
// args[1]: front ceiling
// args[2]: back floor
// args[3]: back ceiling
// args[4]: copy slopes from one side of the line to the other.
lines[i].special = 0;
for (int s = 0; s < (lines[i].backsector ? 4 : 2); s++)
{
if (lines[i].args[s])
P_CopyPlane(lines[i].args[s],
(s & 2 ? lines[i].backsector : lines[i].frontsector), s & 1);
}
if (lines[i].backsector != NULL)
{
if ((lines[i].args[4] & 3) == 1)
{
lines[i].backsector->floorplane = lines[i].frontsector->floorplane;
}
else if ((lines[i].args[4] & 3) == 2)
{
lines[i].frontsector->floorplane = lines[i].backsector->floorplane;
}
if ((lines[i].args[4] & 12) == 4)
{
lines[i].backsector->ceilingplane = lines[i].frontsector->ceilingplane;
}
else if ((lines[i].args[4] & 12) == 8)
{
lines[i].frontsector->ceilingplane = lines[i].backsector->ceilingplane;
}
}
}
}
}