components/prboom/v_video.c
//
// WRAP_V_DrawLine()
//
// Draw a line in the frame buffer.
// Classic Bresenham w/ whatever optimizations needed for speed
//
// Passed the frame coordinates of line, and the color to be drawn
// Returns nothing
//
WRAP_V_DrawLine()
Draw a line in the frame buffer.
Classic Bresenham w/ whatever optimizations needed for speed

Passed the frame coordinates of line, and the color to be drawn
Returns nothing
WRAP_V_DrawLine () Draw a line in the frame buffer . Classic Bresenham w / whatever optimizations needed for speed Passed the frame coordinates of line and the color to be drawn Returns nothing
static void WRAP_V_DrawLine(fline_t* fl, int color)
{
  register int x;
  register int y;
  register int dx;
  register int dy;
  register int sx;
  register int sy;
  register int ax;
  register int ay;
  register int d;
#ifdef RANGECHECK         
  static int fuck = 0;
  if
  (
       fl->a.x < 0 || fl->a.x >= SCREENWIDTH
    || fl->a.y < 0 || fl->a.y >= SCREENHEIGHT
    || fl->b.x < 0 || fl->b.x >= SCREENWIDTH
    || fl->b.y < 0 || fl->b.y >= SCREENHEIGHT
  )
  {
    lprintf(LO_DEBUG, "fuck %d \r", fuck++);
    return;
  }
#endif
#define PUTDOT(xx,yy,cc) V_PlotPixel(0,xx,yy,(byte)cc)
  dx = fl->b.x - fl->a.x;
  ax = 2 * (dx<0 ? -dx : dx);
  sx = dx<0 ? -1 : 1;
  dy = fl->b.y - fl->a.y;
  ay = 2 * (dy<0 ? -dy : dy);
  sy = dy<0 ? -1 : 1;
  x = fl->a.x;
  y = fl->a.y;
  if (ax > ay)
  {
    d = ay - ax/2;
    while (1)
    {
      PUTDOT(x,y,color);
      if (x == fl->b.x) return;
      if (d>=0)
      {
        y += sy;
        d -= ax;
      }
      x += sx;
      d += ay;
    }
  }
  else
  {
    d = ax - ay/2;
    while (1)
    {
      PUTDOT(x, y, color);
      if (y == fl->b.y) return;
      if (d >= 0)
      {
        x += sx;
        d -= ay;
      }
      y += sy;
      d += ax;
    }
  }
}
static void WRAP_V_DrawLine ( fline_t * fl , int color ) { register int x ; register int y ; register int dx ; register int dy ; register int sx ; register int sy ; register int ax ; register int ay ; register int d ; #ifdef RANGECHECK static int fuck = 0 ; if ( fl -> a . x < 0 || fl -> a . x >= SCREENWIDTH || fl -> a . y < 0 || fl -> a . y >= SCREENHEIGHT || fl -> b . x < 0 || fl -> b . x >= SCREENWIDTH || fl -> b . y < 0 || fl -> b . y >= SCREENHEIGHT ) { lprintf ( LO_DEBUG , " \r " , fuck ++ ) ; return ; } #endif #define PUTDOT ( xx , yy , cc )  V_PlotPixel(0,xx,yy,(byte)cc) dx = fl -> b . x - fl -> a . x ; ax = 2 * ( dx < 0 ? - dx : dx ) ; sx = dx < 0 ? -1 : 1 ; dy = fl -> b . y - fl -> a . y ; ay = 2 * ( dy < 0 ? - dy : dy ) ; sy = dy < 0 ? -1 : 1 ; x = fl -> a . x ; y = fl -> a . y ; if ( ax > ay ) { d = ay - ax / 2 ; while ( 1 ) { PUTDOT ( x , y , color ) ; if ( x == fl -> b . x ) return ; if ( d >= 0 ) { y += sy ; d -= ax ; } x += sx ; d += ay ; } } else { d = ax - ay / 2 ; while ( 1 ) { PUTDOT ( x , y , color ) ; if ( y == fl -> b . y ) return ; if ( d >= 0 ) { x += sx ; d -= ay ; } y += sy ; d += ax ; } } }
WRAP_V_DrawLine()
Draw a line in the frame buffer.
WRAP_V_DrawLine () Draw a line in the frame buffer .
// killough 2/22/98 // For debugging only //jff 8/3/98 use logical output routine