SW: Add the macro SO_EMPTY and use it instead of

separate checks of the form sop->xmid == INT32_MAX
This commit is contained in:
NY00123 2020-05-22 15:11:03 +03:00 committed by Christoph Oelckers
parent d510b9b95a
commit 37c3f1cc46
5 changed files with 15 additions and 13 deletions

View file

@ -2152,6 +2152,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];
///////////////////////////////////////////////////////////////////////////////////////////

View file

@ -202,7 +202,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;
@ -240,7 +240,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++)
@ -266,7 +266,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
@ -305,7 +305,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++)

View file

@ -47,7 +47,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)
@ -122,7 +122,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)

View file

@ -1346,7 +1346,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)
@ -3314,7 +3314,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;

View file

@ -1428,7 +1428,7 @@ PostSetupSectorObject(void)
for (sop = SectorObject; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++)
{
if (sop->xmid == INT32_MAX)
if (SO_EMPTY(sop))
continue;
FindMainSector(sop);
}
@ -1442,7 +1442,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];
@ -1476,7 +1476,7 @@ PlaceSectorObjectsOnTracks(void)
SECTOR_OBJECTp sop = &SectorObject[i];
TRACK_POINTp tpoint = NULL;
if (sop->xmid == INT32_MAX)
if (SO_EMPTY(sop))
continue;
@ -2095,7 +2095,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++)
@ -2123,7 +2123,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++)