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.

Multiple Doors - best solution?

Postby Caleb377 » Wed Nov 25, 2020 4:46 pm

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
Caleb377
 
Joined: 28 Jan 2020

Re: Multiple Doors - best solution?

Postby Kappes Buur » Wed Nov 25, 2020 6:07 pm

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
Kappes Buur
 
 
 
Joined: 17 Jul 2003
Location: British Columbia, Canada

Re: Multiple Doors - best solution?

Postby ramon.dexter » Thu Nov 26, 2020 12:13 pm

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 allExpand view
//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
ramon.dexter
rudebwoy
 
Joined: 20 Oct 2015
Location: Kozolupy, Bohemia
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Multiple Doors - best solution?

Postby Caleb377 » Thu Nov 26, 2020 9:16 pm

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
 
Joined: 28 Jan 2020

Re: Multiple Doors - best solution?

Postby Caleb377 » Thu Nov 26, 2020 9:31 pm

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
Caleb377
 
Joined: 28 Jan 2020

Re: Multiple Doors - best solution?

Postby ramon.dexter » Wed Dec 02, 2020 7:55 am

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
ramon.dexter
rudebwoy
 
Joined: 20 Oct 2015
Location: Kozolupy, Bohemia
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Multiple Doors - best solution?

Postby Caleb377 » Fri Dec 04, 2020 10:00 am

Thanks for the update, It was definetly necessary as not all stalls face the same angle.
User avatar
Caleb377
 
Joined: 28 Jan 2020

Re: Multiple Doors - best solution?

Postby estersios » Mon Dec 14, 2020 1:24 pm

can u post a video about your solution?
estersios
 
Joined: 13 Dec 2020
Graphics Processor: ATI/AMD (Modern GZDoom)


Return to Mapping

Who is online

Users browsing this forum: No registered users and 1 guest