disk icon: Add a threshold for showing the disk icon

Only display the disk icon if more then the threshold of bytes
have been read during the previous tic.
This commit is contained in:
Fabian Greffrath 2015-11-02 11:25:54 +01:00
parent 5803fe8494
commit bba2a845a5

View file

@ -26,6 +26,7 @@
#include "doomtype.h"
#include "d_loop.h" // gametic
#include "i_swap.h"
#include "i_system.h"
#include "i_video.h"
@ -340,15 +341,32 @@ 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];
disk_indicator = disk_on;
readbytes += l->size;
if (readbytes >= threshold)
{
disk_indicator = disk_on;
}
c = W_Read(l->wad_file, l->position, dest, l->size);