shithub: choc

Download patch

ref: 6dfceb2ce609dcf05ce4b94ebeb2407f7990374f
parent: 5040fc24007e2cbfe754cae4f8253ce48ff34d60
author: Simon Howard <[email protected]>
date: Sat Oct 15 18:50:57 EDT 2005

Fix pink icon on startup

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

--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,8 @@
      * Mouse buttons mapped incorrectly (button 1 is right, 2 is middle)
      * Music not pausing when game is paused, when using SDL_mixer's 
        native MIDI playback.
+     * Pink icon on startup (palette should be fully set before anything is
+       loaded)
 
 0.1.0 (2005-10-09):
     Dehacked support
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: i_video.c 195 2005-10-15 15:59:14Z fraggle $
+// $Id: i_video.c 201 2005-10-15 22:50:57Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.38  2005/10/15 22:50:57  fraggle
+// Fix pink icon on startup
+//
 // Revision 1.37  2005/10/15 15:59:14  fraggle
 // Map mouse buttons correctly.
 //
@@ -155,7 +158,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: i_video.c 195 2005-10-15 15:59:14Z fraggle $";
+rcsid[] = "$Id: i_video.c 201 2005-10-15 22:50:57Z fraggle $";
 
 #include <SDL.h>
 #include <ctype.h>
@@ -856,10 +859,19 @@
         I_Error("Error setting video mode: %s\n", SDL_GetError());
     }
 
-    // start with a clear black screen
+    // Start with a clear black screen
+    // (screen will be flipped after we set the palette)
 
+    if (SDL_LockSurface(screen) >= 0)
+    {
+        memset(screen->pixels, 0, screen->w * screen->pitch);
+        SDL_UnlockSurface(screen);
+    }
+    
+    // Set the palette
+
     I_SetPalette (W_CacheLumpName ("PLAYPAL",PU_CACHE));
-    SDL_Flip(screen);
+    SDL_SetColors(screen, palette, 0, 256);
 
     // Setup title and icon