From d76bcee393bcba893ad4fc4245b368cd54667024 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 6 Feb 2016 05:16:35 +0100 Subject: [PATCH] - added some line portal restrictions: * linked portals may never have a z-offset so the parameter for that needs to be ignored. * for interactive portals, handling z-displacements when some distance calculation reaches through a portal is way too extensive and problematic to ever have a chance of really working. If such a portal gets defined it will be changed to a teleport-only portal and a message printed. --- src/portal.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/portal.cpp b/src/portal.cpp index 79d0a5f7d6..bfb90cd14a 100644 --- a/src/portal.cpp +++ b/src/portal.cpp @@ -7,6 +7,7 @@ #include "m_bbox.h" #include "p_tags.h" #include "farchive.h" +#include "v_text.h" // simulation recurions maximum CVAR(Int, sv_portal_recursions, 4, CVAR_ARCHIVE|CVAR_SERVERINFO) @@ -58,7 +59,22 @@ void P_SpawnLinePortal(line_t* line) port->mOrigin = line; port->mDestination = dst; port->mType = BYTE(line->args[2]); // range check is done above. - port->mAlign = BYTE(line->args[3] >= PORG_ABSOLUTE && line->args[3] <= PORG_CEILING ? line->args[3] : PORG_ABSOLUTE); + + if (port->mType == PORTT_LINKED) + { + // Linked portals have no z-offset ever. + port->mAlign = PORG_ABSOLUTE; + } + else + { + port->mAlign = BYTE(line->args[3] >= PORG_ABSOLUTE && line->args[3] <= PORG_CEILING ? line->args[3] : PORG_ABSOLUTE); + if (port->mType == PORTT_INTERACTIVE) + { + // 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. + Printf(TEXTCOLOR_RED "Warning: z-offsetting not allowed for interactive portals. Changing line %d to teleport-portal!\n", int(line - lines)); + port->mType = PORTT_TELEPORT; + } + } if (port->mDestination != NULL) { port->mDefFlags = port->mType == PORTT_VISUAL ? PORTF_VISIBLE : port->mType == PORTT_TELEPORT ? PORTF_TYPETELEPORT : PORTF_TYPEINTERACTIVE;