shithub: choc

Download patch

ref: e2e163c6e3fc1db2df6da1d4ed831fe6629e180b
parent: bacd7fff1a0cddfa17218df410e9bfb7596e94a4
author: Simon Howard <[email protected]>
date: Sat Sep 20 16:32:24 EDT 2008

Remove screen parameter from V_DrawPatch functions; update code to use
V_UseBuffer where necessary.

Subversion-branch: /branches/raven-branch
Subversion-revision: 1248

--- a/src/doom/am_map.c
+++ b/src/doom/am_map.c
@@ -89,7 +89,6 @@
 #define XHAIRCOLORS	GRAYS
 
 // drawing stuff
-#define	FB		0
 
 #define AM_PANDOWNKEY	KEY_DOWNARROW
 #define AM_PANUPKEY	KEY_UPARROW
@@ -1342,7 +1341,7 @@
 	    fx = CXMTOF(markpoints[i].x);
 	    fy = CYMTOF(markpoints[i].y);
 	    if (fx >= f_x && fx <= f_w - w && fy >= f_y && fy <= f_h - h)
-		V_DrawPatch(fx, fy, FB, marknums[i]);
+		V_DrawPatch(fx, fy, marknums[i]);
 	}
     }
 
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -296,8 +296,8 @@
 	    y = 4;
 	else
 	    y = viewwindowy+4;
-	V_DrawPatchDirect(viewwindowx+(scaledviewwidth-68)/2,
-			  y,0,W_CacheLumpName (DEH_String("M_PAUSE"), PU_CACHE));
+	V_DrawPatchDirect(viewwindowx + (scaledviewwidth - 68) / 2, y,
+                          W_CacheLumpName (DEH_String("M_PAUSE"), PU_CACHE));
     }
 
 
@@ -484,7 +484,7 @@
 //
 void D_PageDrawer (void)
 {
-    V_DrawPatch (0,0, 0, W_CacheLumpName(pagename, PU_CACHE));
+    V_DrawPatch (0, 0, W_CacheLumpName(pagename, PU_CACHE));
 }
 
 
--- a/src/doom/f_finale.c
+++ b/src/doom/f_finale.c
@@ -294,7 +294,7 @@
 	w = SHORT (hu_font[c]->width);
 	if (cx+w > SCREENWIDTH)
 	    break;
-	V_DrawPatch(cx, cy, 0, hu_font[c]);
+	V_DrawPatch(cx, cy, hu_font[c]);
 	cx+=w;
     }
 	
@@ -538,7 +538,7 @@
 	}
 		
 	w = SHORT (hu_font[c]->width);
-	V_DrawPatch(cx, 180, 0, hu_font[c]);
+	V_DrawPatch(cx, 180, hu_font[c]);
 	cx+=w;
     }
 	
@@ -548,7 +548,6 @@
 //
 // F_CastDrawer
 //
-void V_DrawPatchFlipped (int x, int y, int scrn, patch_t *patch);
 
 void F_CastDrawer (void)
 {
@@ -559,7 +558,7 @@
     patch_t*		patch;
     
     // erase the entire screen to a background
-    V_DrawPatch (0,0,0, W_CacheLumpName (DEH_String("BOSSBACK"), PU_CACHE));
+    V_DrawPatch (0, 0, W_CacheLumpName (DEH_String("BOSSBACK"), PU_CACHE));
 
     F_CastPrint (DEH_String(castorder[castnum].name));
     
@@ -571,9 +570,9 @@
 			
     patch = W_CacheLumpNum (lump+firstspritelump, PU_CACHE);
     if (flip)
-	V_DrawPatchFlipped (160,170,0,patch);
+	V_DrawPatchFlipped(160, 170, patch);
     else
-	V_DrawPatch (160,170,0,patch);
+	V_DrawPatch(160, 170, patch);
 }
 
 
@@ -648,9 +647,9 @@
 	return;
     if (finalecount < 1180)
     {
-	V_DrawPatch ((SCREENWIDTH-13*8)/2,
-		     (SCREENHEIGHT-8*8)/2,0, 
-		     W_CacheLumpName (DEH_String("END0"),PU_CACHE));
+        V_DrawPatch((SCREENWIDTH - 13 * 8) / 2,
+                    (SCREENHEIGHT - 8 * 8) / 2, 
+                    W_CacheLumpName(DEH_String("END0"), PU_CACHE));
 	laststage = 0;
 	return;
     }
@@ -665,8 +664,9 @@
     }
 	
     sprintf (name, DEH_String("END%i"), stage);
-    V_DrawPatch ((SCREENWIDTH-13*8)/2, (SCREENHEIGHT-8*8)/2,0, 
-	         W_CacheLumpName (name,PU_CACHE));
+    V_DrawPatch((SCREENWIDTH - 13 * 8) / 2, 
+                (SCREENHEIGHT - 8 * 8) / 2, 
+                W_CacheLumpName (name,PU_CACHE));
 }
 
 static void F_ArtScreenDrawer(void)
@@ -703,7 +703,7 @@
 
         lumpname = DEH_String(lumpname);
 
-        V_DrawPatch (0, 0, 0, W_CacheLumpName(lumpname, PU_CACHE));
+        V_DrawPatch (0, 0, W_CacheLumpName(lumpname, PU_CACHE));
     }
 }
 
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -258,8 +258,8 @@
             lumpname = "M_LSCNTR";
         }
 
-        V_DrawPatchDirect(x, box_y, 0, W_CacheLumpName(DEH_String(lumpname), 
-                                                       PU_CACHE));
+        V_DrawPatchDirect(x, box_y,
+                          W_CacheLumpName(DEH_String(lumpname), PU_CACHE));
         x += 8;
     }
 
--- a/src/doom/hu_lib.c
+++ b/src/doom/hu_lib.c
@@ -121,7 +121,7 @@
 	    w = SHORT(l->f[c - l->sc]->width);
 	    if (x+w > SCREENWIDTH)
 		break;
-	    V_DrawPatchDirect(x, l->y, FG, l->f[c - l->sc]);
+	    V_DrawPatchDirect(x, l->y, l->f[c - l->sc]);
 	    x += w;
 	}
 	else
@@ -136,7 +136,7 @@
     if (drawcursor
 	&& x + SHORT(l->f['_' - l->sc]->width) <= SCREENWIDTH)
     {
-	V_DrawPatchDirect(x, l->y, FG, l->f['_' - l->sc]);
+	V_DrawPatchDirect(x, l->y, l->f['_' - l->sc]);
     }
 }
 
--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -540,7 +540,9 @@
 {
     int             i;
 	
-    V_DrawPatchDirect (72,28,0,W_CacheLumpName(DEH_String("M_LOADG"),PU_CACHE));
+    V_DrawPatchDirect(72, 28, 
+                      W_CacheLumpName(DEH_String("M_LOADG"), PU_CACHE));
+
     for (i = 0;i < load_end; i++)
     {
 	M_DrawSaveLoadBorder(LoadDef.x,LoadDef.y+LINEHEIGHT*i);
@@ -557,15 +559,18 @@
 {
     int             i;
 	
-    V_DrawPatchDirect (x-8,y+7,0,W_CacheLumpName(DEH_String("M_LSLEFT"),PU_CACHE));
+    V_DrawPatchDirect(x - 8, y + 7,
+                      W_CacheLumpName(DEH_String("M_LSLEFT"), PU_CACHE));
 	
     for (i = 0;i < 24;i++)
     {
-	V_DrawPatchDirect (x,y+7,0,W_CacheLumpName(DEH_String("M_LSCNTR"),PU_CACHE));
+	V_DrawPatchDirect(x, y + 7,
+                          W_CacheLumpName(DEH_String("M_LSCNTR"), PU_CACHE));
 	x += 8;
     }
 
-    V_DrawPatchDirect (x,y+7,0,W_CacheLumpName(DEH_String("M_LSRGHT"),PU_CACHE));
+    V_DrawPatchDirect(x, y + 7, 
+                      W_CacheLumpName(DEH_String("M_LSRGHT"), PU_CACHE));
 }
 
 
@@ -606,7 +611,7 @@
 {
     int             i;
 	
-    V_DrawPatchDirect (72,28,0,W_CacheLumpName(DEH_String("M_SAVEG"),PU_CACHE));
+    V_DrawPatchDirect(72, 28, W_CacheLumpName(DEH_String("M_SAVEG"), PU_CACHE));
     for (i = 0;i < load_end; i++)
     {
 	M_DrawSaveLoadBorder(LoadDef.x,LoadDef.y+LINEHEIGHT*i);
@@ -804,7 +809,7 @@
 
     lumpname = DEH_String(lumpname);
     
-    V_DrawPatchDirect (0, 0, 0, W_CacheLumpName(lumpname, PU_CACHE));
+    V_DrawPatchDirect (0, 0, W_CacheLumpName(lumpname, PU_CACHE));
 
     ReadDef1.x = skullx;
     ReadDef1.y = skully;
@@ -822,7 +827,7 @@
     // We only ever draw the second page if this is 
     // gameversion == exe_doom_1_9 and gamemode == registered
 
-    V_DrawPatchDirect(0, 0, 0, W_CacheLumpName(DEH_String("HELP1"), PU_CACHE));
+    V_DrawPatchDirect(0, 0, W_CacheLumpName(DEH_String("HELP1"), PU_CACHE));
 }
 
 
@@ -831,7 +836,7 @@
 //
 void M_DrawSound(void)
 {
-    V_DrawPatchDirect (60,38,0,W_CacheLumpName(DEH_String("M_SVOL"),PU_CACHE));
+    V_DrawPatchDirect (60, 38, W_CacheLumpName(DEH_String("M_SVOL"), PU_CACHE));
 
     M_DrawThermo(SoundDef.x,SoundDef.y+LINEHEIGHT*(sfx_vol+1),
 		 16,sfxVolume);
@@ -887,7 +892,8 @@
 //
 void M_DrawMainMenu(void)
 {
-    V_DrawPatchDirect (94,2,0,W_CacheLumpName(DEH_String("M_DOOM"),PU_CACHE));
+    V_DrawPatchDirect(94, 2,
+                      W_CacheLumpName(DEH_String("M_DOOM"), PU_CACHE));
 }
 
 
@@ -898,8 +904,8 @@
 //
 void M_DrawNewGame(void)
 {
-    V_DrawPatchDirect (96,14,0,W_CacheLumpName(DEH_String("M_NEWG"),PU_CACHE));
-    V_DrawPatchDirect (54,38,0,W_CacheLumpName(DEH_String("M_SKILL"),PU_CACHE));
+    V_DrawPatchDirect(96, 14, W_CacheLumpName(DEH_String("M_NEWG"), PU_CACHE));
+    V_DrawPatchDirect(54, 38, W_CacheLumpName(DEH_String("M_SKILL"), PU_CACHE));
 }
 
 void M_NewGame(int choice)
@@ -926,7 +932,7 @@
 
 void M_DrawEpisode(void)
 {
-    V_DrawPatchDirect (54,38,0,W_CacheLumpName(DEH_String("M_EPISOD"),PU_CACHE));
+    V_DrawPatchDirect(54, 38, W_CacheLumpName(DEH_String("M_EPISOD"), PU_CACHE));
 }
 
 void M_VerifyNightmare(int ch)
@@ -984,19 +990,20 @@
 
 void M_DrawOptions(void)
 {
-    V_DrawPatchDirect (108,15,0,W_CacheLumpName(DEH_String("M_OPTTTL"),PU_CACHE));
+    V_DrawPatchDirect(108, 15, W_CacheLumpName(DEH_String("M_OPTTTL"),
+                                               PU_CACHE));
 	
-    V_DrawPatchDirect (OptionsDef.x + 175,OptionsDef.y+LINEHEIGHT*detail,0,
-		       W_CacheLumpName(DEH_String(detailNames[detailLevel]),
-			               PU_CACHE));
+    V_DrawPatchDirect(OptionsDef.x + 175, OptionsDef.y + LINEHEIGHT * detail,
+		      W_CacheLumpName(DEH_String(detailNames[detailLevel]),
+			              PU_CACHE));
 
-    V_DrawPatchDirect (OptionsDef.x + 120,OptionsDef.y+LINEHEIGHT*messages,0,
-		       W_CacheLumpName(DEH_String(msgNames[showMessages]),
-				       PU_CACHE));
+    V_DrawPatchDirect(OptionsDef.x + 120, OptionsDef.y + LINEHEIGHT * messages,
+                      W_CacheLumpName(DEH_String(msgNames[showMessages]),
+                                      PU_CACHE));
 
-    M_DrawThermo(OptionsDef.x,OptionsDef.y+LINEHEIGHT*(mousesens+1),
-		 10,mouseSensitivity);
-	
+    M_DrawThermo(OptionsDef.x, OptionsDef.y + LINEHEIGHT * (mousesens + 1),
+		 10, mouseSensitivity);
+
     M_DrawThermo(OptionsDef.x,OptionsDef.y+LINEHEIGHT*(scrnsize+1),
 		 9,screenSize);
 }
@@ -1249,17 +1256,17 @@
     int		i;
 
     xx = x;
-    V_DrawPatchDirect (xx,y,0,W_CacheLumpName(DEH_String("M_THERML"),PU_CACHE));
+    V_DrawPatchDirect(xx, y, W_CacheLumpName(DEH_String("M_THERML"), PU_CACHE));
     xx += 8;
     for (i=0;i<thermWidth;i++)
     {
-	V_DrawPatchDirect (xx,y,0,W_CacheLumpName(DEH_String("M_THERMM"),PU_CACHE));
+	V_DrawPatchDirect(xx, y, W_CacheLumpName(DEH_String("M_THERMM"), PU_CACHE));
 	xx += 8;
     }
-    V_DrawPatchDirect (xx,y,0,W_CacheLumpName(DEH_String("M_THERMR"),PU_CACHE));
+    V_DrawPatchDirect(xx, y, W_CacheLumpName(DEH_String("M_THERMR"), PU_CACHE));
 
-    V_DrawPatchDirect ((x+8) + thermDot*8,y,
-		       0,W_CacheLumpName(DEH_String("M_THERMO"),PU_CACHE));
+    V_DrawPatchDirect((x + 8) + thermDot * 8, y,
+		      W_CacheLumpName(DEH_String("M_THERMO"), PU_CACHE));
 }
 
 
@@ -1269,8 +1276,8 @@
 ( menu_t*	menu,
   int		item )
 {
-    V_DrawPatchDirect (menu->x - 10,        menu->y+item*LINEHEIGHT - 1, 0,
-		       W_CacheLumpName(DEH_String("M_CELL1"),PU_CACHE));
+    V_DrawPatchDirect(menu->x - 10, menu->y + item * LINEHEIGHT - 1, 
+                      W_CacheLumpName(DEH_String("M_CELL1"), PU_CACHE));
 }
 
 void
@@ -1278,8 +1285,8 @@
 ( menu_t*	menu,
   int		item )
 {
-    V_DrawPatchDirect (menu->x - 10,        menu->y+item*LINEHEIGHT - 1, 0,
-		       W_CacheLumpName(DEH_String("M_CELL2"),PU_CACHE));
+    V_DrawPatchDirect(menu->x - 10, menu->y + item * LINEHEIGHT - 1,
+                      W_CacheLumpName(DEH_String("M_CELL2"), PU_CACHE));
 }
 
 
@@ -1391,7 +1398,7 @@
 	w = SHORT (hu_font[c]->width);
 	if (cx+w > SCREENWIDTH)
 	    break;
-	V_DrawPatchDirect(cx, cy, 0, hu_font[c]);
+	V_DrawPatchDirect(cx, cy, hu_font[c]);
 	cx+=w;
     }
 }
@@ -1884,7 +1891,7 @@
 
 	if (name[0])
 	{
-	    V_DrawPatchDirect (x,y,0, W_CacheLumpName(name, PU_CACHE));
+	    V_DrawPatchDirect (x, y, W_CacheLumpName(name, PU_CACHE));
 	}
 	y += LINEHEIGHT;
     }
@@ -1891,7 +1898,7 @@
 
     
     // DRAW SKULL
-    V_DrawPatchDirect(x + SKULLXOFF,currentMenu->y - 5 + itemOn*LINEHEIGHT, 0,
+    V_DrawPatchDirect(x + SKULLXOFF, currentMenu->y - 5 + itemOn*LINEHEIGHT,
 		      W_CacheLumpName(DEH_String(skullName[whichSkull]),
 				      PU_CACHE));
 
--- a/src/doom/r_draw.c
+++ b/src/doom/r_draw.c
@@ -827,7 +827,7 @@
     else
 	name = name1;
     
-    src = W_CacheLumpName (name, PU_CACHE); 
+    src = W_CacheLumpName(name, PU_CACHE); 
     dest = screens[1]; 
 	 
     for (y=0 ; y<SCREENHEIGHT-SBARHEIGHT ; y++) 
@@ -844,45 +844,46 @@
 	    dest += (SCREENWIDTH&63); 
 	} 
     } 
-	
-    patch = W_CacheLumpName (DEH_String("brdr_t"),PU_CACHE);
+     
+    // Draw screen and bezel; this is done to a separate screen buffer.
 
+    V_UseBuffer(screens[1]);
+
+    patch = W_CacheLumpName(DEH_String("brdr_t"),PU_CACHE);
+
     for (x=0 ; x<scaledviewwidth ; x+=8)
-	V_DrawPatch (viewwindowx+x,viewwindowy-8,1,patch);
-    patch = W_CacheLumpName (DEH_String("brdr_b"),PU_CACHE);
+	V_DrawPatch(viewwindowx+x, viewwindowy-8, patch);
+    patch = W_CacheLumpName(DEH_String("brdr_b"),PU_CACHE);
 
     for (x=0 ; x<scaledviewwidth ; x+=8)
-	V_DrawPatch (viewwindowx+x,viewwindowy+viewheight,1,patch);
-    patch = W_CacheLumpName (DEH_String("brdr_l"),PU_CACHE);
+	V_DrawPatch(viewwindowx+x, viewwindowy+viewheight, patch);
+    patch = W_CacheLumpName(DEH_String("brdr_l"),PU_CACHE);
 
     for (y=0 ; y<viewheight ; y+=8)
-	V_DrawPatch (viewwindowx-8,viewwindowy+y,1,patch);
-    patch = W_CacheLumpName (DEH_String("brdr_r"),PU_CACHE);
+	V_DrawPatch(viewwindowx-8, viewwindowy+y, patch);
+    patch = W_CacheLumpName(DEH_String("brdr_r"),PU_CACHE);
 
     for (y=0 ; y<viewheight ; y+=8)
-	V_DrawPatch (viewwindowx+scaledviewwidth,viewwindowy+y,1,patch);
+	V_DrawPatch(viewwindowx+scaledviewwidth, viewwindowy+y, patch);
 
-
     // Draw beveled edge. 
-    V_DrawPatch (viewwindowx-8,
-		 viewwindowy-8,
-		 1,
-		 W_CacheLumpName (DEH_String("brdr_tl"),PU_CACHE));
+    V_DrawPatch(viewwindowx-8,
+                viewwindowy-8,
+                W_CacheLumpName(DEH_String("brdr_tl"),PU_CACHE));
     
-    V_DrawPatch (viewwindowx+scaledviewwidth,
-		 viewwindowy-8,
-		 1,
-		 W_CacheLumpName (DEH_String("brdr_tr"),PU_CACHE));
+    V_DrawPatch(viewwindowx+scaledviewwidth,
+                viewwindowy-8,
+                W_CacheLumpName(DEH_String("brdr_tr"),PU_CACHE));
     
-    V_DrawPatch (viewwindowx-8,
-		 viewwindowy+viewheight,
-		 1,
-		 W_CacheLumpName (DEH_String("brdr_bl"),PU_CACHE));
+    V_DrawPatch(viewwindowx-8,
+                viewwindowy+viewheight,
+                W_CacheLumpName(DEH_String("brdr_bl"),PU_CACHE));
     
-    V_DrawPatch (viewwindowx+scaledviewwidth,
-		 viewwindowy+viewheight,
-		 1,
-		 W_CacheLumpName (DEH_String("brdr_br"),PU_CACHE));
+    V_DrawPatch(viewwindowx+scaledviewwidth,
+                viewwindowy+viewheight,
+                W_CacheLumpName(DEH_String("brdr_br"),PU_CACHE));
+
+    V_RestoreBuffer();
 } 
  
 
--- a/src/doom/st_lib.c
+++ b/src/doom/st_lib.c
@@ -133,19 +133,19 @@
 
     // in the special case of 0, you draw 0
     if (!num)
-	V_DrawPatch(x - w, n->y, FG, n->p[ 0 ]);
+	V_DrawPatch(x - w, n->y, n->p[ 0 ]);
 
     // draw the new number
     while (num && numdigits--)
     {
 	x -= w;
-	V_DrawPatch(x, n->y, FG, n->p[ num % 10 ]);
+	V_DrawPatch(x, n->y, n->p[ num % 10 ]);
 	num /= 10;
     }
 
     // draw a minus sign if necessary
     if (neg)
-	V_DrawPatch(x - 8, n->y, FG, sttminus);
+	V_DrawPatch(x - 8, n->y, sttminus);
 }
 
 
@@ -183,7 +183,7 @@
   int			refresh )
 {
     if (refresh && *per->n.on)
-	V_DrawPatch(per->n.x, per->n.y, FG, per->p);
+	V_DrawPatch(per->n.x, per->n.y, per->p);
     
     STlib_updateNum(&per->n, refresh);
 }
@@ -235,7 +235,7 @@
 
 	    V_CopyRect(x, y-ST_Y, screens[BG], w, h, x, y);
 	}
-	V_DrawPatch(mi->x, mi->y, FG, mi->p[*mi->inum]);
+	V_DrawPatch(mi->x, mi->y, mi->p[*mi->inum]);
 	mi->oldinum = *mi->inum;
     }
 }
@@ -283,7 +283,7 @@
 	    I_Error("updateBinIcon: y - ST_Y < 0");
 
 	if (*bi->val)
-	    V_DrawPatch(bi->x, bi->y, FG, bi->p);
+	    V_DrawPatch(bi->x, bi->y, bi->p);
 	else
 	    V_CopyRect(x, y-ST_Y, screens[BG], w, h, x, y);
 
--- a/src/doom/st_stuff.c
+++ b/src/doom/st_stuff.c
@@ -433,10 +433,14 @@
 
     if (st_statusbaron)
     {
-	V_DrawPatch(ST_X, 0, BG, sbar);
+        V_UseBuffer(screens[BG]);
 
+	V_DrawPatch(ST_X, 0, sbar);
+
 	if (netgame)
-	    V_DrawPatch(ST_FX, 0, BG, faceback);
+	    V_DrawPatch(ST_FX, 0, faceback);
+
+        V_RestoreBuffer();
 
 	V_CopyRect(ST_X, 0, screens[BG], ST_WIDTH, ST_HEIGHT, ST_X, ST_Y);
     }
--- a/src/doom/wi_stuff.c
+++ b/src/doom/wi_stuff.c
@@ -429,13 +429,15 @@
 
     // draw <LevelName> 
     V_DrawPatch((SCREENWIDTH - SHORT(lnames[wbs->last]->width))/2,
-		y, FB, lnames[wbs->last]);
+		y,
+                lnames[wbs->last]);
 
     // draw "Finished!"
     y += (5*SHORT(lnames[wbs->last]->height))/4;
     
     V_DrawPatch((SCREENWIDTH - SHORT(finished->width))/2,
-		y, FB, finished);
+		y,
+                finished);
 }
 
 
@@ -447,13 +449,15 @@
 
     // draw "Entering"
     V_DrawPatch((SCREENWIDTH - SHORT(entering->width))/2,
-		y, FB, entering);
+		y,
+                entering);
 
     // draw level
     y += (5*SHORT(lnames[wbs->next]->height))/4;
 
     V_DrawPatch((SCREENWIDTH - SHORT(lnames[wbs->next]->width))/2,
-		y, FB, lnames[wbs->next]);
+		y, 
+                lnames[wbs->next]);
 
 }
 
@@ -493,8 +497,9 @@
 
     if (fits && i<2)
     {
-	V_DrawPatch(lnodes[wbs->epsd][n].x, lnodes[wbs->epsd][n].y,
-		    FB, c[i]);
+	V_DrawPatch(lnodes[wbs->epsd][n].x,
+                    lnodes[wbs->epsd][n].y,
+		    c[i]);
     }
     else
     {
@@ -601,7 +606,7 @@
 	a = &anims[wbs->epsd][i];
 
 	if (a->ctr >= 0)
-	    V_DrawPatch(a->loc.x, a->loc.y, FB, a->p[a->ctr]);
+	    V_DrawPatch(a->loc.x, a->loc.y, a->p[a->ctr]);
     }
 
 }
@@ -658,13 +663,13 @@
     while (digits--)
     {
 	x -= fontwidth;
-	V_DrawPatch(x, y, FB, num[ n % 10 ]);
+	V_DrawPatch(x, y, num[ n % 10 ]);
 	n /= 10;
     }
 
     // draw a minus sign if necessary
     if (neg)
-	V_DrawPatch(x-=8, y, FB, wiminus);
+	V_DrawPatch(x-=8, y, wiminus);
 
     return x;
 
@@ -679,7 +684,7 @@
     if (p < 0)
 	return;
 
-    V_DrawPatch(x, y, FB, percent);
+    V_DrawPatch(x, y, percent);
     WI_drawNum(x, y, p, -1);
 }
 
@@ -714,7 +719,7 @@
 
 	    // draw
 	    if (div==60 || t / div)
-		V_DrawPatch(x, y, FB, colon);
+		V_DrawPatch(x, y, colon);
 	    
 	} while (t / div);
     }
@@ -721,7 +726,7 @@
     else
     {
 	// "sucks"
-	V_DrawPatch(x - SHORT(sucks->width), y, FB, sucks); 
+	V_DrawPatch(x - SHORT(sucks->width), y, sucks); 
     }
 }
 
@@ -1009,11 +1014,10 @@
     // draw stat titles (top line)
     V_DrawPatch(DM_TOTALSX-SHORT(total->width)/2,
 		DM_MATRIXY-WI_SPACINGY+10,
-		FB,
 		total);
     
-    V_DrawPatch(DM_KILLERSX, DM_KILLERSY, FB, killers);
-    V_DrawPatch(DM_VICTIMSX, DM_VICTIMSY, FB, victims);
+    V_DrawPatch(DM_KILLERSX, DM_KILLERSY, killers);
+    V_DrawPatch(DM_VICTIMSX, DM_VICTIMSY, victims);
 
     // draw P?
     x = DM_MATRIXX + DM_SPACINGX;
@@ -1025,12 +1029,10 @@
 	{
 	    V_DrawPatch(x-SHORT(p[i]->width)/2,
 			DM_MATRIXY - WI_SPACINGY,
-			FB,
 			p[i]);
 	    
 	    V_DrawPatch(DM_MATRIXX-SHORT(p[i]->width)/2,
 			y,
-			FB,
 			p[i]);
 
 	    if (i == me)
@@ -1037,12 +1039,10 @@
 	    {
 		V_DrawPatch(x-SHORT(p[i]->width)/2,
 			    DM_MATRIXY - WI_SPACINGY,
-			    FB,
 			    bstar);
 
 		V_DrawPatch(DM_MATRIXX-SHORT(p[i]->width)/2,
 			    y,
-			    FB,
 			    star);
 	    }
 	}
@@ -1049,9 +1049,9 @@
 	else
 	{
 	    // V_DrawPatch(x-SHORT(bp[i]->width)/2,
-	    //   DM_MATRIXY - WI_SPACINGY, FB, bp[i]);
+	    //   DM_MATRIXY - WI_SPACINGY, bp[i]);
 	    // V_DrawPatch(DM_MATRIXX-SHORT(bp[i]->width)/2,
-	    //   y, FB, bp[i]);
+	    //   y, bp[i]);
 	}
 	x += DM_SPACINGX;
 	y += WI_SPACINGY;
@@ -1283,17 +1283,17 @@
 
     // draw stat titles (top line)
     V_DrawPatch(NG_STATSX+NG_SPACINGX-SHORT(kills->width),
-		NG_STATSY, FB, kills);
+		NG_STATSY, kills);
 
     V_DrawPatch(NG_STATSX+2*NG_SPACINGX-SHORT(items->width),
-		NG_STATSY, FB, items);
+		NG_STATSY, items);
 
     V_DrawPatch(NG_STATSX+3*NG_SPACINGX-SHORT(secret->width),
-		NG_STATSY, FB, secret);
+		NG_STATSY, secret);
     
     if (dofrags)
 	V_DrawPatch(NG_STATSX+4*NG_SPACINGX-SHORT(frags->width),
-		    NG_STATSY, FB, frags);
+		    NG_STATSY, frags);
 
     // draw stats
     y = NG_STATSY + SHORT(kills->height);
@@ -1304,10 +1304,10 @@
 	    continue;
 
 	x = NG_STATSX;
-	V_DrawPatch(x-SHORT(p[i]->width), y, FB, p[i]);
+	V_DrawPatch(x-SHORT(p[i]->width), y, p[i]);
 
 	if (i == me)
-	    V_DrawPatch(x-SHORT(p[i]->width), y, FB, star);
+	    V_DrawPatch(x-SHORT(p[i]->width), y, star);
 
 	x += NG_SPACINGX;
 	WI_drawPercent(x-pwidth, y+10, cnt_kills[i]);	x += NG_SPACINGX;
@@ -1456,21 +1456,21 @@
     
     WI_drawLF();
 
-    V_DrawPatch(SP_STATSX, SP_STATSY, FB, kills);
+    V_DrawPatch(SP_STATSX, SP_STATSY, kills);
     WI_drawPercent(SCREENWIDTH - SP_STATSX, SP_STATSY, cnt_kills[0]);
 
-    V_DrawPatch(SP_STATSX, SP_STATSY+lh, FB, items);
+    V_DrawPatch(SP_STATSX, SP_STATSY+lh, items);
     WI_drawPercent(SCREENWIDTH - SP_STATSX, SP_STATSY+lh, cnt_items[0]);
 
-    V_DrawPatch(SP_STATSX, SP_STATSY+2*lh, FB, sp_secret);
+    V_DrawPatch(SP_STATSX, SP_STATSY+2*lh, sp_secret);
     WI_drawPercent(SCREENWIDTH - SP_STATSX, SP_STATSY+2*lh, cnt_secret[0]);
 
-    V_DrawPatch(SP_TIMEX, SP_TIMEY, FB, timepatch);
+    V_DrawPatch(SP_TIMEX, SP_TIMEY, timepatch);
     WI_drawTime(SCREENWIDTH/2 - SP_TIMEX, SP_TIMEY, cnt_time);
 
     if (wbs->epsd < 3)
     {
-	V_DrawPatch(SCREENWIDTH/2 + SP_TIMEX, SP_TIMEY, FB, par);
+	V_DrawPatch(SCREENWIDTH/2 + SP_TIMEX, SP_TIMEY, par);
 	WI_drawTime(SCREENWIDTH - SP_TIMEX, SP_TIMEY, cnt_par);
     }
 
@@ -1742,8 +1742,12 @@
 	sprintf(bg_lumpname, DEH_String("WIMAP%d"), wbs->epsd);
     }
     
+    // Draw backdrop and save to a temporary buffer
+  
+    V_UseBuffer(screens[1]);
     bg = W_CacheLumpName(bg_lumpname, PU_CACHE);
-    V_DrawPatch(0, 0, 1, bg);
+    V_DrawPatch(0, 0, bg);
+    V_RestoreBuffer();
 }
 
 static void WI_unloadCallback(char *name, patch_t **variable)
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -298,7 +298,7 @@
 
     disk = W_CacheLumpName(disk_name, PU_STATIC);
 
-    V_DrawPatch(0, 0, 0, disk);
+    V_DrawPatch(0, 0, disk);
     disk_image_w = SHORT(disk->width);
     disk_image_h = SHORT(disk->height);
 
--- a/src/v_video.c
+++ b/src/v_video.c
@@ -142,15 +142,16 @@
 //
 // V_MarkRect 
 // 
-void
-V_MarkRect
-( int		x,
-  int		y,
-  int		width,
-  int		height ) 
+void V_MarkRect(int x, int y, int width, int height) 
 { 
-    M_AddToBox (dirtybox, x, y); 
-    M_AddToBox (dirtybox, x + width-1, y + height-1); 
+    // If we are temporarily using an alternate screen, do not 
+    // affect the update box.
+
+    if (dest_screen == I_VideoBuffer)
+    {
+        M_AddToBox (dirtybox, x, y); 
+        M_AddToBox (dirtybox, x + width-1, y + height-1); 
+    }
 } 
  
 
@@ -181,7 +182,7 @@
     V_MarkRect(destx, desty, width, height); 
  
     src = source + SCREENWIDTH * srcy + srcx; 
-    dest = I_VideoBuffer + SCREENWIDTH * desty + destx; 
+    dest = dest_screen + SCREENWIDTH * desty + destx; 
 
     for ( ; height>0 ; height--) 
     { 
@@ -196,139 +197,125 @@
 // V_DrawPatch
 // Masks a column based masked pic to the screen. 
 //
-void
-V_DrawPatch
-( int		x,
-  int		y,
-  int		scrn,
-  patch_t*	patch ) 
+
+void V_DrawPatch(int x, int y, patch_t *patch)
 { 
+    int count;
+    int col;
+    column_t *column;
+    byte *desttop;
+    byte *dest;
+    byte *source;
+    int w;
 
-    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)
+    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)
     {
         I_Error("Bad V_DrawPatch");
     }
-#endif 
- 
-    if (!scrn)
-	V_MarkRect (x, y, SHORT(patch->width), SHORT(patch->height)); 
+#endif
 
-    col = 0; 
-    desttop = screens[scrn]+y*SCREENWIDTH+x; 
-	 
-    w = SHORT(patch->width); 
+    V_MarkRect(x, y, SHORT(patch->width), SHORT(patch->height));
 
+    col = 0;
+    desttop = dest_screen + 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 ); 
-	} 
-    }			 
-} 
- 
+    {
+        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);
+        }
+    }
+}
+
 //
-// V_DrawPatchFlipped 
+// 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; 
-	 
+void V_DrawPatchFlipped(int x, int y, 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)
+    if (x < 0
+     || x + SHORT(patch->width) > SCREENWIDTH
+     || y < 0
+     || y + SHORT(patch->height) > SCREENHEIGHT)
     {
         I_Error("Bad V_DrawPatchFlipped");
     }
-#endif 
- 
-    if (!scrn)
-	V_MarkRect (x, y, SHORT(patch->width), SHORT(patch->height)); 
+#endif
 
-    col = 0; 
-    desttop = screens[scrn]+y*SCREENWIDTH+x; 
-	 
-    w = SHORT(patch->width); 
+    V_MarkRect (x, y, SHORT(patch->width), SHORT(patch->height));
 
-    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 ); 
-	} 
-    }			 
-} 
- 
+    col = 0;
+    desttop = dest_screen + 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);
+        }
+    }
+}
+
+
+
 //
 // V_DrawPatchDirect
 // Draws directly to the screen on the pc. 
 //
 
-void V_DrawPatchDirect(int x, int y, int scrn, patch_t *patch) 
+void V_DrawPatchDirect(int x, int y, patch_t *patch)
 {
-    V_DrawPatch (x,y,scrn, patch); 
+    V_DrawPatch(x, y, patch); 
 } 
  
 
--- a/src/v_video.h
+++ b/src/v_video.h
@@ -60,20 +60,10 @@
                 int width, int height,
                 int destx, int desty);
 
-void
-V_DrawPatch
-( int		x,
-  int		y,
-  int		scrn,
-  patch_t*	patch);
+void V_DrawPatch(int x, int y, patch_t *patch);
+void V_DrawPatchFlipped(int x, int y, patch_t *patch);
 
-void
-V_DrawPatchDirect
-( int		x,
-  int		y,
-  int		scrn,
-  patch_t*	patch );
-
+void V_DrawPatchDirect(int x, int y, patch_t *patch);
 
 // Draw a linear block of pixels into the view buffer.