components/prboom/v_video.c
/*
 * V_DrawBackground tiles a 64x64 patch over the entire screen, providing the
 * background for the Help and Setup screens, and plot text betwen levels.
 * cphipps - used to have M_DrawBackground, but that was used the framebuffer
 * directly, so this is my code from the equivalent function in f_finale.c
 */
V_DrawBackground tiles a 64x64 patch over the entire screen, providing the
background for the Help and Setup screens, and plot text betwen levels.
cphipps - used to have M_DrawBackground, but that was used the framebuffer
directly, so this is my code from the equivalent function in f_finale.c
V_DrawBackground tiles a 64x64 patch over the entire screen providing the background for the Help and Setup screens and plot text betwen levels . cphipps - used to have M_DrawBackground but that was used the framebuffer directly so this is my code from the equivalent function in f_finale . c
static void FUNC_V_DrawBackground(const char* flatname, int scrn)
{
  const byte *src;
  int         x,y;
  int         width,height;
  int         lump;
  src = W_CacheLumpNum(lump = firstflat + R_FlatNumForName(flatname));
  width = height = 64;
  if (V_GetMode() == VID_MODE8) {
    byte *dest = screens[scrn].data;
    while (height--) {
      memcpy (dest, src, width);
      src += width;
      dest += screens[scrn].byte_pitch;
    }
  } else if (V_GetMode() == VID_MODE15) {
    unsigned short *dest = (unsigned short *)screens[scrn].data;
    while (height--) {
      int i;
      for (i=0; i<width; i++) {
        dest[i] = VID_PAL15(src[i], VID_COLORWEIGHTMASK);
      }
      src += width;
      dest += screens[scrn].short_pitch;
    }
  } else if (V_GetMode() == VID_MODE16) {
    unsigned short *dest = (unsigned short *)screens[scrn].data;
    while (height--) {
      int i;
      for (i=0; i<width; i++) {
        dest[i] = VID_PAL16(src[i], VID_COLORWEIGHTMASK);
      }
      src += width;
      dest += screens[scrn].short_pitch;
    }
  } else if (V_GetMode() == VID_MODE32) {
    unsigned int *dest = (unsigned int *)screens[scrn].data;
    while (height--) {
      int i;
      for (i=0; i<width; i++) {
        dest[i] = VID_PAL32(src[i], VID_COLORWEIGHTMASK);
      }
      src += width;
      dest += screens[scrn].int_pitch;
    }
  }
  for (y=0 ; y<SCREENHEIGHT ; y+=64)
    for (x=y ? 0 : 64; x<SCREENWIDTH ; x+=64)
      V_CopyRect(0, 0, scrn, ((SCREENWIDTH-x) < 64) ? (SCREENWIDTH-x) : 64,
     ((SCREENHEIGHT-y) < 64) ? (SCREENHEIGHT-y) : 64, x, y, scrn, VPT_NONE);
  W_UnlockLumpNum(lump);
}
static void FUNC_V_DrawBackground ( const char * flatname , int scrn ) { const byte * src ; int x , y ; int width , height ; int lump ; src = W_CacheLumpNum ( lump = firstflat + R_FlatNumForName ( flatname ) ) ; width = height = 64 ; if ( V_GetMode ( ) == VID_MODE8 ) { byte * dest = screens [ scrn ] . data ; while ( height -- ) { memcpy ( dest , src , width ) ; src += width ; dest += screens [ scrn ] . byte_pitch ; } } else if ( V_GetMode ( ) == VID_MODE15 ) { unsigned short * dest = ( unsigned short * ) screens [ scrn ] . data ; while ( height -- ) { int i ; for ( i = 0 ; i < width ; i ++ ) { dest [ i ] = VID_PAL15 ( src [ i ] , VID_COLORWEIGHTMASK ) ; } src += width ; dest += screens [ scrn ] . short_pitch ; } } else if ( V_GetMode ( ) == VID_MODE16 ) { unsigned short * dest = ( unsigned short * ) screens [ scrn ] . data ; while ( height -- ) { int i ; for ( i = 0 ; i < width ; i ++ ) { dest [ i ] = VID_PAL16 ( src [ i ] , VID_COLORWEIGHTMASK ) ; } src += width ; dest += screens [ scrn ] . short_pitch ; } } else if ( V_GetMode ( ) == VID_MODE32 ) { unsigned int * dest = ( unsigned int * ) screens [ scrn ] . data ; while ( height -- ) { int i ; for ( i = 0 ; i < width ; i ++ ) { dest [ i ] = VID_PAL32 ( src [ i ] , VID_COLORWEIGHTMASK ) ; } src += width ; dest += screens [ scrn ] . int_pitch ; } } for ( y = 0 ; y < SCREENHEIGHT ; y += 64 ) for ( x = y ? 0 : 64 ; x < SCREENWIDTH ; x += 64 ) V_CopyRect ( 0 , 0 , scrn , ( ( SCREENWIDTH - x ) < 64 ) ? ( SCREENWIDTH - x ) : 64 , ( ( SCREENHEIGHT - y ) < 64 ) ? ( SCREENHEIGHT - y ) : 64 , x , y , scrn , VPT_NONE ) ; W_UnlockLumpNum ( lump ) ; }
V_DrawBackground tiles a 64x64 patch over the entire screen, providing the
 background for the Help and Setup screens, and plot text betwen levels.
V_DrawBackground tiles a 64x64 patch over the entire screen providing the background for the Help and Setup screens and plot text betwen levels .
/* erase the entire screen to a tiled background */ // killough 4/17/98: /* V_DrawBlock(0, 0, scrn, 64, 64, src, 0); */ /* end V_DrawBlock */