Page 1 of 1

Unblocking Windows [Updated 11-14-21]

Posted: Wed Nov 10, 2021 9:19 am
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:

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

Posted: Thu Dec 02, 2021 8:13 pm
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.

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

Posted: Fri Dec 03, 2021 5:05 am
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.

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

Posted: Thu Aug 24, 2023 3:11 pm
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.

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

Posted: Sat Aug 26, 2023 8:30 pm
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?

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

Posted: Mon Aug 28, 2023 11:05 am
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.

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

Posted: Mon Aug 28, 2023 5:36 pm
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.

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

Posted: Tue Aug 29, 2023 6:23 pm
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?

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

Posted: Tue Aug 20, 2024 7:26 am
by M4j0d1
Isn't There Supposed To Be a Download Link, What Happened To It?