Replace P_FindSectorFromLineTag() with its corresponding macro for most cases.

This commit is contained in:
Nev3r 2020-04-14 22:19:18 +02:00
parent 5df60f8e15
commit 24baf5bea0
2 changed files with 60 additions and 53 deletions

View file

@ -398,8 +398,9 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type)
INT32 secnum = -1; INT32 secnum = -1;
sector_t *sec; sector_t *sec;
ceiling_t *ceiling; ceiling_t *ceiling;
TAG_ITER_C
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0) TAG_ITER_SECTORS(line->tag, secnum)
{ {
sec = &sectors[secnum]; sec = &sectors[secnum];
@ -618,8 +619,9 @@ INT32 EV_DoCrush(line_t *line, ceiling_e type)
INT32 secnum = -1; INT32 secnum = -1;
sector_t *sec; sector_t *sec;
ceiling_t *ceiling; ceiling_t *ceiling;
TAG_ITER_C
while ((secnum = P_FindSectorFromLineTag(line,secnum)) >= 0) TAG_ITER_SECTORS(line->tag, secnum)
{ {
sec = &sectors[secnum]; sec = &sectors[secnum];

View file

@ -2442,6 +2442,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
{ {
INT32 secnum = -1; INT32 secnum = -1;
mobj_t *bot = NULL; mobj_t *bot = NULL;
TAG_ITER_C
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!
@ -2469,7 +2470,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
while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0) TAG_ITER_SECTORS(line->tag, secnum)
{ {
if (sectors[secnum].lightingdata) if (sectors[secnum].lightingdata)
{ {
@ -2524,7 +2525,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)
{ {
while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0) TAG_ITER_SECTORS(line->tag, secnum)
P_ChangeSectorTag(secnum,(INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS)); P_ChangeSectorTag(secnum,(INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS));
break; break;
} }
@ -2534,7 +2535,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)
while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0) TAG_ITER_SECTORS(line->tag, secnum)
{ {
if (sectors[secnum].floordata) if (sectors[secnum].floordata)
{ {
@ -2604,7 +2605,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
} }
else else
{ {
if ((secnum = P_FindSectorFromLineTag(line, -1)) < 0) if ((secnum = Tag_Iterate_Sectors(line->tag, 0)) < 0)
return; return;
dest = P_GetObjectTypeInSectorNum(MT_TELEPORTMAN, secnum); dest = P_GetObjectTypeInSectorNum(MT_TELEPORTMAN, secnum);
@ -2719,7 +2720,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;
while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0) TAG_ITER_SECTORS(line->tag, secnum)
{ {
sec = &sectors[secnum]; sec = &sectors[secnum];
S_StartSound(&sec->soundorg, sfxnum); S_StartSound(&sec->soundorg, sfxnum);
@ -2834,7 +2835,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
while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0) TAG_ITER_SECTORS(line->tag, secnum)
{ {
if (line->flags & ML_NOCLIMB && line->backsector) if (line->flags & ML_NOCLIMB && line->backsector)
{ {
@ -2868,7 +2869,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
while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0) TAG_ITER_SECTORS(line->tag, secnum)
{ {
if (line->flags & ML_NOCLIMB && line->backsector) if (line->flags & ML_NOCLIMB && line->backsector)
{ {
@ -2902,7 +2903,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)
while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0) TAG_ITER_SECTORS(line->tag, secnum)
{ {
if (line->flags & ML_NOCLIMB && line->backsector) if (line->flags & ML_NOCLIMB && line->backsector)
{ {
@ -2936,7 +2937,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)
while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0) TAG_ITER_SECTORS(line->tag, secnum)
{ {
if (line->flags & ML_NOCLIMB && line->backsector) if (line->flags & ML_NOCLIMB && line->backsector)
{ {
@ -2984,7 +2985,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
while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0) TAG_ITER_SECTORS(line->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);
@ -2999,7 +3000,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
if ((!mo || !mo->player) && !titlemapinaction) // only players have views, and title screens if ((!mo || !mo->player) && !titlemapinaction) // only players have views, and title screens
return; return;
if ((secnum = P_FindSectorFromLineTag(line, -1)) < 0) if ((secnum = Tag_Iterate_Sectors(line->tag, 0)) < 0)
return; return;
altview = P_GetObjectTypeInSectorNum(MT_ALTVIEWMAN, secnum); altview = P_GetObjectTypeInSectorNum(MT_ALTVIEWMAN, secnum);
@ -3318,7 +3319,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;
while ((secnum = P_FindSectorFromLineTag(line, secnum)) >= 0) TAG_ITER_SECTORS(line->tag, secnum)
{ {
boolean tryagain; boolean tryagain;
sec = sectors + secnum; sec = sectors + secnum;
@ -3473,7 +3474,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
// Except it is activated by linedef executor, not level load // Except it is activated by linedef executor, not level load
// This could even override existing colormaps I believe // This could even override existing colormaps I believe
// -- Monster Iestyn 14/06/18 // -- Monster Iestyn 14/06/18
for (secnum = -1; (secnum = P_FindSectorFromLineTag(line, secnum)) >= 0 ;) TAG_ITER_SECTORS(line->tag, secnum)
{ {
P_ResetColormapFader(&sectors[secnum]); P_ResetColormapFader(&sectors[secnum]);
@ -3801,7 +3802,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
} }
case 455: // Fade colormap case 455: // Fade colormap
for (secnum = -1; (secnum = P_FindSectorFromLineTag(line, secnum)) >= 0 ;) TAG_ITER_SECTORS(line->tag, secnum)
{ {
extracolormap_t *source_exc, *dest_exc, *exc; extracolormap_t *source_exc, *dest_exc, *exc;
INT32 speed = (INT32)((line->flags & ML_DONTPEGBOTTOM) || !sides[line->sidenum[0]].rowoffset) && line->sidenum[1] != 0xFFFF ? INT32 speed = (INT32)((line->flags & ML_DONTPEGBOTTOM) || !sides[line->sidenum[0]].rowoffset) && line->sidenum[1] != 0xFFFF ?
@ -3890,7 +3891,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
for (secnum = -1; (secnum = P_FindSectorFromLineTag(line, secnum)) >= 0 ;) TAG_ITER_SECTORS(line->tag, secnum)
P_ResetColormapFader(&sectors[secnum]); P_ResetColormapFader(&sectors[secnum]);
break; break;
@ -3904,7 +3905,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
boolean persist = (line->flags & ML_EFFECT2); boolean persist = (line->flags & ML_EFFECT2);
mobj_t *anchormo; mobj_t *anchormo;
if ((secnum = P_FindSectorFromLineTag(line, -1)) < 0) if ((secnum = Tag_Iterate_Sectors(line->tag, 0)) < 0)
return; return;
anchormo = P_GetObjectTypeInSectorNum(MT_ANGLEMAN, secnum); anchormo = P_GetObjectTypeInSectorNum(MT_ANGLEMAN, secnum);
@ -6547,10 +6548,11 @@ void P_SpawnSpecials(boolean fromnetsave)
INT32 s; INT32 s;
size_t sec; size_t sec;
ffloortype_e ffloorflags; ffloortype_e ffloorflags;
TAG_ITER_C
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;
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) TAG_ITER_SECTORS(lines[i].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!
@ -6574,7 +6576,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;
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) TAG_ITER_SECTORS(lines[i].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;
@ -6601,7 +6603,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
{ {
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0;) TAG_ITER_SECTORS(lines[i].tag, s)
P_ApplyFlatAlignment(lines + i, sectors + s, flatangle, xoffs, yoffs); P_ApplyFlatAlignment(lines + i, sectors + s, flatangle, xoffs, yoffs);
} }
} }
@ -6612,7 +6614,7 @@ void P_SpawnSpecials(boolean fromnetsave)
break; break;
case 8: // Sector Parameters case 8: // Sector Parameters
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) TAG_ITER_SECTORS(lines[i].tag, s)
{ {
if (lines[i].flags & ML_NOCLIMB) if (lines[i].flags & ML_NOCLIMB)
{ {
@ -6640,7 +6642,7 @@ void P_SpawnSpecials(boolean fromnetsave)
case 10: // Vertical culling plane for sprites and FOFs case 10: // Vertical culling plane for sprites and FOFs
sec = sides[*lines[i].sidenum].sector - sectors; sec = sides[*lines[i].sidenum].sector - sectors;
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) TAG_ITER_SECTORS(lines[i].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;
@ -6701,19 +6703,18 @@ 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;
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) TAG_ITER_SECTORS(lines[i].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_BLOCKMONSTERS) { // Find FOFs by control sector tag if (lines[i].flags & ML_BLOCKMONSTERS) { // Find FOFs by control sector tag
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) TAG_ITER_SECTORS(lines[i].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_C
TAG_ITER_LINES((lines + i)->tag, s) TAG_ITER_LINES((lines + i)->tag, s)
{ {
if ((size_t)s == i) if ((size_t)s == i)
@ -6732,15 +6733,15 @@ void P_SpawnSpecials(boolean fromnetsave)
break; break;
case 66: // Displace floor by front sector case 66: // Displace floor by front sector
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) TAG_ITER_SECTORS(lines[i].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, P_AproxDistance(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
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) TAG_ITER_SECTORS(lines[i].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, P_AproxDistance(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
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) TAG_ITER_SECTORS(lines[i].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, P_AproxDistance(lines[i].dx, lines[i].dy)>>8, sides[lines[i].sidenum[0]].sector-sectors, s, !!(lines[i].flags & ML_NOCLIMB));
break; break;
@ -7115,7 +7116,7 @@ void P_SpawnSpecials(boolean fromnetsave)
case 251: // A THWOMP! case 251: // A THWOMP!
sec = sides[*lines[i].sidenum].sector - sectors; sec = sides[*lines[i].sidenum].sector - sectors;
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) TAG_ITER_SECTORS(lines[i].tag, s)
{ {
P_AddThwompThinker(&sectors[sec], &sectors[s], &lines[i]); P_AddThwompThinker(&sectors[sec], &sectors[s], &lines[i]);
P_AddFakeFloor(&sectors[s], &sectors[sec], lines + i, P_AddFakeFloor(&sectors[s], &sectors[sec], lines + i,
@ -7163,7 +7164,7 @@ void P_SpawnSpecials(boolean fromnetsave)
sec = sides[*lines[i].sidenum].sector - sectors; sec = sides[*lines[i].sidenum].sector - sectors;
// No longer totally disrupts netgames // No longer totally disrupts netgames
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) TAG_ITER_SECTORS(lines[i].tag, s)
EV_AddLaserThinker(&sectors[s], &sectors[sec], lines + i, secthinkers); EV_AddLaserThinker(&sectors[s], &sectors[sec], lines + i, secthinkers);
break; break;
@ -7355,46 +7356,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;
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) TAG_ITER_SECTORS(lines[i].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;
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) TAG_ITER_SECTORS(lines[i].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;
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) TAG_ITER_SECTORS(lines[i].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;
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) TAG_ITER_SECTORS(lines[i].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;
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) TAG_ITER_SECTORS(lines[i].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;
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) TAG_ITER_SECTORS(lines[i].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.
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) TAG_ITER_SECTORS(lines[i].tag, s)
sectors[s].extra_colormap = sectors[s].spawn_extra_colormap = sides[lines[i].sidenum[0]].colormap_data; sectors[s].extra_colormap = sectors[s].spawn_extra_colormap = sides[lines[i].sidenum[0]].colormap_data;
break; break;
@ -7560,6 +7561,7 @@ void T_Scroll(scroll_t *s)
size_t i; size_t i;
INT32 sect; INT32 sect;
ffloor_t *rover; ffloor_t *rover;
TAG_ITER_C
case sc_side: // scroll wall texture case sc_side: // scroll wall texture
side = sides + s->affectee; side = sides + s->affectee;
@ -7596,7 +7598,7 @@ void T_Scroll(scroll_t *s)
if (!is3dblock) if (!is3dblock)
continue; continue;
for (sect = -1; (sect = P_FindSectorFromTag(line->tag, sect)) >= 0 ;) TAG_ITER_SECTORS(line->tag, sect)
{ {
sector_t *psec; sector_t *psec;
psec = sectors + sect; psec = sectors + sect;
@ -7809,10 +7811,11 @@ static void P_SpawnScrollers(void)
switch (special) switch (special)
{ {
register INT32 s; register INT32 s;
TAG_ITER_C
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
for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) TAG_ITER_SECTORS(l->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;
@ -7821,13 +7824,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);
for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) TAG_ITER_SECTORS(l->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
for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) TAG_ITER_SECTORS(l->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;
@ -7836,7 +7839,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);
for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) TAG_ITER_SECTORS(l->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;
@ -7844,7 +7847,6 @@ 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_C
TAG_ITER_LINES(l->tag, s) TAG_ITER_LINES(l->tag, s)
if (s != (INT32)i) if (s != (INT32)i)
Add_Scroller(sc_side, dx, dy, control, lines[s].sidenum[0], accel, 0); Add_Scroller(sc_side, dx, dy, control, lines[s].sidenum[0], accel, 0);
@ -7915,8 +7917,9 @@ void T_Disappear(disappear_t *d)
{ {
ffloor_t *rover; ffloor_t *rover;
register INT32 s; register INT32 s;
TAG_ITER_C
for (s = -1; (s = P_FindSectorFromLineTag(&lines[d->affectee], s)) >= 0 ;) TAG_ITER_SECTORS(lines[d->affectee].tag, s)
{ {
for (rover = sectors[s].ffloors; rover; rover = rover->next) for (rover = sectors[s].ffloors; rover; rover = rover->next)
{ {
@ -8649,6 +8652,7 @@ 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_C
for (i = 0; i < numlines; i++, l++) for (i = 0; i < numlines; i++, l++)
if (l->special == 540) if (l->special == 540)
@ -8673,7 +8677,7 @@ static void P_SpawnFriction(void)
else else
movefactor = FRACUNIT; movefactor = FRACUNIT;
for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) TAG_ITER_SECTORS(l->tag, s)
Add_Friction(friction, movefactor, s, -1); Add_Friction(friction, movefactor, s, -1);
} }
} }
@ -9203,20 +9207,21 @@ static void P_SpawnPushers(void)
line_t *l = lines; line_t *l = lines;
register INT32 s; register INT32 s;
mobj_t *thing; mobj_t *thing;
TAG_ITER_C
for (i = 0; i < numlines; i++, l++) for (i = 0; i < numlines; i++, l++)
switch (l->special) switch (l->special)
{ {
case 541: // wind case 541: // wind
for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) TAG_ITER_SECTORS(l->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
for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) TAG_ITER_SECTORS(l->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
for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) TAG_ITER_SECTORS(l->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
@ -9224,19 +9229,19 @@ static void P_SpawnPushers(void)
} }
break; break;
case 545: // current up case 545: // current up
for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) TAG_ITER_SECTORS(l->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
for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) TAG_ITER_SECTORS(l->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
for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) TAG_ITER_SECTORS(l->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
for (s = -1; (s = P_FindSectorFromLineTag(l, s)) >= 0 ;) TAG_ITER_SECTORS(l->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;
} }