Re enable a portal with Line_SetPortalTarget

Moderator: GZDoom Developers

Post Reply
User avatar
gwHero
Posts: 360
Joined: Mon May 08, 2017 3:23 am
Graphics Processor: Intel with Vulkan/Metal Support
Location: The Netherlands

Re enable a portal with Line_SetPortalTarget

Post by gwHero »

Currently it is possible to change a portal destination at runtime with Line_SetPortalTarget.
It's also possible to disable a portal by setting the destination to zero:

Code: Select all

Line_SetPortalTarget (1, 0);
Creating portals at runtime is not possible, but it would be nice to re enable a portal after it was disabled by giving it the original destination back, as, if I understood this correctly, was meant here:
viewtopic.php?f=18&t=46916&start=390#p892097
User avatar
gwHero
Posts: 360
Joined: Mon May 08, 2017 3:23 am
Graphics Processor: Intel with Vulkan/Metal Support
Location: The Netherlands

Re: Re enable a portal with Line_SetPortalTarget

Post by gwHero »

Update: I've looked into the code and it works only when it's a portal of type Interactive, and not for Visual only or Visual + teleport:

Code: Select all

if (port->mDestination == nullptr)
	{
		port->mFlags = 0;
	}
	else if (port->mType == PORTT_INTERACTIVE)
	{
		FLinePortal *portd = port->mDestination->portalindex < linePortals.Size()? &linePortals[port->mDestination->portalindex] : nullptr;
		if (portd != nullptr && portd->mType == PORTT_INTERACTIVE && portd->mDestination == line)
		{
			// this is a 2-way interactive portal
			port->mFlags = port->mDefFlags | PORTF_INTERACTIVE;
			portd->mFlags = portd->mDefFlags | PORTF_INTERACTIVE;
		}
		else
		{
			port->mFlags = port->mDefFlags;
		}
		SetRotation(portd);
	}
	SetRotation(port);
I'll see if I can do a code submission.

Update:
Code submission viewtopic.php?f=59&t=57976
User avatar
gwHero
Posts: 360
Joined: Mon May 08, 2017 3:23 am
Graphics Processor: Intel with Vulkan/Metal Support
Location: The Netherlands

Re: Re enable a portal with Line_SetPortalTarget

Post by gwHero »

I noticed that https://github.com/coelckers/gzdoom/pull/373 was committed.
I've been testing with with devbuild 597-g9e07bab and I can confirm that it's working fine.
Thanks
User avatar
Rachael
Posts: 13530
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Re enable a portal with Line_SetPortalTarget

Post by Rachael »

Thanks. Forgot to close this.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”