- let ValidateSprite print better messages when developer mode is set to warning and also call it for Blood.

This commit is contained in:
Christoph Oelckers 2021-11-09 23:50:02 +01:00
parent f2e344a235
commit 642088ed80
3 changed files with 9 additions and 4 deletions

View file

@ -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*);

View file

@ -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, &sectnum);
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)
{

View file

@ -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);