ref: 7510c7488be938826fc93630560ccd985c69545b
parent: 8d36576277fc6dfbf13663d7edbbf20dd7c15466
author: Fabian Greffrath <[email protected]>
date: Mon Sep 7 07:25:46 EDT 2015
condense checks for drawing disk icon and redrawing HUD into one variable
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -182,17 +182,10 @@
boolean done;
boolean wipe;
boolean redrawsbar;
- static boolean force_redrawsbar = false;
if (nodrawers)
return; // for comparative timing / profiling
- if (force_redrawsbar)
- {
- redrawsbar = true;
- force_redrawsbar = false;
- }
- else
redrawsbar = false;
// change the view size if needed
@@ -223,7 +216,7 @@
break;
if (automapactive)
AM_Drawer ();
- if (wipe || (viewheight != 200 && fullscreen) )
+ if (wipe || (viewheight != 200 && fullscreen) || disk_indicator == disk_dirty )
redrawsbar = true;
if (inhelpscreensstate && !inhelpscreens)
redrawsbar = true; // just put away the help screen
@@ -310,11 +303,6 @@
// normal update
if (!wipe)
{
- if (disk_indicator)
- {
- force_redrawsbar = true;
- }
-
I_FinishUpdate (); // page flip or blit buffer
return;
}
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -986,13 +986,17 @@
I_VideoBuffer[ (SCREENHEIGHT-1)*SCREENWIDTH + i] = 0x0;
}
- if (disk_indicator)
+ if (disk_indicator == disk_on)
{
I_BeginRead();
- disk_indicator = false;
+ disk_indicator = disk_dirty;
}
+ else if (disk_indicator == disk_dirty)
+ {
+ disk_indicator = disk_off;
+ }
- // draw to screen
+ // draw to screen
BlitArea(0, 0, SCREENWIDTH, SCREENHEIGHT);
--- a/src/strife/d_main.c
+++ b/src/strife/d_main.c
@@ -217,7 +217,6 @@
boolean done;
boolean wipe;
boolean redrawsbar;
- static boolean force_borderdraw = false;
if (nodrawers)
return; // for comparative timing / profiling
@@ -301,11 +300,10 @@
// see if the border needs to be updated to the screen
if (gamestate == GS_LEVEL && !automapactive && scaledviewwidth != 320)
{
- if (menuactive || menuactivestate || !viewactivestate || force_borderdraw)
+ if (menuactive || menuactivestate || !viewactivestate || disk_indicator == disk_dirty)
{
borderdrawcount = 3;
popupactivestate = false;
- force_borderdraw = false;
}
if (borderdrawcount)
{
@@ -360,11 +358,6 @@
// normal update
if (!wipe)
{
- if (disk_indicator)
- {
- force_borderdraw = true;
- }
-
I_FinishUpdate (); // page flip or blit buffer
return;
}
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -335,7 +335,7 @@
// Loads the lump into the given buffer,
// which must be >= W_LumpLength().
//
-boolean disk_indicator = false;
+disk_indicator_e disk_indicator = false;
void W_ReadLump(lumpindex_t lump, void *dest)
{
@@ -349,7 +349,7 @@
l = lumpinfo[lump];
- disk_indicator = true;
+ disk_indicator = disk_on;
c = W_Read(l->wad_file, l->position, dest, l->size);
--- a/src/w_wad.h
+++ b/src/w_wad.h
@@ -49,10 +49,17 @@
lumpindex_t next;
};
+typedef enum
+{
+ disk_off,
+ disk_on,
+ disk_dirty
+} disk_indicator_e;
+extern disk_indicator_e disk_indicator;
+
extern lumpinfo_t **lumpinfo;
extern unsigned int numlumps;
-extern boolean disk_indicator;
wad_file_t *W_AddFile(char *filename);
void W_Reload(void);