shithub: choc

Download patch

ref: 165b0bddfdbd55c07f86895bd14d6725bff9e61d
parent: 1821d8bdd335307de1455ad4342c58ad4841b123
author: Fabian Greffrath <fabian@greffrath.com>
date: Tue Sep 1 11:14:31 EDT 2015

Video: Show a disk icon if lumps have been read in the previous tic

This restores the disk icon that is displayed in the bottom right
corner of the screen whenever lumps are loaded. Instead of being drawn
and probably overdrawn again within the same tic, the icon is now
shown for at least one full tic. Also, the icon is not scaled to the
screen in its own step anymore, but is merely projected into
I_VideoBuffer and then scaled with the rest of the scren at the
end of the respective tic.

This closes #603 and lets us get rid up UpdateRect() entirely.

--- a/src/i_video.c
+++ b/src/i_video.c
@@ -31,6 +31,7 @@
 #include "icon.c"
 
 #include "config.h"
+#include "d_loop.h"
 #include "deh_str.h"
 #include "doomtype.h"
 #include "doomkeys.h"
@@ -992,6 +993,8 @@
     }
 }
 
+static int readtic;
+
 void I_BeginRead(void)
 {
     byte *screenloc = I_VideoBuffer
@@ -1002,6 +1005,8 @@
     if (!initialized || disk_image == NULL)
         return;
 
+    readtic = gametic;
+
     // save background and copy the disk image in
 
     for (y=0; y<LOADING_DISK_H; ++y)
@@ -1015,9 +1020,6 @@
 
         screenloc += SCREENWIDTH;
     }
-
-    UpdateRect(SCREENWIDTH - LOADING_DISK_W, SCREENHEIGHT - LOADING_DISK_H,
-               SCREENWIDTH, SCREENHEIGHT);
 }
 
 void I_EndRead(void)
@@ -1030,6 +1032,8 @@
     if (!initialized || disk_image == NULL)
         return;
 
+    readtic = 0;
+
     // save background and copy the disk image in
 
     for (y=0; y<LOADING_DISK_H; ++y)
@@ -1040,9 +1044,6 @@
 
         screenloc += SCREENWIDTH;
     }
-
-    UpdateRect(SCREENWIDTH - LOADING_DISK_W, SCREENHEIGHT - LOADING_DISK_H,
-               SCREENWIDTH, SCREENHEIGHT);
 }
 
 //
@@ -1089,6 +1090,13 @@
 	    I_VideoBuffer[ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0xff;
 	for ( ; i<20*4 ; i+=4)
 	    I_VideoBuffer[ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0;
+    }
+
+    // show a disk icon if lumps have been read in the previous tic
+
+    if (readtic && gametic > readtic)
+    {
+        I_EndRead();
     }
 
     // draw to screen
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -356,8 +356,6 @@
         I_Error("W_ReadLump: only read %i of %i on lump %i",
                 c, l->size, lump);
     }
-
-    I_EndRead();
 }