diff options
author | Simon Howard | 2008-09-20 19:46:11 +0000 |
---|---|---|
committer | Simon Howard | 2008-09-20 19:46:11 +0000 |
commit | cb4c334c162601fa2e2675e293e2e4c7a6ae57e4 (patch) | |
tree | ae88c01b0478ca87d2b5ee3a8d316b03b2af0b5e /src/i_video.c | |
parent | e2e44080a665c68dffdf1863fd1902be395adb10 (diff) | |
download | chocolate-doom-cb4c334c162601fa2e2675e293e2e4c7a6ae57e4.tar.gz chocolate-doom-cb4c334c162601fa2e2675e293e2e4c7a6ae57e4.tar.bz2 chocolate-doom-cb4c334c162601fa2e2675e293e2e4c7a6ae57e4.zip |
Add I_VideoBuffer variable for pointer to screen buffer used by
i_video.c code. Make V_CopyRect always blit to the screen.
Subversion-branch: /branches/raven-branch
Subversion-revision: 1245
Diffstat (limited to 'src/i_video.c')
-rw-r--r-- | src/i_video.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/i_video.c b/src/i_video.c index cc8cad6a..5adc6b40 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -101,7 +101,7 @@ static boolean initialised = false; static boolean nomouse = false; int usemouse = 1; -// if true, screens[0] is screen->pixel +// if true, I_VideoBuffer is screen->pixels static boolean native_surface; @@ -132,6 +132,10 @@ static int startup_delay = 1000; static int grabmouse = true; +// The screen buffer; this is modified to draw things to the screen + +byte *I_VideoBuffer = NULL; + // If true, game is running as a screensaver boolean screensaver_mode = false; @@ -304,9 +308,9 @@ static void LoadDiskImage(void) for (y=0; y<disk_image_h; ++y) { memcpy(disk_image + disk_image_w * y, - screens[0] + SCREENWIDTH * y, + I_VideoBuffer + SCREENWIDTH * y, disk_image_w); - memset(screens[0] + SCREENWIDTH * y, 0, disk_image_w); + memset(I_VideoBuffer + SCREENWIDTH * y, 0, disk_image_w); } W_ReleaseLumpName(disk_name); @@ -689,7 +693,7 @@ static boolean BlitArea(int x1, int y1, int x2, int y2) if (SDL_LockSurface(screen) >= 0) { - I_InitScale(screens[0], + I_InitScale(I_VideoBuffer, (byte *) screen->pixels + (y_offset * screen->pitch) + x_offset, screen->pitch); @@ -738,7 +742,7 @@ void I_BeginRead(void) for (y=0; y<disk_image_h; ++y) { byte *screenloc = - screens[0] + I_VideoBuffer + (SCREENHEIGHT - 1 - disk_image_h + y) * SCREENWIDTH + (SCREENWIDTH - 1 - disk_image_w); @@ -764,7 +768,7 @@ void I_EndRead(void) for (y=0; y<disk_image_h; ++y) { byte *screenloc = - screens[0] + I_VideoBuffer + (SCREENHEIGHT - 1 - disk_image_h + y) * SCREENWIDTH + (SCREENWIDTH - 1 - disk_image_w); @@ -810,9 +814,9 @@ void I_FinishUpdate (void) if (tics > 20) tics = 20; for (i=0 ; i<tics*2 ; i+=4) - screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0xff; + I_VideoBuffer[ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0xff; for ( ; i<20*4 ; i+=4) - screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0; + I_VideoBuffer[ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0; } // draw to screen @@ -839,7 +843,7 @@ void I_FinishUpdate (void) // void I_ReadScreen (byte* scr) { - memcpy (scr, screens[0], SCREENWIDTH*SCREENHEIGHT); + memcpy(scr, I_VideoBuffer, SCREENWIDTH*SCREENHEIGHT); } @@ -1603,23 +1607,25 @@ void I_InitGraphics(void) if (native_surface) { - screens[0] = (unsigned char *) screen->pixels; + I_VideoBuffer = (unsigned char *) screen->pixels; - screens[0] += (screen->h - SCREENHEIGHT) / 2; + I_VideoBuffer += (screen->h - SCREENHEIGHT) / 2; } else { - screens[0] = (unsigned char *) Z_Malloc (SCREENWIDTH * SCREENHEIGHT, - PU_STATIC, NULL); + I_VideoBuffer = (unsigned char *) Z_Malloc (SCREENWIDTH * SCREENHEIGHT, + PU_STATIC, NULL); } + V_RestoreBuffer(); + // "Loading from disk" icon LoadDiskImage(); // Clear the screen to black. - memset(screens[0], 0, SCREENWIDTH * SCREENHEIGHT); + memset(I_VideoBuffer, 0, SCREENWIDTH * SCREENHEIGHT); // We need SDL to give us translated versions of keys as well |