From 7e74d1c4a12ff454ad226d2f7393d9f5504277d0 Mon Sep 17 00:00:00 2001 From: Timothy Quinn Date: Thu, 4 Mar 2021 21:16:01 +0100 Subject: [PATCH] - ported Eternity's Line_QuickPortal --- src/maploader/specials.cpp | 12 ++++++++---- src/playsim/actionspecials.h | 7 +++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/maploader/specials.cpp b/src/maploader/specials.cpp index 9393d4823a6..41369a244b7 100644 --- a/src/maploader/specials.cpp +++ b/src/maploader/specials.cpp @@ -120,16 +120,18 @@ void MapLoader::SpawnLinePortal(line_t* line) // portal destination is special argument #0 line_t* dst = nullptr; - if (line->args[2] >= PORTT_VISUAL && line->args[2] <= PORTT_LINKED) + if ((line->args[2] >= PORTT_VISUAL && line->args[2] <= PORTT_LINKED) || line->special == Line_QuickPortal) { - dst = Level->FindPortalDestination(line, line->args[0]); + int type = (line->special != Line_QuickPortal) ? line->args[2] : line->args[0] == 0 ? PORTT_LINKED : PORTT_VISUAL; + int tag = (line->special == Line_QuickPortal) ? Level->tagManager.GetFirstLineID(line) : line->args[0]; + dst = Level->FindPortalDestination(line, tag); line->portalindex = Level->linePortals.Reserve(1); FLinePortal *port = &Level->linePortals.Last(); port->mOrigin = line; port->mDestination = dst; - port->mType = uint8_t(line->args[2]); // range check is done above. + port->mType = uint8_t(type); // range check is done above. if (port->mType == PORTT_LINKED) { @@ -138,7 +140,8 @@ void MapLoader::SpawnLinePortal(line_t* line) } else { - port->mAlign = uint8_t(line->args[3] >= PORG_ABSOLUTE && line->args[3] <= PORG_CEILING ? line->args[3] : PORG_ABSOLUTE); + int flags = (line->special == Line_QuickPortal) ? PORG_ABSOLUTE : line->args[3]; + port->mAlign = uint8_t(flags >= PORG_ABSOLUTE && flags <= PORG_CEILING ? flags : PORG_ABSOLUTE); if (port->mType == PORTT_INTERACTIVE && port->mAlign != PORG_ABSOLUTE) { // Due to the way z is often handled, these pose a major issue for parts of the code that needs to transparently handle interactive portals. @@ -754,6 +757,7 @@ void MapLoader::SpawnSpecials () break; case Line_SetPortal: + case Line_QuickPortal: SpawnLinePortal(&line); break; diff --git a/src/playsim/actionspecials.h b/src/playsim/actionspecials.h index d62f93536ee..fcd4d386bb0 100644 --- a/src/playsim/actionspecials.h +++ b/src/playsim/actionspecials.h @@ -138,6 +138,9 @@ DEFINE_SPECIAL(Floor_Waggle, 138, 5, 5, 5) DEFINE_SPECIAL(Thing_SpawnFacing, 139, 2, 4, 4) DEFINE_SPECIAL(Sector_ChangeSound, 140, 2, 2, 2) +DEFINE_SPECIAL(Line_SetHealth, 150, 2, 2, 2) +DEFINE_SPECIAL(Sector_SetHealth, 151, 3, 3, 3) + DEFINE_SPECIAL(Teleport_NoStop, 154, 2, 3, 3) // portal specials DEFINE_SPECIAL(Line_SetPortal, 156, -1, -1, 4) @@ -152,8 +155,6 @@ DEFINE_SPECIAL(Sector_Set3DFloor, 160, -1, -1, 5) DEFINE_SPECIAL(Sector_SetContents, 161, -1, -1, 3) // [RH] Begin new specials for ZDoom -DEFINE_SPECIAL(Line_SetHealth, 150, 2, 2, 2) -DEFINE_SPECIAL(Sector_SetHealth, 151, 3, 3, 3) DEFINE_SPECIAL(Ceiling_CrushAndRaiseDist, 168, 3, 5, 5) DEFINE_SPECIAL(Generic_Crusher2, 169, 5, 5, 5) DEFINE_SPECIAL(Sector_SetCeilingScale2, 170, 3, 3, 3) @@ -271,4 +272,6 @@ DEFINE_SPECIAL(Ceiling_MoveToValueAndCrush, 280, 4, 5, 5) DEFINE_SPECIAL(Line_SetAutomapFlags, 281, 3, 3, 3) DEFINE_SPECIAL(Line_SetAutomapStyle, 282, 2, 2, 2) +DEFINE_SPECIAL(Line_QuickPortal, 301, -1, -1, 1) + #undef DEFINE_SPECIAL