foxygit / doom Log in
commit 013dc015d160e5090579f75f4b8a9b3d5acb7b52
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Sat Sep 27 02:15:33 2008 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Sat Sep 27 02:15:33 2008 +0000

    Split out startup banner code into common code; display copyright notice
    in Heretic.

    Subversion-branch: /branches/raven-branch
    Subversion-revision: 1295
---
 src/doom/d_main.c    | 32 +++-----------------------------
 src/heretic/d_main.c |  4 ++++
 src/i_system.c       | 52 ++++++++++++++++++++++++++++++++++++++++------------
 src/i_system.h       | 12 ++++++++++++
 4 files changed, 59 insertions(+), 41 deletions(-)

diff --git a/src/doom/d_main.c b/src/doom/d_main.c
index 67d4489d..3bc5bfe7 100644
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -602,18 +602,6 @@ static boolean D_AddFile(char *filename)

     return handle != NULL;
 }
-// Startup banner
-
-void PrintBanner(char *msg)
-{
-    int i;
-    int spaces = 35 - (strlen(msg) / 2);
-
-    for (i=0; i<spaces; ++i)
-        putchar(' ');
-
-    puts(msg);
-}

 // Copyright message banners
 // Some dehacked mods replace these.  These are only displayed if they are
@@ -850,7 +838,7 @@ void D_DoomMain (void)

     // print banner

-    PrintBanner(PACKAGE_STRING);
+    I_PrintBanner(PACKAGE_STRING);

     printf (DEH_String("Z_Init: Init zone memory allocation daemon. \n"));
     Z_Init ();
@@ -1457,27 +1445,13 @@ void D_DoomMain (void)
     if (W_CheckNumForName("SS_START") >= 0
      || W_CheckNumForName("FF_END") >= 0)
     {
-        printf ("===========================================================================\n");
+        I_PrintDivider();
         printf(" WARNING: The loaded WAD file contains modified sprites or\n"
                " floor textures.  You may want to use the '-merge' command\n"
                " line option instead of '-file'.\n");
     }
-
-    printf ("===========================================================================\n");
-
-    PrintBanner(gamedescription);
-
-
-    printf (
-	    "===========================================================================\n"
-	    " " PACKAGE_NAME " is free software, covered by the GNU General Public\n"
-            " License.  There is NO warranty; not even for MERCHANTABILITY or FITNESS\n"
-            " FOR A PARTICULAR PURPOSE. You are welcome to change and distribute\n"
-            " copies under certain conditions. See the source for more information.\n"
-
-	    "===========================================================================\n"
-	);

+    I_PrintStartupBanner(gamedescription);
     PrintDehackedBanners();

     printf (DEH_String("M_Init: Init miscellaneous info.\n"));
diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c
index 3f96a867..8c7a14d0 100644
--- a/src/heretic/d_main.c
+++ b/src/heretic/d_main.c
@@ -797,6 +797,8 @@ void D_DoomMain(void)
     FILE *fp;
     boolean devMap;

+    I_PrintBanner(PACKAGE_STRING);
+
     I_AtExit(D_Endoom, false);

     M_FindResponseFile();
@@ -949,6 +951,8 @@ void D_DoomMain(void)
         gamedescription = "Heretic (registered)";
     }

+    I_PrintStartupBanner(gamedescription);
+
 #ifdef __WATCOMC__
     I_StartupKeyboard();
     I_StartupJoystick();
diff --git a/src/i_system.c b/src/i_system.c
index 034d831a..77c06436 100644
--- a/src/i_system.c
+++ b/src/i_system.c
@@ -38,6 +38,8 @@
 #include <unistd.h>
 #endif

+#include "config.h"
+
 #include "deh_str.h"
 #include "doomtype.h"
 #include "m_argv.h"
@@ -119,6 +121,44 @@ byte *I_ZoneBase (int *size)
     return zonemem;
 }

+void I_PrintBanner(char *msg)
+{
+    int i;
+    int spaces = 35 - (strlen(msg) / 2);
+
+    for (i=0; i<spaces; ++i)
+        putchar(' ');
+
+    puts(msg);
+}
+
+void I_PrintDivider(void)
+{
+    int i;
+
+    for (i=0; i<75; ++i)
+    {
+        putchar('=');
+    }
+
+    putchar('\n');
+}
+
+void I_PrintStartupBanner(char *gamedescription)
+{
+    I_PrintDivider();
+    I_PrintBanner(gamedescription);
+    I_PrintDivider();
+
+    printf(
+    " " PACKAGE_NAME " is free software, covered by the GNU General Public\n"
+    " License.  There is NO warranty; not even for MERCHANTABILITY or FITNESS\n"
+    " FOR A PARTICULAR PURPOSE. You are welcome to change and distribute\n"
+    " copies under certain conditions. See the source for more information.\n");
+
+    I_PrintDivider();
+}
+
 //
 // I_ConsoleStdout
 //
@@ -215,7 +255,6 @@ void I_WaitVBL(int count)
 //
 // I_Error
 //
-extern boolean demorecording;

 static boolean already_quitting = false;

@@ -256,17 +295,6 @@ void I_Error (char *error, ...)
         entry = entry->next;
     }

-  /*
-    if (demorecording)
-    {
-	G_CheckDemoStatus();
-    }
-
-    D_QuitNetGame ();
-    I_ShutdownGraphics();
-    S_Shutdown();
-    */
-
 #ifdef _WIN32
     // On Windows, pop up a dialog box with the error message.
     {
diff --git a/src/i_system.h b/src/i_system.h
index 000c6025..2af3aa33 100644
--- a/src/i_system.h
+++ b/src/i_system.h
@@ -85,5 +85,17 @@ void I_BindVariables(void);

 void I_Endoom(byte *data);

+// Print startup banner copyright message.
+
+void I_PrintStartupBanner(char *gamedescription);
+
+// Print a centered text banner displaying the given string.
+
+void I_PrintBanner(char *text);
+
+// Print a dividing line for startup banners.
+
+void I_PrintDivider(void);
+
 #endif