- added a 'copy portal' option so that linedef-based portals can be transferred to sectors that already have a tag.

SVN r2053 (trunk)
This commit is contained in:
Christoph Oelckers 2009-12-28 00:01:07 +00:00
parent 3f059898fd
commit 4a8518e4f1
2 changed files with 42 additions and 12 deletions

View file

@ -1601,9 +1601,6 @@ void P_SpawnThings (int position)
{
int numthings = MapThingsConverted.Size();
// [RH] Spawn slope creating things first.
P_SpawnSlopeMakers (&MapThingsConverted[0], &MapThingsConverted[numthings]);
for (int i=0; i < numthings; i++)
{
SpawnMapThing (i, &MapThingsConverted[i], position);
@ -3623,11 +3620,14 @@ void P_SetupLevel (char *lumpname, int position)
deathmatchstarts.Clear ();
if (!buildmap)
{
// [RH] Spawn slope creating things first.
P_SpawnSlopeMakers (&MapThingsConverted[0], &MapThingsConverted[MapThingsConverted.Size()]);
// Spawn 3d floors - must be done before spawning things so it can't be done in P_SpawnSpecials
P_Spawn3DFloors();
if (!buildmap)
{
times[14].Clock();
P_SpawnThings(position);

View file

@ -828,6 +828,19 @@ void DWallLightTransfer::DoTransfer (BYTE lightlevel, int target, BYTE flags)
}
}
inline void SetPortal(sector_t *sector, INTBOOL ceiling, AStackPoint *portal)
{
if (ceiling)
{
if (sector->CeilingSkyBox == NULL) sector->CeilingSkyBox = portal;
}
else
{
if (sector->FloorSkyBox == NULL) sector->FloorSkyBox = portal;
}
}
void P_SpawnPortal(line_t *line, int sectortag, INTBOOL ceiling, int alpha)
{
for (int i=0;i<numlines;i++)
@ -858,15 +871,32 @@ void P_SpawnPortal(line_t *line, int sectortag, INTBOOL ceiling, int alpha)
for (int s=-1; (s = P_FindSectorFromTag(sectortag,s)) >= 0;)
{
if (ceiling)
SetPortal(&sectors[s], ceiling, reference);
}
for (int j=0;j<numlines;j++)
{
if (sectors[s].CeilingSkyBox == NULL) sectors[s].CeilingSkyBox = reference;
// Check if this portal needs to be copied to other sectors
// This must be done here to ensure that it gets done only after the portal is set up
if (lines[i].special == Sector_SetPortal &&
lines[i].args[1] == 1 &&
lines[i].args[2] == ceiling &&
lines[i].args[3] == sectortag)
{
if (lines[i].args[0] == 0)
{
SetPortal(lines[i].frontsector, ceiling, reference);
}
else
{
if (sectors[s].FloorSkyBox == NULL) sectors[s].FloorSkyBox = reference;
for (int s=-1; (s = P_FindSectorFromTag(lines[i].args[0],s)) >= 0;)
{
SetPortal(&sectors[s], ceiling, reference);
}
}
}
}
return;
}
}