Unblocking Windows [Updated 11-14-21]

Post your example zscripts/ACS scripts/etc here.
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
Hey Doomer
Posts: 283
Joined: Sat Sep 25, 2021 3:38 am

Unblocking Windows [Updated 11-14-21]

Post by Hey Doomer »

One of my peeves with Doom level design is arbitrary windows that allow projectiles through but not the player. This is my take on unblocking those windows to let the player jump through them.

CVars:

Code: Select all

user bool win_window = false;
user bool win_win2floor = false;
user bool win_win2ceiling = false;
user bool win_blocking = true;
win_blocking unblocks all two-sided lines. The others give more control depending on the status of DONTPEGTOP and DONTPEGBOTTOM. win_window unblocks "real" windows, for example.

ZScript:

Code: Select all

class windows_EventHandler : EventHandler
{
	override
	void WorldLoaded(WorldEvent e)
	{
		int BLOCKING = 1;                 // bit 0x0001
		int TWOSIDED = 2;                 // bit 0x0004
		int DONTPEGTOP = 4;               // bit 0x0008
		int DONTPEGBOTTOM = 8;            // bit 0x0010

		for(int i = 0; i < Level.Sectors.Size(); i++)
		{
			for (int ii = 0; ii < Level.Sectors[i].lines.Size(); ii++)
			{
				int f = Level.Sectors[i].lines[ii].flags;
				int peg_top = f & (BLOCKING + TWOSIDED + DONTPEGTOP);
				int peg_bottom = f & (BLOCKING + TWOSIDED + DONTPEGBOTTOM);
				int blocking = f & (BLOCKING + TWOSIDED);

				if (CVar.FindCVar("win_window").GetBool() && peg_top && peg_bottom)
				{
					Level.Sectors[i].lines[ii].flags = f ^ BLOCKING;
				}
				if (CVar.FindCVar("win_win2floor").GetBool() && peg_top && !peg_bottom)
				{
					Level.Sectors[i].lines[ii].flags = f ^ BLOCKING;
				}
				if (CVar.FindCVar("win_win2ceiling").GetBool() && !peg_top && peg_bottom)
				{
					Level.Sectors[i].lines[ii].flags = f ^ BLOCKING;
				}
				if (CVar.FindCVar("win_blocking").GetBool() && blocking)
				{
					Level.Sectors[i].lines[ii].flags = f ^ BLOCKING;
				}
			}
		}
	}
}
This seems to work, although I haven't tested it extensively with different kinds of windows in different levels. It doesn't check for adjacent sector exits, and it's possible to jump through a window and get stuck, a peril of self-defenestration.

Update 11/14/21
Spoiler:
thugsta
Posts: 150
Joined: Mon Jan 21, 2019 10:10 am

Re: Unblocking Windows [Updated 11-14-21]

Post by thugsta »

Nice mod, is there any chance you can add a window panel to the windows? That will also be a nice touch to those empty holes, maybe you can even shoot them and hearing a smash noise with the window disappearing or leaving it partially shattered around it's edge of the window hole.

Just some idea if you want to extend this. Thanks for bring this some attention.
Hey Doomer
Posts: 283
Joined: Sat Sep 25, 2021 3:38 am

Re: Unblocking Windows [Updated 11-14-21]

Post by Hey Doomer »

That will also be a nice touch to those empty holes
You are correct. Empty holes that may or may not be solid windows are an annoyance. I may do that as a separate mod, since it's somewhat different from just changing line flags. Great idea and definitely a quality of life thing in Doom.
User avatar
BROS_ETT_311
Posts: 218
Joined: Fri Nov 03, 2017 6:05 pm

Re: Unblocking Windows [Updated 11-14-21]

Post by BROS_ETT_311 »

Sorry for the bump, but is there a way to configure this to account for sections which serve as triggers? Not sure if I'm explaining it right, though a good example is map 30 of TNT, as it's currently impossible to complete.
User avatar
Hey Doomer_
Posts: 398
Joined: Tue Oct 18, 2022 1:59 am
Operating System Version (Optional): Windows 11
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Unblocking Windows [Updated 11-14-21]

Post by Hey Doomer_ »

BROS_ETT_311 wrote: Thu Aug 24, 2023 3:11 pm Sorry for the bump, but is there a way to configure this to account for sections which serve as triggers? Not sure if I'm explaining it right, though a good example is map 30 of TNT, as it's currently impossible to complete.
Where in map 30?
User avatar
BROS_ETT_311
Posts: 218
Joined: Fri Nov 03, 2017 6:05 pm

Re: Unblocking Windows [Updated 11-14-21]

Post by BROS_ETT_311 »

Hey Doomer_ wrote: Sat Aug 26, 2023 8:30 pm Where in map 30?
I'm not positive where the trigger itself occurs, but if enemies are alerted right at the beginning of the map, the player will almost instantly get telefragged. I'll do some digging.

EDIT: Not sure if this will help, but I loaded up your deathcam mod to see if it would pinpoint what exactly is killing the player. Turns out there's a voodoo doll far off in the map, which gets telefragged the moment the cacodemons/lostsouls start advancing in on the player. Without the windows mod loaded up, they'll actually circumnavigate the platforms rather than cross them.
User avatar
Hey Doomer_
Posts: 398
Joined: Tue Oct 18, 2022 1:59 am
Operating System Version (Optional): Windows 11
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Unblocking Windows [Updated 11-14-21]

Post by Hey Doomer_ »

BROS_ETT_311 wrote: Mon Aug 28, 2023 11:05 am
Hey Doomer_ wrote: Sat Aug 26, 2023 8:30 pm Where in map 30?
I'm not positive where the trigger itself occurs, but if enemies are alerted right at the beginning of the map, the player will almost instantly get telefragged. I'll do some digging.

EDIT: Not sure if this will help, but I loaded up your deathcam mod to see if it would pinpoint what exactly is killing the player. Turns out there's a voodoo doll far off in the map, which gets telefragged the moment the cacodemons/lostsouls start advancing in on the player. Without the windows mod loaded up, they'll actually circumnavigate the platforms rather than cross them.
That is interesting.

This mod turns off bit 1 in the linedef flag, which is set to block monsters and players. I remember thinking at the time it would be weird if the player jumped through a window but a Cacodemon would be stuck on the other side.

You can try this:

Code: Select all

	int BLOCKING = 16384
This is bit 14 (0x4000). This can also be referenced (untested) with Line.ML_BLOCK_PLAYERS e.g.

Code: Select all

Level.Sectors[i].lines[ii].flags = f ^ Line.ML_BLOCK_PLAYERS;
This unblocks only players, although I've no idea what happens with a voodoo doll.
User avatar
BROS_ETT_311
Posts: 218
Joined: Fri Nov 03, 2017 6:05 pm

Re: Unblocking Windows [Updated 11-14-21]

Post by BROS_ETT_311 »

Hey Doomer_ wrote: Mon Aug 28, 2023 5:36 pm You can try this:

Code: Select all

	int BLOCKING = 16384
This is bit 14 (0x4000). This can also be referenced (untested) with Line.ML_BLOCK_PLAYERS e.g.

Code: Select all

Level.Sectors[i].lines[ii].flags = f ^ Line.ML_BLOCK_PLAYERS;
This unblocks only players, although I've no idea what happens with a voodoo doll.
I gave this a shot, though I don't think I implemented it correctly since it's back to vanilla behavior.
Spoiler:
If at all possible, could it be reworked to only block monsters for certain map hashes?

Return to “Script Library”