From 9ce8202eb15afda65aba4447be8145066f801784 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 10 Sep 2020 21:39:52 +0200 Subject: [PATCH] - Duke: Added a file check for the map to be entered when ending a level. World Tour contains a map definition for E5L9 but no map for it. --- source/build/src/clip.cpp | 2 ++ source/games/duke/src/premap.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index 030c2d704..1b460f784 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -399,11 +399,13 @@ static int get_floorspr_clipyou(vec2_t const v1, vec2_t const v2, vec2_t const v static void clipupdatesector(vec2_t const pos, int16_t * const sectnum, int walldist) { +#if 0 if (enginecompatibility_mode != ENGINECOMPATIBILITY_NONE) { updatesector(pos.x, pos.y, sectnum); return; } +#endif if (inside_p(pos.x, pos.y, *sectnum)) return; diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 5d4b45b3d..f0c517c26 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -1046,8 +1046,16 @@ bool setnextmap(bool checksecretexit) map = FindNextMap(currentLevel); } + // Make sure these two are cleared in case the map check errors out. + ud.from_bonus = 0; + ud.secretlevel = 0; if (map) { + // If the map doesn't exist, abort with a meaningful message instead of crashing. + if (fileSystem.FindFile(map->fileName) < 0) + { + I_Error("Trying to open non-existent %s", map->fileName.GetChars()); + } ud.from_bonus = from_bonus; } CompleteLevel(map);