summaryrefslogtreecommitdiff
path: root/src/p_map.c
diff options
context:
space:
mode:
authorSimon Howard2010-01-26 19:18:18 +0000
committerSimon Howard2010-01-26 19:18:18 +0000
commit7c47cdf16112ed6b15e8a918377156035a166f1e (patch)
treea0b8b5481ae2904e42db50c7541028bdeb8d9390 /src/p_map.c
parentbf8974e63b988ae1b5d2fdb0492dfe0bb3613680 (diff)
downloadchocolate-doom-7c47cdf16112ed6b15e8a918377156035a166f1e.tar.gz
chocolate-doom-7c47cdf16112ed6b15e8a918377156035a166f1e.tar.bz2
chocolate-doom-7c47cdf16112ed6b15e8a918377156035a166f1e.zip
Fix glass hack windows where a linedef is flagged as two sided but has
only one side. Fixes WADs such as OTTAWAU.WAD (thanks Never_Again). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1826
Diffstat (limited to 'src/p_map.c')
-rw-r--r--src/p_map.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/p_map.c b/src/p_map.c
index 89f8f3f8..b50fff2c 100644
--- a/src/p_map.c
+++ b/src/p_map.c
@@ -885,7 +885,17 @@ PTR_AimTraverse (intercept_t* in)
dist = FixedMul (attackrange, in->frac);
- if (li->frontsector->floorheight != li->backsector->floorheight)
+ // Return false if there is no back sector. This should never
+ // be the case if the line is two-sided; however, some WADs
+ // (eg. ottawau.wad) use this as an "impassible glass" trick
+ // and rely on Vanilla Doom's (unintentional) support for this.
+
+ if (li->backsector == NULL)
+ {
+ return false;
+ }
+
+ if (li->frontsector->floorheight != li->backsector->floorheight)
{
slope = FixedDiv (openbottom - shootz , dist);
if (slope > bottomslope)
@@ -973,7 +983,14 @@ boolean PTR_ShootTraverse (intercept_t* in)
dist = FixedMul (attackrange, in->frac);
- if (li->frontsector->floorheight != li->backsector->floorheight)
+ // Check if backsector is NULL. See comment in PTR_AimTraverse.
+
+ if (li->backsector == NULL)
+ {
+ goto hitline;
+ }
+
+ if (li->frontsector->floorheight != li->backsector->floorheight)
{
slope = FixedDiv (openbottom - shootz , dist);
if (slope > aimslope)