diff options
author | Simon Howard | 2008-09-20 19:54:44 +0000 |
---|---|---|
committer | Simon Howard | 2008-09-20 19:54:44 +0000 |
commit | 96cfb635bef9e156f1c304e7f68b4bf0eeead891 (patch) | |
tree | 4069faf596add0450a1f4134755ee00f85941c54 | |
parent | cb4c334c162601fa2e2675e293e2e4c7a6ae57e4 (diff) | |
download | chocolate-doom-96cfb635bef9e156f1c304e7f68b4bf0eeead891.tar.gz chocolate-doom-96cfb635bef9e156f1c304e7f68b4bf0eeead891.tar.bz2 chocolate-doom-96cfb635bef9e156f1c304e7f68b4bf0eeead891.zip |
Add a dest_buffer pointer for the v_video code, and V_UseBuffer to allow
that to be temporarily changed. Make V_DrawBlock always draw to the
screen.
Subversion-branch: /branches/raven-branch
Subversion-revision: 1246
-rw-r--r-- | src/doom/f_wipe.c | 2 | ||||
-rw-r--r-- | src/i_video.c | 1 | ||||
-rw-r--r-- | src/v_video.c | 98 | ||||
-rw-r--r-- | src/v_video.h | 11 |
4 files changed, 28 insertions, 84 deletions
diff --git a/src/doom/f_wipe.c b/src/doom/f_wipe.c index 0c352469..83cb8584 100644 --- a/src/doom/f_wipe.c +++ b/src/doom/f_wipe.c @@ -256,7 +256,7 @@ wipe_EndScreen { wipe_scr_end = Z_Malloc(SCREENWIDTH * SCREENHEIGHT, PU_STATIC, NULL); I_ReadScreen(wipe_scr_end); - V_DrawBlock(x, y, 0, width, height, wipe_scr_start); // restore start scr. + V_DrawBlock(x, y, width, height, wipe_scr_start); // restore start scr. return 0; } diff --git a/src/i_video.c b/src/i_video.c index 5adc6b40..d3e7b31d 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -1617,6 +1617,7 @@ void I_InitGraphics(void) PU_STATIC, NULL); } + screens[0] = I_VideoBuffer; V_RestoreBuffer(); // "Loading from disk" icon diff --git a/src/v_video.c b/src/v_video.c index e5075c87..cca077fe 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -42,6 +42,10 @@ #include "w_wad.h" #include "z_zone.h" +// The screen buffer that the v_video.c code draws to. + +static byte *dest_screen = NULL; + // Each screen is [SCREENWIDTH*SCREENHEIGHT]; byte* screens[5]; @@ -321,66 +325,10 @@ V_DrawPatchFlipped // 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, int scrn, patch_t *patch) { V_DrawPatch (x,y,scrn, 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_Error ("Bad V_DrawPatchDirect"); - } -#endif - - // V_MarkRect (x, y, SHORT(patch->width), SHORT(patch->height)); - desttop = destscreen + y*SCREENWIDTH/4 + (x>>2); - - w = SHORT(patch->width); - for ( col = 0 ; col<w ; col++) - { - outp (SC_INDEX+1,1<<(x&3)); - 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/4; - count = column->length; - - while (count--) - { - *dest = *source++; - dest += SCREENWIDTH/4; - } - column = (column_t *)( (byte *)column + column->length - + 4 ); - } - if ( ((++x)&3) == 0 ) - desttop++; // go to next byte, not next plane - }*/ } @@ -389,23 +337,16 @@ V_DrawPatchDirect // 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 ) + +void V_DrawBlock(int x, int y, int width, int height, byte *src) { - byte* dest; - + byte *dest; + #ifdef RANGECHECK - if (x<0 - ||x+width >SCREENWIDTH - || y<0 - || y+height>SCREENHEIGHT - || (unsigned)scrn>4 ) + if (x < 0 + || x + width >SCREENWIDTH + || y < 0 + || y + height > SCREENHEIGHT) { I_Error ("Bad V_DrawBlock"); } @@ -413,7 +354,7 @@ V_DrawBlock V_MarkRect (x, y, width, height); - dest = screens[scrn] + y*SCREENWIDTH+x; + dest = dest_screen + y * SCREENWIDTH + x; while (height--) { @@ -442,11 +383,18 @@ void V_Init (void) } } +// Set the buffer that the code draws to. + +void V_UseBuffer(byte *buffer) +{ + dest_screen = buffer; +} + // Restore screen buffer to the i_video screen buffer. void V_RestoreBuffer(void) { - screens[0] = I_VideoBuffer; + dest_screen = I_VideoBuffer; } // diff --git a/src/v_video.h b/src/v_video.h index 5312619a..969024c9 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -76,14 +76,8 @@ V_DrawPatchDirect // 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 ); + +void V_DrawBlock(int x, int y, int width, int height, byte *src); // Reads a linear block of pixels into the view buffer. void @@ -105,6 +99,7 @@ V_MarkRect void V_ScreenShot(void); +void V_UseBuffer(byte *buffer); void V_RestoreBuffer(void); #endif |