summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2008-02-09 22:31:02 +0000
committerSimon Howard2008-02-09 22:31:02 +0000
commit9e165649eb624ece3a0509841016d5e5c3eb2ddf (patch)
tree0fde9ee0dbc83116f2ebdcec838d106f1cb63b53 /src
parent7577bb4156c0a75528a2901cf086c9c547467484 (diff)
downloadchocolate-doom-9e165649eb624ece3a0509841016d5e5c3eb2ddf.tar.gz
chocolate-doom-9e165649eb624ece3a0509841016d5e5c3eb2ddf.tar.bz2
chocolate-doom-9e165649eb624ece3a0509841016d5e5c3eb2ddf.zip
Fix up the R_Main startup progress dots. If stdout is a file, don't
display the surrounding box. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1069
Diffstat (limited to 'src')
-rw-r--r--src/i_system.c15
-rw-r--r--src/i_system.h3
-rw-r--r--src/r_data.c21
3 files changed, 32 insertions, 7 deletions
diff --git a/src/i_system.c b/src/i_system.c
index 7a01362f..5273a2f9 100644
--- a/src/i_system.c
+++ b/src/i_system.c
@@ -99,6 +99,21 @@ byte *I_ZoneBase (int *size)
return zonemem;
}
+//
+// I_ConsoleStdout
+//
+// Returns true if stdout is a real console, false if it is a file
+//
+
+boolean I_ConsoleStdout(void)
+{
+#ifdef _WIN32
+ // SDL "helpfully" always redirects stdout to a file.
+ return 0;
+#else
+ return isatty(fileno(stdout));
+#endif
+}
//
// I_Init
diff --git a/src/i_system.h b/src/i_system.h
index 71729357..a5e06a50 100644
--- a/src/i_system.h
+++ b/src/i_system.h
@@ -41,6 +41,8 @@ void I_Init (void);
// for the zone management.
byte* I_ZoneBase (int *size);
+boolean I_ConsoleStdout(void);
+
// Called by D_DoomLoop,
// called before processing any tics in a frame
@@ -86,3 +88,4 @@ void I_Error (char *error, ...);
#endif
+
diff --git a/src/r_data.c b/src/r_data.c
index 0f792d8e..2b11d82c 100644
--- a/src/r_data.c
+++ b/src/r_data.c
@@ -529,13 +529,20 @@ void R_InitTextures (void)
temp1 = W_GetNumForName (DEH_String("S_START")); // P_???????
temp2 = W_GetNumForName (DEH_String("S_END")) - 1;
temp3 = ((temp2-temp1+63)/64) + ((numtextures+63)/64);
- printf("[");
- for (i = 0; i < temp3; i++)
- printf(" ");
- printf(" ]");
- for (i = 0; i < temp3; i++)
- printf("\x8");
- printf("\x8\x8\x8\x8\x8\x8\x8\x8\x8\x8");
+
+ // If stdout is a real console, use the classic vanilla "filling
+ // up the box" effect, which uses backspace to "step back" inside
+ // the box. If stdout is a file, don't draw the box.
+
+ if (I_ConsoleStdout())
+ {
+ printf("[");
+ for (i = 0; i < temp3 + 9; i++)
+ printf(" ");
+ printf("]");
+ for (i = 0; i < temp3 + 10; i++)
+ printf("\b");
+ }
for (i=0 ; i<numtextures ; i++, directory++)
{