mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-20 18:01:16 +00:00
Merge branch 'remove-iterdeclarations' into 'next'
Remove TAG_ITER_DECLARECOUNTER See merge request STJr/SRB2!1398
This commit is contained in:
commit
b49238f7c4
8 changed files with 88 additions and 133 deletions
|
@ -395,9 +395,8 @@ 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(0);
|
||||
|
||||
TAG_ITER_SECTORS(0, tag, secnum)
|
||||
TAG_ITER_SECTORS(tag, secnum)
|
||||
{
|
||||
sec = §ors[secnum];
|
||||
|
||||
|
@ -617,9 +616,8 @@ 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(0);
|
||||
|
||||
TAG_ITER_SECTORS(0, tag, secnum)
|
||||
TAG_ITER_SECTORS(tag, secnum)
|
||||
{
|
||||
sec = §ors[secnum];
|
||||
|
||||
|
|
|
@ -635,7 +635,6 @@ void T_BounceCheese(bouncecheese_t *bouncer)
|
|||
boolean remove;
|
||||
INT32 i;
|
||||
mtag_t tag = Tag_FGet(&bouncer->sourceline->tags);
|
||||
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 +649,7 @@ void T_BounceCheese(bouncecheese_t *bouncer)
|
|||
}
|
||||
|
||||
// You can use multiple target sectors, but at your own risk!!!
|
||||
TAG_ITER_SECTORS(0, tag, i)
|
||||
TAG_ITER_SECTORS(tag, i)
|
||||
{
|
||||
actionsector = §ors[i];
|
||||
actionsector->moved = true;
|
||||
|
@ -775,7 +774,6 @@ void T_StartCrumble(crumble_t *crumble)
|
|||
sector_t *sector;
|
||||
INT32 i;
|
||||
mtag_t tag = Tag_FGet(&crumble->sourceline->tags);
|
||||
TAG_ITER_DECLARECOUNTER(0);
|
||||
|
||||
// Once done, the no-return thinker just sits there,
|
||||
// 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
|
||||
{
|
||||
TAG_ITER_SECTORS(0, tag, i)
|
||||
TAG_ITER_SECTORS(tag, i)
|
||||
{
|
||||
sector = §ors[i];
|
||||
|
||||
|
@ -840,7 +838,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(0, tag, i)
|
||||
TAG_ITER_SECTORS(tag, i)
|
||||
{
|
||||
sector = §ors[i];
|
||||
|
||||
|
@ -932,7 +930,7 @@ void T_StartCrumble(crumble_t *crumble)
|
|||
P_RemoveThinker(&crumble->thinker);
|
||||
}
|
||||
|
||||
TAG_ITER_SECTORS(0, tag, i)
|
||||
TAG_ITER_SECTORS(tag, i)
|
||||
{
|
||||
sector = §ors[i];
|
||||
sector->moved = true;
|
||||
|
@ -948,7 +946,6 @@ void T_StartCrumble(crumble_t *crumble)
|
|||
void T_MarioBlock(mariothink_t *block)
|
||||
{
|
||||
INT32 i;
|
||||
TAG_ITER_DECLARECOUNTER(0);
|
||||
|
||||
T_MovePlane
|
||||
(
|
||||
|
@ -983,7 +980,7 @@ void T_MarioBlock(mariothink_t *block)
|
|||
block->sector->ceilspeed = 0;
|
||||
block->direction = 0;
|
||||
}
|
||||
TAG_ITER_SECTORS(0, (INT16)block->tag, i)
|
||||
TAG_ITER_SECTORS((INT16)block->tag, i)
|
||||
P_RecalcPrecipInSector(§ors[i]);
|
||||
}
|
||||
|
||||
|
@ -1293,9 +1290,8 @@ void T_NoEnemiesSector(noenemies_t *nobaddies)
|
|||
INT32 secnum = -1;
|
||||
boolean FOFsector = false;
|
||||
mtag_t tag = Tag_FGet(&nobaddies->sourceline->tags);
|
||||
TAG_ITER_DECLARECOUNTER(0);
|
||||
|
||||
TAG_ITER_SECTORS(0, tag, secnum)
|
||||
TAG_ITER_SECTORS(tag, secnum)
|
||||
{
|
||||
sec = §ors[secnum];
|
||||
|
||||
|
@ -1306,14 +1302,13 @@ void T_NoEnemiesSector(noenemies_t *nobaddies)
|
|||
{
|
||||
INT32 targetsecnum = -1;
|
||||
mtag_t tag2 = Tag_FGet(&sec->lines[i]->tags);
|
||||
TAG_ITER_DECLARECOUNTER(1);
|
||||
|
||||
if (sec->lines[i]->special < 100 || sec->lines[i]->special >= 300)
|
||||
continue;
|
||||
|
||||
FOFsector = true;
|
||||
|
||||
TAG_ITER_SECTORS(1, tag2, targetsecnum)
|
||||
TAG_ITER_SECTORS(tag2, targetsecnum)
|
||||
{
|
||||
if (T_SectorHasEnemies(§ors[targetsecnum]))
|
||||
return;
|
||||
|
@ -1400,7 +1395,6 @@ void T_EachTimeThinker(eachtime_t *eachtime)
|
|||
fixed_t bottomheight, topheight;
|
||||
ffloor_t *rover;
|
||||
mtag_t tag = Tag_FGet(&eachtime->sourceline->tags);
|
||||
TAG_ITER_DECLARECOUNTER(0);
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
|
@ -1410,7 +1404,7 @@ void T_EachTimeThinker(eachtime_t *eachtime)
|
|||
eachtime->playersOnArea[i] = false;
|
||||
}
|
||||
|
||||
TAG_ITER_SECTORS(0, tag, secnum)
|
||||
TAG_ITER_SECTORS(tag, secnum)
|
||||
{
|
||||
sec = §ors[secnum];
|
||||
|
||||
|
@ -1428,14 +1422,13 @@ void T_EachTimeThinker(eachtime_t *eachtime)
|
|||
{
|
||||
INT32 targetsecnum = -1;
|
||||
mtag_t tag2 = Tag_FGet(&sec->lines[i]->tags);
|
||||
TAG_ITER_DECLARECOUNTER(1);
|
||||
|
||||
if (sec->lines[i]->special < 100 || sec->lines[i]->special >= 300)
|
||||
continue;
|
||||
|
||||
FOFsector = true;
|
||||
|
||||
TAG_ITER_SECTORS(1, tag2, targetsecnum)
|
||||
TAG_ITER_SECTORS(tag2, targetsecnum)
|
||||
{
|
||||
targetsec = §ors[targetsecnum];
|
||||
|
||||
|
@ -1570,12 +1563,11 @@ void T_RaiseSector(raise_t *raise)
|
|||
INT32 direction;
|
||||
result_e res = 0;
|
||||
mtag_t tag = raise->tag;
|
||||
TAG_ITER_DECLARECOUNTER(0);
|
||||
|
||||
if (raise->sector->crumblestate >= CRUMBLE_FALL || raise->sector->ceilingdata)
|
||||
return;
|
||||
|
||||
TAG_ITER_SECTORS(0, tag, i)
|
||||
TAG_ITER_SECTORS(tag, i)
|
||||
{
|
||||
sector = §ors[i];
|
||||
|
||||
|
@ -1702,7 +1694,7 @@ void T_RaiseSector(raise_t *raise)
|
|||
raise->sector->ceilspeed = 42;
|
||||
raise->sector->floorspeed = speed*direction;
|
||||
|
||||
TAG_ITER_SECTORS(0, tag, i)
|
||||
TAG_ITER_SECTORS(tag, i)
|
||||
P_RecalcPrecipInSector(§ors[i]);
|
||||
}
|
||||
|
||||
|
@ -1820,9 +1812,8 @@ 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(0);
|
||||
|
||||
TAG_ITER_SECTORS(0, tag, secnum)
|
||||
TAG_ITER_SECTORS(tag, secnum)
|
||||
{
|
||||
sec = §ors[secnum];
|
||||
|
||||
|
@ -2037,10 +2028,9 @@ 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(0);
|
||||
|
||||
// act on all sectors with the same tag as the triggering linedef
|
||||
TAG_ITER_SECTORS(0, tag, secnum)
|
||||
TAG_ITER_SECTORS(tag, secnum)
|
||||
{
|
||||
sec = §ors[secnum];
|
||||
|
||||
|
@ -2337,7 +2327,6 @@ 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(0);
|
||||
|
||||
// If floor is already activated, skip it
|
||||
if (sec->floordata)
|
||||
|
@ -2380,7 +2369,7 @@ INT32 EV_StartCrumble(sector_t *sec, ffloor_t *rover, boolean floating,
|
|||
|
||||
crumble->sector->crumblestate = CRUMBLE_ACTIVATED;
|
||||
|
||||
TAG_ITER_SECTORS(0, tag, i)
|
||||
TAG_ITER_SECTORS(tag, i)
|
||||
{
|
||||
foundsec = §ors[i];
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
INT32 i;
|
||||
TAG_ITER_DECLARECOUNTER(0);
|
||||
|
||||
// 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
|
||||
&& sectors[i].lightingdata
|
||||
|
|
|
@ -4605,9 +4605,8 @@ static boolean P_Boss4MoveCage(mobj_t *mobj, fixed_t delta)
|
|||
INT32 snum;
|
||||
sector_t *sector;
|
||||
boolean gotcage = false;
|
||||
TAG_ITER_DECLARECOUNTER(0);
|
||||
|
||||
TAG_ITER_SECTORS(0, tag, snum)
|
||||
TAG_ITER_SECTORS(tag, snum)
|
||||
{
|
||||
sector = §ors[snum];
|
||||
sector->floorheight += delta;
|
||||
|
@ -4691,9 +4690,8 @@ static void P_Boss4DestroyCage(mobj_t *mobj)
|
|||
size_t a;
|
||||
sector_t *sector, *rsec;
|
||||
ffloor_t *rover;
|
||||
TAG_ITER_DECLARECOUNTER(0);
|
||||
|
||||
TAG_ITER_SECTORS(0, tag, snum)
|
||||
TAG_ITER_SECTORS(tag, snum)
|
||||
{
|
||||
sector = §ors[snum];
|
||||
|
||||
|
|
|
@ -2984,9 +2984,7 @@ static void P_ConvertBinaryMap(void)
|
|||
INT32 check = -1;
|
||||
INT32 paramline = -1;
|
||||
|
||||
TAG_ITER_DECLARECOUNTER(0);
|
||||
|
||||
TAG_ITER_LINES(0, tag, check)
|
||||
TAG_ITER_LINES(tag, check)
|
||||
{
|
||||
if (lines[check].special == 22)
|
||||
{
|
||||
|
@ -3229,11 +3227,9 @@ static void P_ConvertBinaryMap(void)
|
|||
INT32 firstline = -1;
|
||||
mtag_t tag = mapthings[i].angle;
|
||||
|
||||
TAG_ITER_DECLARECOUNTER(0);
|
||||
|
||||
Tag_FSet(&mapthings[i].tags, tag);
|
||||
|
||||
TAG_ITER_LINES(0, tag, check)
|
||||
TAG_ITER_LINES(tag, check)
|
||||
{
|
||||
if (lines[check].special == 20)
|
||||
{
|
||||
|
|
|
@ -546,11 +546,10 @@ 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(0);
|
||||
|
||||
if (!tag || *secslope)
|
||||
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;
|
||||
if (srcslope)
|
||||
|
|
122
src/p_spec.c
122
src/p_spec.c
|
@ -2223,7 +2223,6 @@ 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(0);
|
||||
|
||||
I_Assert(!mo || !P_MobjWasRemoved(mo)); // If mo is there, mo must be valid!
|
||||
|
||||
|
@ -2251,7 +2250,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(0, tag, secnum)
|
||||
TAG_ITER_SECTORS(tag, secnum)
|
||||
{
|
||||
if (sectors[secnum].lightingdata)
|
||||
{
|
||||
|
@ -2306,7 +2305,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(0, tag, secnum)
|
||||
TAG_ITER_SECTORS(tag, secnum)
|
||||
Tag_SectorFSet(secnum,(INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS));
|
||||
break;
|
||||
}
|
||||
|
@ -2316,7 +2315,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(0, tag, secnum)
|
||||
TAG_ITER_SECTORS(tag, secnum)
|
||||
{
|
||||
if (sectors[secnum].floordata)
|
||||
{
|
||||
|
@ -2501,7 +2500,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(0, tag, secnum)
|
||||
TAG_ITER_SECTORS(tag, secnum)
|
||||
{
|
||||
sec = §ors[secnum];
|
||||
S_StartSound(&sec->soundorg, sfxnum);
|
||||
|
@ -2616,7 +2615,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
|||
break;
|
||||
|
||||
case 416: // Spawn adjustable fire flicker
|
||||
TAG_ITER_SECTORS(0, tag, secnum)
|
||||
TAG_ITER_SECTORS(tag, secnum)
|
||||
{
|
||||
if (line->flags & ML_NOCLIMB && line->backsector)
|
||||
{
|
||||
|
@ -2650,7 +2649,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
|||
break;
|
||||
|
||||
case 417: // Spawn adjustable glowing light
|
||||
TAG_ITER_SECTORS(0, tag, secnum)
|
||||
TAG_ITER_SECTORS(tag, secnum)
|
||||
{
|
||||
if (line->flags & ML_NOCLIMB && line->backsector)
|
||||
{
|
||||
|
@ -2684,7 +2683,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(0, tag, secnum)
|
||||
TAG_ITER_SECTORS(tag, secnum)
|
||||
{
|
||||
if (line->flags & ML_NOCLIMB && line->backsector)
|
||||
{
|
||||
|
@ -2718,7 +2717,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(0, tag, secnum)
|
||||
TAG_ITER_SECTORS(tag, secnum)
|
||||
{
|
||||
if (line->flags & ML_NOCLIMB && line->backsector)
|
||||
{
|
||||
|
@ -2766,7 +2765,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(0, tag, secnum)
|
||||
TAG_ITER_SECTORS(tag, secnum)
|
||||
if (sectors[secnum].lightingdata)
|
||||
{
|
||||
P_RemoveThinker(&((elevator_t *)sectors[secnum].lightingdata)->thinker);
|
||||
|
@ -2980,7 +2979,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(0, sectag, secnum)
|
||||
TAG_ITER_SECTORS(sectag, secnum)
|
||||
{
|
||||
sec = sectors + secnum;
|
||||
|
||||
|
@ -3105,7 +3104,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(0, tag, secnum)
|
||||
TAG_ITER_SECTORS(tag, secnum)
|
||||
{
|
||||
boolean tryagain;
|
||||
sec = sectors + secnum;
|
||||
|
@ -3165,7 +3164,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(0, sectag, secnum)
|
||||
TAG_ITER_SECTORS(sectag, secnum)
|
||||
{
|
||||
sec = sectors + secnum;
|
||||
|
||||
|
@ -3223,7 +3222,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(0, sectag, secnum)
|
||||
TAG_ITER_SECTORS(sectag, secnum)
|
||||
{
|
||||
sec = sectors + secnum;
|
||||
|
||||
|
@ -3279,7 +3278,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
|||
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)
|
||||
continue;
|
||||
|
@ -3414,7 +3413,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(0, sectag, secnum)
|
||||
TAG_ITER_SECTORS(sectag, secnum)
|
||||
{
|
||||
sec = sectors + secnum;
|
||||
|
||||
|
@ -3478,7 +3477,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(0, sectag, secnum)
|
||||
TAG_ITER_SECTORS(sectag, secnum)
|
||||
{
|
||||
sec = sectors + secnum;
|
||||
|
||||
|
@ -3563,7 +3562,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(0, sectag, secnum)
|
||||
TAG_ITER_SECTORS(sectag, secnum)
|
||||
{
|
||||
sec = sectors + secnum;
|
||||
|
||||
|
@ -3614,7 +3613,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;
|
||||
|
||||
|
@ -3694,7 +3693,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
|||
break;
|
||||
}
|
||||
case 456: // Stop fade colormap
|
||||
TAG_ITER_SECTORS(0, line->args[0], secnum)
|
||||
TAG_ITER_SECTORS(line->args[0], secnum)
|
||||
P_ResetColormapFader(§ors[secnum]);
|
||||
break;
|
||||
|
||||
|
@ -3887,12 +3886,11 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
|||
case 465: // Set linedef executor delay
|
||||
{
|
||||
INT32 linenum;
|
||||
TAG_ITER_DECLARECOUNTER(1);
|
||||
|
||||
if (!udmf)
|
||||
break;
|
||||
|
||||
TAG_ITER_LINES(1, line->args[0], linenum)
|
||||
TAG_ITER_LINES(line->args[0], linenum)
|
||||
{
|
||||
if (line->args[2])
|
||||
lines[linenum].executordelay += line->args[1];
|
||||
|
@ -5943,9 +5941,8 @@ void T_LaserFlash(laserthink_t *flash)
|
|||
sector_t *sector;
|
||||
sector_t *sourcesec = flash->sourceline->frontsector;
|
||||
fixed_t top, bottom;
|
||||
TAG_ITER_DECLARECOUNTER(0);
|
||||
|
||||
TAG_ITER_SECTORS(0, flash->tag, s)
|
||||
TAG_ITER_SECTORS(flash->tag, s)
|
||||
{
|
||||
sector = §ors[s];
|
||||
for (fflr = sector->ffloors; fflr; fflr = fflr->next)
|
||||
|
@ -6225,11 +6222,10 @@ void P_SpawnSpecials(boolean fromnetsave)
|
|||
INT32 s;
|
||||
size_t sec;
|
||||
ffloortype_e ffloorflags;
|
||||
TAG_ITER_DECLARECOUNTER(0);
|
||||
|
||||
case 1: // Definable gravity per sector
|
||||
sec = sides[*lines[i].sidenum].sector - sectors;
|
||||
TAG_ITER_SECTORS(0, tag, s)
|
||||
TAG_ITER_SECTORS(tag, s)
|
||||
{
|
||||
sectors[s].gravity = §ors[sec].floorheight; // This allows it to change in realtime!
|
||||
|
||||
|
@ -6253,7 +6249,7 @@ void P_SpawnSpecials(boolean fromnetsave)
|
|||
|
||||
case 5: // Change camera info
|
||||
sec = sides[*lines[i].sidenum].sector - sectors;
|
||||
TAG_ITER_SECTORS(0, tag, s)
|
||||
TAG_ITER_SECTORS(tag, s)
|
||||
P_AddCameraScanner(§ors[sec], §ors[s], R_PointToAngle2(lines[i].v2->x, lines[i].v2->y, lines[i].v1->x, lines[i].v1->y));
|
||||
break;
|
||||
|
||||
|
@ -6280,7 +6276,7 @@ void P_SpawnSpecials(boolean fromnetsave)
|
|||
P_ApplyFlatAlignment(lines + i, lines[i].frontsector, flatangle, xoffs, yoffs);
|
||||
else
|
||||
{
|
||||
TAG_ITER_SECTORS(0, tag, s)
|
||||
TAG_ITER_SECTORS(tag, s)
|
||||
P_ApplyFlatAlignment(lines + i, sectors + s, flatangle, xoffs, yoffs);
|
||||
}
|
||||
}
|
||||
|
@ -6291,7 +6287,7 @@ void P_SpawnSpecials(boolean fromnetsave)
|
|||
break;
|
||||
|
||||
case 8: // Sector Parameters
|
||||
TAG_ITER_SECTORS(0, tag, s)
|
||||
TAG_ITER_SECTORS(tag, s)
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB)
|
||||
{
|
||||
|
@ -6318,7 +6314,7 @@ void P_SpawnSpecials(boolean fromnetsave)
|
|||
break;
|
||||
|
||||
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!
|
||||
break;
|
||||
|
||||
|
@ -6379,19 +6375,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(0, tag, s)
|
||||
TAG_ITER_SECTORS(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(0, tag, s)
|
||||
TAG_ITER_SECTORS(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(0, tag, s)
|
||||
TAG_ITER_LINES(tag, s)
|
||||
{
|
||||
if ((size_t)s == i)
|
||||
continue;
|
||||
|
@ -6402,15 +6398,15 @@ void P_SpawnSpecials(boolean fromnetsave)
|
|||
break;
|
||||
|
||||
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));
|
||||
break;
|
||||
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));
|
||||
break;
|
||||
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));
|
||||
break;
|
||||
|
||||
|
@ -7006,46 +7002,46 @@ void P_SpawnSpecials(boolean fromnetsave)
|
|||
|
||||
case 600: // floor lighting independently (e.g. lava)
|
||||
sec = sides[*lines[i].sidenum].sector-sectors;
|
||||
TAG_ITER_SECTORS(0, tag, s)
|
||||
TAG_ITER_SECTORS(tag, s)
|
||||
sectors[s].floorlightsec = (INT32)sec;
|
||||
break;
|
||||
|
||||
case 601: // ceiling lighting independently
|
||||
sec = sides[*lines[i].sidenum].sector-sectors;
|
||||
TAG_ITER_SECTORS(0, tag, s)
|
||||
TAG_ITER_SECTORS(tag, s)
|
||||
sectors[s].ceilinglightsec = (INT32)sec;
|
||||
break;
|
||||
|
||||
case 602: // Adjustable pulsating light
|
||||
sec = sides[*lines[i].sidenum].sector - sectors;
|
||||
TAG_ITER_SECTORS(0, tag, s)
|
||||
TAG_ITER_SECTORS(tag, s)
|
||||
P_SpawnAdjustableGlowingLight(§ors[sec], §ors[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(0, tag, s)
|
||||
TAG_ITER_SECTORS(tag, s)
|
||||
P_SpawnAdjustableFireFlicker(§ors[sec], §ors[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(0, tag, s)
|
||||
TAG_ITER_SECTORS(tag, s)
|
||||
P_SpawnAdjustableStrobeFlash(§ors[sec], §ors[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(0, tag, s)
|
||||
TAG_ITER_SECTORS(tag, s)
|
||||
P_SpawnAdjustableStrobeFlash(§ors[sec], §ors[s],
|
||||
abs(lines[i].dx)>>FRACBITS, abs(lines[i].dy)>>FRACBITS, true);
|
||||
break;
|
||||
|
||||
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;
|
||||
|
||||
|
@ -7119,13 +7115,12 @@ void P_SpawnSpecials(boolean fromnetsave)
|
|||
*/
|
||||
static void P_AddFakeFloorsByLine(size_t line, ffloortype_e ffloorflags, thinkerlist_t *secthinkers)
|
||||
{
|
||||
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(0, tag, s)
|
||||
TAG_ITER_SECTORS(tag, s)
|
||||
P_AddFakeFloor(§ors[s], §ors[sec], li, ffloorflags, secthinkers);
|
||||
}
|
||||
|
||||
|
@ -7235,7 +7230,6 @@ void T_Scroll(scroll_t *s)
|
|||
size_t i;
|
||||
INT32 sect;
|
||||
ffloor_t *rover;
|
||||
TAG_ITER_DECLARECOUNTER(0);
|
||||
|
||||
case sc_side: // scroll wall texture
|
||||
side = sides + s->affectee;
|
||||
|
@ -7272,7 +7266,7 @@ void T_Scroll(scroll_t *s)
|
|||
if (!is3dblock)
|
||||
continue;
|
||||
|
||||
TAG_ITER_SECTORS(0, Tag_FGet(&line->tags), sect)
|
||||
TAG_ITER_SECTORS(Tag_FGet(&line->tags), sect)
|
||||
{
|
||||
sector_t *psec;
|
||||
psec = sectors + sect;
|
||||
|
@ -7347,7 +7341,7 @@ void T_Scroll(scroll_t *s)
|
|||
|
||||
if (!is3dblock)
|
||||
continue;
|
||||
TAG_ITER_SECTORS(0, Tag_FGet(&line->tags), sect)
|
||||
TAG_ITER_SECTORS(Tag_FGet(&line->tags), sect)
|
||||
{
|
||||
sector_t *psec;
|
||||
psec = sectors + sect;
|
||||
|
@ -7487,11 +7481,10 @@ static void P_SpawnScrollers(void)
|
|||
switch (special)
|
||||
{
|
||||
register INT32 s;
|
||||
TAG_ITER_DECLARECOUNTER(0);
|
||||
|
||||
case 513: // scroll effect 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);
|
||||
if (special != 533)
|
||||
break;
|
||||
|
@ -7500,13 +7493,13 @@ static void P_SpawnScrollers(void)
|
|||
case 523: // carry objects on ceiling
|
||||
dx = FixedMul(dx, 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);
|
||||
break;
|
||||
|
||||
case 510: // scroll effect 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);
|
||||
if (special != 530)
|
||||
break;
|
||||
|
@ -7515,7 +7508,7 @@ static void P_SpawnScrollers(void)
|
|||
case 520: // carry objects on floor
|
||||
dx = FixedMul(dx, 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);
|
||||
break;
|
||||
|
||||
|
@ -7523,7 +7516,7 @@ static void P_SpawnScrollers(void)
|
|||
// (same direction and speed as scrolling floors)
|
||||
case 502:
|
||||
{
|
||||
TAG_ITER_LINES(0, tag, s)
|
||||
TAG_ITER_LINES(tag, s)
|
||||
if (s != (INT32)i)
|
||||
{
|
||||
if (l->flags & ML_EFFECT2) // use texture offsets instead
|
||||
|
@ -7625,9 +7618,8 @@ void T_Disappear(disappear_t *d)
|
|||
ffloor_t *rover;
|
||||
register INT32 s;
|
||||
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)
|
||||
{
|
||||
|
@ -8358,7 +8350,6 @@ 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(0);
|
||||
|
||||
for (i = 0; i < numlines; i++, l++)
|
||||
if (l->special == 540)
|
||||
|
@ -8384,7 +8375,7 @@ static void P_SpawnFriction(void)
|
|||
else
|
||||
movefactor = FRACUNIT;
|
||||
|
||||
TAG_ITER_SECTORS(0, tag, s)
|
||||
TAG_ITER_SECTORS(tag, s)
|
||||
Add_Friction(friction, movefactor, s, -1);
|
||||
}
|
||||
}
|
||||
|
@ -8906,7 +8897,6 @@ static void P_SpawnPushers(void)
|
|||
mtag_t tag;
|
||||
register INT32 s;
|
||||
mobj_t *thing;
|
||||
TAG_ITER_DECLARECOUNTER(0);
|
||||
|
||||
for (i = 0; i < numlines; i++, l++)
|
||||
{
|
||||
|
@ -8914,15 +8904,15 @@ static void P_SpawnPushers(void)
|
|||
switch (l->special)
|
||||
{
|
||||
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);
|
||||
break;
|
||||
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);
|
||||
break;
|
||||
case 547: // push/pull
|
||||
TAG_ITER_SECTORS(0, tag, s)
|
||||
TAG_ITER_SECTORS(tag, s)
|
||||
{
|
||||
thing = P_GetPushThing(s);
|
||||
if (thing) // No MT_P* means no effect
|
||||
|
@ -8930,19 +8920,19 @@ static void P_SpawnPushers(void)
|
|||
}
|
||||
break;
|
||||
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);
|
||||
break;
|
||||
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);
|
||||
break;
|
||||
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);
|
||||
break;
|
||||
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);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -71,25 +71,16 @@ INT32 Tag_Iterate_Things (const mtag_t tag, const size_t p);
|
|||
INT32 Tag_FindLineSpecial(const INT16 special, const mtag_t tag);
|
||||
INT32 P_FindSpecialLineFromTag(INT16 special, INT16 tag, INT32 start);
|
||||
|
||||
// Use this macro to declare an iterator position variable.
|
||||
#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++)
|
||||
#define ICNAME2(id) ICNT_##id
|
||||
#define ICNAME(id) ICNAME2(id)
|
||||
#define TAG_ITER(fn, tag, return_varname) for(size_t ICNAME(__LINE__) = 0; (return_varname = fn(tag, ICNAME(__LINE__))) >= 0; ICNAME(__LINE__)++)
|
||||
|
||||
// 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_LINES(level, tag, return_varname) TAG_ITER(level, 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_SECTORS(tag, return_varname) TAG_ITER(Tag_Iterate_Sectors, tag, return_varname)
|
||||
#define TAG_ITER_LINES(tag, return_varname) TAG_ITER(Tag_Iterate_Lines, tag, return_varname)
|
||||
#define TAG_ITER_THINGS(tag, return_varname) TAG_ITER(Tag_Iterate_Things, tag, return_varname)
|
||||
|
||||
/* ITERATION MACROS
|
||||
TAG_ITER_DECLARECOUNTER must be used before using the iterators.
|
||||
|
||||
'level':
|
||||
For each nested iteration, an additional TAG_ITER_DECLARECOUNTER
|
||||
must be used with a different level number to avoid conflict with
|
||||
the outer iterations.
|
||||
Most cases don't have nested iterations and thus the level is just 0.
|
||||
|
||||
'tag':
|
||||
Pretty much the elements' tag to iterate through.
|
||||
|
||||
|
@ -99,17 +90,12 @@ Target variable's name to return the iteration results to.
|
|||
|
||||
EXAMPLE:
|
||||
{
|
||||
TAG_ITER_DECLARECOUNTER(0);
|
||||
TAG_ITER_DECLARECOUNTER(1); // For the nested iteration.
|
||||
|
||||
size_t li;
|
||||
size_t sec;
|
||||
|
||||
INT32 tag1 = 4;
|
||||
|
||||
...
|
||||
|
||||
TAG_ITER_LINES(0, tag1, li)
|
||||
TAG_ITER_LINES(tag1, li)
|
||||
{
|
||||
line_t *line = lines + li;
|
||||
|
||||
|
@ -117,11 +103,11 @@ EXAMPLE:
|
|||
|
||||
if (something)
|
||||
{
|
||||
size_t sec;
|
||||
mtag_t tag2 = 8;
|
||||
|
||||
// Nested iteration; just make sure the level is higher
|
||||
// and that it has its own counter declared in scope.
|
||||
TAG_ITER_SECTORS(1, tag2, sec)
|
||||
// Nested iteration.
|
||||
TAG_ITER_SECTORS(tag2, sec)
|
||||
{
|
||||
sector_t *sector = sectors + sec;
|
||||
|
||||
|
|
Loading…
Reference in a new issue