- SW: replaced some asserts with proper value checks.

These asserts can actually be triggered by some maps with incorrect setups.
This commit is contained in:
Christoph Oelckers 2021-05-11 00:59:23 +02:00
parent ae94fb921c
commit bde644f77f

View file

@ -838,14 +838,18 @@ FindCeilingView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum
if (*sectnum < 0) if (*sectnum < 0)
return false; return false;
ASSERT(sp); if (!sp || sp->hitag != VIEW_THRU_FLOOR)
ASSERT(sp->hitag == VIEW_THRU_FLOOR); {
*sectnum = 0;
return false;
}
pix_diff = labs(z - sector[sp->sectnum].floorz) >> 8;
newz = sector[sp->sectnum].floorz + ((pix_diff / 128) + 1) * Z(128);
if (!testnewrenderer) if (!testnewrenderer)
{ {
pix_diff = labs(z - sector[sp->sectnum].floorz) >> 8;
newz = sector[sp->sectnum].floorz + ((pix_diff / 128) + 1) * Z(128);
it.Reset(STAT_FAF); it.Reset(STAT_FAF);
while ((i = it.NextIndex()) >= 0) while ((i = it.NextIndex()) >= 0)
{ {
@ -932,15 +936,18 @@ FindFloorView(short match, int32_t* x, int32_t* y, int32_t z, int16_t* sectnum)
if (*sectnum < 0) if (*sectnum < 0)
return false; return false;
ASSERT(sp); if (!sp || sp->hitag != VIEW_THRU_CEILING)
ASSERT(sp->hitag == VIEW_THRU_CEILING); {
*sectnum = 0;
// move ceiling multiple of 128 so that the wall tile will line up return false;
pix_diff = labs(z - sector[sp->sectnum].ceilingz) >> 8; }
newz = sector[sp->sectnum].ceilingz - ((pix_diff / 128) + 1) * Z(128);
if (!testnewrenderer) if (!testnewrenderer)
{ {
// move ceiling multiple of 128 so that the wall tile will line up
pix_diff = labs(z - sector[sp->sectnum].ceilingz) >> 8;
newz = sector[sp->sectnum].ceilingz - ((pix_diff / 128) + 1) * Z(128);
it.Reset(STAT_FAF); it.Reset(STAT_FAF);
while ((i = it.NextIndex()) >= 0) while ((i = it.NextIndex()) >= 0)
{ {