- 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.
This commit is contained in:
Christoph Oelckers 2016-02-06 05:16:35 +01:00
parent 501af18168
commit d76bcee393

View file

@ -7,6 +7,7 @@
#include "m_bbox.h" #include "m_bbox.h"
#include "p_tags.h" #include "p_tags.h"
#include "farchive.h" #include "farchive.h"
#include "v_text.h"
// simulation recurions maximum // simulation recurions maximum
CVAR(Int, sv_portal_recursions, 4, CVAR_ARCHIVE|CVAR_SERVERINFO) CVAR(Int, sv_portal_recursions, 4, CVAR_ARCHIVE|CVAR_SERVERINFO)
@ -58,7 +59,22 @@ void P_SpawnLinePortal(line_t* line)
port->mOrigin = line; port->mOrigin = line;
port->mDestination = dst; port->mDestination = dst;
port->mType = BYTE(line->args[2]); // range check is done above. 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) if (port->mDestination != NULL)
{ {
port->mDefFlags = port->mType == PORTT_VISUAL ? PORTF_VISIBLE : port->mType == PORTT_TELEPORT ? PORTF_TYPETELEPORT : PORTF_TYPEINTERACTIVE; port->mDefFlags = port->mType == PORTT_VISUAL ? PORTF_VISIBLE : port->mType == PORTT_TELEPORT ? PORTF_TYPETELEPORT : PORTF_TYPEINTERACTIVE;