summaryrefslogtreecommitdiff
path: root/src/doom/p_setup.c
diff options
context:
space:
mode:
authorSimon Howard2010-02-06 03:14:20 +0000
committerSimon Howard2010-02-06 03:14:20 +0000
commitd9520b6415f8e373cf759f316094b986e57f0f5a (patch)
treed256f7d4f1941ec33ae3c956449c70349de7297d /src/doom/p_setup.c
parent57011e785808847273461aaf6d8ed1df76ff1db9 (diff)
parent52f81b4ef175358d1e1f7f9eecab2a1edb7f4b65 (diff)
downloadchocolate-doom-d9520b6415f8e373cf759f316094b986e57f0f5a.tar.gz
chocolate-doom-d9520b6415f8e373cf759f316094b986e57f0f5a.tar.bz2
chocolate-doom-d9520b6415f8e373cf759f316094b986e57f0f5a.zip
Merge from trunk.
Subversion-branch: /branches/strife-branch Subversion-revision: 1849
Diffstat (limited to 'src/doom/p_setup.c')
-rw-r--r--src/doom/p_setup.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/doom/p_setup.c b/src/doom/p_setup.c
index 5cf7a628..2a3a8f85 100644
--- a/src/doom/p_setup.c
+++ b/src/doom/p_setup.c
@@ -167,6 +167,7 @@ void P_LoadSegs (int lump)
line_t* ldef;
int linedef;
int side;
+ int sidenum;
numsegs = W_LumpLength (lump) / sizeof(mapseg_t);
segs = Z_Malloc (numsegs*sizeof(seg_t),PU_LEVEL,0);
@@ -179,7 +180,7 @@ void P_LoadSegs (int lump)
{
li->v1 = &vertexes[SHORT(ml->v1)];
li->v2 = &vertexes[SHORT(ml->v2)];
-
+
li->angle = (SHORT(ml->angle))<<16;
li->offset = (SHORT(ml->offset))<<16;
linedef = SHORT(ml->linedef);
@@ -188,10 +189,28 @@ void P_LoadSegs (int lump)
side = SHORT(ml->side);
li->sidedef = &sides[ldef->sidenum[side]];
li->frontsector = sides[ldef->sidenum[side]].sector;
- if (ldef-> flags & ML_TWOSIDED)
- li->backsector = sides[ldef->sidenum[side^1]].sector;
- else
+
+ if (ldef-> flags & ML_TWOSIDED)
+ {
+ sidenum = ldef->sidenum[side ^ 1];
+
+ // If the sidenum is out of range, this may be a "glass hack"
+ // impassible window. Point at side #0 (this may not be
+ // the correct Vanilla behavior; however, it seems to work for
+ // OTTAWAU.WAD, which is the one place I've seen this trick
+ // used).
+
+ if (sidenum < 0 || sidenum >= numsides)
+ {
+ sidenum = 0;
+ }
+
+ li->backsector = sides[sidenum].sector;
+ }
+ else
+ {
li->backsector = 0;
+ }
}
W_ReleaseLumpNum(lump);