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

This commit is contained in:
Fabian Greffrath 2015-11-02 13:48:32 +01:00
parent cb3520a3da
commit ff61aa8695
3 changed files with 15 additions and 19 deletions

View file

@ -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

View file

@ -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

View file

@ -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);