From ff61aa8695321e21b349583b4b43f19084d870c4 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Mon, 2 Nov 2015 13:48:32 +0100 Subject: [PATCH] disk icon: Move check for accumulated read bytes to i_video.c --- src/i_video.c | 12 +++++++++++- src/i_video.h | 2 ++ src/w_wad.c | 20 ++------------------ 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/i_video.c b/src/i_video.c index 91b6a7f9..17d28897 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -175,6 +175,12 @@ int png_screenshots = 0; 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 @@ void I_FinishUpdate (void) 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 diff --git a/src/i_video.h b/src/i_video.h index 46144d2b..0663796e 100644 --- a/src/i_video.h +++ b/src/i_video.h @@ -151,6 +151,8 @@ extern int screen_height; extern int screen_bpp; extern int fullscreen; extern int aspect_ratio_correct; + extern int show_diskicon; +extern int diskicon_readbytes; #endif diff --git a/src/w_wad.c b/src/w_wad.c index a01ef952..c26fb0f7 100644 --- 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 @@ void W_ReadLump(lumpindex_t lump, void *dest) { 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);