diff --git a/source/build/include/build.h b/source/build/include/build.h index cc6f7c75a..c61b66484 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -377,6 +377,7 @@ int32_t engineInit(void); void engineUnInit(void); void initspritelists(void); +void ValidateSprite(spritetype& spr); void engineLoadBoard(const char *filename, int flags, vec3_t *dapos, int16_t *daang, int *dacursectnum); void loadMapBackup(const char* filename); void G_LoadMapHack(const char* filename, const unsigned char*); diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index 14b954761..69e8a3eb0 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -206,7 +206,7 @@ static void SetWallPalV5() } } -static void ValidateSprite(spritetype& spr) +void ValidateSprite(spritetype& spr) { int index = int(&spr - sprite); bool bugged = false; @@ -224,10 +224,13 @@ static void ValidateSprite(spritetype& spr) { int sectnum = -1; updatesector(spr.x, spr.y, §num); - spr.sectnum = sectnum; - bugged = sectnum < 0; - if (bugged) Printf("Sprite #%d (%d,%d) with invalid sector %d\n", index, spr.x, spr.y, sectnum); + if (!DPrintf(DMSG_WARNING, "Sprite #%d (%d,%d) with invalid sector %d was corrected to sector %d\n", index, spr.x, spr.y, spr.sectnum, sectnum)) + { + bugged = sectnum < 0; + if (bugged) Printf("Sprite #%d (%d,%d) with invalid sector %d\n", index, spr.x, spr.y, spr.sectnum); + } + spr.sectnum = sectnum; } if (bugged) { diff --git a/source/games/blood/src/db.cpp b/source/games/blood/src/db.cpp index 40b6caf79..cb06d4b23 100644 --- a/source/games/blood/src/db.cpp +++ b/source/games/blood/src/db.cpp @@ -893,6 +893,7 @@ void dbLoadMap(const char *pPath, int *pX, int *pY, int *pZ, short *pAngle, shor pSprite->shade = load.shade; pSprite->blend = 0; pSprite->time = i; + ValidateSprite(*pSprite); InsertSpriteSect(i, sprite[i].sectnum); InsertSpriteStat(i, sprite[i].statnum);