Skip to content

Commit

Permalink
disk icon: Move check for accumulated read bytes to i_video.c
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiangreffrath committed Nov 2, 2015
1 parent cb3520a commit ff61aa8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
12 changes: 11 additions & 1 deletion src/i_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/i_video.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 2 additions & 18 deletions src/w_wad.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

#include "doomtype.h"

#include "d_loop.h" // gametic
#include "i_swap.h"
#include "i_system.h"
#include "i_video.h"
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit ff61aa8

Please sign in to comment.