Example #1
0
//
// V_CopyRect
//
// Copies a source rectangle in a screen buffer to a destination
// rectangle in another screen buffer. Source origin in srcx,srcy,
// destination origin in destx,desty, common size in width and height.
// Source buffer specfified by srcscrn, destination buffer by destscrn.
//
// Marks the destination rectangle on the screen dirty.
//
// No return.
//
void V_CopyRect(int srcx, int srcy, int srcscrn, int width,
                int height, int destx, int desty, int destscrn )
{
  byte *src;
  byte *dest;

#ifdef RANGECHECK
  if (srcx<0
      ||srcx+width >SCREENWIDTH
      || srcy<0
      || srcy+height>SCREENHEIGHT
      ||destx<0||destx+width >SCREENWIDTH
      || desty<0
      || desty+height>SCREENHEIGHT)
    I_Error ("Bad V_CopyRect");
#endif

  V_MarkRect (destx, desty, width, height);

  src = screens[srcscrn]+SCREENWIDTH*srcy+srcx;
  dest = screens[destscrn]+SCREENWIDTH*desty+destx;

  for ( ; height>0 ; height--)
    {
      memcpy (dest, src, width);
      src += SCREENWIDTH;
      dest += SCREENWIDTH;
    }
}
Example #2
0
int wipe_ScreenWipe(int wipeno, int x, int y, int width, int height, int ticks)
{
    int rc;
    static int (*wipes[])(int, int, int) =
    {
        wipe_initColorXForm, wipe_doColorXForm, wipe_exitColorXForm,
        wipe_initMelt, wipe_doMelt, wipe_exitMelt
    };

    void V_MarkRect(int, int, int, int);

    // initial stuff
    if (!go)
    {
        go = 1;
        // DEBUG
        // wipe_scr = (byte *)Z_Malloc(width * height, PU_STATIC, (void *)0);
        wipe_scr = screens[0];
        (*wipes[wipeno * 3])(width, height, ticks);
    }

    // do a piece of wipe-in
    V_MarkRect(0, 0, width, height);
    rc = (*wipes[wipeno * 3 + 1])(width, height, ticks);
    //  V_DrawBlock(x, y, 0, width, height, wipe_scr); // DEBUG

    // final stuff
    if (rc)
    {
        go = 0;
        (*wipes[wipeno * 3 + 2])(width, height, ticks);
    }

    return !go;
}
Example #3
0
//
// V_DrawBlock
// Draw a linear block of pixels into the view buffer.
//
void
V_DrawBlock
( int		x,
  int		y,
  int		scrn,
  int		width,
  int		height,
  byte*		src ) 
{ 
    byte*	dest; 
	 
#ifdef RANGECHECK 
    if (x<0
	||x+width >SCREENWIDTH
	|| y<0
	|| y+height>SCREENHEIGHT 
	|| (unsigned)scrn>4 )
    {
	I_Error ("Bad V_DrawBlock");
    }
#endif 
 
    V_MarkRect (x, y, width, height); 
 
    dest = screens[scrn] + y*SCREENWIDTH+x; 

    while (height--) 
    { 
	memcpy (dest, src, width); 
	src += width; 
	dest += SCREENWIDTH; 
    } 
} 
Example #4
0
//
// V_DrawPatchFlipped 
// Masks a column based masked pic to the screen.
// Flips horizontally, e.g. to mirror face.
//
void
V_DrawPatchFlipped
( int		x,
  int		y,
  int		scrn,
  patch_t*	patch ) 
{ 

    int		count;
    int		col; 
    column_t*	column; 
    byte*	desttop;
    byte*	dest;
    byte*	source; 
    int		w; 
	 
    y -= SHORT(patch->topoffset); 
    x -= SHORT(patch->leftoffset); 
#ifdef RANGECHECK 
    if (x<0
	||x+SHORT(patch->width) >SCREENWIDTH
	|| y<0
	|| y+SHORT(patch->height)>SCREENHEIGHT 
	|| (unsigned)scrn>4)
    {
      fprintf( stderr, "Patch origin %d,%d exceeds LFB\n", x,y );
      I_Error ("Bad V_DrawPatch in V_DrawPatchFlipped");
    }
#endif 
 
    if (!scrn)
	V_MarkRect (x, y, SHORT(patch->width), SHORT(patch->height)); 

    col = 0; 
    desttop = screens[scrn]+y*SCREENWIDTH+x; 
	 
    w = SHORT(patch->width); 

    for ( ; col<w ; x++, col++, desttop++) 
    { 
	column = (column_t *)((byte *)patch + LONG(patch->columnofs[w-1-col])); 
 
	// step through the posts in a column 
	while (column->topdelta != 0xff ) 
	{ 
	    source = (byte *)column + 3; 
	    dest = desttop + column->topdelta*SCREENWIDTH; 
	    count = column->length; 
			 
	    while (count--) 
	    { 
		*dest = *source++; 
		dest += SCREENWIDTH; 
	    } 
	    column = (column_t *)(  (byte *)column + column->length 
				    + 4 ); 
	} 
    }			 
} 
Example #5
0
void F_TextWrite (void)
{
  {
    // erase the entire screen to a tiled background
    const byte *src; // cph - const
    int         x,y;
    int         lump;
    
    // killough 4/17/98: 
    src = W_CacheLumpNum(lump = firstflat + R_FlatNumForName(finaleflat));
    
    V_DrawBlock(0, 0, 0, 64, 64, src, 0);
    
    for (y=0 ; y<SCREENHEIGHT ; y+=64)
      for (x=y ? 0 : 64; x<SCREENWIDTH ; x+=64)
	V_CopyRect(0, 0, 0, ((SCREENWIDTH-x) < 64) ? (SCREENWIDTH-x) : 64, 
		   ((SCREENHEIGHT-y) < 64) ? (SCREENHEIGHT-y) : 64, x, y, 0);
    W_UnlockLumpNum(lump);
  }
  V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT);
  { // draw some of the text onto the screen
    int         cx = 10;
    int         cy = 10;
    const char* ch = finaletext; // CPhipps - const
    int         count = (finalecount - 10)/Get_TextSpeed();                 // phares
    int         w;
    
    if (count < 0)
      count = 0;
    
    for ( ; count ; count-- ) {
      int       c = *ch++;
      
      if (!c)
	break;
      if (c == '\n') {
	cx = 10;
	cy += 11;
	continue;
      }
              
      c = toupper(c) - HU_FONTSTART;
      if (c < 0 || c> HU_FONTSIZE) {
	cx += 4;
	continue;
      }
      
      w = SHORT (hu_font[c]->width);
      if (cx+w > SCREENWIDTH)
	break;
      // CPhipps - patch drawing updated
      V_DrawMemPatch(cx, cy, 0, hu_font[c], NULL, VPT_STRETCH);
      cx+=w;
    }
  }
}
Example #6
0
//
// F_BunnyScroll
//
void F_BunnyScroll (void)
{
    signed int  scrolled;
    int		x;
    patch_t*	p1;
    patch_t*	p2;
    char	name[10];
    int		stage;
    static int	laststage;
		
    p1 = W_CacheLumpName (DEH_String("PFUB2"), PU_LEVEL);
    p2 = W_CacheLumpName (DEH_String("PFUB1"), PU_LEVEL);

    V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT);
	
    scrolled = (SCREENWIDTH - ((signed int) finalecount-230)/2);
    if (scrolled > SCREENWIDTH)
	scrolled = SCREENWIDTH;
    if (scrolled < 0)
	scrolled = 0;
		
    for ( x=0 ; x<SCREENWIDTH ; x++)
    {
	if (x+scrolled < SCREENWIDTH)
	    F_DrawPatchCol (x, p1, x+scrolled);
	else
	    F_DrawPatchCol (x, p2, x+scrolled - SCREENWIDTH);		
    }
	
    if (finalecount < 1130)
	return;
    if (finalecount < 1180)
    {
        V_DrawPatch((SCREENWIDTH - 13 * 8) / 2,
                    (SCREENHEIGHT - 8 * 8) / 2, 
                    W_CacheLumpName(DEH_String("END0"), PU_CACHE));
	laststage = 0;
	return;
    }
	
    stage = (finalecount-1180) / 5;
    if (stage > 6)
	stage = 6;
    if (stage > laststage)
    {
	S_StartSound (NULL, sfx_pistol);
	laststage = stage;
    }
	
    DEH_snprintf(name, 10, "END%i", stage);
    V_DrawPatch((SCREENWIDTH - 13 * 8) / 2, 
                (SCREENHEIGHT - 8 * 8) / 2, 
                W_CacheLumpName (name,PU_CACHE));
}
Example #7
0
//
// F_BunnyScroll
//
void F_BunnyScroll (void)
{
    int		scrolled;
    int		x;
    patch_t*	p1;
    patch_t*	p2;
    char	name[10];
    int		stage;
    static int	laststage;
		
    p1 = W_CacheLumpName ("PFUB2", PU_LEVEL);
    p2 = W_CacheLumpName ("PFUB1", PU_LEVEL);

    V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT);
	
    scrolled = 320 - (finalecount-230)/2;
    if (scrolled > 320)
	scrolled = 320;
    if (scrolled < 0)
	scrolled = 0;
		
    for ( x=0 ; x<SCREENWIDTH ; x++)
    {
	if (x+scrolled < 320)
	    F_DrawPatchCol (x, p1, x+scrolled);
	else
	    F_DrawPatchCol (x, p2, x+scrolled - 320);		
    }
	
    if (finalecount < 1130)
	return;
    if (finalecount < 1180)
    {
	V_DrawPatch ((SCREENWIDTH-13*8)/2,
		     (SCREENHEIGHT-8*8)/2,0, W_CacheLumpName ("END0",PU_CACHE));
	laststage = 0;
	return;
    }
	
    stage = (finalecount-1180) / 5;
    if (stage > 6)
	stage = 6;
    if (stage > laststage)
    {
#ifdef USE_SOUND
	S_StartSound (NULL, sfx_pistol);
	laststage = stage;
#endif
    }
	
    sprintf (name,"END%i",stage);
    V_DrawPatch ((SCREENWIDTH-13*8)/2, (SCREENHEIGHT-8*8)/2,0, W_CacheLumpName (name,PU_CACHE));
}
Example #8
0
void WI_slamBackground(void)
{
	byte *src, *dest;
	int y;
	
	src = screens[1];
	dest = screens[0];
	for (y=0;y<sysvideo.height;y++) {
	    memcpy(dest, src, sysvideo.width);
		src += sysvideo.width;
		dest += sysvideo.pitch;
	}
    V_MarkRect (0, 0, sysvideo.width, sysvideo.height);
}
//
// F_BunnyScroll
//
void F_BunnyScroll (void)
{
    int		scrolled;
    int		x;
    patch_t*	p1;
    patch_t*	p2;
    char	name[10];
    int		stage;
		
    p1 = (patch_t*)W_CacheLumpName ("PFUB2", PU_LEVEL_SHARED);
    p2 = (patch_t*)W_CacheLumpName ("PFUB1", PU_LEVEL_SHARED);

    V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT);
	
    scrolled = 320 - (::g->finalecount-230)/2;
    if (scrolled > 320)
	scrolled = 320;
    if (scrolled < 0)
	scrolled = 0;
		
    for ( x=0 ; x<ORIGINAL_WIDTH ; x++)
    {
	if (x+scrolled < 320)
	    F_DrawPatchCol (x, p1, x+scrolled);
	else
	    F_DrawPatchCol (x, p2, x+scrolled - 320);		
    }
	
    if (::g->finalecount < 1130)
	return;
    if (::g->finalecount < 1180)
    {
	V_DrawPatch ((ORIGINAL_WIDTH-13*8)/2,
		     (ORIGINAL_HEIGHT-8*8)/2,0, (patch_t*)W_CacheLumpName ("END0",PU_CACHE_SHARED));
	::g->laststage = 0;
	return;
    }
	
    stage = (::g->finalecount-1180) / 5;
    if (stage > 6)
	stage = 6;
    if (stage > ::g->laststage)
    {
	S_StartSound (NULL, sfx_pistol);
	::g->laststage = stage;
    }
	
    sprintf (name,"END%i",stage);
    V_DrawPatch ((ORIGINAL_WIDTH-13*8)/2, (ORIGINAL_HEIGHT-8*8)/2,0, (patch_t*)W_CacheLumpName (name,PU_CACHE_SHARED));
}
Example #10
0
OVERLAY static void F_BunnyScroll (void)
{
  char        name[10];
  int         stage;
  static int  laststage;

  V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT);
  {
    int scrolled = (finalecount-230)/2;
    if (scrolled <= 0) {
      V_DrawNamePatch(0, 0, 0, pfub2, NULL, VPT_STRETCH);
    } else if (scrolled >= 320) {
      V_DrawNamePatch(0, 0, 0, pfub1, NULL, VPT_STRETCH);
    } else {
#define SCRN 2
      int realscrolled = (SCREENWIDTH * scrolled) / 320;

      V_AllocScreen(SCRN);
      V_DrawNamePatch(0, 0, SCRN, pfub2, NULL, VPT_STRETCH);
      V_CopyRect(realscrolled, 0, SCRN, SCREENWIDTH-realscrolled, SCREENHEIGHT, 0, 0, 0);
      V_DrawNamePatch(0, 0, SCRN, pfub1, NULL, VPT_STRETCH);
      V_CopyRect(0, 0, SCRN, realscrolled, SCREENHEIGHT, SCREENWIDTH-realscrolled, 0, 0);
      V_FreeScreen(SCRN);
    }
  }

  if (finalecount < 1130)
    return;
  if (finalecount < 1180)
  {
    // CPhipps - patch drawing updated
    V_DrawNamePatch((320-13*8)/2, (200-8*8)/2,0, "END0", NULL, VPT_STRETCH);
    laststage = 0;
    return;
  }
      
  stage = (finalecount-1180) / 5;
  if (stage > 6)
    stage = 6;
  if (stage > laststage)
  {
    S_StartSound (NULL, sfx_pistol);
    laststage = stage;
  }
      
  sprintf (name,"END%i",stage);
  // CPhipps - patch drawing updated
  V_DrawNamePatch((320-13*8)/2, (200-8*8)/2, 0, name, NULL, VPT_STRETCH);
}
Example #11
0
//
// V_CopyRect 
// 
void
V_CopyRect
( int		srcx,
  int		srcy,
  int		srcscrn,
  int		width,
  int		height,
  int		destx,
  int		desty,
  int		destscrn ) 
{ 
    byte*	src;
    byte*	dest; 
	 
#ifdef RANGECHECK 
    if (srcx<0
	||srcx+width >ORIGINAL_WIDTH
	|| srcy<0
	|| srcy+height>ORIGINAL_HEIGHT 
	||destx<0||destx+width >ORIGINAL_WIDTH
	|| desty<0
	|| desty+height>ORIGINAL_HEIGHT
	|| (unsigned)srcscrn>4
	|| (unsigned)destscrn>4)
    {
	I_Error ("Bad V_CopyRect");
    }
#endif 
    V_MarkRect (destx, desty, width, height); 

	// SMF - rewritten for scaling
	srcx *= GLOBAL_IMAGE_SCALER;
	srcy *= GLOBAL_IMAGE_SCALER;
	destx *= GLOBAL_IMAGE_SCALER;
	desty *= GLOBAL_IMAGE_SCALER;
	width *= GLOBAL_IMAGE_SCALER;
	height *= GLOBAL_IMAGE_SCALER;

	src = ::g->screens[srcscrn] + srcy * SCREENWIDTH + srcx; 
	dest = ::g->screens[destscrn] + desty * SCREENWIDTH + destx; 

	for ( ; height>0 ; height--) { 
		memcpy(dest, src, width); 
		src += SCREENWIDTH; 
		dest += SCREENWIDTH; 
	} 
} 
Example #12
0
// haleyjd 08/26/10: [STRIFE] Verified unmodified.
int
wipe_ScreenWipe
( int	wipeno,
  int	x,
  int	y,
  int	width,
  int	height,
  int	ticks )
{
    int rc;
    static int (*wipes[])(int, int, int) =
    {
	    wipe_initColorXForm, wipe_doColorXForm, wipe_exitColorXForm,
	    wipe_initMelt, wipe_doMelt, wipe_exitMelt
    };

    // initial stuff
    if(!go)
    {
	    go = 1;
            // haleyjd 20110629 [STRIFE]: We *must* use a temp buffer here.
	    wipe_scr = (byte *) Z_Malloc(width*height, PU_STATIC, 0); // DEBUG
	    //wipe_scr = I_VideoBuffer;
	    (*wipes[wipeno*3])(width, height, ticks);
    }

    // do a piece of wipe-in
    V_MarkRect(0, 0, width, height);
    rc = (*wipes[wipeno*3+1])(width, height, ticks);

    // [SVE] svillarreal
    if(!use3drenderer)
    {
        // haleyjd 20110629 [STRIFE]: Copy temp buffer to the real screen.
        V_DrawBlock(x, y, width, height, wipe_scr);
    }

    // final stuff
    if(rc)
    {
	    go = 0;
	    (*wipes[wipeno*3+2])(width, height, ticks);
    }

    return !go;
}
Example #13
0
// killough 3/5/98: reformatted and cleaned up
int wipe_ScreenWipe(int x, int y, int width, int height, int ticks)
{
  static boolean go;                               // when zero, stop the wipe
  if (!go)                                         // initial stuff
    {
      go = 1;
      wipe_scr = screens[0];
      wipe_initMelt(width, height, ticks);
    }
  V_MarkRect(0, 0, width, height);                 // do a piece of wipe-in
  if (wipe_doMelt(width, height, ticks))     // final stuff
    {
      wipe_exitMelt(width, height, ticks);
      go = 0;
    }
  return !go;
}
Example #14
0
// killough 3/5/98: reformatted and cleaned up
int wipe_ScreenWipe(int wipeno, int x, int y, int width, int height, int ticks)
{
  static boolean go;                               // when zero, stop the wipe

  if (hires)     // killough 11/98: hires support
    width <<= 1, height <<= 1, ticks <<= 1;

  if (!go)                                         // initial stuff
  {
    go = 1;
    wipe_scr = screens[0];
    wipes[wipeno * 3](width, height, ticks);
  }
  V_MarkRect(0, 0, width, height);                 // do a piece of wipe-in
  if (wipes[wipeno * 3 + 1](width, height, ticks)) // final stuff
  {
    wipes[wipeno * 3 + 2](width, height, ticks);
    go = 0;
  }
  return !go;
}
Example #15
0
//
// V_DrawBlock
//
// Draw a linear block of pixels into the view buffer. 
//
// The bytes at src are copied in linear order to the screen rectangle
// at x,y in screenbuffer scrn, with size width by height.
//
// The destination rectangle is marked dirty.
//
// No return.
// 
// CPhipps - modified  to take the patch translation flags. For now, only stretching is 
//  implemented, to support highres in the menus
//
void V_DrawBlock(int x, int y, int scrn, int width, int height, 
		 const byte *src, enum patch_translation_e flags)
{
  byte *dest;

#ifdef RANGECHECK
  if (x<0
      ||x+width >((flags & VPT_STRETCH) ? 320 : SCREENWIDTH)
      || y<0
      || y+height>((flags & VPT_STRETCH) ? 200 : SCREENHEIGHT))
    I_Error ("Bad V_DrawBlock");

  if (flags & (VPT_TRANS | VPT_FLIP))
    I_Error("Bad V_DrawBlock (flags=%u)",flags);
#endif

  if (flags & VPT_STRETCH) {
    byte   *dest;
    int     s_width;
    fixed_t dx = (320 << FRACBITS) / SCREENWIDTH;
    
    x = (x * SCREENWIDTH) / 320; y = (y * SCREENHEIGHT) / 200;
    s_width = (width * SCREENWIDTH) / 320; height = (height * SCREENHEIGHT) / 200;
    
    if (!scrn)
      V_MarkRect (x, y, width, height);

    dest = screens[scrn] + y*SCREENWIDTH+x;
    // x & y no longer needed
    
    while (height--) {
      const byte *const src_row = src + width * ((height * 200) / SCREENHEIGHT);
      byte       *const dst_row = dest + SCREENWIDTH * height;
      fixed_t           tx;
      
      for (x=0, tx=0; x<s_width; x++, tx+=dx)
	dst_row[x] = src_row[tx >> FRACBITS];
    }
  } else {
Example #16
0
//
// F_BunnyScroll
//
void F_BunnyScroll (void)
{
	static int	laststage;

	V_MarkRect (0, 0, screen->width, screen->height);

	int scrolled = clamp(320 - (finalecount-230)/2, 0, 320);

	if (!bunny_scroll_initialized)
		F_InitBunnyScroll();

	R_CopySubimage(scroll_texture, bunny_texture, 0, 0, 319, 199, scrolled, 0, scrolled + 319, 199);

	screen->DrawTextureFullScreen(scroll_texture);

	if (finalecount < 1130)
		return;
	if (finalecount < 1180)
	{
		screen->DrawTextureIndirect(R_LoadTexture("END0"), (320-13*8)/2, (200-8*8)/2);
		laststage = 0;
		return;
	}

	int stage = (finalecount-1180) / 5;
	if (stage > 6)
		stage = 6;
	if (stage > laststage)
	{
		S_Sound (CHAN_WEAPON, "weapons/pistol", 1, ATTN_NONE);
		laststage = stage;
	}

	char name[10];
	sprintf(name,"END%i",stage);
	screen->DrawTextureIndirect(R_LoadTexture(name), (320-13*8)/2, (200-8*8)/2);
}
Example #17
0
//
// F_DrawMap34End
//
// [STRIFE] Modified from F_BunnyScroll
// * In 1.2 and up this just causes a weird black screen.
// * In the demo version, it was an actual scroll between two screens.
// I have implemented both code segments, though only the black screen
// one will currently be used, as full demo version support isn't looking
// likely right now.
//
void F_DrawMap34End (void)
{
    signed int  scrolled;
    int         x;
    patch_t*    p1;
    patch_t*    p2;

    p1 = W_CacheLumpName (DEH_String("credit"),  PU_LEVEL);
    p2 = W_CacheLumpName (DEH_String("vellogo"), PU_LEVEL);

    V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT);


    scrolled = (320 - ((signed int) finalecount-430)/2);
    if (scrolled > 320)
        scrolled = 320;
    if (scrolled < 0)
        scrolled = 0;

#ifdef STRIFE_DEMO_CODE
    for ( x=0 ; x<SCREENWIDTH ; x++)
    {
        if (x+scrolled < 320)
            F_DrawPatchCol (x, p1, x+scrolled);
        else
            F_DrawPatchCol (x, p2, x+scrolled - 320);
    }
#else
    // wtf this is supposed to do, I have no idea!
    x = 1;
    do
    {
        x += 11;
    }
    while(x < 320);
#endif
}
Example #18
0
void F_TextWrite (void)
{
    byte*	src;
    pixel_t*	dest;
    
    int		x,y,w;
    signed int	count;
    const char *ch;
    int		c;
    int		cx;
    int		cy;
    
    // erase the entire screen to a tiled background
    src = W_CacheLumpName ( finaleflat , PU_CACHE);
    dest = I_VideoBuffer;
	
    for (y=0 ; y<SCREENHEIGHT ; y++)
    {
	for (x=0 ; x<SCREENWIDTH/64 ; x++)
	{
	    memcpy (dest, src+((y&63)<<6), 64);
	    dest += 64;
	}
	if (SCREENWIDTH&63)
	{
	    memcpy (dest, src+((y&63)<<6), SCREENWIDTH&63);
	    dest += (SCREENWIDTH&63);
	}
    }

    V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT);
    
    // draw some of the text onto the screen
    cx = 10;
    cy = 10;
    ch = finaletext;
	
    count = ((signed int) finalecount - 10) / TEXTSPEED;
    if (count < 0)
	count = 0;
    for ( ; count ; count-- )
    {
	c = *ch++;
	if (!c)
	    break;
	if (c == '\n')
	{
	    cx = 10;
	    cy += 11;
	    continue;
	}
		
	c = toupper(c) - HU_FONTSTART;
	if (c < 0 || c> HU_FONTSIZE)
	{
	    cx += 4;
	    continue;
	}
		
	w = SHORT (hu_font[c]->width);
	if (cx+w > SCREENWIDTH)
	    break;
	V_DrawPatch(cx, cy, hu_font[c]);
	cx+=w;
    }
	
}
void F_TextWrite (void)
{
    byte*	src;
    byte*	dest;
    
    int		x,y,w;
    int		count;
    const char*	ch;
    int		c;
    int		cx;
    int		cy;
    
	if(::g->finalecount == 60 ) {
		DoomLib::ShowXToContinue( true );
	}

    // erase the entire screen to a tiled background
    src = (byte*)W_CacheLumpName ( finaleflat , PU_CACHE_SHARED);
    dest = ::g->screens[0];
	
    for (y=0 ; y<SCREENHEIGHT ; y++)
    {
	for (x=0 ; x<SCREENWIDTH/64 ; x++)
	{
	    memcpy (dest, src+((y&63)<<6), 64);
	    dest += 64;
	}
	if (SCREENWIDTH&63)
	{
	    memcpy (dest, src+((y&63)<<6), SCREENWIDTH&63);
	    dest += (SCREENWIDTH&63);
	}
    }

    V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT);
    
    // draw some of the text onto the screen
    cx = 10;
    cy = 10;
    ch = finaletext;
	
    count = (::g->finalecount - 10)/TEXTSPEED;
    if (count < 0)
	count = 0;
    for ( ; count ; count-- )
    {
	c = *ch++;
	if (!c)
	    break;
	if (c == '\n')
	{
	    cx = 10;
	    cy += 11;
	    continue;
	}
		
	c = toupper(c) - HU_FONTSTART;
	if (c < 0 || c> HU_FONTSIZE)
	{
	    cx += 4;
	    continue;
	}
		
	w = SHORT (::g->hu_font[c]->width);
	if (cx+w > SCREENWIDTH)
	    break;
	V_DrawPatch(cx, cy, 0, ::g->hu_font[c]);
	cx+=w;
    }
	
}
Example #20
0
//
// F_TextWrite
//
void F_TextWrite (void)
{
	const char*	ch;
	int 		c;
	int 		cx;
	int 		cy;

	screen->Clear(0, 0, screen->width, screen->height, 0);

	int background_width = screen->width;
	int background_height = screen->height;
	if (!screen->isProtectedRes() && screen->width * 3 > screen->height * 4)
		background_width = 4 * screen->height / 3;

	// center the background and text in 4:3 perspective
	int x1 = (screen->width - background_width) / 2;
	int y1 = (screen->height - background_height) / 2;
	int x2 = x1 + background_width - 1;
	int y2 = y1 + background_height - 1;

	// erase the entire screen to a tiled background
	texhandle_t flat_texhandle = texturemanager.getHandle(finaleflat, Texture::TEX_FLAT);
	if (flat_texhandle != TextureManager::NOT_FOUND_TEXTURE_HANDLE)
	{
		const Texture* flat_texture = texturemanager.getTexture(flat_texhandle);
		screen->FlatFill(flat_texture, x1, y1, x2, y2);
	}

	V_MarkRect(0, 0, screen->width, screen->height);

	// draw some of the text onto the screen
	const int initial_cx = 10 * CleanXfac + x1;
	const int initial_cy = 10 * CleanYfac + y1;
	const int cy_inc = 11 * CleanYfac;

	cx = initial_cx; 
	cy = initial_cy; 
	ch = finaletext;

	if (finalecount < 11)
		return;

	for (int count = (finalecount - 10) / TEXTSPEED; count; count--)
	{
		c = *ch++;
		if (!c)
			break;
		if (c == '\n')
		{
			cx = initial_cx;
			cy += cy_inc;
			continue;
		}

		int charwidth = doom_font->getTextWidth(c);
		if (cx + charwidth > x2)
			break;
		
		char dummy_str[2] = { char(c), 0 };
		doom_font->printText(screen, cx, cy, CR_RED, dummy_str);
		cx += charwidth;
	}
}
Example #21
0
int wipe_ScreenWipe ( int wipeno, int width, int height, int ticks )
{
  int rc;

  //F**K YOU, CARMACK!!!!
  //F**K YOU AND YOUR F*****G FUNCTION POINTERS!!!
  //ESPECIALLY YOUR F*****G FUNCTION POINTERS!!!
  //F**K!!!!

  /*static int (*wipes[])(int, int, int) =
  {
  wipe_initColorXForm, wipe_doColorXForm, wipe_exitColorXForm,
  wipe_initMelt, wipe_doMelt, wipe_exitMelt
  };*/

  // initial stuff
  if (!go)
  {
    go = 1;
    //wipe_scr = (byte *) Z_Malloc(width*height, PU_STATIC, 0); // carmack debug, don't touch!
    wipe_scr = screens[0];
    //(*wipes[wipeno*3])(width, height, ticks);
    switch (wipeno*3)
    {
    case 0:
      wipe_initColorXForm(width, height, ticks);
      break;
      /*case 1:
      wipe_doColorXForm(width, height, ticks);
      break;
      case 2:
      wipe_exitColorXForm(width, height, ticks);
      break;*/
    case 3:
      wipe_initMelt(width, height, ticks);
      break;
      /*case 4:
      wipe_doMelt(width, height, ticks);
      break;
      case 5:
      wipe_exitMelt(width, height, ticks);
      break;*/
    default:
      I_Error("wipe_ScreenWipe: INVALID FUNCTION INDICATOR");
    }
  }

  // do a piece of wipe-in
  V_MarkRect(0, 0, width, height);
  //rc = (*wipes[wipeno*3+1])(width, height, ticks);
  switch (1 + wipeno*3)
  {
    /*case 0:
    rc= wipe_initColorXForm(width, height, ticks);
    break;*/
  case 1:
    rc= wipe_doColorXForm(width, height, ticks);
    break;
    /*case 2:
    rc= wipe_exitColorXForm(width, height, ticks);
    break;
    case 3:
    rc= wipe_initMelt(width, height, ticks);
    break;*/
  case 4:
    rc= wipe_doMelt(width, height, ticks);
    break;
    /*case 5:
    rc= wipe_exitMelt(width, height, ticks);
    break;*/
  default:
    rc= 0;
    I_Error("wipe_ScreenWipe: INVALID FUNCTION INDICATOR");
  }
  //V_DrawBlock(x, y, 0, width, height, wipe_scr); // carmack debug, don't touch!

  // final stuff
  if (rc)
  {
    go = 0;
    switch (2 + wipeno*3)
    {
      /*case 0:
      wipe_initColorXForm(width, height, ticks);
      break;
      case 1:
      wipe_doColorXForm(width, height, ticks);
      break;*/
    case 2:
      wipe_exitColorXForm(width, height, ticks);
      break;
      /*case 3:
      wipe_initMelt(width, height, ticks);
      break;
      case 4:
      wipe_doMelt(width, height, ticks);
      break;*/
    case 5:
      wipe_exitMelt(width, height, ticks);
      break;
    default:
      I_Error("wipe_ScreenWipe: INVALID FUNCTION INDICATOR");
    }
    //(*wipes[wipeno*3+2])(width, height, ticks);
  }

  return !go;

}
Example #22
0
//
// V_DrawPatch
// Masks a column based masked pic to the screen. 
//
void
V_DrawPatch
( int		x,
  int		y,
  int		scrn,
  patch_t*	patch ) 
{ 

    int		count;
    int		col; 
    column_t*	column; 
    byte*	desttop;
    byte*	dest;
    byte*	source; 
    int		w; 
	 
    y -= SHORT(patch->topoffset); 
    x -= SHORT(patch->leftoffset); 
#ifdef RANGECHECK 
    if (x<0
	||x+SHORT(patch->width) >SCREENWIDTH
	|| y<0
	|| y+SHORT(patch->height)>SCREENHEIGHT 
	|| (unsigned)scrn>4)
    {
    	I_DBGprintf("Patch at %d,%d exceeds LFB\n", x,y );
      // No I_Error abort - what is up with TNT.WAD?
    	I_DBGprintf("V_DrawPatch: bad patch (ignored)\n");
      return;
    }
#endif 
 
    if (!scrn)
	V_MarkRect (x, y, SHORT(patch->width), SHORT(patch->height)); 

    col = 0; 
    desttop = screens[scrn]+y*SCREENWIDTH+x; 
	 
    w = SHORT(patch->width); 

    for ( ; col<w ; x++, col++, desttop++)
    { 
	column = (column_t *)((byte *)patch + LONG(patch->columnofs[col])); 
 
	// step through the posts in a column 
	while (column->topdelta != 0xff ) 
	{ 
	    source = (byte *)column + 3; 
	    dest = desttop + column->topdelta*SCREENWIDTH; 
	    count = column->length; 
			 
	    while (count--) 
	    { 
		*dest = *source++; 
		dest += SCREENWIDTH; 
	    } 
	    column = (column_t *)(  (byte *)column + column->length 
				    + 4 ); 
	} 
    }			 
} 
Example #23
0
//
// V_DrawPatchFlipped 
// Masks a column based masked pic to the screen.
// Flips horizontally, e.g. to mirror face.
//
void
V_DrawPatchFlipped
( int		x,
  int		y,
  int		scrn,
  patch_t*	patch ) 
{ 

    int				count;
    int				col; 
    postColumn_t*	column; 
    byte*			source; 
    int				w; 
	 
    y -= SHORT(patch->topoffset); 
    x -= SHORT(patch->leftoffset); 
#ifdef RANGECHECK 
    if (x<0
	||x+SHORT(patch->width) >ORIGINAL_WIDTH
	|| y<0
	|| y+SHORT(patch->height)>ORIGINAL_HEIGHT
	|| (unsigned)scrn>4)
    {
      I_PrintfE("Patch origin %d,%d exceeds LFB\n", x,y );
      I_Error ("Bad V_DrawPatch in V_DrawPatchFlipped");
    }
#endif 
 
    if (!scrn)
	V_MarkRect (x, y, SHORT(patch->width), SHORT(patch->height)); 

    col = 0; 
	int destx = x;
	int desty = y;

    w = SHORT(patch->width); 

    for ( ; col<w ; x++, col++ ) 
    { 
		column = (postColumn_t *)((byte *)patch + LONG(patch->columnofs[w-1-col])); 

		destx = x;
	 
		// step through the posts in a column 
		while (column->topdelta != 0xff ) 
		{ 
			source = (byte *)column + 3; 
			desty = y + column->topdelta;
			count = column->length; 
				 
			while (count--) 
			{
				int scaledx, scaledy;
				scaledx = destx * GLOBAL_IMAGE_SCALER;
				scaledy = desty * GLOBAL_IMAGE_SCALER;
				byte src = *source++;

				for ( int i = 0; i < GLOBAL_IMAGE_SCALER; i++ ) {
					for ( int j = 0; j < GLOBAL_IMAGE_SCALER; j++ ) {
						::g->screens[scrn][( scaledx + j ) + ( scaledy + i ) * SCREENWIDTH] = src;
					}
				}

				desty++;
			} 
			column = (postColumn_t *)(  (byte *)column + column->length + 4 );
		} 
    }			 
} 
Example #24
0
void WI_slamBackground(void)
{
    memcpy(screens[0], screens[1], SCREENWIDTH * SCREENHEIGHT);
    V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT);
}