ref: 96cfb635bef9e156f1c304e7f68b4bf0eeead891
parent: cb4c334c162601fa2e2675e293e2e4c7a6ae57e4
author: Simon Howard <[email protected]>
date: Sat Sep 20 15:54:44 EDT 2008
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
--- a/src/doom/f_wipe.c
+++ b/src/doom/f_wipe.c
@@ -256,7 +256,7 @@
{
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;
}
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1617,6 +1617,7 @@
PU_STATIC, NULL);
}
+ screens[0] = I_VideoBuffer;
V_RestoreBuffer();
// "Loading from disk" icon
--- 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_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_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_MarkRect (x, y, width, height);
- dest = screens[scrn] + y*SCREENWIDTH+x;
+ dest = dest_screen + y * SCREENWIDTH + x;
while (height--)
{
@@ -442,11 +383,18 @@
}
}
+// 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;
}
//
--- a/src/v_video.h
+++ b/src/v_video.h
@@ -76,15 +76,9 @@
// 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
V_GetBlock
@@ -105,6 +99,7 @@
void V_ScreenShot(void);
+void V_UseBuffer(byte *buffer);
void V_RestoreBuffer(void);
#endif