foxygit / doom Log in
commit bd41935ec4bbd8aa287a870cca8cfd33064665fc
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Sat Oct 14 13:59:28 2006 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Sat Oct 14 13:59:28 2006 +0000

    Disable the "loading from disk" icon on MacOS.

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 700
---
 src/i_video.c | 40 +++++++++++++++++++++++++++++-----------
 1 file changed, 29 insertions(+), 11 deletions(-)

diff --git a/src/i_video.c b/src/i_video.c
index 1d36442d..c67e139e 100644
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*-
 //-----------------------------------------------------------------------------
 //
-// $Id: i_video.c 653 2006-09-22 20:32:00Z fraggle $
+// $Id: i_video.c 700 2006-10-14 13:59:28Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -175,7 +175,7 @@
 //-----------------------------------------------------------------------------

 static const char
-rcsid[] = "$Id: i_video.c 653 2006-09-22 20:32:00Z fraggle $";
+rcsid[] = "$Id: i_video.c 700 2006-10-14 13:59:28Z fraggle $";

 #include <SDL.h>
 #include <ctype.h>
@@ -265,6 +265,7 @@ int screenmultiply = 1;
 // disk image data and background overwritten by the disk to be
 // restored by EndRead

+static boolean use_loading_disk;
 static byte *disk_image = NULL;
 static int disk_image_w, disk_image_h;
 static byte *saved_background;
@@ -1053,12 +1054,11 @@ static boolean CheckValidFSMode(void)
 void I_InitGraphics(void)
 {
     SDL_Event dummy;
+    char buf[20];
     int flags = 0;

     SDL_Init(SDL_INIT_VIDEO);

-    flags |= SDL_SWSURFACE | SDL_HWPALETTE | SDL_DOUBLEBUF;
-
     // mouse grabbing

     if (M_CheckParm("-grabmouse"))
@@ -1082,11 +1082,6 @@ void I_InitGraphics(void)
         fullscreen = FULLSCREEN_ON;
     }

-    if (fullscreen != FULLSCREEN_OFF)
-    {
-        flags |= SDL_FULLSCREEN;
-    }
-
     nomouse = M_CheckParm("-nomouse") > 0;

     // scale-by-2 mode
@@ -1182,6 +1177,13 @@ void I_InitGraphics(void)

     GetWindowDimensions(&windowwidth, &windowheight);

+    flags |= SDL_SWSURFACE | SDL_HWPALETTE | SDL_DOUBLEBUF;
+
+    if (fullscreen != FULLSCREEN_OFF)
+    {
+        flags |= SDL_FULLSCREEN;
+    }
+
     screen = SDL_SetVideoMode(windowwidth, windowheight, 8, flags);

     if (screen == NULL)
@@ -1254,9 +1256,25 @@ void I_InitGraphics(void)
 	screens[0] = (unsigned char *) Z_Malloc (SCREENWIDTH * SCREENHEIGHT, PU_STATIC, NULL);
     }

-    // Loading from disk icon
+    use_loading_disk = true;
+
+    SDL_VideoDriverName(buf, 15);
+
+    if (!strcmp(buf, "Quartz"))
+    {
+        // MacOS Quartz gives us pageflipped graphics that screw up the
+        // display when we use the loading disk.  Disable it.
+        // This is a gross hack.

-    LoadDiskImage();
+        use_loading_disk = false;
+    }
+
+    // "Loading from disk" icon
+
+    if (use_loading_disk)
+    {
+        LoadDiskImage();
+    }

     memset(screens[0], 0, SCREENWIDTH * SCREENHEIGHT);