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.
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.
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.
Side sidedef = Level.Sectors[i].Lines[ii].Sidedef[INNER];
textureid midid = sidedef.GetTexture(sidedef.Mid);
if (midid.isNull())
{
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.
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.
override
void WorldLoaded(WorldEvent e)
{
//int BLOCKING = 1; // bit 0x0001 (1)
int BLOCKING = 16384; // bit 0x4000 (14)
int TWOSIDED = 2; // bit 0x0004
int DONTPEGTOP = 4; // bit 0x0008
int DONTPEGBOTTOM = 8; // bit 0x0010
int INNER = 0;
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);
Side sidedef = Level.Sectors[i].Lines[ii].Sidedef[INNER];
textureid midid = sidedef.GetTexture(sidedef.Mid);
if (midid.isNull())
{
if (CVar.FindCVar("win_window").GetBool() && peg_top && peg_bottom)
{
//Level.Sectors[i].lines[ii].flags = f ^ BLOCKING;
Level.Sectors[i].lines[ii].flags = f ^ Line.ML_BLOCK_PLAYERS;
}
if (CVar.FindCVar("win_win2floor").GetBool() && peg_top && !peg_bottom)
{
//Level.Sectors[i].lines[ii].flags = f ^ BLOCKING;
Level.Sectors[i].lines[ii].flags = f ^ Line.ML_BLOCK_PLAYERS;
}
if (CVar.FindCVar("win_win2ceiling").GetBool() && !peg_top && peg_bottom)
{
//Level.Sectors[i].lines[ii].flags = f ^ BLOCKING;
Level.Sectors[i].lines[ii].flags = f ^ Line.ML_BLOCK_PLAYERS;
}
if (CVar.FindCVar("win_blocking").GetBool() && blocking)
{
//Level.Sectors[i].lines[ii].flags = f ^ BLOCKING;
Level.Sectors[i].lines[ii].flags = f ^ Line.ML_BLOCK_PLAYERS;
}
}
}
}
}
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?