From a13612ab9b53116ef5842f6ad01eae3e36e212c5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 13 Jan 2022 00:21:15 +0100 Subject: [PATCH] - Blood: allow bad start spots to pass for modern maps. These can have alternative start spot definitions. The error will still be printed, though. --- source/core/maploader.cpp | 6 +++--- source/core/maptypes.h | 2 +- source/games/blood/src/db.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index 66bb284b5..ed186cc8a 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -418,7 +418,7 @@ void fixSectors() } } -void validateStartSector(const char* filename, const vec3_t& pos, int* cursectnum, unsigned numsectors) +void validateStartSector(const char* filename, const vec3_t& pos, int* cursectnum, unsigned numsectors, bool noabort) { if ((unsigned)(*cursectnum) >= numsectors) @@ -426,10 +426,10 @@ void validateStartSector(const char* filename, const vec3_t& pos, int* cursectnu sectortype* sect = nullptr; updatesectorz(pos.X, pos.Y, pos.Z, §); if (!sect) updatesector(pos.X, pos.Y, §); - if (sect) + if (sect || noabort) { Printf(PRINT_HIGH, "Error in map %s: Start sector %d out of range. Max. sector is %d\n", filename, *cursectnum, numsectors); - *cursectnum = sectnum(sect); + *cursectnum = sect? sectnum(sect) : 0; } else { diff --git a/source/core/maptypes.h b/source/core/maptypes.h index 666593aac..abbfe8c69 100644 --- a/source/core/maptypes.h +++ b/source/core/maptypes.h @@ -648,4 +648,4 @@ void loadMap(const char *filename, int flags, vec3_t *pos, int16_t *ang, int *cu TArray loadMapWalls(const char* filename); void loadMapBackup(const char* filename); void loadMapHack(const char* filename, const unsigned char*, SpawnSpriteDef& sprites); -void validateStartSector(const char* filename, const vec3_t& pos, int* cursectnum, unsigned numsectors); +void validateStartSector(const char* filename, const vec3_t& pos, int* cursectnum, unsigned numsectors, bool noabort = false); diff --git a/source/games/blood/src/db.cpp b/source/games/blood/src/db.cpp index 43b21805b..0c89b3fd9 100644 --- a/source/games/blood/src/db.cpp +++ b/source/games/blood/src/db.cpp @@ -672,7 +672,7 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, int* sectionGeometry.SetSize(sections.Size()); wallbackup = wall; sectorbackup = sector; - validateStartSector(mapname.GetChars(), { *pX, *pY, *pZ }, cursectnum, mapHeader.numsectors); + validateStartSector(mapname.GetChars(), { *pX, *pY, *pZ }, cursectnum, mapHeader.numsectors, gModernMap); }