shithub: choc

Download patch

ref: 97888140d15254059c5520fba21ba2bfc6d0bf86
parent: 96e3baf08dd5c704a607eab36cf62a50f386a9a6
parent: 68377d5376c94b4c49159e2f19a4235a46875347
author: Fabian Greffrath <fabian@greffrath.com>
date: Wed Sep 2 08:21:31 EDT 2015

Merge pull request #605 from jmtd/diskicon

Diskicon

--- a/src/i_video.c
+++ b/src/i_video.c
@@ -403,15 +403,6 @@
 
     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.
-
-        return;
-    }
-
     if (M_CheckParm("-cdrom") > 0)
         disk_name = DEH_String("STCDROM");
     else
@@ -971,30 +962,8 @@
     return result;
 }
 
-static void UpdateRect(int x1, int y1, int x2, int y2)
-{
-    int x1_scaled, x2_scaled, y1_scaled, y2_scaled;
+static int readtic = 0;
 
-    // Do stretching and blitting
-
-    if (BlitArea(x1, y1, x2, y2))
-    {
-        // Update the area
-
-        x1_scaled = (x1 * screen_mode->width) / SCREENWIDTH;
-        y1_scaled = (y1 * screen_mode->height) / SCREENHEIGHT;
-        x2_scaled = (x2 * screen_mode->width) / SCREENWIDTH;
-        y2_scaled = (y2 * screen_mode->height) / SCREENHEIGHT;
-
-        SDL_UpdateRect(screen,
-                       x1_scaled, y1_scaled,
-                       x2_scaled - x1_scaled,
-                       y2_scaled - y1_scaled);
-    }
-}
-
-static int readtic;
-
 void I_BeginRead(void)
 {
     byte *screenloc = I_VideoBuffer
@@ -1005,10 +974,9 @@
     if (!initialized || disk_image == NULL)
         return;
 
-    // save background and copy the disk image in
-
     for (y=0; y<LOADING_DISK_H; ++y)
     {
+        // save background if the disk isn't already drawn
         if (!readtic)
         {
             memcpy(saved_background + y * LOADING_DISK_W,
@@ -1015,6 +983,8 @@
                    screenloc,
                    LOADING_DISK_W);
         }
+
+        // copy the disk image in
         memcpy(screenloc,
                disk_image + y * LOADING_DISK_W,
                LOADING_DISK_W);
@@ -1032,10 +1002,10 @@
                     + (SCREENWIDTH - LOADING_DISK_W);
     int y;
 
-    if (!initialized || disk_image == NULL)
+    if (!initialized || saved_background == NULL)
         return;
 
-    // save background and copy the disk image in
+    // restore background from beneath disk indicator
 
     for (y=0; y<LOADING_DISK_H; ++y)
     {
@@ -1097,9 +1067,16 @@
 
     // show a disk icon if lumps have been read in the previous tic
 
-    if (readtic && gametic > readtic)
+    if (readtic)
     {
-        I_EndRead();
+        if (gametic > readtic)
+        {
+            I_EndRead();
+        }
+        else
+        {
+            I_BeginRead();
+        }
     }
 
     // draw to screen