diff options
Diffstat (limited to 'src/doom')
-rw-r--r-- | src/doom/r_draw.c | 44 | ||||
-rw-r--r-- | src/doom/st_lib.c | 6 | ||||
-rw-r--r-- | src/doom/st_lib.h | 2 | ||||
-rw-r--r-- | src/doom/st_stuff.c | 13 | ||||
-rw-r--r-- | src/doom/st_stuff.h | 1 | ||||
-rw-r--r-- | src/doom/wi_stuff.c | 70 |
6 files changed, 71 insertions, 65 deletions
diff --git a/src/doom/r_draw.c b/src/doom/r_draw.c index d75aec3b..1b6420d9 100644 --- a/src/doom/r_draw.c +++ b/src/doom/r_draw.c @@ -77,7 +77,10 @@ int columnofs[MAXWIDTH]; // byte translations[3][256]; - +// Backing buffer containing the bezel drawn around the screen and +// surrounding background. + +static byte *background_buffer = NULL; // @@ -815,20 +818,39 @@ void R_FillBackScreen (void) char *name1 = DEH_String("FLOOR7_2"); // DOOM II border patch. - char *name2 = DEH_String("GRNROCK"); + char *name2 = DEH_String("GRNROCK"); + + char *name; + + // If we are running full screen, there is no need to do any of this, + // and the background buffer can be freed if it was previously in use. + + if (scaledviewwidth == SCREENWIDTH) + { + if (background_buffer != NULL) + { + Z_Free(background_buffer); + background_buffer = NULL; + } - char* name; - - if (scaledviewwidth == 320) return; + } + + // Allocate the background buffer if necessary - if ( gamemode == commercial) + if (background_buffer == NULL) + { + background_buffer = Z_Malloc(SCREENWIDTH * (SCREENHEIGHT - SBARHEIGHT), + PU_STATIC, NULL); + } + + if (gamemode == commercial) name = name2; else name = name1; src = W_CacheLumpName(name, PU_CACHE); - dest = screens[1]; + dest = background_buffer; for (y=0 ; y<SCREENHEIGHT-SBARHEIGHT ; y++) { @@ -847,7 +869,7 @@ void R_FillBackScreen (void) // Draw screen and bezel; this is done to a separate screen buffer. - V_UseBuffer(screens[1]); + V_UseBuffer(background_buffer); patch = W_CacheLumpName(DEH_String("brdr_t"),PU_CACHE); @@ -900,7 +922,11 @@ R_VideoErase // is not optiomal, e.g. byte by byte on // a 32bit CPU, as GNU GCC/Linux libc did // at one point. - memcpy(I_VideoBuffer + ofs, screens[1] + ofs, count); + + if (background_buffer != NULL) + { + memcpy(I_VideoBuffer + ofs, background_buffer + ofs, count); + } } diff --git a/src/doom/st_lib.c b/src/doom/st_lib.c index 9ba9cdcc..c7e87951 100644 --- a/src/doom/st_lib.c +++ b/src/doom/st_lib.c @@ -123,7 +123,7 @@ STlib_drawNum if (n->y - ST_Y < 0) I_Error("drawNum: n->y - ST_Y < 0"); - V_CopyRect(x, n->y - ST_Y, screens[BG], w*numdigits, h, x, n->y); + V_CopyRect(x, n->y - ST_Y, st_backing_screen, w*numdigits, h, x, n->y); // if non-number, do not draw it if (num == 1994) @@ -233,7 +233,7 @@ STlib_updateMultIcon if (y - ST_Y < 0) I_Error("updateMultIcon: y - ST_Y < 0"); - V_CopyRect(x, y-ST_Y, screens[BG], w, h, x, y); + V_CopyRect(x, y-ST_Y, st_backing_screen, w, h, x, y); } V_DrawPatch(mi->x, mi->y, mi->p[*mi->inum]); mi->oldinum = *mi->inum; @@ -285,7 +285,7 @@ STlib_updateBinIcon if (*bi->val) V_DrawPatch(bi->x, bi->y, bi->p); else - V_CopyRect(x, y-ST_Y, screens[BG], w, h, x, y); + V_CopyRect(x, y-ST_Y, st_backing_screen, w, h, x, y); bi->oldval = *bi->val; } diff --git a/src/doom/st_lib.h b/src/doom/st_lib.h index bf9a6f87..9345272c 100644 --- a/src/doom/st_lib.h +++ b/src/doom/st_lib.h @@ -35,7 +35,7 @@ // // Background and foreground screen numbers // -#define BG 4 + #define FG 0 diff --git a/src/doom/st_stuff.c b/src/doom/st_stuff.c index 97968f2a..e6ef0828 100644 --- a/src/doom/st_stuff.c +++ b/src/doom/st_stuff.c @@ -269,6 +269,8 @@ #define ST_MAPTITLEY 0 #define ST_MAPHEIGHT 1 +// graphics are drawn to a backing screen and blitted to the real screen +byte *st_backing_screen; // main player in game static player_t* plyr; @@ -276,9 +278,6 @@ static player_t* plyr; // ST_Start() has just been called static boolean st_firsttime; -// used to execute ST_Init() only once -static int veryfirsttime = 1; - // lump number for PLAYPAL static int lu_palette; @@ -433,7 +432,7 @@ void ST_refreshBackground(void) if (st_statusbaron) { - V_UseBuffer(screens[BG]); + V_UseBuffer(st_backing_screen); V_DrawPatch(ST_X, 0, sbar); @@ -442,7 +441,7 @@ void ST_refreshBackground(void) V_RestoreBuffer(); - V_CopyRect(ST_X, 0, screens[BG], ST_WIDTH, ST_HEIGHT, ST_X, ST_Y); + V_CopyRect(ST_X, 0, st_backing_screen, ST_WIDTH, ST_HEIGHT, ST_X, ST_Y); } } @@ -1407,7 +1406,7 @@ void ST_Stop (void) void ST_Init (void) { - veryfirsttime = 0; ST_loadData(); - screens[4] = (byte *) Z_Malloc(ST_WIDTH*ST_HEIGHT, PU_STATIC, 0); + st_backing_screen = (byte *) Z_Malloc(ST_WIDTH * ST_HEIGHT, PU_STATIC, 0); } + diff --git a/src/doom/st_stuff.h b/src/doom/st_stuff.h index c6b56fd6..31bd9764 100644 --- a/src/doom/st_stuff.h +++ b/src/doom/st_stuff.h @@ -82,6 +82,7 @@ typedef enum boolean ST_Responder(event_t* ev); +extern byte *st_backing_screen; extern cheatseq_t cheat_mus; extern cheatseq_t cheat_god; extern cheatseq_t cheat_ammo; diff --git a/src/doom/wi_stuff.c b/src/doom/wi_stuff.c index 85243d84..7a0edc9d 100644 --- a/src/doom/wi_stuff.c +++ b/src/doom/wi_stuff.c @@ -400,18 +400,17 @@ static patch_t* bp[MAXPLAYERS]; // Name graphics of each level (centered) static patch_t** lnames; +// Buffer storing the backdrop +static patch_t *background; + // // CODE // // slam background -// UNUSED static unsigned char *background=0; - - void WI_slamBackground(void) { - memcpy(I_VideoBuffer, screens[1], SCREENWIDTH * SCREENHEIGHT); - V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT); + V_DrawPatch(0, 0, background); } // The ticker is used to detect keys @@ -1551,21 +1550,9 @@ typedef void (*load_callback_t)(char *lumpname, patch_t **variable); static void WI_loadUnloadData(load_callback_t callback) { - int i; - int j; - char name[9]; - anim_t* a; - - // UNUSED unsigned char *pic = screens[1]; - // if (gamemode == commercial) - // { - // darken the background image - // while (pic != screens[1] + SCREENHEIGHT*SCREENWIDTH) - // { - // *pic = colormaps[256*25 + *pic]; - // pic++; - // } - //} + int i, j; + char name[9]; + anim_t *a; if (gamemode == commercial) { @@ -1692,6 +1679,24 @@ static void WI_loadUnloadData(load_callback_t callback) callback(name, &bp[i]); } + // Background image + + if (gamemode == commercial) + { + strcpy(name, DEH_String("INTERPIC")); + } + else if (gamemode == retail && wbs->epsd == 3) + { + strcpy(name, DEH_String("INTERPIC")); + } + else + { + sprintf(name, DEH_String("WIMAP%d"), wbs->epsd); + } + + // Draw backdrop and save to a temporary buffer + + callback(name, &background); } static void WI_loadCallback(char *name, patch_t **variable) @@ -1701,9 +1706,6 @@ static void WI_loadCallback(char *name, patch_t **variable) void WI_loadData(void) { - char bg_lumpname[9]; - patch_t *bg; - if (gamemode == commercial) { NUMCMAPS = 32; @@ -1726,28 +1728,6 @@ void WI_loadData(void) // dead face bstar = W_CacheLumpName(DEH_String("STFDEAD0"), PU_STATIC); - - // Background image - - if (gamemode == commercial) - { - strcpy(bg_lumpname, DEH_String("INTERPIC")); - } - else if (gamemode == retail && wbs->epsd == 3) - { - strcpy(bg_lumpname, DEH_String("INTERPIC")); - } - else - { - 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, bg); - V_RestoreBuffer(); } static void WI_unloadCallback(char *name, patch_t **variable) |