From 636dc9bb6ba074a9c863d4d9d0a3e3b704b20f4e Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 4 Aug 2005 01:13:46 +0000 Subject: Loading disk Subversion-branch: /trunk/chocolate-doom Subversion-revision: 33 --- src/i_video.c | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---- src/w_wad.c | 11 ++++--- 2 files changed, 102 insertions(+), 11 deletions(-) diff --git a/src/i_video.c b/src/i_video.c index baa4fb44..28ced016 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: i_video.c 31 2005-08-03 22:19:52Z fraggle $ +// $Id: i_video.c 33 2005-08-04 01:13:46Z fraggle $ // // Copyright(C) 1993-1996 Id Software, Inc. // Copyright(C) 2005 Simon Howard @@ -22,6 +22,9 @@ // 02111-1307, USA. // // $Log$ +// Revision 1.10 2005/08/04 01:13:46 fraggle +// Loading disk +// // Revision 1.9 2005/08/03 22:19:52 fraggle // Set some flags to fix palette and improve performance // @@ -59,15 +62,17 @@ //----------------------------------------------------------------------------- static const char -rcsid[] = "$Id: i_video.c 31 2005-08-03 22:19:52Z fraggle $"; +rcsid[] = "$Id: i_video.c 33 2005-08-04 01:13:46Z fraggle $"; #include #include +#include "z_zone.h" #include "doomstat.h" #include "i_system.h" #include "v_video.h" #include "m_argv.h" +#include "m_swap.h" #include "d_main.h" #include "doomdef.h" @@ -85,7 +90,90 @@ boolean grabMouse; // replace each 320x200 pixel with multiply*multiply pixels. // According to Dave Taylor, it still is a bonehead thing // to use .... -static int multiply=2; +static int multiply=1; + +// disk image data and background overwritten by the disk to be +// restored by EndRead + +static byte *disk_image = NULL; +static int disk_image_w, disk_image_h; +static byte *saved_background; + +void I_BeginRead(void) +{ + int y; + + if (disk_image == NULL) + return; + + // save background and copy the disk image in + + for (y=0; yw - disk_image_w, screen->h - disk_image_h, + disk_image_w, disk_image_h); +} + +void I_EndRead(void) +{ + int y; + + if (disk_image == NULL) + return; + + // save background and copy the disk image in + + for (y=0; yw - disk_image_w, screen->h - disk_image_h, + disk_image_w, disk_image_h); +} + +static void LoadDiskImage(void) +{ + patch_t *disk; + int y; + + disk = (patch_t *) W_CacheLumpName("STDISK", PU_STATIC); + + V_DrawPatch(0, 0, 0, disk); + disk_image_w = SHORT(disk->width); + disk_image_h = SHORT(disk->height); + printf("%i, %i\n", disk_image_w, disk_image_h); + + disk_image = Z_Malloc(disk_image_w * disk_image_h, PU_STATIC, NULL); + saved_background = Z_Malloc(disk_image_w * disk_image_h, PU_STATIC, NULL); + + for (y=0; yw, screen->h); + SDL_Flip(screen); } @@ -532,14 +620,13 @@ void I_SetPalette (byte* palette) } - void I_InitGraphics(void) { int flags = 0; SDL_Init(SDL_INIT_VIDEO); - flags |= SDL_SWSURFACE | SDL_HWPALETTE; + flags |= SDL_SWSURFACE | SDL_HWPALETTE | SDL_DOUBLEBUF; flags |= SDL_FULLSCREEN; screen = SDL_SetVideoMode(SCREENWIDTH*multiply, SCREENHEIGHT*multiply, 8, flags); @@ -557,8 +644,9 @@ void I_InitGraphics(void) SDL_EnableUNICODE(1); SDL_ShowCursor(0); SDL_WM_GrabInput(SDL_GRAB_ON); -} + LoadDiskImage(); +} unsigned exptable[256]; diff --git a/src/w_wad.c b/src/w_wad.c index 18f8fedf..8415fbd5 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: w_wad.c 15 2005-07-23 18:50:34Z fraggle $ +// $Id: w_wad.c 33 2005-08-04 01:13:46Z fraggle $ // // Copyright(C) 1993-1996 Id Software, Inc. // Copyright(C) 2005 Simon Howard @@ -22,6 +22,9 @@ // 02111-1307, USA. // // $Log$ +// Revision 1.4 2005/08/04 01:13:46 fraggle +// Loading disk +// // Revision 1.3 2005/07/23 18:50:34 fraggle // Use standard C file functions for WAD code // @@ -39,7 +42,7 @@ static const char -rcsid[] = "$Id: w_wad.c 15 2005-07-23 18:50:34Z fraggle $"; +rcsid[] = "$Id: w_wad.c 33 2005-08-04 01:13:46Z fraggle $"; #include @@ -453,7 +456,7 @@ W_ReadLump l = lumpinfo+lump; - // ??? I_BeginRead (); + I_BeginRead (); if (l->handle == NULL) { @@ -474,7 +477,7 @@ W_ReadLump if (l->handle == NULL) fclose (handle); - // ??? I_EndRead (); + I_EndRead (); } -- cgit v1.2.3