shithub: choc

Download patch

ref: adc6a405ba0d2b77cf227184044186a84a971161
parent: 80ef754afea340ed4f06c780b3a025f23538db04
author: Simon Howard <[email protected]>
date: Thu Sep 25 15:31:14 EDT 2008

Make ENDOOM screen work on Heretic.

Subversion-branch: /branches/raven-branch
Subversion-revision: 1284

--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -132,7 +132,9 @@
 char		wadfile[1024];		// primary wad file
 char		mapdir[1024];           // directory of development maps
 
+int             show_endoom = 1;
 
+
 void D_CheckNetGame (void);
 void D_ProcessEvents (void);
 void G_BuildTiccmd (ticcmd_t* cmd);
@@ -359,6 +361,7 @@
     M_BindVariable("snd_channels",           &snd_channels);
     M_BindVariable("vanilla_savegame_limit", &vanilla_savegame_limit);
     M_BindVariable("vanilla_demo_limit",     &vanilla_demo_limit);
+    M_BindVariable("show_endoom",            &show_endoom);
 
     // Multiplayer chat macros
 
@@ -805,6 +808,25 @@
     }
 }
 
+// Function called at exit to display the ENDOOM screen
+
+static void D_Endoom(void)
+{
+    byte *endoom;
+
+    // Don't show ENDOOM if we have it disabled, or we're running
+    // in screensaver or control test mode.
+
+    if (!show_endoom || screensaver_mode || M_CheckParm("-testcontrols") > 0)
+    {
+        return;
+    }
+
+    endoom = W_CacheLumpName(DEH_String("ENDOOM"), PU_STATIC);
+
+    I_Endoom(endoom);
+}
+
 //
 // D_DoomMain
 //
@@ -813,6 +835,8 @@
     int             p;
     char            file[256];
     char            demolumpname[9];
+
+    I_AtExit(D_Endoom, false);
 
     M_FindResponseFile ();
 
--- a/src/heretic/d_main.c
+++ b/src/heretic/d_main.c
@@ -60,6 +60,8 @@
 
 FILE *debugfile;
 
+static int show_endoom = 1;
+
 void D_CheckNetGame(void);
 void D_ProcessEvents(void);
 void G_BuildTiccmd(ticcmd_t * cmd);
@@ -746,6 +748,7 @@
     M_BindVariable("music_volume",           &snd_MusicVolume);
     M_BindVariable("screenblocks",           &screenblocks);
     M_BindVariable("snd_channels",           &snd_Channels);
+    M_BindVariable("show_endoom",            &show_endoom);
 
     for (i=0; i<10; ++i)
     {
@@ -756,6 +759,26 @@
     }
 }
 
+// 
+// Called at exit to display the ENDOOM screen (ENDTEXT in Heretic)
+//
+
+static void D_Endoom(void)
+{
+    byte *endoom_data;
+
+    // Disable ENDOOM?
+
+    if (!show_endoom)
+    {
+        return;
+    }
+
+    endoom_data = W_CacheLumpName("ENDTEXT", PU_STATIC);
+
+    I_Endoom(endoom_data);
+}
+
 //---------------------------------------------------------------------------
 //
 // PROC D_DoomMain
@@ -771,7 +794,8 @@
     char file[256];
     FILE *fp;
     boolean devMap;
-    //char *screen;
+
+    I_AtExit(D_Endoom, false);
 
     M_FindResponseFile();
     setbuf(stdout, NULL);
--- a/src/i_system.c
+++ b/src/i_system.c
@@ -55,7 +55,6 @@
 #include "z_zone.h"
 
 int mb_used = 16;
-int show_endoom = 1;
 
 typedef struct atexit_listentry_s atexit_listentry_t;
 
@@ -150,13 +149,10 @@
 // Displays the text mode ending screen after the game quits
 //
 
-void I_Endoom(void)
+void I_Endoom(byte *endoom_data)
 {
-    unsigned char *endoom_data;
     unsigned char *screendata;
 
-    endoom_data = W_CacheLumpName(DEH_String("ENDOOM"), PU_STATIC);
-
     // Set up text mode screen
 
     TXT_Init();
@@ -208,24 +204,6 @@
         entry = entry->next;
     }
 
-/*
-    D_QuitNetGame ();
-    G_CheckDemoStatus();
-    S_Shutdown();
-
-    if (!screensaver_mode)
-    {
-        M_SaveDefaults ();
-    }
-
-    I_ShutdownGraphics();
-    */
-
-    if (show_endoom && !screensaver_mode && !M_CheckParm("-testcontrols"))
-    {
-        I_Endoom();
-    }
-
     exit(0);
 }
 
@@ -313,7 +291,5 @@
     I_BindVideoVariables();
     I_BindJoystickVariables();
     I_BindSoundVariables();
-
-    M_BindVariable("show_endoom", &show_endoom);
 }
 
--- a/src/i_system.h
+++ b/src/i_system.h
@@ -80,5 +80,10 @@
 
 void I_BindVariables(void);
 
+// Display the Endoom screen on shutdown.  Pass a pointer to the 
+// ENDOOM lump.
+
+void I_Endoom(byte *data);
+
 #endif