Linedef exec FOF specials: Move logic into for (rover =...) block so procedure happens on every FOF match

This commit is contained in:
mazmazz 2018-09-19 17:49:03 -04:00
parent 87087c190e
commit 24938473a5

View file

@ -3090,7 +3090,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS);
INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS);
sector_t *sec; // Sector that the FOF is visible in sector_t *sec; // Sector that the FOF is visible in
ffloor_t *rover; // FOF that we are going to crumble ffloor_t *rover, *foundrover; // FOF that we are going to crumble
for (secnum = -1; (secnum = P_FindSectorFromTag(sectag, secnum)) >= 0 ;) for (secnum = -1; (secnum = P_FindSectorFromTag(sectag, secnum)) >= 0 ;)
{ {
@ -3105,16 +3105,18 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
for (rover = sec->ffloors; rover; rover = rover->next) for (rover = sec->ffloors; rover; rover = rover->next)
{ {
if (rover->master->frontsector->tag == foftag) if (rover->master->frontsector->tag == foftag)
break; {
foundrover = rover; // for debug, "Can't find a FOF" message below
EV_CrumbleChain(sec, rover);
}
} }
if (!rover) if (!foundrover)
{ {
CONS_Debug(DBG_GAMELOGIC, "Line type 436 Executor: Can't find a FOF control sector with tag %d\n", foftag); CONS_Debug(DBG_GAMELOGIC, "Line type 436 Executor: Can't find a FOF control sector with tag %d\n", foftag);
return; return;
} }
EV_CrumbleChain(sec, rover);
} }
} }
break; break;
@ -3274,7 +3276,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS);
INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS);
sector_t *sec; // Sector that the FOF is visible (or not visible) in sector_t *sec; // Sector that the FOF is visible (or not visible) in
ffloor_t *rover; // FOF to vanish/un-vanish ffloor_t *rover, *foundrover; // FOF to vanish/un-vanish
ffloortype_e oldflags; // store FOF's old flags ffloortype_e oldflags; // store FOF's old flags
for (secnum = -1; (secnum = P_FindSectorFromTag(sectag, secnum)) >= 0 ;) for (secnum = -1; (secnum = P_FindSectorFromTag(sectag, secnum)) >= 0 ;)
@ -3290,14 +3292,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
for (rover = sec->ffloors; rover; rover = rover->next) for (rover = sec->ffloors; rover; rover = rover->next)
{ {
if (rover->master->frontsector->tag == foftag) if (rover->master->frontsector->tag == foftag)
break;
}
if (!rover)
{ {
CONS_Debug(DBG_GAMELOGIC, "Line type 445 Executor: Can't find a FOF control sector with tag %d\n", foftag); foundrover = rover; // for debug, "Can't find a FOF" message below
return;
}
oldflags = rover->flags; oldflags = rover->flags;
@ -3312,6 +3308,14 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
sec->moved = true; sec->moved = true;
} }
} }
if (!foundrover)
{
CONS_Debug(DBG_GAMELOGIC, "Line type 445 Executor: Can't find a FOF control sector with tag %d\n", foftag);
return;
}
}
}
break; break;
case 446: // Make block fall remotely (acts like FF_CRUMBLE) case 446: // Make block fall remotely (acts like FF_CRUMBLE)
@ -3319,7 +3323,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS);
INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS);
sector_t *sec; // Sector that the FOF is visible in sector_t *sec; // Sector that the FOF is visible in
ffloor_t *rover; // FOF that we are going to make fall down ffloor_t *rover, *foundrover; // FOF that we are going to make fall down
player_t *player = NULL; // player that caused FOF to fall player_t *player = NULL; // player that caused FOF to fall
boolean respawn = true; // should the fallen FOF respawn? boolean respawn = true; // should the fallen FOF respawn?
@ -3342,14 +3346,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
for (rover = sec->ffloors; rover; rover = rover->next) for (rover = sec->ffloors; rover; rover = rover->next)
{ {
if (rover->master->frontsector->tag == foftag) if (rover->master->frontsector->tag == foftag)
break;
}
if (!rover)
{ {
CONS_Debug(DBG_GAMELOGIC, "Line type 446 Executor: Can't find a FOF control sector with tag %d\n", foftag); foundrover = rover; // for debug, "Can't find a FOF" message below
return;
}
if (line->flags & ML_BLOCKMONSTERS) // FOF flags determine respawn ability instead? if (line->flags & ML_BLOCKMONSTERS) // FOF flags determine respawn ability instead?
respawn = !(rover->flags & FF_NORETURN) ^ !!(line->flags & ML_NOCLIMB); // no climb inverts respawn = !(rover->flags & FF_NORETURN) ^ !!(line->flags & ML_NOCLIMB); // no climb inverts
@ -3357,6 +3355,14 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
EV_StartCrumble(rover->master->frontsector, rover, (rover->flags & FF_FLOATBOB), player, rover->alpha, respawn); EV_StartCrumble(rover->master->frontsector, rover, (rover->flags & FF_FLOATBOB), player, rover->alpha, respawn);
} }
} }
if (!foundrover)
{
CONS_Debug(DBG_GAMELOGIC, "Line type 446 Executor: Can't find a FOF control sector with tag %d\n", foftag);
return;
}
}
}
break; break;
case 447: // Change colormap of tagged sectors! case 447: // Change colormap of tagged sectors!
@ -3486,7 +3492,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS);
INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS);
sector_t *sec; // Sector that the FOF is visible in sector_t *sec; // Sector that the FOF is visible in
ffloor_t *rover; // FOF that we are going to operate ffloor_t *rover, *foundrover; // FOF that we are going to operate
for (secnum = -1; (secnum = P_FindSectorFromTag(sectag, secnum)) >= 0 ;) for (secnum = -1; (secnum = P_FindSectorFromTag(sectag, secnum)) >= 0 ;)
{ {
@ -3501,14 +3507,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
for (rover = sec->ffloors; rover; rover = rover->next) for (rover = sec->ffloors; rover; rover = rover->next)
{ {
if (rover->master->frontsector->tag == foftag) if (rover->master->frontsector->tag == foftag)
break;
}
if (!rover)
{ {
CONS_Debug(DBG_GAMELOGIC, "Line type 452 Executor: Can't find a FOF control sector with tag %d\n", foftag); foundrover = rover; // for debug, "Can't find a FOF" message below
return;
}
// If fading an invisible FOF whose render flags we did not yet set, // If fading an invisible FOF whose render flags we did not yet set,
// initialize its alpha to 1 // initialize its alpha to 1
@ -3534,6 +3534,14 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
false, // do not do ghost fade (no collision during fade) false, // do not do ghost fade (no collision during fade)
true); // use exact alpha values (for opengl) true); // use exact alpha values (for opengl)
} }
}
if (!foundrover)
{
CONS_Debug(DBG_GAMELOGIC, "Line type 452 Executor: Can't find a FOF control sector with tag %d\n", foftag);
return;
}
}
break; break;
} }
@ -3546,7 +3554,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS);
INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS);
sector_t *sec; // Sector that the FOF is visible in sector_t *sec; // Sector that the FOF is visible in
ffloor_t *rover; // FOF that we are going to operate ffloor_t *rover, *foundrover; // FOF that we are going to operate
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
for (secnum = -1; (secnum = P_FindSectorFromTag(sectag, secnum)) >= 0 ;) for (secnum = -1; (secnum = P_FindSectorFromTag(sectag, secnum)) >= 0 ;)
@ -3562,15 +3570,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
for (rover = sec->ffloors; rover; rover = rover->next) for (rover = sec->ffloors; rover; rover = rover->next)
{ {
if (rover->master->frontsector->tag == foftag) if (rover->master->frontsector->tag == foftag)
break;
j++;
}
if (!rover)
{ {
CONS_Debug(DBG_GAMELOGIC, "Line type 453 Executor: Can't find a FOF control sector with tag %d\n", foftag); foundrover = rover; // for debug, "Can't find a FOF" message below
return;
}
// Prevent continuous execs from interfering on an existing fade // Prevent continuous execs from interfering on an existing fade
if (!(line->flags & ML_EFFECT5) if (!(line->flags & ML_EFFECT5)
@ -3621,6 +3622,15 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
(line->flags & ML_TFERLINE)); // use exact alpha values (for opengl) (line->flags & ML_TFERLINE)); // use exact alpha values (for opengl)
} }
} }
j++;
}
if (!foundrover)
{
CONS_Debug(DBG_GAMELOGIC, "Line type 453 Executor: Can't find a FOF control sector with tag %d\n", foftag);
return;
}
}
break; break;
} }
@ -3629,7 +3639,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS); INT16 sectag = (INT16)(sides[line->sidenum[0]].textureoffset>>FRACBITS);
INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS); INT16 foftag = (INT16)(sides[line->sidenum[0]].rowoffset>>FRACBITS);
sector_t *sec; // Sector that the FOF is visible in sector_t *sec; // Sector that the FOF is visible in
ffloor_t *rover; // FOF that we are going to operate ffloor_t *rover, *foundrover; // FOF that we are going to operate
for (secnum = -1; (secnum = P_FindSectorFromTag(sectag, secnum)) >= 0 ;) for (secnum = -1; (secnum = P_FindSectorFromTag(sectag, secnum)) >= 0 ;)
{ {
@ -3644,17 +3654,19 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
for (rover = sec->ffloors; rover; rover = rover->next) for (rover = sec->ffloors; rover; rover = rover->next)
{ {
if (rover->master->frontsector->tag == foftag) if (rover->master->frontsector->tag == foftag)
break; {
foundrover = rover; // for debug, "Can't find a FOF" message below
P_ResetFakeFloorFader(rover, NULL,
!(line->flags & ML_BLOCKMONSTERS)); // do not finalize collision flags
}
} }
if (!rover) if (!foundrover)
{ {
CONS_Debug(DBG_GAMELOGIC, "Line type 454 Executor: Can't find a FOF control sector with tag %d\n", foftag); CONS_Debug(DBG_GAMELOGIC, "Line type 454 Executor: Can't find a FOF control sector with tag %d\n", foftag);
return; return;
} }
P_ResetFakeFloorFader(rover, NULL,
!(line->flags & ML_BLOCKMONSTERS)); // do not finalize collision flags
} }
break; break;
} }