components/prboom/p_spec.c
// killough 2/28/98:
//
// This function, with the help of r_plane.c and r_bsp.c, supports generalized
// scrolling floors and walls, with optional mobj-carrying properties, e.g.
// conveyor belts, rivers, etc. A linedef with a special type affects all
// tagged sectors the same way, by creating scrolling and/or object-carrying
// properties. Multiple linedefs may be used on the same sector and are
// cumulative, although the special case of scrolling a floor and carrying
// things on it, requires only one linedef. The linedef's direction determines
// the scrolling direction, and the linedef's length determines the scrolling
// speed. This was designed so that an edge around the sector could be used to
// control the direction of the sector's scrolling, which is usually what is
// desired.
//
// Process the active scrollers.
//
// This is the main scrolling code
// killough 3/7/98
killough 2/28/98:
This function, with the help of r_plane.c and r_bsp.c, supports generalized
scrolling floors and walls, with optional mobj-carrying properties, e.g.
conveyor belts, rivers, etc. A linedef with a special type affects all
tagged sectors the same way, by creating scrolling and/or object-carrying
properties. Multiple linedefs may be used on the same sector and are
cumulative, although the special case of scrolling a floor and carrying
things on it, requires only one linedef. The linedef's direction determines
the scrolling direction, and the linedef's length determines the scrolling
speed. This was designed so that an edge around the sector could be used to
control the direction of the sector's scrolling, which is usually what is
desired.

Process the active scrollers.

This is the main scrolling code
killough 3/7/98
killough 2 / 28 / 98 : This function with the help of r_plane . c and r_bsp . c supports generalized scrolling floors and walls with optional mobj - carrying properties e . g . conveyor belts rivers etc . A linedef with a special type affects all tagged sectors the same way by creating scrolling and / or object - carrying properties . Multiple linedefs may be used on the same sector and are cumulative although the special case of scrolling a floor and carrying things on it requires only one linedef . The linedef ' s direction determines the scrolling direction and the linedef ' s length determines the scrolling speed . This was designed so that an edge around the sector could be used to control the direction of the sector ' s scrolling which is usually what is desired . Process the active scrollers . This is the main scrolling code killough 3 / 7 / 98
void T_Scroll(scroll_t *s)
{
  fixed_t dx = s->dx, dy = s->dy;
  if (s->control != -1)
    {   
      fixed_t height = sectors[s->control].floorheight +
        sectors[s->control].ceilingheight;
      fixed_t delta = height - s->last_height;
      s->last_height = height;
      dx = FixedMul(dx, delta);
      dy = FixedMul(dy, delta);
    }
  if (s->accel)
    {
      s->vdx = dx += s->vdx;
      s->vdy = dy += s->vdy;
    }
  if (!(dx | dy))                   
    return;
  switch (s->type)
    {
      side_t *side;
      sector_t *sec;
      fixed_t height, waterheight;  
      msecnode_t *node;
      mobj_t *thing;
    case sc_side:                   
        side = sides + s->affectee;
        side->textureoffset += dx;
        side->rowoffset += dy;
        break;
    case sc_floor:                  
        sec = sectors + s->affectee;
        sec->floor_xoffs += dx;
        sec->floor_yoffs += dy;
        break;
    case sc_ceiling:               
        sec = sectors + s->affectee;
        sec->ceiling_xoffs += dx;
        sec->ceiling_yoffs += dy;
        break;
    case sc_carry:
      sec = sectors + s->affectee;
      height = sec->floorheight;
      waterheight = sec->heightsec != -1 &&
        sectors[sec->heightsec].floorheight > height ?
        sectors[sec->heightsec].floorheight : INT_MIN;
      for (node = sec->touching_thinglist; node; node = node->m_snext)
        if (!((thing = node->m_thing)->flags & MF_NOCLIP) &&
            (!(thing->flags & MF_NOGRAVITY || thing->z > height) ||
             thing->z < waterheight))
          {
            thing->momx += dx;
            thing->momy += dy;
          }
      break;
    case sc_carry_ceiling:       
      break;
    }
}
void T_Scroll ( scroll_t * s ) { fixed_t dx = s -> dx , dy = s -> dy ; if ( s -> control != -1 ) { fixed_t height = sectors [ s -> control ] . floorheight + sectors [ s -> control ] . ceilingheight ; fixed_t delta = height - s -> last_height ; s -> last_height = height ; dx = FixedMul ( dx , delta ) ; dy = FixedMul ( dy , delta ) ; } if ( s -> accel ) { s -> vdx = dx += s -> vdx ; s -> vdy = dy += s -> vdy ; } if ( ! ( dx | dy ) ) return ; switch ( s -> type ) { side_t * side ; sector_t * sec ; fixed_t height , waterheight ; msecnode_t * node ; mobj_t * thing ; case sc_side : side = sides + s -> affectee ; side -> textureoffset += dx ; side -> rowoffset += dy ; break ; case sc_floor : sec = sectors + s -> affectee ; sec -> floor_xoffs += dx ; sec -> floor_yoffs += dy ; break ; case sc_ceiling : sec = sectors + s -> affectee ; sec -> ceiling_xoffs += dx ; sec -> ceiling_yoffs += dy ; break ; case sc_carry : sec = sectors + s -> affectee ; height = sec -> floorheight ; waterheight = sec -> heightsec != -1 && sectors [ sec -> heightsec ] . floorheight > height ? sectors [ sec -> heightsec ] . floorheight : INT_MIN ; for ( node = sec -> touching_thinglist ; node ; node = node -> m_snext ) if ( ! ( ( thing = node -> m_thing ) -> flags & MF_NOCLIP ) && ( ! ( thing -> flags & MF_NOGRAVITY || thing -> z > height ) || thing -> z < waterheight ) ) { thing -> momx += dx ; thing -> momy += dy ; } break ; case sc_carry_ceiling : break ; } }
killough 2/28/98:
This function, with the help of r_plane.c and r_bsp.c, supports generalized
scrolling floors and walls, with optional mobj-carrying properties, e.g.
killough 2 / 28 / 98 : This function with the help of r_plane . c and r_bsp . c supports generalized scrolling floors and walls with optional mobj - carrying properties e . g .
// compute scroll amounts based on a sector's height changes // killough 3/14/98: Add acceleration // no-op if both (x,y) offsets 0 // killough 4/4/98: add waterheight // killough 3/7/98: Scroll wall texture // killough 3/7/98: Scroll floor texture // killough 3/7/98: Scroll ceiling texture // killough 3/7/98: Carry things on floor // killough 3/20/98: use new sector list which reflects true members // killough 3/27/98: fix carrier bug // killough 4/4/98: Underwater, carry things even w/o gravity // Move objects only if on floor or underwater, // non-floating, and clipped. // to be added later