- 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
parent fc2f95da0e
commit 3e8435e22c
4 changed files with 73 additions and 17 deletions

View file

@ -106,7 +106,7 @@ DEFINE_SPECIAL(Light_Glow, 114, 4, 4, 4)
DEFINE_SPECIAL(Light_Flicker, 115, 3, 3, 3)
DEFINE_SPECIAL(Light_Strobe, 116, 5, 5, 5)
DEFINE_SPECIAL(Light_Stop, 117, 1, 1, 1)
DEFINE_SPECIAL(Plane_Copy, 118, -1, -1, 5)
DEFINE_SPECIAL(Thing_Damage, 119, 2, 3, 3)
DEFINE_SPECIAL(Radius_Quake, 120, 5, 5, 5) // Earthquake
DEFINE_SPECIAL(Line_SetIdentification, 121, -1, -1, 5)

View file

@ -3088,7 +3088,7 @@ lnSpecFunc LineSpecials[256] =
/* 115 */ LS_Light_Flicker,
/* 116 */ LS_Light_Strobe,
/* 117 */ LS_Light_Stop,
/* 118 */ LS_NOP,
/* 118 */ LS_NOP, // Plane_Copy
/* 119 */ LS_Thing_Damage,
/* 120 */ LS_Radius_Quake,
/* 121 */ LS_NOP, // Line_SetIdentification
@ -3111,22 +3111,22 @@ lnSpecFunc LineSpecials[256] =
/* 138 */ LS_Floor_Waggle,
/* 139 */ LS_Thing_SpawnFacing,
/* 140 */ LS_Sector_ChangeSound,
/* 141 */ LS_NOP, // 141 Music_Pause // [BC] Start
/* 142 */ LS_NOP, // 142 Music_Change
/* 143 */ LS_NOP, // 143 Player_RemoveItem
/* 144 */ LS_NOP, // 144 Player_GiveItem
/* 141 */ LS_NOP,
/* 142 */ LS_NOP,
/* 143 */ LS_NOP,
/* 144 */ LS_NOP,
/* 145 */ LS_NOP, // 145 Player_SetTeam
/* 146 */ LS_NOP, // 146 Player_SetLeader
/* 147 */ LS_NOP, // 147 Team_InitFP
/* 148 */ LS_NOP, // 148 TeleportAll
/* 149 */ LS_NOP, // 149 TeleportAll_NoFog
/* 150 */ LS_NOP, // 150 Team_GiveFP
/* 151 */ LS_NOP, // 151 Team_UseFP
/* 146 */ LS_NOP,
/* 147 */ LS_NOP,
/* 148 */ LS_NOP,
/* 149 */ LS_NOP,
/* 150 */ LS_NOP,
/* 151 */ LS_NOP,
/* 152 */ LS_NOP, // 152 Team_Score
/* 153 */ LS_NOP, // 153 Team_Init
/* 153 */ LS_NOP, // 153 Team_GivePoints
/* 154 */ LS_Teleport_NoStop,
/* 155 */ LS_NOP, // 155 Team_RemoveItem
/* 156 */ LS_NOP, // 156 Team_GiveItem // [BC] End
/* 155 */ LS_NOP,
/* 156 */ LS_NOP,
/* 157 */ LS_NOP, // SetGlobalFogParameter // in GZDoom
/* 158 */ LS_NOP, // FS_Execute in GZDoom
/* 159 */ LS_NOP, // Sector_SetPlaneReflection in GZDoom

View file

@ -68,6 +68,7 @@
void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt);
void P_SetSlopes ();
void P_CopySlopes();
void BloodCrypt (void *data, int key, int len);
void P_ClearUDMFKeys();
@ -3628,6 +3629,7 @@ void P_SetupLevel (char *lumpname, int position)
{
// [RH] Spawn slope creating things first.
P_SpawnSlopeMakers (&MapThingsConverted[0], &MapThingsConverted[MapThingsConverted.Size()]);
P_CopySlopes();
// Spawn 3d floors - must be done before spawning things so it can't be done in P_SpawnSpecials
P_Spawn3DFloors();

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;
}
}
}
}
}