shithub: choc

Download patch

ref: 33fa8bcf625e35c8d9afbaf1f87b7f6b463baafd
parent: a74f73ec1309e789115cc8058d802adc8307047a
author: Simon Howard <[email protected]>
date: Sat Sep 24 20:31:32 EDT 2005

Fix disk icon appearing before palette is set (pink disk!)
Cleanup and commenting

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

--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: i_video.c 130 2005-09-24 23:44:49Z fraggle $
+// $Id: i_video.c 133 2005-09-25 00:31:32Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,10 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.31  2005/09/25 00:31:32  fraggle
+// Fix disk icon appearing before palette is set (pink disk!)
+// Cleanup and commenting
+//
 // Revision 1.30  2005/09/24 23:44:49  fraggle
 // Enforce sane screenmultiply values
 //
@@ -130,7 +134,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: i_video.c 130 2005-09-24 23:44:49Z fraggle $";
+rcsid[] = "$Id: i_video.c 133 2005-09-25 00:31:32Z fraggle $";
 
 #include <SDL.h>
 #include <ctype.h>
@@ -591,8 +595,8 @@
         SDL_UpdateRect(screen, 
                        x1 * screenmultiply, 
                        y1 * screenmultiply, 
-                       (x2-x1) * screenmultiply, 
-                       (y2-y1) * screenmultiply);
+                       w * screenmultiply, 
+                       h * screenmultiply);
     }
 }
 
@@ -812,6 +816,14 @@
         I_Error("Error setting video mode: %s\n", SDL_GetError());
     }
 
+    // start with a clear black screen
+
+    memset(screens[0], 0, SCREENWIDTH * SCREENHEIGHT);
+    I_SetPalette (W_CacheLumpName ("PLAYPAL",PU_CACHE));
+    SDL_Flip(screen);
+
+    // Setup title and icon
+
     SetCaption();
     SetIcon();
 
@@ -835,13 +847,13 @@
     else
 	screens[0] = (unsigned char *) Z_Malloc (SCREENWIDTH * SCREENHEIGHT, PU_STATIC, NULL);
 
+    // Loading from disk icon
+
     LoadDiskImage();
 
-    SDL_EnableUNICODE(1);
+    // We need SDL to give us translated versions of keys as well
 
-    // start with a clear black screen
-
-    memset(screens[0], 0, SCREENWIDTH * SCREENHEIGHT);
+    SDL_EnableUNICODE(1);
 
     // clear out any events waiting at the start