Skip to content

Commit

Permalink
- ported Eternity's Line_QuickPortal
Browse files Browse the repository at this point in the history
  • Loading branch information
Ursus-maritimus210 authored and coelckers committed Mar 4, 2021
1 parent ecc4d31 commit 7e74d1c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
12 changes: 8 additions & 4 deletions src/maploader/specials.cpp
Expand Up @@ -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)
{
Expand All @@ -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.
Expand Down Expand Up @@ -754,6 +757,7 @@ void MapLoader::SpawnSpecials ()
break;

case Line_SetPortal:
case Line_QuickPortal:
SpawnLinePortal(&line);
break;

Expand Down
7 changes: 5 additions & 2 deletions src/playsim/actionspecials.h
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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

0 comments on commit 7e74d1c

Please sign in to comment.