Commit 09d3c601 authored by NY00123's avatar NY00123 Committed by Evan Ramos
Browse files

SW: Add the macro SO_EMPTY and use it instead of

separate checks of the form sop->xmid == INT32_MAX
parent 4c97870f
......@@ -2078,6 +2078,8 @@ struct SECTOR_OBJECTstruct
#define SO_TANK 98
#define SO_SPEED_BOAT 99
#define SO_EMPTY(sop) ((sop)->xmid == INT32_MAX)
extern SECTOR_OBJECT SectorObject[MAX_SECTOR_OBJECTS];
///////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -198,7 +198,7 @@ void so_updateinterpolations(void) // Stick at beginning of domovethings
for (sop = SectorObject, interp = so_interpdata;
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
{
if (sop->xmid == INT32_MAX /*|| sop->xmid == MAXSO*/)
if (SO_EMPTY(sop))
continue;
if (interp->tic < interp->lasttic)
interp->tic += synctics;
......@@ -236,7 +236,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b
for (sop = SectorObject, interp = so_interpdata;
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
{
if (sop->xmid == INT32_MAX /*|| sop->xmid == MAXSO*/)
if (SO_EMPTY(sop))
continue;
for (i = 0; i < interp->numinterpolations; i++)
......@@ -262,7 +262,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b
for (sop = SectorObject, interp = so_interpdata;
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
{
if (sop->xmid == INT32_MAX /*|| sop->xmid == MAXSO*/)
if (SO_EMPTY(sop))
continue;
// Unfortunately, interpolating over less samples doesn't work well
......@@ -301,7 +301,7 @@ void so_restoreinterpolations(void) // Stick at end of drawscree
for (sop = SectorObject, interp = so_interpdata;
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
{
if (sop->xmid == INT32_MAX /*|| sop->xmid == MAXSO*/)
if (SO_EMPTY(sop))
continue;
for (i = 0, data = interp->data; i < interp->numinterpolations; i++, data++)
......
......@@ -43,7 +43,7 @@ DoSectorObjectSetScale(short match)
for (sop = SectorObject; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++)
{
if (sop->xmid == INT32_MAX)
if (SO_EMPTY(sop))
continue;
if (sop->match_event == match)
......@@ -118,7 +118,7 @@ DoSOevent(short match, short state)
for (sop = SectorObject; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++)
{
if (sop->xmid == INT32_MAX)
if (SO_EMPTY(sop))
continue;
if (sop->match_event == match)
......
......@@ -1337,7 +1337,7 @@ DoSectorObjectKillMatch(short match)
for (sop = SectorObject; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++)
{
if (sop->xmid == INT32_MAX)
if (SO_EMPTY(sop))
continue;
if (sop->match_event == match)
......@@ -3308,7 +3308,7 @@ DoSector(void)
for (sop = SectorObject; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++)
{
if (sop->xmid == INT32_MAX /*|| sop->xmid == MAXSO*/)
if (SO_EMPTY(sop))
continue;
......
......@@ -1423,7 +1423,7 @@ PostSetupSectorObject(void)
for (sop = SectorObject; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++)
{
if (sop->xmid == INT32_MAX)
if (SO_EMPTY(sop))
continue;
FindMainSector(sop);
}
......@@ -1437,7 +1437,7 @@ PlayerOnObject(short sectnum_match)
SECTOR_OBJECTp sop;
// place each sector object on the track
//for (i = 0; (SectorObject[i].xmid != INT32_MAX) && (i < MAX_SECTOR_OBJECTS); i++)
//for (i = 0; !SO_EMPTY(&SectorObject[i]) && (i < MAX_SECTOR_OBJECTS); i++)
for (i = 0; (i < MAX_SECTOR_OBJECTS); i++)
{
sop = &SectorObject[i];
......@@ -1471,7 +1471,7 @@ PlaceSectorObjectsOnTracks(void)
SECTOR_OBJECTp sop = &SectorObject[i];
TRACK_POINTp tpoint = NULL;
if (sop->xmid == INT32_MAX)
if (SO_EMPTY(sop))
continue;
......@@ -2091,7 +2091,7 @@ DetectSectorObject(SECTORp sectph)
// move all points to nx,ny
for (sop = SectorObject; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++)
{
if (sop->xmid == INT32_MAX /*|| sop->xmid == MAXSO*/)
if (SO_EMPTY(sop))
continue;
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++)
......@@ -2119,7 +2119,7 @@ DetectSectorObjectByWall(WALLp wph)
// move all points to nx,ny
for (sop = SectorObject; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++)
{
if (sop->xmid == INT32_MAX /*|| sop->xmid == MAXSO*/)
if (SO_EMPTY(sop))
continue;
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++)
......
Supports Markdown
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