Commit 0224524e authored by Richard Gobeille's avatar Richard Gobeille
Browse files

Duke3d: improve nextsectorneighborz() return value checks

Improves the messages printed to console when bailing out of sector effect processing due to nextsectorneighborz() returning -1. This also adds such a check to ST_21_FLOOR_DOOR, which was missing it entirely. (!!)
parent 888bda5c
......@@ -731,7 +731,11 @@ void G_OperateSectors(int sectNum, int spriteNum)
if (i == -1)
{
i = nextsectorneighborz(sectNum,pSector->floorz,1,-1);
if (i == -1) return;
if (i == -1)
{
OSD_Printf("ST_16_PLATFORM_DOWN/ST_17_PLATFORM_UP: bad neighbor for sector %d!\n", sectNum);
return;
}
j = sector[i].floorz;
SetAnimation(sectNum,&pSector->floorz,j,pSector->extra);
}
......@@ -758,7 +762,10 @@ void G_OperateSectors(int sectNum, int spriteNum)
i = nextsectorneighborz(sectNum, pSector->floorz, 1, 1);
if (i == -1)
{
OSD_Printf("ST_18_ELEVATOR_DOWN/ST_19_ELEVATOR_UP: bad neighbor for sector %d!\n", sectNum);
return;
}
j = sector[i].floorz;
......@@ -792,7 +799,7 @@ void G_OperateSectors(int sectNum, int spriteNum)
if (j == -1) j = nextsectorneighborz(sectNum,pSector->ceilingz,1,1);
if (j == -1)
{
OSD_Printf("WARNING: ST29: null sector!\n");
OSD_Printf("ST_29_TEETH_DOOR: bad neighbor for sector %d!\n", sectNum);
return;
}
j = sector[j].ceilingz;
......@@ -803,7 +810,7 @@ void G_OperateSectors(int sectNum, int spriteNum)
if (j == -1) j = nextsectorneighborz(sectNum,pSector->ceilingz,-1,-1);
if (j == -1)
{
OSD_Printf("WARNING: ST29: null sector!\n");
OSD_Printf("ST_29_TEETH_DOOR: bad neighbor for sector %d!\n", sectNum);
return;
}
j = sector[j].floorz;
......@@ -852,13 +859,29 @@ REDODOOR:
if (i >= 0)
{
if (g_animateGoal[sectNum] == pSector->ceilingz)
g_animateGoal[i] = sector[nextsectorneighborz(sectNum,pSector->ceilingz,1,1)].floorz;
{
j = nextsectorneighborz(sectNum, pSector->ceilingz, 1, 1);
if (j == -1)
{
OSD_Printf("ST_21_FLOOR_DOOR: bad neighbor for sector %d!\n", sectNum);
return;
}
g_animateGoal[i] = sector[j].floorz;
}
else g_animateGoal[i] = pSector->ceilingz;
}
else
{
if (pSector->ceilingz == pSector->floorz)
j = sector[nextsectorneighborz(sectNum,pSector->ceilingz,1,1)].floorz;
{
i = nextsectorneighborz(sectNum, pSector->ceilingz, 1, 1);
if (i == -1)
{
OSD_Printf("ST_21_FLOOR_DOOR: bad neighbor for sector %d!\n", sectNum);
return;
}
j = sector[i].floorz;
}
else j = pSector->ceilingz;
pSector->lotag ^= 0x8000u;
......@@ -888,8 +911,7 @@ REDODOOR:
}
else
{
OSD_Printf("WARNING: ST_22_SPLITTING_DOOR: null sector: floor neighbor=%d, ceiling neighbor=%d!\n",
floorNeighbor, ceilingNeighbor);
OSD_Printf("ST_22_SPLITTING_DOOR: bad neighbor for sector %d; floor neighbor=%d, ceiling neighbor=%d!\n", sectNum, floorNeighbor, ceilingNeighbor);
pSector->lotag ^= 0x8000u;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment