Add a level parameter to the iterators to account for nesting, and thus avoid variable shadowing.

This commit is contained in:
Nev3r 2020-11-12 13:48:14 +01:00
parent a8f554075f
commit 2c8a99f25a
8 changed files with 112 additions and 112 deletions

View File

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

View File

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

View File

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

View File

@ -4631,9 +4631,9 @@ static boolean P_Boss4MoveCage(mobj_t *mobj, fixed_t delta)
INT32 snum;
sector_t *sector;
boolean gotcage = false;
TAG_ITER_DECLARECOUNTER;
TAG_ITER_DECLARECOUNTER(0);
TAG_ITER_SECTORS(tag, snum)
TAG_ITER_SECTORS(0, tag, snum)
{
sector = &sectors[snum];
sector->floorheight += delta;
@ -4717,9 +4717,9 @@ static void P_Boss4DestroyCage(mobj_t *mobj)
size_t a;
sector_t *sector, *rsec;
ffloor_t *rover;
TAG_ITER_DECLARECOUNTER;
TAG_ITER_DECLARECOUNTER(0);
TAG_ITER_SECTORS(tag, snum)
TAG_ITER_SECTORS(0, tag, snum)
{
sector = &sectors[snum];

View File

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

View File

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

View File

@ -2223,7 +2223,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
INT32 secnum = -1;
mobj_t *bot = NULL;
mtag_t tag = Tag_FGet(&line->tags);
TAG_ITER_DECLARECOUNTER;
TAG_ITER_DECLARECOUNTER(0);
I_Assert(!mo || !P_MobjWasRemoved(mo)); // If mo is there, mo must be valid!
@ -2251,7 +2251,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
newceilinglightsec = line->frontsector->ceilinglightsec;
// act on all sectors with the same tag as the triggering linedef
TAG_ITER_SECTORS(tag, secnum)
TAG_ITER_SECTORS(0, tag, secnum)
{
if (sectors[secnum].lightingdata)
{
@ -2306,7 +2306,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
case 409: // Change tagged sectors' tag
// (formerly "Change calling sectors' tag", but behavior was changed)
{
TAG_ITER_SECTORS(tag, secnum)
TAG_ITER_SECTORS(0, tag, secnum)
Tag_SectorFSet(secnum,(INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS));
break;
}
@ -2316,7 +2316,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break;
case 411: // Stop floor/ceiling movement in tagged sector(s)
TAG_ITER_SECTORS(tag, secnum)
TAG_ITER_SECTORS(0, tag, secnum)
{
if (sectors[secnum].floordata)
{
@ -2501,7 +2501,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
// Additionally play the sound from tagged sectors' soundorgs
sector_t *sec;
TAG_ITER_SECTORS(tag, secnum)
TAG_ITER_SECTORS(0, tag, secnum)
{
sec = &sectors[secnum];
S_StartSound(&sec->soundorg, sfxnum);
@ -2616,7 +2616,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break;
case 416: // Spawn adjustable fire flicker
TAG_ITER_SECTORS(tag, secnum)
TAG_ITER_SECTORS(0, tag, secnum)
{
if (line->flags & ML_NOCLIMB && line->backsector)
{
@ -2650,7 +2650,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break;
case 417: // Spawn adjustable glowing light
TAG_ITER_SECTORS(tag, secnum)
TAG_ITER_SECTORS(0, tag, secnum)
{
if (line->flags & ML_NOCLIMB && line->backsector)
{
@ -2684,7 +2684,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break;
case 418: // Spawn adjustable strobe flash (unsynchronized)
TAG_ITER_SECTORS(tag, secnum)
TAG_ITER_SECTORS(0, tag, secnum)
{
if (line->flags & ML_NOCLIMB && line->backsector)
{
@ -2718,7 +2718,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break;
case 419: // Spawn adjustable strobe flash (synchronized)
TAG_ITER_SECTORS(tag, secnum)
TAG_ITER_SECTORS(0, tag, secnum)
{
if (line->flags & ML_NOCLIMB && line->backsector)
{
@ -2766,7 +2766,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break;
case 421: // Stop lighting effect in tagged sectors
TAG_ITER_SECTORS(tag, secnum)
TAG_ITER_SECTORS(0, tag, secnum)
if (sectors[secnum].lightingdata)
{
P_RemoveThinker(&((elevator_t *)sectors[secnum].lightingdata)->thinker);
@ -2980,7 +2980,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
ffloor_t *rover; // FOF that we are going to crumble
boolean foundrover = false; // for debug, "Can't find a FOF" message
TAG_ITER_SECTORS(sectag, secnum)
TAG_ITER_SECTORS(0, sectag, secnum)
{
sec = sectors + secnum;
@ -3105,7 +3105,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
if (line->sidenum[1] != 0xffff)
state = (statenum_t)sides[line->sidenum[1]].toptexture;
TAG_ITER_SECTORS(tag, secnum)
TAG_ITER_SECTORS(0, tag, secnum)
{
boolean tryagain;
sec = sectors + secnum;
@ -3165,7 +3165,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
ffloortype_e oldflags; // store FOF's old flags
TAG_ITER_SECTORS(sectag, secnum)
TAG_ITER_SECTORS(0, sectag, secnum)
{
sec = sectors + secnum;
@ -3223,7 +3223,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
if (line->flags & ML_NOCLIMB) // don't respawn!
respawn = false;
TAG_ITER_SECTORS(sectag, secnum)
TAG_ITER_SECTORS(0, sectag, secnum)
{
sec = sectors + secnum;
@ -3279,7 +3279,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
source = sectors[sourcesec].extra_colormap;
}
}
TAG_ITER_SECTORS(line->args[0], secnum)
TAG_ITER_SECTORS(0, line->args[0], secnum)
{
if (sectors[secnum].colormap_protected)
continue;
@ -3414,7 +3414,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
ffloor_t *rover; // FOF that we are going to operate
boolean foundrover = false; // for debug, "Can't find a FOF" message
TAG_ITER_SECTORS(sectag, secnum)
TAG_ITER_SECTORS(0, sectag, secnum)
{
sec = sectors + secnum;
@ -3478,7 +3478,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
size_t j = 0; // sec->ffloors is saved as ffloor #0, ss->ffloors->next is #1, etc
TAG_ITER_SECTORS(sectag, secnum)
TAG_ITER_SECTORS(0, sectag, secnum)
{
sec = sectors + secnum;
@ -3563,7 +3563,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
ffloor_t *rover; // FOF that we are going to operate
boolean foundrover = false; // for debug, "Can't find a FOF" message
TAG_ITER_SECTORS(sectag, secnum)
TAG_ITER_SECTORS(0, sectag, secnum)
{
sec = sectors + secnum;
@ -3614,7 +3614,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
}
}
TAG_ITER_SECTORS(line->args[0], secnum)
TAG_ITER_SECTORS(0, line->args[0], secnum)
{
extracolormap_t *source_exc, *dest_exc, *exc;
@ -3694,7 +3694,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
break;
}
case 456: // Stop fade colormap
TAG_ITER_SECTORS(line->args[0], secnum)
TAG_ITER_SECTORS(0, line->args[0], secnum)
P_ResetColormapFader(&sectors[secnum]);
break;
@ -3887,12 +3887,12 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
case 465: // Set linedef executor delay
{
INT32 linenum;
TAG_ITER_DECLARECOUNTER;
TAG_ITER_DECLARECOUNTER(1);
if (!udmf)
break;
TAG_ITER_LINES(line->args[0], linenum)
TAG_ITER_LINES(1, line->args[0], linenum)
{
if (line->args[2])
lines[linenum].executordelay += line->args[1];
@ -5922,9 +5922,9 @@ void T_LaserFlash(laserthink_t *flash)
sector_t *sector;
sector_t *sourcesec = flash->sourceline->frontsector;
fixed_t top, bottom;
TAG_ITER_DECLARECOUNTER;
TAG_ITER_DECLARECOUNTER(0);
TAG_ITER_SECTORS(flash->tag, s)
TAG_ITER_SECTORS(0, flash->tag, s)
{
sector = &sectors[s];
for (fflr = sector->ffloors; fflr; fflr = fflr->next)
@ -6204,11 +6204,11 @@ void P_SpawnSpecials(boolean fromnetsave)
INT32 s;
size_t sec;
ffloortype_e ffloorflags;
TAG_ITER_DECLARECOUNTER;
TAG_ITER_DECLARECOUNTER(0);
case 1: // Definable gravity per sector
sec = sides[*lines[i].sidenum].sector - sectors;
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
{
sectors[s].gravity = &sectors[sec].floorheight; // This allows it to change in realtime!
@ -6232,7 +6232,7 @@ void P_SpawnSpecials(boolean fromnetsave)
case 5: // Change camera info
sec = sides[*lines[i].sidenum].sector - sectors;
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, 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));
break;
@ -6259,7 +6259,7 @@ void P_SpawnSpecials(boolean fromnetsave)
P_ApplyFlatAlignment(lines + i, lines[i].frontsector, flatangle, xoffs, yoffs);
else
{
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
P_ApplyFlatAlignment(lines + i, sectors + s, flatangle, xoffs, yoffs);
}
}
@ -6270,7 +6270,7 @@ void P_SpawnSpecials(boolean fromnetsave)
break;
case 8: // Sector Parameters
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
{
if (lines[i].flags & ML_NOCLIMB)
{
@ -6297,7 +6297,7 @@ void P_SpawnSpecials(boolean fromnetsave)
break;
case 10: // Vertical culling plane for sprites and FOFs
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
sectors[s].cullheight = &lines[i]; // This allows it to change in realtime!
break;
@ -6358,19 +6358,19 @@ void P_SpawnSpecials(boolean fromnetsave)
case 63: // support for drawn heights coming from different sector
sec = sides[*lines[i].sidenum].sector-sectors;
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
sectors[s].heightsec = (INT32)sec;
break;
case 64: // Appearing/Disappearing FOF option
if (lines[i].flags & ML_BLOCKMONSTERS) { // Find FOFs by control sector tag
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
for (j = 0; (unsigned)j < sectors[s].linecount; j++)
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);
} else // Find FOFs by effect sector tag
{
TAG_ITER_LINES(tag, s)
TAG_ITER_LINES(0, tag, s)
{
if ((size_t)s == i)
continue;
@ -6381,15 +6381,15 @@ void P_SpawnSpecials(boolean fromnetsave)
break;
case 66: // Displace floor by front sector
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, 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));
break;
case 67: // Displace ceiling by front sector
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, 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));
break;
case 68: // Displace both floor AND ceiling by front sector
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, 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));
break;
@ -6985,46 +6985,46 @@ void P_SpawnSpecials(boolean fromnetsave)
case 600: // floor lighting independently (e.g. lava)
sec = sides[*lines[i].sidenum].sector-sectors;
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
sectors[s].floorlightsec = (INT32)sec;
break;
case 601: // ceiling lighting independently
sec = sides[*lines[i].sidenum].sector-sectors;
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
sectors[s].ceilinglightsec = (INT32)sec;
break;
case 602: // Adjustable pulsating light
sec = sides[*lines[i].sidenum].sector - sectors;
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
P_SpawnAdjustableGlowingLight(&sectors[sec], &sectors[s],
P_AproxDistance(lines[i].dx, lines[i].dy)>>FRACBITS);
break;
case 603: // Adjustable flickering light
sec = sides[*lines[i].sidenum].sector - sectors;
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
P_SpawnAdjustableFireFlicker(&sectors[sec], &sectors[s],
P_AproxDistance(lines[i].dx, lines[i].dy)>>FRACBITS);
break;
case 604: // Adjustable Blinking Light (unsynchronized)
sec = sides[*lines[i].sidenum].sector - sectors;
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
P_SpawnAdjustableStrobeFlash(&sectors[sec], &sectors[s],
abs(lines[i].dx)>>FRACBITS, abs(lines[i].dy)>>FRACBITS, false);
break;
case 605: // Adjustable Blinking Light (synchronized)
sec = sides[*lines[i].sidenum].sector - sectors;
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
P_SpawnAdjustableStrobeFlash(&sectors[sec], &sectors[s],
abs(lines[i].dx)>>FRACBITS, abs(lines[i].dy)>>FRACBITS, true);
break;
case 606: // HACK! Copy colormaps. Just plain colormaps.
TAG_ITER_SECTORS(lines[i].args[0], s)
TAG_ITER_SECTORS(0, lines[i].args[0], s)
{
extracolormap_t *exc;
@ -7098,13 +7098,13 @@ void P_SpawnSpecials(boolean fromnetsave)
*/
static void P_AddFakeFloorsByLine(size_t line, ffloortype_e ffloorflags, thinkerlist_t *secthinkers)
{
TAG_ITER_DECLARECOUNTER;
TAG_ITER_DECLARECOUNTER(0);
INT32 s;
mtag_t tag = Tag_FGet(&lines[line].tags);
size_t sec = sides[*lines[line].sidenum].sector-sectors;
line_t* li = lines + line;
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
P_AddFakeFloor(&sectors[s], &sectors[sec], li, ffloorflags, secthinkers);
}
@ -7214,7 +7214,7 @@ void T_Scroll(scroll_t *s)
size_t i;
INT32 sect;
ffloor_t *rover;
TAG_ITER_DECLARECOUNTER;
TAG_ITER_DECLARECOUNTER(0);
case sc_side: // scroll wall texture
side = sides + s->affectee;
@ -7251,7 +7251,7 @@ void T_Scroll(scroll_t *s)
if (!is3dblock)
continue;
TAG_ITER_SECTORS(Tag_FGet(&line->tags), sect)
TAG_ITER_SECTORS(0, Tag_FGet(&line->tags), sect)
{
sector_t *psec;
psec = sectors + sect;
@ -7326,7 +7326,7 @@ void T_Scroll(scroll_t *s)
if (!is3dblock)
continue;
TAG_ITER_SECTORS(Tag_FGet(&line->tags), sect)
TAG_ITER_SECTORS(0, Tag_FGet(&line->tags), sect)
{
sector_t *psec;
psec = sectors + sect;
@ -7466,11 +7466,11 @@ static void P_SpawnScrollers(void)
switch (special)
{
register INT32 s;
TAG_ITER_DECLARECOUNTER;
TAG_ITER_DECLARECOUNTER(0);
case 513: // scroll effect ceiling
case 533: // scroll and carry objects on ceiling
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
Add_Scroller(sc_ceiling, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB);
if (special != 533)
break;
@ -7479,13 +7479,13 @@ static void P_SpawnScrollers(void)
case 523: // carry objects on ceiling
dx = FixedMul(dx, CARRYFACTOR);
dy = FixedMul(dy, CARRYFACTOR);
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
Add_Scroller(sc_carry_ceiling, dx, dy, control, s, accel, l->flags & ML_NOCLIMB);
break;
case 510: // scroll effect floor
case 530: // scroll and carry objects on floor
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
Add_Scroller(sc_floor, -dx, dy, control, s, accel, l->flags & ML_NOCLIMB);
if (special != 530)
break;
@ -7494,7 +7494,7 @@ static void P_SpawnScrollers(void)
case 520: // carry objects on floor
dx = FixedMul(dx, CARRYFACTOR);
dy = FixedMul(dy, CARRYFACTOR);
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
Add_Scroller(sc_carry, dx, dy, control, s, accel, l->flags & ML_NOCLIMB);
break;
@ -7502,7 +7502,7 @@ static void P_SpawnScrollers(void)
// (same direction and speed as scrolling floors)
case 502:
{
TAG_ITER_LINES(tag, s)
TAG_ITER_LINES(0, tag, s)
if (s != (INT32)i)
{
if (l->flags & ML_EFFECT2) // use texture offsets instead
@ -7604,9 +7604,9 @@ void T_Disappear(disappear_t *d)
ffloor_t *rover;
register INT32 s;
mtag_t afftag = Tag_FGet(&lines[d->affectee].tags);
TAG_ITER_DECLARECOUNTER;
TAG_ITER_DECLARECOUNTER(0);
TAG_ITER_SECTORS(afftag, s)
TAG_ITER_SECTORS(0, afftag, s)
{
for (rover = sectors[s].ffloors; rover; rover = rover->next)
{
@ -8337,7 +8337,7 @@ static void P_SpawnFriction(void)
fixed_t strength; // frontside texture offset controls magnitude
fixed_t friction; // friction value to be applied during movement
INT32 movefactor; // applied to each player move to simulate inertia
TAG_ITER_DECLARECOUNTER;
TAG_ITER_DECLARECOUNTER(0);
for (i = 0; i < numlines; i++, l++)
if (l->special == 540)
@ -8363,7 +8363,7 @@ static void P_SpawnFriction(void)
else
movefactor = FRACUNIT;
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
Add_Friction(friction, movefactor, s, -1);
}
}
@ -8882,7 +8882,7 @@ static void P_SpawnPushers(void)
mtag_t tag;
register INT32 s;
mobj_t *thing;
TAG_ITER_DECLARECOUNTER;
TAG_ITER_DECLARECOUNTER(0);
for (i = 0; i < numlines; i++, l++)
{
@ -8890,15 +8890,15 @@ static void P_SpawnPushers(void)
switch (l->special)
{
case 541: // wind
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
Add_Pusher(p_wind, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4);
break;
case 544: // current
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
Add_Pusher(p_current, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4);
break;
case 547: // push/pull
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
{
thing = P_GetPushThing(s);
if (thing) // No MT_P* means no effect
@ -8906,19 +8906,19 @@ static void P_SpawnPushers(void)
}
break;
case 545: // current up
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
Add_Pusher(p_upcurrent, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4);
break;
case 546: // current down
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
Add_Pusher(p_downcurrent, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4);
break;
case 542: // wind up
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
Add_Pusher(p_upwind, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4);
break;
case 543: // wind down
TAG_ITER_SECTORS(tag, s)
TAG_ITER_SECTORS(0, tag, s)
Add_Pusher(p_downwind, l->dx, l->dy, NULL, s, -1, l->flags & ML_NOCLIMB, l->flags & ML_EFFECT4);
break;
}

View File

@ -62,13 +62,13 @@ INT32 Tag_FindLineSpecial(const INT16 special, const mtag_t tag);
INT32 P_FindSpecialLineFromTag(INT16 special, INT16 tag, INT32 start);
// Use this macro to declare the iterator position variable.
#define TAG_ITER_DECLARECOUNTER size_t tag_iterator_pos
#define TAG_ITER_DECLARECOUNTER(level) size_t ICNT_##level
#define TAG_ITER(fn, tag, id) for(tag_iterator_pos = 0; (id = fn(tag, tag_iterator_pos)) >= 0; tag_iterator_pos++)
#define TAG_ITER(level, fn, tag, id) for(ICNT_##level = 0; (id = fn(tag, ICNT_##level)) >= 0; ICNT_##level++)
// Use these macros as wrappers for the taglist iterations.
#define TAG_ITER_SECTORS(tag, id) TAG_ITER(Tag_Iterate_Sectors, tag, id)
#define TAG_ITER_LINES(tag, id) TAG_ITER(Tag_Iterate_Lines, tag, id)
#define TAG_ITER_THINGS(tag, id) TAG_ITER(Tag_Iterate_Things, tag, id)
#define TAG_ITER_SECTORS(level, tag, id) TAG_ITER(level, Tag_Iterate_Sectors, tag, id)
#define TAG_ITER_LINES(level, tag, id) TAG_ITER(level, Tag_Iterate_Lines, tag, id)
#define TAG_ITER_THINGS(level, tag, id) TAG_ITER(level, Tag_Iterate_Things, tag, id)
#endif //__R_TAGLIST__