From e2e163c6e3fc1db2df6da1d4ed831fe6629e180b Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 20 Sep 2008 20:32:24 +0000 Subject: Remove screen parameter from V_DrawPatch functions; update code to use V_UseBuffer where necessary. Subversion-branch: /branches/raven-branch Subversion-revision: 1248 --- src/doom/am_map.c | 3 +- src/doom/d_main.c | 6 +- src/doom/f_finale.c | 24 +++--- src/doom/g_game.c | 4 +- src/doom/hu_lib.c | 4 +- src/doom/m_menu.c | 75 +++++++++--------- src/doom/r_draw.c | 55 +++++++------- src/doom/st_lib.c | 12 +-- src/doom/st_stuff.c | 8 +- src/doom/wi_stuff.c | 70 +++++++++-------- src/i_video.c | 2 +- src/v_video.c | 215 ++++++++++++++++++++++++---------------------------- src/v_video.h | 16 +--- 13 files changed, 243 insertions(+), 251 deletions(-) diff --git a/src/doom/am_map.c b/src/doom/am_map.c index 9b662ac2..e2b84e6d 100644 --- 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 @@ void AM_drawMarks(void) 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]); } } diff --git a/src/doom/d_main.c b/src/doom/d_main.c index 6aaa5d9c..67a22a50 100644 --- a/src/doom/d_main.c +++ b/src/doom/d_main.c @@ -296,8 +296,8 @@ void D_Display (void) 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_PageTicker (void) // void D_PageDrawer (void) { - V_DrawPatch (0,0, 0, W_CacheLumpName(pagename, PU_CACHE)); + V_DrawPatch (0, 0, W_CacheLumpName(pagename, PU_CACHE)); } diff --git a/src/doom/f_finale.c b/src/doom/f_finale.c index e4d35ca4..974dc32e 100644 --- a/src/doom/f_finale.c +++ b/src/doom/f_finale.c @@ -294,7 +294,7 @@ void F_TextWrite (void) 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 @@ void F_CastPrint (char* text) } 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 @@ void F_CastPrint (char* text) // // F_CastDrawer // -void V_DrawPatchFlipped (int x, int y, int scrn, patch_t *patch); void F_CastDrawer (void) { @@ -559,7 +558,7 @@ void F_CastDrawer (void) 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 @@ void F_CastDrawer (void) 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 @@ void F_BunnyScroll (void) 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 @@ void F_BunnyScroll (void) } 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 @@ static void F_ArtScreenDrawer(void) lumpname = DEH_String(lumpname); - V_DrawPatch (0, 0, 0, W_CacheLumpName(lumpname, PU_CACHE)); + V_DrawPatch (0, 0, W_CacheLumpName(lumpname, PU_CACHE)); } } diff --git a/src/doom/g_game.c b/src/doom/g_game.c index 99be6592..221a898a 100644 --- a/src/doom/g_game.c +++ b/src/doom/g_game.c @@ -258,8 +258,8 @@ void G_DrawMouseSpeedBox(void) 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; } diff --git a/src/doom/hu_lib.c b/src/doom/hu_lib.c index 5d8428ba..c7c62d06 100644 --- a/src/doom/hu_lib.c +++ b/src/doom/hu_lib.c @@ -121,7 +121,7 @@ HUlib_drawTextLine 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 @@ HUlib_drawTextLine 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]); } } diff --git a/src/doom/m_menu.c b/src/doom/m_menu.c index 113edc43..a5e81775 100644 --- a/src/doom/m_menu.c +++ b/src/doom/m_menu.c @@ -540,7 +540,9 @@ void M_DrawLoad(void) { 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 @@ void M_DrawSaveLoadBorder(int x,int y) { 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 @@ void M_DrawSave(void) { 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 @@ void M_DrawReadThis1(void) 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 @@ void M_DrawReadThis2(void) // 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_DrawReadThis2(void) // 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_MusicVol(int choice) // 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_DrawMainMenu(void) // 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 @@ int epi; 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 @@ char msgNames[2][9] = {"M_MSGOFF","M_MSGON"}; 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 @@ M_DrawThermo 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;ix - 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 @@ M_DrawSelCell ( 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 @@ M_WriteText 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,14 +1891,14 @@ void M_Drawer (void) if (name[0]) { - V_DrawPatchDirect (x,y,0, W_CacheLumpName(name, PU_CACHE)); + V_DrawPatchDirect (x, y, W_CacheLumpName(name, PU_CACHE)); } y += LINEHEIGHT; } // 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)); diff --git a/src/doom/r_draw.c b/src/doom/r_draw.c index 6813ea59..58ef41bc 100644 --- a/src/doom/r_draw.c +++ b/src/doom/r_draw.c @@ -827,7 +827,7 @@ void R_FillBackScreen (void) else name = name1; - src = W_CacheLumpName (name, PU_CACHE); + src = W_CacheLumpName(name, PU_CACHE); dest = screens[1]; for (y=0 ; yy, 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 @@ STlib_updatePercent 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 @@ STlib_updateMultIcon 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 @@ STlib_updateBinIcon 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); diff --git a/src/doom/st_stuff.c b/src/doom/st_stuff.c index 21e7e206..97968f2a 100644 --- a/src/doom/st_stuff.c +++ b/src/doom/st_stuff.c @@ -433,10 +433,14 @@ void ST_refreshBackground(void) 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); } diff --git a/src/doom/wi_stuff.c b/src/doom/wi_stuff.c index 938d6915..e0e0ad24 100644 --- a/src/doom/wi_stuff.c +++ b/src/doom/wi_stuff.c @@ -429,13 +429,15 @@ void WI_drawLF(void) // draw 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 @@ void WI_drawEL(void) // 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 @@ WI_drawOnLnode 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 @@ void WI_drawAnimatedBack(void) 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 @@ WI_drawNum 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 @@ WI_drawPercent if (p < 0) return; - V_DrawPatch(x, y, FB, percent); + V_DrawPatch(x, y, percent); WI_drawNum(x, y, p, -1); } @@ -714,14 +719,14 @@ WI_drawTime // draw if (div==60 || t / div) - V_DrawPatch(x, y, FB, colon); + V_DrawPatch(x, y, colon); } while (t / div); } else { // "sucks" - V_DrawPatch(x - SHORT(sucks->width), y, FB, sucks); + V_DrawPatch(x - SHORT(sucks->width), y, sucks); } } @@ -1009,11 +1014,10 @@ void WI_drawDeathmatchStats(void) // 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,33 +1029,29 @@ void WI_drawDeathmatchStats(void) { 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) { 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); } } 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 @@ void WI_drawNetgameStats(void) // 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 @@ void WI_drawNetgameStats(void) 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 @@ void WI_drawStats(void) 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 @@ void WI_loadData(void) 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) diff --git a/src/i_video.c b/src/i_video.c index d3e7b31d..ebfadc10 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -298,7 +298,7 @@ static void LoadDiskImage(void) 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); diff --git a/src/v_video.c b/src/v_video.c index cca077fe..5bb1c962 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -142,15 +142,16 @@ const byte gammatable[5][256] = // // 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 @@ void V_CopyRect(int srcx, int srcy, byte *source, 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,129 +197,115 @@ void V_CopyRect(int srcx, int srcy, byte *source, // 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) +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; + + 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 + + V_MarkRect(x, y, SHORT(patch->width), SHORT(patch->height)); + + col = 0; + desttop = dest_screen + y * SCREENWIDTH + x; - col = 0; - desttop = screens[scrn]+y*SCREENWIDTH+x; - - w = SHORT(patch->width); + w = SHORT(patch->width); for ( ; colcolumnofs[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)); + + col = 0; + desttop = dest_screen + y * SCREENWIDTH + x; + + w = SHORT(patch->width); + + for ( ; colcolumnofs[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); + } + } +} - for ( ; colcolumnofs[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 ); - } - } -} - // @@ -326,9 +313,9 @@ V_DrawPatchFlipped // 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); } diff --git a/src/v_video.h b/src/v_video.h index 7efe1b36..ba1aab36 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -60,20 +60,10 @@ void V_CopyRect(int srcx, int srcy, byte *source, int width, int height, int destx, int desty); -void -V_DrawPatch -( int x, - int y, - int scrn, - patch_t* patch); - -void -V_DrawPatchDirect -( 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, patch_t *patch); // Draw a linear block of pixels into the view buffer. -- cgit v1.2.3