shithub: choc

Download patch

ref: 8f20863e40e5f721adc616817eae8442898b9a70
parent: abc595e83b1eda6478d07b87ce79d417b953014a
author: Simon Howard <fraggle@gmail.com>
date: Sat Oct 1 23:03:40 EDT 2005

Make sure loading disk is only shown if the display is initialised

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

--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: i_video.c 140 2005-09-27 22:33:42Z fraggle $
+// $Id: i_video.c 145 2005-10-02 03:03:40Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.34  2005/10/02 03:03:40  fraggle
+// Make sure loading disk is only shown if the display is initialised
+//
 // Revision 1.33  2005/09/27 22:33:42  fraggle
 // Always use SDL_Flip to update the screen.  Fixes problems in Windows when
 // running fullscreen, introduced by fixes to the disk icon code.
@@ -141,7 +144,7 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: i_video.c 140 2005-09-27 22:33:42Z fraggle $";
+rcsid[] = "$Id: i_video.c 145 2005-10-02 03:03:40Z fraggle $";
 
 #include <SDL.h>
 #include <ctype.h>
@@ -172,6 +175,10 @@
 
 static int windowwidth, windowheight;
 
+// display has been set up?
+
+static boolean initialised = false;
+
 // if true, screens[0] is screen->pixel
 
 static boolean native_surface;
@@ -371,6 +378,8 @@
     SDL_WM_GrabInput(SDL_GRAB_OFF);
 
     SDL_QuitSubSystem(SDL_INIT_VIDEO);
+    
+    initialised = false;
 }
 
 
@@ -602,7 +611,7 @@
 {
     int y;
 
-    if (disk_image == NULL)
+    if (!initialised || disk_image == NULL)
         return;
 
     // save background and copy the disk image in
@@ -628,7 +637,7 @@
 {
     int y;
 
-    if (disk_image == NULL)
+    if (!initialised || disk_image == NULL)
         return;
 
     // save background and copy the disk image in
@@ -657,6 +666,9 @@
     int		i;
     // UNUSED static unsigned char *bigscreen=0;
 
+    if (!initialised)
+        return;
+    
     UpdateGrab();
 
     // Don't update the screen if the window isn't visible.
@@ -870,5 +882,7 @@
     // clear out any events waiting at the start
   
     while (SDL_PollEvent(&dummy));
+
+    initialised = true;
 }