Remove TAG_ITER_DECLARECOUNTER and the level field on the iterator macros.

Declare the position counters inside the for loops instead; RIP C90.

# Conflicts:
#	src/p_mobj.c
#	src/p_spec.c
This commit is contained in:
toaster 2022-03-18 16:43:03 +00:00
parent 5ac3709d43
commit 487103bc47
7 changed files with 83 additions and 115 deletions

View file

@ -395,9 +395,8 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type)
sector_t *sec; sector_t *sec;
ceiling_t *ceiling; ceiling_t *ceiling;
mtag_t tag = Tag_FGet(&line->tags); mtag_t tag = Tag_FGet(&line->tags);
TAG_ITER_DECLARECOUNTER(0);
TAG_ITER_SECTORS(0, tag, secnum) TAG_ITER_SECTORS(tag, secnum)
{ {
sec = &sectors[secnum]; sec = &sectors[secnum];
@ -617,9 +616,8 @@ INT32 EV_DoCrush(line_t *line, ceiling_e type)
sector_t *sec; sector_t *sec;
ceiling_t *ceiling; ceiling_t *ceiling;
mtag_t tag = Tag_FGet(&line->tags); mtag_t tag = Tag_FGet(&line->tags);
TAG_ITER_DECLARECOUNTER(0);
TAG_ITER_SECTORS(0, tag, secnum) TAG_ITER_SECTORS(tag, secnum)
{ {
sec = &sectors[secnum]; sec = &sectors[secnum];

View file

@ -635,7 +635,6 @@ void T_BounceCheese(bouncecheese_t *bouncer)
boolean remove; boolean remove;
INT32 i; INT32 i;
mtag_t tag = Tag_FGet(&bouncer->sourceline->tags); mtag_t tag = Tag_FGet(&bouncer->sourceline->tags);
TAG_ITER_DECLARECOUNTER(0);
if (bouncer->sector->crumblestate == CRUMBLE_RESTORE || bouncer->sector->crumblestate == CRUMBLE_WAIT if (bouncer->sector->crumblestate == CRUMBLE_RESTORE || bouncer->sector->crumblestate == CRUMBLE_WAIT
|| bouncer->sector->crumblestate == CRUMBLE_ACTIVATED) // Oops! Crumbler says to remove yourself! || bouncer->sector->crumblestate == CRUMBLE_ACTIVATED) // Oops! Crumbler says to remove yourself!
@ -650,7 +649,7 @@ void T_BounceCheese(bouncecheese_t *bouncer)
} }
// You can use multiple target sectors, but at your own risk!!! // You can use multiple target sectors, but at your own risk!!!
TAG_ITER_SECTORS(0, tag, i) TAG_ITER_SECTORS(tag, i)
{ {
actionsector = &sectors[i]; actionsector = &sectors[i];
actionsector->moved = true; actionsector->moved = true;
@ -775,7 +774,6 @@ void T_StartCrumble(crumble_t *crumble)
sector_t *sector; sector_t *sector;
INT32 i; INT32 i;
mtag_t tag = Tag_FGet(&crumble->sourceline->tags); mtag_t tag = Tag_FGet(&crumble->sourceline->tags);
TAG_ITER_DECLARECOUNTER(0);
// Once done, the no-return thinker just sits there, // Once done, the no-return thinker just sits there,
// constantly 'returning'... kind of an oxymoron, isn't it? // constantly 'returning'... kind of an oxymoron, isn't it?
@ -804,7 +802,7 @@ void T_StartCrumble(crumble_t *crumble)
} }
else if (++crumble->timer == 0) // Reposition back to original spot else if (++crumble->timer == 0) // Reposition back to original spot
{ {
TAG_ITER_SECTORS(0, tag, i) TAG_ITER_SECTORS(tag, i)
{ {
sector = &sectors[i]; sector = &sectors[i];
@ -840,7 +838,7 @@ void T_StartCrumble(crumble_t *crumble)
// Flash to indicate that the platform is about to return. // Flash to indicate that the platform is about to return.
if (crumble->timer > -224 && (leveltime % ((abs(crumble->timer)/8) + 1) == 0)) if (crumble->timer > -224 && (leveltime % ((abs(crumble->timer)/8) + 1) == 0))
{ {
TAG_ITER_SECTORS(0, tag, i) TAG_ITER_SECTORS(tag, i)
{ {
sector = &sectors[i]; sector = &sectors[i];
@ -932,7 +930,7 @@ void T_StartCrumble(crumble_t *crumble)
P_RemoveThinker(&crumble->thinker); P_RemoveThinker(&crumble->thinker);
} }
TAG_ITER_SECTORS(0, tag, i) TAG_ITER_SECTORS(tag, i)
{ {
sector = &sectors[i]; sector = &sectors[i];
sector->moved = true; sector->moved = true;
@ -948,7 +946,6 @@ void T_StartCrumble(crumble_t *crumble)
void T_MarioBlock(mariothink_t *block) void T_MarioBlock(mariothink_t *block)
{ {
INT32 i; INT32 i;
TAG_ITER_DECLARECOUNTER(0);
T_MovePlane T_MovePlane
( (
@ -983,7 +980,7 @@ void T_MarioBlock(mariothink_t *block)
block->sector->ceilspeed = 0; block->sector->ceilspeed = 0;
block->direction = 0; block->direction = 0;
} }
TAG_ITER_SECTORS(0, (INT16)block->tag, i) TAG_ITER_SECTORS((INT16)block->tag, i)
P_RecalcPrecipInSector(&sectors[i]); P_RecalcPrecipInSector(&sectors[i]);
} }
@ -1283,9 +1280,8 @@ void T_NoEnemiesSector(noenemies_t *nobaddies)
INT32 secnum = -1; INT32 secnum = -1;
boolean FOFsector = false; boolean FOFsector = false;
mtag_t tag = Tag_FGet(&nobaddies->sourceline->tags); mtag_t tag = Tag_FGet(&nobaddies->sourceline->tags);
TAG_ITER_DECLARECOUNTER(0);
TAG_ITER_SECTORS(0, tag, secnum) TAG_ITER_SECTORS(tag, secnum)
{ {
sec = &sectors[secnum]; sec = &sectors[secnum];
@ -1296,14 +1292,13 @@ void T_NoEnemiesSector(noenemies_t *nobaddies)
{ {
INT32 targetsecnum = -1; INT32 targetsecnum = -1;
mtag_t tag2 = Tag_FGet(&sec->lines[i]->tags); mtag_t tag2 = Tag_FGet(&sec->lines[i]->tags);
TAG_ITER_DECLARECOUNTER(1);
if (sec->lines[i]->special < 100 || sec->lines[i]->special >= 300) if (sec->lines[i]->special < 100 || sec->lines[i]->special >= 300)
continue; continue;
FOFsector = true; FOFsector = true;
TAG_ITER_SECTORS(1, tag2, targetsecnum) TAG_ITER_SECTORS(tag2, targetsecnum)
{ {
if (T_SectorHasEnemies(&sectors[targetsecnum])) if (T_SectorHasEnemies(&sectors[targetsecnum]))
return; return;
@ -1363,7 +1358,6 @@ void T_EachTimeThinker(eachtime_t *eachtime)
fixed_t bottomheight, topheight; fixed_t bottomheight, topheight;
ffloor_t *rover; ffloor_t *rover;
mtag_t tag = Tag_FGet(&eachtime->sourceline->tags); mtag_t tag = Tag_FGet(&eachtime->sourceline->tags);
TAG_ITER_DECLARECOUNTER(0);
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
{ {
@ -1373,7 +1367,7 @@ void T_EachTimeThinker(eachtime_t *eachtime)
eachtime->playersOnArea[i] = false; eachtime->playersOnArea[i] = false;
} }
TAG_ITER_SECTORS(0, tag, secnum) TAG_ITER_SECTORS(tag, secnum)
{ {
sec = &sectors[secnum]; sec = &sectors[secnum];
@ -1391,14 +1385,13 @@ void T_EachTimeThinker(eachtime_t *eachtime)
{ {
INT32 targetsecnum = -1; INT32 targetsecnum = -1;
mtag_t tag2 = Tag_FGet(&sec->lines[i]->tags); mtag_t tag2 = Tag_FGet(&sec->lines[i]->tags);
TAG_ITER_DECLARECOUNTER(1);
if (sec->lines[i]->special < 100 || sec->lines[i]->special >= 300) if (sec->lines[i]->special < 100 || sec->lines[i]->special >= 300)
continue; continue;
FOFsector = true; FOFsector = true;
TAG_ITER_SECTORS(1, tag2, targetsecnum) TAG_ITER_SECTORS(tag2, targetsecnum)
{ {
targetsec = &sectors[targetsecnum]; targetsec = &sectors[targetsecnum];
@ -1533,12 +1526,11 @@ void T_RaiseSector(raise_t *raise)
INT32 direction; INT32 direction;
result_e res = 0; result_e res = 0;
mtag_t tag = raise->tag; mtag_t tag = raise->tag;
TAG_ITER_DECLARECOUNTER(0);
if (raise->sector->crumblestate >= CRUMBLE_FALL || raise->sector->ceilingdata) if (raise->sector->crumblestate >= CRUMBLE_FALL || raise->sector->ceilingdata)
return; return;
TAG_ITER_SECTORS(0, tag, i) TAG_ITER_SECTORS(tag, i)
{ {
sector = &sectors[i]; sector = &sectors[i];
@ -1665,7 +1657,7 @@ void T_RaiseSector(raise_t *raise)
raise->sector->ceilspeed = 42; raise->sector->ceilspeed = 42;
raise->sector->floorspeed = speed*direction; raise->sector->floorspeed = speed*direction;
TAG_ITER_SECTORS(0, tag, i) TAG_ITER_SECTORS(tag, i)
P_RecalcPrecipInSector(&sectors[i]); P_RecalcPrecipInSector(&sectors[i]);
} }
@ -1759,9 +1751,8 @@ void EV_DoFloor(line_t *line, floor_e floortype)
sector_t *sec; sector_t *sec;
floormove_t *dofloor; floormove_t *dofloor;
mtag_t tag = Tag_FGet(&line->tags); mtag_t tag = Tag_FGet(&line->tags);
TAG_ITER_DECLARECOUNTER(0);
TAG_ITER_SECTORS(0, tag, secnum) TAG_ITER_SECTORS(tag, secnum)
{ {
sec = &sectors[secnum]; sec = &sectors[secnum];
@ -1976,10 +1967,9 @@ void EV_DoElevator(line_t *line, elevator_e elevtype, boolean customspeed)
sector_t *sec; sector_t *sec;
elevator_t *elevator; elevator_t *elevator;
mtag_t tag = Tag_FGet(&line->tags); mtag_t tag = Tag_FGet(&line->tags);
TAG_ITER_DECLARECOUNTER(0);
// act on all sectors with the same tag as the triggering linedef // act on all sectors with the same tag as the triggering linedef
TAG_ITER_SECTORS(0, tag, secnum) TAG_ITER_SECTORS(tag, secnum)
{ {
sec = &sectors[secnum]; sec = &sectors[secnum];
@ -2277,7 +2267,6 @@ INT32 EV_StartCrumble(sector_t *sec, ffloor_t *rover, boolean floating,
sector_t *foundsec; sector_t *foundsec;
INT32 i; INT32 i;
mtag_t tag = Tag_FGet(&rover->master->tags); mtag_t tag = Tag_FGet(&rover->master->tags);
TAG_ITER_DECLARECOUNTER(0);
// If floor is already activated, skip it // If floor is already activated, skip it
if (sec->floordata) if (sec->floordata)
@ -2320,7 +2309,7 @@ INT32 EV_StartCrumble(sector_t *sec, ffloor_t *rover, boolean floating,
crumble->sector->crumblestate = CRUMBLE_ACTIVATED; crumble->sector->crumblestate = CRUMBLE_ACTIVATED;
TAG_ITER_SECTORS(0, tag, i) TAG_ITER_SECTORS(tag, i)
{ {
foundsec = &sectors[i]; foundsec = &sectors[i];

View file

@ -374,10 +374,9 @@ void P_FadeLightBySector(sector_t *sector, INT32 destvalue, INT32 speed, boolean
void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed, boolean ticbased, boolean force) void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed, boolean ticbased, boolean force)
{ {
INT32 i; INT32 i;
TAG_ITER_DECLARECOUNTER(0);
// search all sectors for ones with tag // search all sectors for ones with tag
TAG_ITER_SECTORS(0, tag, i) TAG_ITER_SECTORS(tag, i)
{ {
if (!force && ticbased // always let speed fader execute if (!force && ticbased // always let speed fader execute
&& sectors[i].lightingdata && sectors[i].lightingdata

View file

@ -3074,9 +3074,7 @@ static void P_ConvertBinaryMap(void)
INT32 check = -1; INT32 check = -1;
INT32 paramline = -1; INT32 paramline = -1;
TAG_ITER_DECLARECOUNTER(0); TAG_ITER_LINES(tag, check)
TAG_ITER_LINES(0, tag, check)
{ {
if (lines[check].special == 22) if (lines[check].special == 22)
{ {
@ -3319,11 +3317,9 @@ static void P_ConvertBinaryMap(void)
INT32 firstline = -1; INT32 firstline = -1;
mtag_t tag = mapthings[i].angle; mtag_t tag = mapthings[i].angle;
TAG_ITER_DECLARECOUNTER(0);
Tag_FSet(&mapthings[i].tags, tag); Tag_FSet(&mapthings[i].tags, tag);
TAG_ITER_LINES(0, tag, check) TAG_ITER_LINES(tag, check)
{ {
if (lines[check].special == 20) if (lines[check].special == 20)
{ {

View file

@ -595,11 +595,10 @@ static boolean P_SetSlopeFromTag(sector_t *sec, INT32 tag, boolean ceiling)
{ {
INT32 i; INT32 i;
pslope_t **secslope = ceiling ? &sec->c_slope : &sec->f_slope; pslope_t **secslope = ceiling ? &sec->c_slope : &sec->f_slope;
TAG_ITER_DECLARECOUNTER(0);
if (!tag || *secslope) if (!tag || *secslope)
return false; return false;
TAG_ITER_SECTORS(0, tag, i) TAG_ITER_SECTORS(tag, i)
{ {
pslope_t *srcslope = ceiling ? sectors[i].c_slope : sectors[i].f_slope; pslope_t *srcslope = ceiling ? sectors[i].c_slope : sectors[i].f_slope;
if (srcslope) if (srcslope)

View file

@ -2120,7 +2120,6 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
{ {
INT32 secnum = -1; INT32 secnum = -1;
mtag_t tag = Tag_FGet(&line->tags); mtag_t tag = Tag_FGet(&line->tags);
TAG_ITER_DECLARECOUNTER(0);
I_Assert(!mo || !P_MobjWasRemoved(mo)); // If mo is there, mo must be valid! I_Assert(!mo || !P_MobjWasRemoved(mo)); // If mo is there, mo must be valid!
@ -2145,7 +2144,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
newceilinglightsec = line->frontsector->ceilinglightsec; newceilinglightsec = line->frontsector->ceilinglightsec;
// act on all sectors with the same tag as the triggering linedef // act on all sectors with the same tag as the triggering linedef
TAG_ITER_SECTORS(0, tag, secnum) TAG_ITER_SECTORS(tag, secnum)
{ {
if (sectors[secnum].lightingdata) if (sectors[secnum].lightingdata)
{ {
@ -2200,7 +2199,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
case 409: // Change tagged sectors' tag case 409: // Change tagged sectors' tag
// (formerly "Change calling sectors' tag", but behavior was changed) // (formerly "Change calling sectors' tag", but behavior was changed)
{ {
TAG_ITER_SECTORS(0, tag, secnum) TAG_ITER_SECTORS(tag, secnum)
Tag_SectorFSet(secnum,(INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS)); Tag_SectorFSet(secnum,(INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS));
break; break;
} }
@ -2210,7 +2209,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break; break;
case 411: // Stop floor/ceiling movement in tagged sector(s) case 411: // Stop floor/ceiling movement in tagged sector(s)
TAG_ITER_SECTORS(0, tag, secnum) TAG_ITER_SECTORS(tag, secnum)
{ {
if (sectors[secnum].floordata) if (sectors[secnum].floordata)
{ {
@ -2394,7 +2393,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
// Additionally play the sound from tagged sectors' soundorgs // Additionally play the sound from tagged sectors' soundorgs
sector_t *sec; sector_t *sec;
TAG_ITER_SECTORS(0, tag, secnum) TAG_ITER_SECTORS(tag, secnum)
{ {
sec = &sectors[secnum]; sec = &sectors[secnum];
S_StartSound(&sec->soundorg, sfxnum); S_StartSound(&sec->soundorg, sfxnum);
@ -2511,7 +2510,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break; break;
case 416: // Spawn adjustable fire flicker case 416: // Spawn adjustable fire flicker
TAG_ITER_SECTORS(0, tag, secnum) TAG_ITER_SECTORS(tag, secnum)
{ {
if (line->flags & ML_NOCLIMB && line->backsector) if (line->flags & ML_NOCLIMB && line->backsector)
{ {
@ -2545,7 +2544,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break; break;
case 417: // Spawn adjustable glowing light case 417: // Spawn adjustable glowing light
TAG_ITER_SECTORS(0, tag, secnum) TAG_ITER_SECTORS(tag, secnum)
{ {
if (line->flags & ML_NOCLIMB && line->backsector) if (line->flags & ML_NOCLIMB && line->backsector)
{ {
@ -2579,7 +2578,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break; break;
case 418: // Spawn adjustable strobe flash (unsynchronized) case 418: // Spawn adjustable strobe flash (unsynchronized)
TAG_ITER_SECTORS(0, tag, secnum) TAG_ITER_SECTORS(tag, secnum)
{ {
if (line->flags & ML_NOCLIMB && line->backsector) if (line->flags & ML_NOCLIMB && line->backsector)
{ {
@ -2613,7 +2612,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break; break;
case 419: // Spawn adjustable strobe flash (synchronized) case 419: // Spawn adjustable strobe flash (synchronized)
TAG_ITER_SECTORS(0, tag, secnum) TAG_ITER_SECTORS(tag, secnum)
{ {
if (line->flags & ML_NOCLIMB && line->backsector) if (line->flags & ML_NOCLIMB && line->backsector)
{ {
@ -2661,7 +2660,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break; break;
case 421: // Stop lighting effect in tagged sectors case 421: // Stop lighting effect in tagged sectors
TAG_ITER_SECTORS(0, tag, secnum) TAG_ITER_SECTORS(tag, secnum)
if (sectors[secnum].lightingdata) if (sectors[secnum].lightingdata)
{ {
P_RemoveThinker(&((elevator_t *)sectors[secnum].lightingdata)->thinker); P_RemoveThinker(&((elevator_t *)sectors[secnum].lightingdata)->thinker);
@ -2829,7 +2828,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
ffloor_t *rover; // FOF that we are going to crumble ffloor_t *rover; // FOF that we are going to crumble
boolean foundrover = false; // for debug, "Can't find a FOF" message boolean foundrover = false; // for debug, "Can't find a FOF" message
TAG_ITER_SECTORS(0, sectag, secnum) TAG_ITER_SECTORS(sectag, secnum)
{ {
sec = sectors + secnum; sec = sectors + secnum;
@ -2950,7 +2949,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
if (line->sidenum[1] != 0xffff) if (line->sidenum[1] != 0xffff)
state = (statenum_t)sides[line->sidenum[1]].toptexture; state = (statenum_t)sides[line->sidenum[1]].toptexture;
TAG_ITER_SECTORS(0, tag, secnum) TAG_ITER_SECTORS(tag, secnum)
{ {
boolean tryagain; boolean tryagain;
sec = sectors + secnum; sec = sectors + secnum;
@ -3010,7 +3009,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
boolean foundrover = false; // for debug, "Can't find a FOF" message boolean foundrover = false; // for debug, "Can't find a FOF" message
ffloortype_e oldflags; // store FOF's old flags ffloortype_e oldflags; // store FOF's old flags
TAG_ITER_SECTORS(0, sectag, secnum) TAG_ITER_SECTORS(sectag, secnum)
{ {
sec = sectors + secnum; sec = sectors + secnum;
@ -3068,7 +3067,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
if (line->flags & ML_NOCLIMB) // don't respawn! if (line->flags & ML_NOCLIMB) // don't respawn!
respawn = false; respawn = false;
TAG_ITER_SECTORS(0, sectag, secnum) TAG_ITER_SECTORS(sectag, secnum)
{ {
sec = sectors + secnum; sec = sectors + secnum;
@ -3124,7 +3123,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
source = sectors[sourcesec].extra_colormap; source = sectors[sourcesec].extra_colormap;
} }
} }
TAG_ITER_SECTORS(0, line->args[0], secnum) TAG_ITER_SECTORS(line->args[0], secnum)
{ {
if (sectors[secnum].colormap_protected) if (sectors[secnum].colormap_protected)
continue; continue;
@ -3268,7 +3267,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
ffloor_t *rover; // FOF that we are going to operate ffloor_t *rover; // FOF that we are going to operate
boolean foundrover = false; // for debug, "Can't find a FOF" message boolean foundrover = false; // for debug, "Can't find a FOF" message
TAG_ITER_SECTORS(0, sectag, secnum) TAG_ITER_SECTORS(sectag, secnum)
{ {
sec = sectors + secnum; sec = sectors + secnum;
@ -3332,7 +3331,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
boolean foundrover = false; // for debug, "Can't find a FOF" message boolean foundrover = false; // for debug, "Can't find a FOF" message
size_t j = 0; // sec->ffloors is saved as ffloor #0, ss->ffloors->next is #1, etc size_t j = 0; // sec->ffloors is saved as ffloor #0, ss->ffloors->next is #1, etc
TAG_ITER_SECTORS(0, sectag, secnum) TAG_ITER_SECTORS(sectag, secnum)
{ {
sec = sectors + secnum; sec = sectors + secnum;
@ -3417,7 +3416,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
ffloor_t *rover; // FOF that we are going to operate ffloor_t *rover; // FOF that we are going to operate
boolean foundrover = false; // for debug, "Can't find a FOF" message boolean foundrover = false; // for debug, "Can't find a FOF" message
TAG_ITER_SECTORS(0, sectag, secnum) TAG_ITER_SECTORS(sectag, secnum)
{ {
sec = sectors + secnum; sec = sectors + secnum;
@ -3468,7 +3467,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
} }
} }
TAG_ITER_SECTORS(0, line->args[0], secnum) TAG_ITER_SECTORS(line->args[0], secnum)
{ {
extracolormap_t *source_exc, *dest_exc, *exc; extracolormap_t *source_exc, *dest_exc, *exc;
@ -3548,7 +3547,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break; break;
} }
case 456: // Stop fade colormap case 456: // Stop fade colormap
TAG_ITER_SECTORS(0, line->args[0], secnum) TAG_ITER_SECTORS(line->args[0], secnum)
P_ResetColormapFader(&sectors[secnum]); P_ResetColormapFader(&sectors[secnum]);
break; break;
@ -3742,12 +3741,11 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
case 465: // Set linedef executor delay case 465: // Set linedef executor delay
{ {
INT32 linenum; INT32 linenum;
TAG_ITER_DECLARECOUNTER(1);
if (!udmf) if (!udmf)
break; break;
TAG_ITER_LINES(1, line->args[0], linenum) TAG_ITER_LINES(line->args[0], linenum)
{ {
if (line->args[2]) if (line->args[2])
lines[linenum].executordelay += line->args[1]; lines[linenum].executordelay += line->args[1];
@ -5752,9 +5750,8 @@ void T_LaserFlash(laserthink_t *flash)
sector_t *sector; sector_t *sector;
sector_t *sourcesec = flash->sourceline->frontsector; sector_t *sourcesec = flash->sourceline->frontsector;
fixed_t top, bottom; fixed_t top, bottom;
TAG_ITER_DECLARECOUNTER(0);
TAG_ITER_SECTORS(0, flash->tag, s) TAG_ITER_SECTORS(flash->tag, s)
{ {
sector = &sectors[s]; sector = &sectors[s];
for (fflr = sector->ffloors; fflr; fflr = fflr->next) for (fflr = sector->ffloors; fflr; fflr = fflr->next)
@ -6027,11 +6024,10 @@ void P_SpawnSpecials(boolean fromnetsave)
INT32 s; INT32 s;
size_t sec; size_t sec;
ffloortype_e ffloorflags; ffloortype_e ffloorflags;
TAG_ITER_DECLARECOUNTER(0);
case 1: // Definable gravity per sector case 1: // Definable gravity per sector
sec = sides[*lines[i].sidenum].sector - sectors; sec = sides[*lines[i].sidenum].sector - sectors;
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
{ {
sectors[s].gravity = &sectors[sec].floorheight; // This allows it to change in realtime! sectors[s].gravity = &sectors[sec].floorheight; // This allows it to change in realtime!
@ -6055,7 +6051,7 @@ void P_SpawnSpecials(boolean fromnetsave)
case 5: // Change camera info case 5: // Change camera info
sec = sides[*lines[i].sidenum].sector - sectors; sec = sides[*lines[i].sidenum].sector - sectors;
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
P_AddCameraScanner(&sectors[sec], &sectors[s], R_PointToAngle2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y)); P_AddCameraScanner(&sectors[sec], &sectors[s], R_PointToAngle2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y));
break; break;
@ -6082,7 +6078,7 @@ void P_SpawnSpecials(boolean fromnetsave)
P_ApplyFlatAlignment(lines + i, lines[i].frontsector, flatangle, xoffs, yoffs); P_ApplyFlatAlignment(lines + i, lines[i].frontsector, flatangle, xoffs, yoffs);
else else
{ {
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
P_ApplyFlatAlignment(lines + i, sectors + s, flatangle, xoffs, yoffs); P_ApplyFlatAlignment(lines + i, sectors + s, flatangle, xoffs, yoffs);
} }
} }
@ -6093,7 +6089,7 @@ void P_SpawnSpecials(boolean fromnetsave)
break; break;
case 8: // Sector Parameters case 8: // Sector Parameters
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
{ {
if (lines[i].flags & ML_NOCLIMB) if (lines[i].flags & ML_NOCLIMB)
{ {
@ -6126,7 +6122,7 @@ void P_SpawnSpecials(boolean fromnetsave)
break; break;
case 10: // Vertical culling plane for sprites and FOFs case 10: // Vertical culling plane for sprites and FOFs
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
sectors[s].cullheight = &lines[i]; // This allows it to change in realtime! sectors[s].cullheight = &lines[i]; // This allows it to change in realtime!
break; break;
@ -6187,19 +6183,19 @@ void P_SpawnSpecials(boolean fromnetsave)
case 63: // support for drawn heights coming from different sector case 63: // support for drawn heights coming from different sector
sec = sides[*lines[i].sidenum].sector-sectors; sec = sides[*lines[i].sidenum].sector-sectors;
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
sectors[s].heightsec = (INT32)sec; sectors[s].heightsec = (INT32)sec;
break; break;
case 64: // Appearing/Disappearing FOF option case 64: // Appearing/Disappearing FOF option
if (lines[i].flags & ML_BLOCKPLAYERS) { // Find FOFs by control sector tag if (lines[i].flags & ML_BLOCKPLAYERS) { // Find FOFs by control sector tag
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
for (j = 0; (unsigned)j < sectors[s].linecount; j++) for (j = 0; (unsigned)j < sectors[s].linecount; j++)
if (sectors[s].lines[j]->special >= 100 && sectors[s].lines[j]->special < 300) if (sectors[s].lines[j]->special >= 100 && sectors[s].lines[j]->special < 300)
Add_MasterDisappearer(abs(lines[i].dx>>FRACBITS), abs(lines[i].dy>>FRACBITS), abs(sides[lines[i].sidenum[0]].sector->floorheight>>FRACBITS), (INT32)(sectors[s].lines[j]-lines), (INT32)i); Add_MasterDisappearer(abs(lines[i].dx>>FRACBITS), abs(lines[i].dy>>FRACBITS), abs(sides[lines[i].sidenum[0]].sector->floorheight>>FRACBITS), (INT32)(sectors[s].lines[j]-lines), (INT32)i);
} else // Find FOFs by effect sector tag } else // Find FOFs by effect sector tag
{ {
TAG_ITER_LINES(0, tag, s) TAG_ITER_LINES(tag, s)
{ {
if ((size_t)s == i) if ((size_t)s == i)
continue; continue;
@ -6210,16 +6206,16 @@ void P_SpawnSpecials(boolean fromnetsave)
break; break;
case 66: // Displace floor by front sector case 66: // Displace floor by front sector
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
P_AddPlaneDisplaceThinker(pd_floor, P_AproxDistance(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB)); P_AddPlaneDisplaceThinker(pd_floor, FixedHypot(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB));
break; break;
case 67: // Displace ceiling by front sector case 67: // Displace ceiling by front sector
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
P_AddPlaneDisplaceThinker(pd_ceiling, P_AproxDistance(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB)); P_AddPlaneDisplaceThinker(pd_ceiling, FixedHypot(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB));
break; break;
case 68: // Displace both floor AND ceiling by front sector case 68: // Displace both floor AND ceiling by front sector
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
P_AddPlaneDisplaceThinker(pd_both, P_AproxDistance(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB)); P_AddPlaneDisplaceThinker(pd_both, FixedHypot(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB));
break; break;
case 100: // FOF (solid, opaque, shadows) case 100: // FOF (solid, opaque, shadows)
@ -6810,46 +6806,46 @@ void P_SpawnSpecials(boolean fromnetsave)
case 600: // floor lighting independently (e.g. lava) case 600: // floor lighting independently (e.g. lava)
sec = sides[*lines[i].sidenum].sector-sectors; sec = sides[*lines[i].sidenum].sector-sectors;
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
sectors[s].floorlightsec = (INT32)sec; sectors[s].floorlightsec = (INT32)sec;
break; break;
case 601: // ceiling lighting independently case 601: // ceiling lighting independently
sec = sides[*lines[i].sidenum].sector-sectors; sec = sides[*lines[i].sidenum].sector-sectors;
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
sectors[s].ceilinglightsec = (INT32)sec; sectors[s].ceilinglightsec = (INT32)sec;
break; break;
case 602: // Adjustable pulsating light case 602: // Adjustable pulsating light
sec = sides[*lines[i].sidenum].sector - sectors; sec = sides[*lines[i].sidenum].sector - sectors;
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
P_SpawnAdjustableGlowingLight(&sectors[sec], &sectors[s], P_SpawnAdjustableGlowingLight(&sectors[sec], &sectors[s],
P_AproxDistance(lines[i].dx, lines[i].dy)>>FRACBITS); P_AproxDistance(lines[i].dx, lines[i].dy)>>FRACBITS);
break; break;
case 603: // Adjustable flickering light case 603: // Adjustable flickering light
sec = sides[*lines[i].sidenum].sector - sectors; sec = sides[*lines[i].sidenum].sector - sectors;
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
P_SpawnAdjustableFireFlicker(&sectors[sec], &sectors[s], P_SpawnAdjustableFireFlicker(&sectors[sec], &sectors[s],
P_AproxDistance(lines[i].dx, lines[i].dy)>>FRACBITS); P_AproxDistance(lines[i].dx, lines[i].dy)>>FRACBITS);
break; break;
case 604: // Adjustable Blinking Light (unsynchronized) case 604: // Adjustable Blinking Light (unsynchronized)
sec = sides[*lines[i].sidenum].sector - sectors; sec = sides[*lines[i].sidenum].sector - sectors;
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
P_SpawnAdjustableStrobeFlash(&sectors[sec], &sectors[s], P_SpawnAdjustableStrobeFlash(&sectors[sec], &sectors[s],
abs(lines[i].dx)>>FRACBITS, abs(lines[i].dy)>>FRACBITS, false); abs(lines[i].dx)>>FRACBITS, abs(lines[i].dy)>>FRACBITS, false);
break; break;
case 605: // Adjustable Blinking Light (synchronized) case 605: // Adjustable Blinking Light (synchronized)
sec = sides[*lines[i].sidenum].sector - sectors; sec = sides[*lines[i].sidenum].sector - sectors;
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
P_SpawnAdjustableStrobeFlash(&sectors[sec], &sectors[s], P_SpawnAdjustableStrobeFlash(&sectors[sec], &sectors[s],
abs(lines[i].dx)>>FRACBITS, abs(lines[i].dy)>>FRACBITS, true); abs(lines[i].dx)>>FRACBITS, abs(lines[i].dy)>>FRACBITS, true);
break; break;
case 606: // HACK! Copy colormaps. Just plain colormaps. case 606: // HACK! Copy colormaps. Just plain colormaps.
TAG_ITER_SECTORS(0, lines[i].args[0], s) TAG_ITER_SECTORS(lines[i].args[0], s)
{ {
extracolormap_t *exc; extracolormap_t *exc;
@ -6977,13 +6973,12 @@ void P_SpawnSpecialsAfterSlopes(void)
*/ */
static void P_AddFakeFloorsByLine(size_t line, ffloortype_e ffloorflags, thinkerlist_t *secthinkers) static void P_AddFakeFloorsByLine(size_t line, ffloortype_e ffloorflags, thinkerlist_t *secthinkers)
{ {
TAG_ITER_DECLARECOUNTER(0);
INT32 s; INT32 s;
mtag_t tag = Tag_FGet(&lines[line].tags); mtag_t tag = Tag_FGet(&lines[line].tags);
size_t sec = sides[*lines[line].sidenum].sector-sectors; size_t sec = sides[*lines[line].sidenum].sector-sectors;
line_t* li = lines + line; line_t* li = lines + line;
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
P_AddFakeFloor(&sectors[s], &sectors[sec], li, ffloorflags, secthinkers); P_AddFakeFloor(&sectors[s], &sectors[sec], li, ffloorflags, secthinkers);
} }
@ -7091,7 +7086,6 @@ void T_Scroll(scroll_t *s)
size_t i; size_t i;
INT32 sect; INT32 sect;
ffloor_t *rover; ffloor_t *rover;
TAG_ITER_DECLARECOUNTER(0);
case sc_side: // scroll wall texture case sc_side: // scroll wall texture
side = sides + s->affectee; side = sides + s->affectee;
@ -7128,7 +7122,7 @@ void T_Scroll(scroll_t *s)
if (!is3dblock) if (!is3dblock)
continue; continue;
TAG_ITER_SECTORS(0, Tag_FGet(&line->tags), sect) TAG_ITER_SECTORS(Tag_FGet(&line->tags), sect)
{ {
sector_t *psec; sector_t *psec;
psec = sectors + sect; psec = sectors + sect;
@ -7203,7 +7197,7 @@ void T_Scroll(scroll_t *s)
if (!is3dblock) if (!is3dblock)
continue; continue;
TAG_ITER_SECTORS(0, Tag_FGet(&line->tags), sect) TAG_ITER_SECTORS(Tag_FGet(&line->tags), sect)
{ {
sector_t *psec; sector_t *psec;
psec = sectors + sect; psec = sectors + sect;
@ -7315,7 +7309,6 @@ static void P_SpawnScrollers(void)
INT32 special = l->special; INT32 special = l->special;
register INT32 s; register INT32 s;
TAG_ITER_DECLARECOUNTER(0);
tag = Tag_FGet(&l->tags); tag = Tag_FGet(&l->tags);
@ -7360,7 +7353,7 @@ static void P_SpawnScrollers(void)
{ {
case 513: // scroll effect ceiling case 513: // scroll effect ceiling
case 533: // scroll and carry objects on ceiling case 533: // scroll and carry objects on ceiling
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
Add_Scroller(sc_ceiling, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB); Add_Scroller(sc_ceiling, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB);
if (special != 533) if (special != 533)
break; break;
@ -7369,13 +7362,13 @@ static void P_SpawnScrollers(void)
case 523: // carry objects on ceiling case 523: // carry objects on ceiling
dx = FixedMul(dx, CARRYFACTOR); dx = FixedMul(dx, CARRYFACTOR);
dy = FixedMul(dy, CARRYFACTOR); dy = FixedMul(dy, CARRYFACTOR);
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
Add_Scroller(sc_carry_ceiling, dx, dy, control, s, accel, l->flags & ML_NOCLIMB); Add_Scroller(sc_carry_ceiling, dx, dy, control, s, accel, l->flags & ML_NOCLIMB);
break; break;
case 510: // scroll effect floor case 510: // scroll effect floor
case 530: // scroll and carry objects on floor case 530: // scroll and carry objects on floor
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
Add_Scroller(sc_floor, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB); Add_Scroller(sc_floor, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB);
if (special != 530) if (special != 530)
break; break;
@ -7384,7 +7377,7 @@ static void P_SpawnScrollers(void)
case 520: // carry objects on floor case 520: // carry objects on floor
dx = FixedMul(dx, CARRYFACTOR); dx = FixedMul(dx, CARRYFACTOR);
dy = FixedMul(dy, CARRYFACTOR); dy = FixedMul(dy, CARRYFACTOR);
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
Add_Scroller(sc_carry, dx, dy, control, s, accel, l->flags & ML_NOCLIMB); Add_Scroller(sc_carry, dx, dy, control, s, accel, l->flags & ML_NOCLIMB);
break; break;
@ -7392,7 +7385,7 @@ static void P_SpawnScrollers(void)
// (same direction and speed as scrolling floors) // (same direction and speed as scrolling floors)
case 502: case 502:
{ {
TAG_ITER_LINES(0, tag, s) TAG_ITER_LINES(tag, s)
if (s != (INT32)i) if (s != (INT32)i)
{ {
if (l->flags & ML_EFFECT2) // use texture offsets instead if (l->flags & ML_EFFECT2) // use texture offsets instead
@ -7506,9 +7499,8 @@ void T_Disappear(disappear_t *d)
ffloor_t *rover; ffloor_t *rover;
register INT32 s; register INT32 s;
mtag_t afftag = Tag_FGet(&lines[d->affectee].tags); mtag_t afftag = Tag_FGet(&lines[d->affectee].tags);
TAG_ITER_DECLARECOUNTER(0);
TAG_ITER_SECTORS(0, afftag, s) TAG_ITER_SECTORS(afftag, s)
{ {
for (rover = sectors[s].ffloors; rover; rover = rover->next) for (rover = sectors[s].ffloors; rover; rover = rover->next)
{ {
@ -8239,7 +8231,6 @@ static void P_SpawnFriction(void)
fixed_t strength; // frontside texture offset controls magnitude fixed_t strength; // frontside texture offset controls magnitude
fixed_t friction; // friction value to be applied during movement fixed_t friction; // friction value to be applied during movement
INT32 movefactor; // applied to each player move to simulate inertia INT32 movefactor; // applied to each player move to simulate inertia
TAG_ITER_DECLARECOUNTER(0);
for (i = 0; i < numlines; i++, l++) for (i = 0; i < numlines; i++, l++)
if (l->special == 540) if (l->special == 540)
@ -8265,7 +8256,7 @@ static void P_SpawnFriction(void)
else else
movefactor = FRACUNIT; movefactor = FRACUNIT;
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
Add_Friction(friction, movefactor, s, -1); Add_Friction(friction, movefactor, s, -1);
} }
} }
@ -8737,7 +8728,6 @@ static void P_SpawnPushers(void)
mtag_t tag; mtag_t tag;
register INT32 s; register INT32 s;
mobj_t *thing; mobj_t *thing;
TAG_ITER_DECLARECOUNTER(0);
for (i = 0; i < numlines; i++, l++) for (i = 0; i < numlines; i++, l++)
{ {
@ -8745,15 +8735,15 @@ static void P_SpawnPushers(void)
switch (l->special) switch (l->special)
{ {
case 541: // wind case 541: // wind
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
Add_Pusher(p_wind, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); Add_Pusher(p_wind, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4);
break; break;
case 544: // current case 544: // current
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
Add_Pusher(p_current, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); Add_Pusher(p_current, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4);
break; break;
case 547: // push/pull case 547: // push/pull
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
{ {
thing = P_GetPushThing(s); thing = P_GetPushThing(s);
if (thing) // No MT_P* means no effect if (thing) // No MT_P* means no effect
@ -8761,19 +8751,19 @@ static void P_SpawnPushers(void)
} }
break; break;
case 545: // current up case 545: // current up
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
Add_Pusher(p_upcurrent, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); Add_Pusher(p_upcurrent, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4);
break; break;
case 546: // current down case 546: // current down
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
Add_Pusher(p_downcurrent, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); Add_Pusher(p_downcurrent, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4);
break; break;
case 542: // wind up case 542: // wind up
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
Add_Pusher(p_upwind, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); Add_Pusher(p_upwind, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4);
break; break;
case 543: // wind down case 543: // wind down
TAG_ITER_SECTORS(0, tag, s) TAG_ITER_SECTORS(tag, s)
Add_Pusher(p_downwind, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4); Add_Pusher(p_downwind, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4);
break; break;
} }

View file

@ -71,15 +71,12 @@ INT32 Tag_Iterate_Things (const mtag_t tag, const size_t p);
INT32 Tag_FindLineSpecial(const INT16 special, const mtag_t tag); INT32 Tag_FindLineSpecial(const INT16 special, const mtag_t tag);
INT32 P_FindSpecialLineFromTag(INT16 special, INT16 tag, INT32 start); INT32 P_FindSpecialLineFromTag(INT16 special, INT16 tag, INT32 start);
// Use this macro to declare an iterator position variable. #define TAG_ITER(fn, tag, return_varname) for(size_t ICNT_ ## __LINE__ = 0; (return_varname = fn(tag, ICNT_ ## __LINE__)) >= 0; ICNT_ ## __LINE__++)
#define TAG_ITER_DECLARECOUNTER(level) size_t ICNT_##level
#define TAG_ITER(level, fn, tag, return_varname) for(ICNT_##level = 0; (return_varname = fn(tag, ICNT_##level)) >= 0; ICNT_##level++)
// Use these macros as wrappers for a taglist iteration. // Use these macros as wrappers for a taglist iteration.
#define TAG_ITER_SECTORS(level, tag, return_varname) TAG_ITER(level, Tag_Iterate_Sectors, tag, return_varname) #define TAG_ITER_SECTORS(tag, return_varname) TAG_ITER(Tag_Iterate_Sectors, tag, return_varname)
#define TAG_ITER_LINES(level, tag, return_varname) TAG_ITER(level, Tag_Iterate_Lines, tag, return_varname) #define TAG_ITER_LINES(tag, return_varname) TAG_ITER(Tag_Iterate_Lines, tag, return_varname)
#define TAG_ITER_THINGS(level, tag, return_varname) TAG_ITER(level, Tag_Iterate_Things, tag, return_varname) #define TAG_ITER_THINGS(tag, return_varname) TAG_ITER(Tag_Iterate_Things, tag, return_varname)
/* ITERATION MACROS /* ITERATION MACROS
TAG_ITER_DECLARECOUNTER must be used before using the iterators. TAG_ITER_DECLARECOUNTER must be used before using the iterators.