- some preparations for portal stuff:

* set up linked sector portals so that everything that will eventually have to be considered is present, even though the software renderer currently can't handle those adequately.
* tag all skybox things with a type so that they can easily be distinguished at run time.
* fill in the linked portal types in xlat/eternity.txt.
This commit is contained in:
Christoph Oelckers 2016-02-14 13:12:03 +01:00
parent 993a840630
commit d5a1004c41
8 changed files with 53 additions and 13 deletions

View file

@ -106,11 +106,7 @@ class ASkyCamCompat : public ASkyViewpoint
DECLARE_CLASS (ASkyCamCompat, ASkyViewpoint)
public:
void BeginPlay ()
{
// Do not call the SkyViewpoint's super method because it would trash our setup
AActor::BeginPlay();
}
void BeginPlay();
};

View file

@ -54,6 +54,7 @@ void ASkyViewpoint::BeginPlay ()
{
level.DefaultSkybox = this;
}
special1 = SKYBOX_SKYVIEWPOINT;
}
void ASkyViewpoint::Serialize (FArchive &arc)
@ -85,6 +86,13 @@ void ASkyViewpoint::Destroy ()
IMPLEMENT_CLASS (ASkyCamCompat)
void ASkyCamCompat::BeginPlay()
{
// Do not call the SkyViewpoint's super method because it would trash our setup
AActor::BeginPlay();
special1 = SKYBOX_SKYVIEWPOINT;
}
//---------------------------------------------------------------------------
@ -154,6 +162,7 @@ void AStackPoint::BeginPlay ()
AActor::BeginPlay ();
bAlways = true;
special1 = SKYBOX_STACKEDSECTORTHING;
}
//---------------------------------------------------------------------------

View file

@ -1019,15 +1019,16 @@ static void CopyPortal(int sectortag, int plane, ASkyViewpoint *origin, fixed_t
}
}
void P_SpawnPortal(line_t *line, int sectortag, int plane, int alpha)
void P_SpawnPortal(line_t *line, int sectortag, int plane, int alpha, int linked)
{
if (plane < 0 || plane > 2 || (linked && plane == 2)) return;
for (int i=0;i<numlines;i++)
{
// We must look for the reference line with a linear search unless we want to waste the line ID for it
// which is not a good idea.
if (lines[i].special == Sector_SetPortal &&
lines[i].args[0] == sectortag &&
lines[i].args[1] == 0 &&
lines[i].args[1] == linked &&
lines[i].args[2] == plane &&
lines[i].args[3] == 1)
{
@ -1036,10 +1037,18 @@ void P_SpawnPortal(line_t *line, int sectortag, int plane, int alpha)
fixed_t y1 = fixed_t((SQWORD(line->v1->y) + SQWORD(line->v2->y)) >> 1);
fixed_t x2 = fixed_t((SQWORD(lines[i].v1->x) + SQWORD(lines[i].v2->x)) >> 1);
fixed_t y2 = fixed_t((SQWORD(lines[i].v1->y) + SQWORD(lines[i].v2->y)) >> 1);
fixed_t z = linked ? line->frontsector->planes[plane].TexZ : 0; // the map's sector height defines the portal plane for linked portals
fixed_t alpha = Scale (lines[i].args[4], OPAQUE, 255);
AStackPoint *anchor = Spawn<AStackPoint>(x1, y1, 0, NO_REPLACE);
AStackPoint *reference = Spawn<AStackPoint>(x2, y2, 0, NO_REPLACE);
reference->special1 = linked ? SKYBOX_LINKEDPORTAL : SKYBOX_PORTAL;
anchor->special1 = SKYBOX_ANCHOR;
// store the portal displacement in the unused scaleX/Y members of the portal reference actor.
anchor->scaleX = -(reference->scaleX = x2 - x1);
anchor->scaleY = -(reference->scaleY = y2 - y1);
anchor->threshold = reference->threshold = z;
reference->Mate = anchor;
anchor->Mate = reference;
@ -1427,13 +1436,17 @@ void P_SpawnSpecials (void)
// - 0: normal (handled here)
// - 1: copy (handled by the portal they copy)
// - 2: EE-style skybox (handled by the camera object)
// - 3: EE-style flat portal (GZDoom HW renderer only for now)
// - 4: EE-style horizon portal (GZDoom HW renderer only for now)
// - 5: copy portal to line (GZDoom HW renderer only for now)
// - 6: linked portal
// other values reserved for later use
// arg 2 = 0:floor, 1:ceiling, 2:both
// arg 3 = 0: anchor, 1: reference line
// arg 4 = for the anchor only: alpha
if (lines[i].args[1] == 0 && lines[i].args[3] == 0)
if ((lines[i].args[1] == 0 || lines[i].args[1] == 6) && lines[i].args[3] == 0)
{
P_SpawnPortal(&lines[i], lines[i].args[0], lines[i].args[2], lines[i].args[4]);
P_SpawnPortal(&lines[i], lines[i].args[0], lines[i].args[2], lines[i].args[4], lines[i].args[1]);
}
break;
@ -1510,6 +1523,7 @@ void P_SpawnSpecials (void)
break;
}
}
P_CreateLinkedPortals();
// [RH] Start running any open scripts on this map
FBehavior::StaticStartTypedScripts (SCRIPT_Open, NULL, false);
P_FinalizePortals();

View file

@ -504,3 +504,8 @@ bool PortalTracer::TraceStep()
return (oDepth != depth); // if a portal has been found, return false
}
void P_CreateLinkedPortals()
{
}

View file

@ -53,6 +53,7 @@ extern TArray<FLinePortal> linePortals;
void P_SpawnLinePortal(line_t* line);
void P_FinalizePortals();
bool P_ChangePortal(line_t *ln, int thisid, int destid);
void P_CreateLinkedPortals();
/* code ported from prototype */

View file

@ -1094,6 +1094,7 @@ void R_Subsector (subsector_t *sub)
}
skybox = frontsector->GetSkyBox(sector_t::ceiling);
if (skybox != NULL && skybox->special1 >= SKYBOX_PLANE) skybox = NULL; // skip unsupported portal types
ceilingplane = frontsector->ceilingplane.PointOnSide(viewx, viewy, viewz) > 0 ||
frontsector->GetTexture(sector_t::ceiling) == skyflatnum ||
@ -1135,6 +1136,8 @@ void R_Subsector (subsector_t *sub)
// killough 3/16/98: add floorlightlevel
// killough 10/98: add support for skies transferred from sidedefs
skybox = frontsector->GetSkyBox(sector_t::floor);
if (skybox != NULL && skybox->special1 >= SKYBOX_PLANE) skybox = NULL; // skip unsupported portal types
floorplane = frontsector->floorplane.PointOnSide(viewx, viewy, viewz) > 0 || // killough 3/7/98
frontsector->GetTexture(sector_t::floor) == skyflatnum ||
(skybox != NULL && skybox->bAlways) ||

View file

@ -57,6 +57,18 @@ enum
extern size_t MaxDrawSegs;
enum
{
SKYBOX_ANCHOR = -1,
SKYBOX_SKYVIEWPOINT = 0, // a regular skybox
SKYBOX_STACKEDSECTORTHING, // stacked sectors with the thing method
SKYBOX_PORTAL, // stacked sectors with Sector_SetPortal
SKYBOX_LINKEDPORTAL, // linked portal (interactive)
SKYBOX_PLANE, // EE-style plane portal (not implemented in SW renderer)
SKYBOX_HORIZON, // EE-style horizon portal (not implemented in SW renderer)
};
//
// INTERNAL MAP TYPES
// used by play and refresh

View file

@ -132,10 +132,10 @@ enum
357 = 0, Polyobj_OR_RotateLeft(0)
// Eternity's linked portals, vertical link version (floor-to-ceiling)
358 = 0, Unsupported() // "Portal_LinkedCeiling"
359 = 0, Unsupported() // "Portal_LinkedFloor"
360 = 0, Unsupported() // "Portal_LinkedAnchorLine"
361 = 0, Unsupported() // "Portal_LinkedAnchorLineFloor"
358 = 0, Sector_SetPortal(tag, 6, 1, 1, 0) // "Portal_AnchoredCeiling"
359 = 0, Sector_SetPortal(tag, 6, 0, 1, 0) // "Portal_AnchoredFloor"
360 = 0, Sector_SetPortal(tag, 6, 1, 0, 0) // "Portal_AnchorLine"
361 = 0, Sector_SetPortal(tag, 6, 0, 0, 0) // "Portal_AnchorLineFloor"
// Even more parameterized linedefs
362 = 0, Pillar_Build(0)