shithub: choc

Download patch

ref: ff61aa8695321e21b349583b4b43f19084d870c4
parent: cb3520a3dac5d67904d21604a786fcb31baaaf02
author: Fabian Greffrath <fabian@greffrath.com>
date: Mon Nov 2 08:48:32 EST 2015

disk icon: Move check for accumulated read bytes to i_video.c

--- a/src/i_video.c
+++ b/src/i_video.c
@@ -175,6 +175,12 @@
 
 int show_diskicon = 1;
 
+// Only display the disk icon if more then this much bytes have been read
+// during the previous tic.
+
+static const int diskicon_threshold = 20*1024;
+int diskicon_readbytes = 0;
+
 // if true, I_VideoBuffer is screen->pixels
 
 static boolean native_surface;
@@ -961,12 +967,16 @@
 
     if (show_diskicon && disk_indicator == disk_on)
     {
-	V_BeginRead();
+	if (diskicon_readbytes >= diskicon_threshold)
+	{
+	    V_BeginRead();
+	}
     }
     else if (disk_indicator == disk_dirty)
     {
 	disk_indicator = disk_off;
     }
+    diskicon_readbytes = 0;
 
     // draw to screen
 
--- a/src/i_video.h
+++ b/src/i_video.h
@@ -151,6 +151,8 @@
 extern int screen_bpp;
 extern int fullscreen;
 extern int aspect_ratio_correct;
+
 extern int show_diskicon;
+extern int diskicon_readbytes;
 
 #endif
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -26,7 +26,6 @@
 
 #include "doomtype.h"
 
-#include "d_loop.h" // gametic
 #include "i_swap.h"
 #include "i_system.h"
 #include "i_video.h"
@@ -341,32 +340,17 @@
 {
     int c;
     lumpinfo_t *l;
-    static int lasttic, readbytes;
 
-    // Only display the disk icon if more then this much bytes have been read
-    // during the previous tic.
-
-    const int threshold = 20*1024;
-
     if (lump >= numlumps)
     {
         I_Error ("W_ReadLump: %i >= numlumps", lump);
     }
 
-    if (gametic > lasttic)
-    {
-        lasttic = gametic;
-        readbytes = 0;
-    }
-
     l = lumpinfo[lump];
 
-    readbytes += l->size;
+    diskicon_readbytes += l->size;
 
-    if (readbytes >= threshold)
-    {
-        disk_indicator = disk_on;
-    }
+    disk_indicator = disk_on;
 
     c = W_Read(l->wad_file, l->position, dest, l->size);