components/prboom/p_floor.c
/*
 * EV_BuildStairs()
 *
 * Handles staircase building. A sequence of sectors chosen by algorithm
 * rise at a speed indicated to a height that increases by the stepsize
 * each step.
 *
 * Passed the linedef triggering the stairs and the type of stair rise
 * Returns true if any thinkers are created
 *
 * cph 2001/09/21 - compatibility nightmares again
 * There are three different ways this function has, during its history, stepped
 * through all the stairs to be triggered by the single switch
 * - original Doom used a linear P_FindSectorFromLineTag, but failed to preserve
 * the index of the previous sector found, so instead it would restart its
 * linear search from the last sector of the previous staircase
 * - MBF/PrBoom with comp_stairs fail to emulate this, because their
 * P_FindSectorFromLineTag is a chained hash table implementation. Instead they
 * start following the hash chain from the last sector of the previous
 * staircase, which will (probably) have the wrong tag, so they miss any further
 * stairs
 * - Boom fixed the bug, and MBF/PrBoom without comp_stairs work right
 */
EV_BuildStairs()
Handles staircase building. A sequence of sectors chosen by algorithm
rise at a speed indicated to a height that increases by the stepsize
each step.

Passed the linedef triggering the stairs and the type of stair rise
Returns true if any thinkers are created

cph 2001/09/21 - compatibility nightmares again
There are three different ways this function has, during its history, stepped
through all the stairs to be triggered by the single switch
- original Doom used a linear P_FindSectorFromLineTag, but failed to preserve
the index of the previous sector found, so instead it would restart its
linear search from the last sector of the previous staircase
- MBF/PrBoom with comp_stairs fail to emulate this, because their
P_FindSectorFromLineTag is a chained hash table implementation. Instead they
start following the hash chain from the last sector of the previous
staircase, which will (probably) have the wrong tag, so they miss any further
stairs
- Boom fixed the bug, and MBF/PrBoom without comp_stairs work right
EV_BuildStairs () Handles staircase building . A sequence of sectors chosen by algorithm rise at a speed indicated to a height that increases by the stepsize each step . Passed the linedef triggering the stairs and the type of stair rise Returns true if any thinkers are created cph 2001 / 09 / 21 - compatibility nightmares again There are three different ways this function has during its history stepped through all the stairs to be triggered by the single switch - original Doom used a linear P_FindSectorFromLineTag but failed to preserve the index of the previous sector found so instead it would restart its linear search from the last sector of the previous staircase - MBF / PrBoom with comp_stairs fail to emulate this because their P_FindSectorFromLineTag is a chained hash table implementation . Instead they start following the hash chain from the last sector of the previous staircase which will ( probably ) have the wrong tag so they miss any further stairs - Boom fixed the bug and MBF / PrBoom without comp_stairs work right
static inline int P_FindSectorFromLineTagWithLowerBound
(line_t* l, int start, int min)
{
  do {
    start = P_FindSectorFromLineTag(l,start);
  } while (start >= 0 && start <= min);
  return start;
}
static inline int P_FindSectorFromLineTagWithLowerBound ( line_t * l , int start , int min ) { do { start = P_FindSectorFromLineTag ( l , start ) ; } while ( start >= 0 && start <= min ) ; return start ; }
EV_BuildStairs()
 Handles staircase building.
EV_BuildStairs () Handles staircase building .
/* Emulate original Doom's linear lower-bounded P_FindSectorFromLineTag
   * as needed */