From cd1104e80c00b8ceb3889e8c83c5d7a3b99ea378 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 29 May 2010 09:11:12 +0000 Subject: [PATCH] - changed: Maps with missing first sidedefs no longer abort. THey now print a console warning and use the first sidedef in the map. SVN r2344 (trunk) --- src/p_setup.cpp | 20 ++++++++++++++++---- src/p_udmf.cpp | 5 +++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 5efdac413..b19b64240 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -1967,8 +1967,14 @@ void P_LoadLineDefs (MapData * map) } else { - if (LittleShort(mld->sidenum[0]) != NO_INDEX) - sidecount++; + // patch missing first sides instead of crashing out. + // Visual glitches are better than not being able to play. + if (LittleShort(mld->sidenum[0]) == NO_INDEX) + { + Printf("Line %d has no first side.\n", i); + mld->sidenum[0] = 0; + } + sidecount++; if (LittleShort(mld->sidenum[1]) != NO_INDEX) sidecount++; linemap[i] = i+skipped; @@ -2037,8 +2043,14 @@ void P_LoadLineDefs2 (MapData * map) } else { - if (LittleShort(mld->sidenum[0]) != NO_INDEX) - sidecount++; + // patch missing first sides instead of crashing out. + // Visual glitches are better than not being able to play. + if (LittleShort(mld->sidenum[0]) == NO_INDEX) + { + Printf("Line %d has no first side.\n", i); + mld->sidenum[0] = 0; + } + sidecount++; if (LittleShort(mld->sidenum[1]) != NO_INDEX) sidecount++; linemap[i] = i+skipped; diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 33fb027a7..6cbfccbef 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -850,6 +850,11 @@ struct UDMFParser { ld->Alpha = FRACUNIT * 3/4; } + if (ld->sidedef[0] == NULL) + { + ld->sidedef[0] = (side_t*)(intptr_t)(1); + Printf("Line %d has no first side.\n", index); + } } //===========================================================================