From 6dfceb2ce609dcf05ce4b94ebeb2407f7990374f Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 15 Oct 2005 22:50:57 +0000 Subject: Fix pink icon on startup Subversion-branch: /trunk/chocolate-doom Subversion-revision: 201 --- NEWS | 2 ++ src/i_video.c | 20 ++++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index a0154424..c7b451f5 100644 --- 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 diff --git a/src/i_video.c b/src/i_video.c index d6acc879..da8af154 100644 --- 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 #include @@ -856,10 +859,19 @@ void I_InitGraphics(void) 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 -- cgit v1.2.3