shithub: choc

Download patch

ref: ebf190f5a9732fcee1be244c433ba57434683d6b
parent: 1e30507db78e1361b409cd7e5ca0f231a7c5a016
author: Simon Howard <[email protected]>
date: Wed Aug 3 17:58:02 EDT 2005

Working scale*2

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 30

--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: i_video.c 29 2005-07-25 20:50:55Z fraggle $
+// $Id: i_video.c 30 2005-08-03 21:58:02Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.8  2005/08/03 21:58:02  fraggle
+// Working scale*2
+//
 // Revision 1.7  2005/07/25 20:50:55  fraggle
 // mouse
 //
@@ -53,7 +56,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: i_video.c 29 2005-07-25 20:50:55Z fraggle $";
+rcsid[] = "$Id: i_video.c 30 2005-08-03 21:58:02Z fraggle $";
 
 #include <ctype.h>
 #include <SDL.h>
@@ -79,7 +82,7 @@
 // replace each 320x200 pixel with multiply*multiply pixels.
 // According to Dave Taylor, it still is a bonehead thing
 // to use ....
-static int	multiply=1;
+static int	multiply=2;
 
 //
 // Translates the SDL key
@@ -378,7 +381,6 @@
 	    screens[0][ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0;
     
     }
-#if 0
     // scales the screen size before blitting it
     if (multiply == 2)
     {
@@ -388,10 +390,14 @@
 	unsigned int twoopixels;
 	unsigned int twomoreopixels;
 	unsigned int fouripixels;
+        unsigned int X_width = screen->pitch;
+        Uint8 *screen_pixels = (Uint8 *) screen->pixels;
 
+        SDL_LockSurface(screen);
+
 	ilineptr = (unsigned int *) (screens[0]);
 	for (i=0 ; i<2 ; i++)
-	    olineptrs[i] = (unsigned int *) &image->data[i*X_width];
+	    olineptrs[i] = (unsigned int *) &screen_pixels[i*X_width];
 
 	y = SCREENHEIGHT;
 	while (y--)
@@ -422,7 +428,9 @@
 	    olineptrs[1] += X_width/4;
 	}
 
+        SDL_UnlockSurface(screen);
     }
+#if 0
     else if (multiply == 3)
     {
 	unsigned int *olineptrs[3];
@@ -528,9 +536,9 @@
 
     SDL_Init(SDL_INIT_VIDEO);
 
-//    flags |= SDL_FULLSCREEN;
+    flags |= SDL_FULLSCREEN;
 
-    screen = SDL_SetVideoMode(SCREENWIDTH, SCREENHEIGHT, 8, flags);
+    screen = SDL_SetVideoMode(SCREENWIDTH*multiply, SCREENHEIGHT*multiply, 8, flags);
 
     if (screen == NULL)
     {
@@ -558,7 +566,7 @@
 	exptable[i] = i | (i<<8) | (i<<16) | (i<<24);
 }
 
-double		exptable2[256*256];
+double exptable2[256*256];
 
 void InitExpand2 (void)
 {
@@ -572,7 +580,6 @@
 	unsigned	u[2];
     } pixel;
 	
-    printf ("building exptable2...\n");
     exp = exptable2;
     for (i=0 ; i<256 ; i++)
     {
@@ -583,7 +590,6 @@
 	    *exp++ = pixel.d;
 	}
     }
-    printf ("done.\n");
 }
 
 int	inited;