diff --git a/src/g_shared/a_sharedglobal.h b/src/g_shared/a_sharedglobal.h index acb4faf0f7..0c9e723b6a 100644 --- a/src/g_shared/a_sharedglobal.h +++ b/src/g_shared/a_sharedglobal.h @@ -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(); }; diff --git a/src/g_shared/a_skies.cpp b/src/g_shared/a_skies.cpp index a8c8ebd55d..a34a30956a 100644 --- a/src/g_shared/a_skies.cpp +++ b/src/g_shared/a_skies.cpp @@ -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; } //--------------------------------------------------------------------------- diff --git a/src/p_spec.cpp b/src/p_spec.cpp index a8c13c5ac9..9ea1ecb9ba 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -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;iv1->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(x1, y1, 0, NO_REPLACE); AStackPoint *reference = Spawn(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(); diff --git a/src/portal.cpp b/src/portal.cpp index 7f08e6d6ea..a8e66db707 100644 --- a/src/portal.cpp +++ b/src/portal.cpp @@ -504,3 +504,8 @@ bool PortalTracer::TraceStep() return (oDepth != depth); // if a portal has been found, return false } +void P_CreateLinkedPortals() +{ +} + + diff --git a/src/portal.h b/src/portal.h index 53fb1c16ef..5e3d5bb8d3 100644 --- a/src/portal.h +++ b/src/portal.h @@ -53,6 +53,7 @@ extern TArray 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 */ diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index 819bd95324..8fba4a8e36 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -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) || diff --git a/src/r_defs.h b/src/r_defs.h index a9b09c9e66..7b86e00dee 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -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 diff --git a/wadsrc/static/xlat/eternity.txt b/wadsrc/static/xlat/eternity.txt index f76466c29a..04d5febff2 100644 --- a/wadsrc/static/xlat/eternity.txt +++ b/wadsrc/static/xlat/eternity.txt @@ -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)