Multiple Doors - best solution?

Ask about mapping, UDMF, using DoomBuilder/editor of choice, etc, here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
User avatar
Caleb377
Posts: 46
Joined: Tue Jan 28, 2020 2:54 pm

Multiple Doors - best solution?

Post by Caleb377 »

Hello everyone, I have a small design quirk with, of all things... bathroom doors. :?
The thing is that normal Doom engine doors that lower into the floor or raise into the ceiling are not an option.
I've placed many polyobject swinging doors at various points in my maps but I had to ask, is there any other better option in this case?

I don't care if the animation opens the door very quickly (like Duke3D swinging doors) that almost look like the doors vanish and appear open,
As individual polyobject swinging doors for every stall would be a nightmare.

All viable options to simplify this are welcomed, thanks.
User avatar
Kappes Buur
 
 
Posts: 4010
Joined: Thu Jul 17, 2003 12:19 am
Location: British Columbia, Canada

Re: Multiple Doors - best solution?

Post by Kappes Buur »

It is not necessary to be able to open/close all the doors of the stalls. It would be doubtful that all stalls are occupado at the same time. Leave most doors open, with a texture that shows hinges. Have a look at the stalls in Rex's Paranoid MAP01.
User avatar
ramon.dexter
Posts: 1254
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Multiple Doors - best solution?

Post by ramon.dexter »

Hi Caleb377, check this script I'm using to control polyobject doors in my maps. It's sort of "function" script, meaning one script could be controlled up to 1000 polyobject doors. The only important thing is the 'poly' variable, that is the number of polyobject. The 'spd' var is not necessary, it is used to control which sound is played (creak or normal sound).

Code: Select all

//POLYOBJECT DOORS
//=============================================================================================
//universal door script - one script to rule dem all
//==--------------------------------------------------==
#define MAX_SWINGING_DOORS 1000
bool polyDoor[MAX_SWINGING_DOORS]; //'dynamic' variable = array
//==--------------------------------------------------==
//universal door script with variable sound
//==--------------------------------------------------==
script "polyDRswing_Right" (int poly, int spd)
{
	if(!polyDoor[poly])
	{
		Polyobj_RotateRight(poly, spd, 64);
		if(spd  < 16)
		{
			AmbientSound("DoorCreak", 127);
		}
		else if(spd >= 16)
		{
			AmbientSound("sounds/officeDopen", 127);
		}
		PolyWait(poly);
		polyDoor[poly] = true;
	}
	else if(polyDoor[poly])
	{
		Polyobj_RotateLeft(poly, spd, 64);
		if(spd  < 16)
		{
			AmbientSound("DoorCreak", 127);
		}
		else if(spd >= 16)
		{
			AmbientSound("sounds/officeDclose", 127);
		}
		PolyWait(poly);
		polyDoor[poly] = false;
	}
}
script "polyDRswing_Left" (int poly, int spd)
{
	if(!polyDoor[poly])
	{
		Polyobj_RotateLeft(poly, spd, 64);
		if(spd  < 16)
		{
			AmbientSound("DoorCreak", 127);
		}
		else if(spd >= 16)
		{
			AmbientSound("sounds/officeDopen", 127);
		}
		PolyWait(poly);
		polyDoor[poly] = true;
	}
	else if(polyDoor[poly])
	{
		Polyobj_RotateRight(poly, spd, 64);
		if(spd  < 16)
		{
			AmbientSound("DoorCreak", 127);
		}
		else if(spd >= 16)
		{
			AmbientSound("sounds/officeDclose", 127);
		}
		PolyWait(poly);
		polyDoor[poly] = false;
	}
}
script "polyDRSlide" (int poly, int angle, int dist) {
	if(!polyDoor[poly]) {
		Polyobj_Move(poly, 24, angle, dist);
		PolyWait(poly);
		polyDoor[poly] = true;
	}
	else if(polyDoor[poly]) {
        int backAngle;
        switch(angle) {
            case 0:
                backAngle = 128;
            break;
            case 32:
                backAngle = 160;
            break;
            case 64:
                backAngle = 192;
            break;
            case 96:
                backAngle = 224;
            break;
            case 128:
                backAngle = 0;
            break;
            case 160:
                backAngle = 32;
            break;
            case 192:
                backAngle = 64;
            break;
            case 224:
                backAngle = 96;
            break;
        }
		Polyobj_Move(poly, 24, backAngle, dist);
		PolyWait(poly);
		polyDoor[poly] = false;
	}
}
script "polyDRslideDelay" (int poly, int angle, int dist) {
	Polyobj_Move(poly, 24, angle, dist);
	PolyWait(poly);
	Delay (3*35);
	int backAngle;
	switch(angle) {
		case 0:
			backAngle = 128;
		break;
		case 32:
			backAngle = 160;
		break;
		case 64:
			backAngle = 192;
		break;
		case 96:
			backAngle = 224;
		break;
		case 128:
			backAngle = 0;
		break;
		case 160:
			backAngle = 32;
		break;
		case 192:
			backAngle = 64;
		break;
		case 224:
			backAngle = 96;
		break;
	}
	Polyobj_Move(poly, 24, backAngle, dist);
	PolyWait(poly);
}
//==--------------------------------------------------==
//=============================================================================================
Last edited by ramon.dexter on Wed Dec 02, 2020 10:56 am, edited 1 time in total.
User avatar
Caleb377
Posts: 46
Joined: Tue Jan 28, 2020 2:54 pm

Re: Multiple Doors - best solution?

Post by Caleb377 »

Kappes Buur wrote:It is not necessary to be able to open/close all the doors of the stalls. It would be doubtful that all stalls are occupado at the same time. Leave most doors open, with a texture that shows hinges. Have a look at the stalls in Rex's Paranoid MAP01.
That is both obvious and brillant... I've never played "Paranoid" before, but I saw the bathroom stalls and now I know exactly what you mean.
That mod is incredible btw.

Thanks, this will save me a lot of time.
User avatar
Caleb377
Posts: 46
Joined: Tue Jan 28, 2020 2:54 pm

Re: Multiple Doors - best solution?

Post by Caleb377 »

ramon.dexter wrote:Hi Caleb377, check this script I'm using to control polyobject doors in my maps. It's sort of "function" script, meaning one script could be controlled up to 1000 polyobject doors. The only important thing is the 'poly' variable, that is the number of polyobject. The 'spd' var is not necessary, it is used to control which sound is played (creak or normal sound).
That might be what I need, I still need to find a balance between leaving most doors open and keep a few closed.
It will have to handle just about 20 doors, now the thing is not messing it up with how close together these things are.
Toilets.jpg
Thanks for sharing your script, I'll test it to see what's the best solution.
You do not have the required permissions to view the files attached to this post.
User avatar
ramon.dexter
Posts: 1254
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Multiple Doors - best solution?

Post by ramon.dexter »

If you started, don't use the sliding doors script. It correctly works only for '0' angle, other angles don't work. Had to completely rewrite it.

edit: OK, I made a new properly working version of the script. Included in my original post in the code with the scripts.
User avatar
Caleb377
Posts: 46
Joined: Tue Jan 28, 2020 2:54 pm

Re: Multiple Doors - best solution?

Post by Caleb377 »

Thanks for the update, It was definetly necessary as not all stalls face the same angle.
estersios
Posts: 4
Joined: Sun Dec 13, 2020 1:59 pm
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: Multiple Doors - best solution?

Post by estersios »

can u post a video about your solution?

Return to “Mapping”