From adc6a405ba0d2b77cf227184044186a84a971161 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 25 Sep 2008 19:31:14 +0000 Subject: Make ENDOOM screen work on Heretic. Subversion-branch: /branches/raven-branch Subversion-revision: 1284 --- src/doom/d_main.c | 24 ++++++++++++++++++++++++ src/heretic/d_main.c | 26 +++++++++++++++++++++++++- src/i_system.c | 26 +------------------------- src/i_system.h | 5 +++++ 4 files changed, 55 insertions(+), 26 deletions(-) diff --git a/src/doom/d_main.c b/src/doom/d_main.c index a6f85f07..2da2efa8 100644 --- a/src/doom/d_main.c +++ b/src/doom/d_main.c @@ -132,6 +132,8 @@ boolean storedemo; 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); @@ -359,6 +361,7 @@ void D_BindVariables(void) 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 @@ static void LoadChexDeh(void) } } +// 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 // @@ -814,6 +836,8 @@ void D_DoomMain (void) char file[256]; char demolumpname[9]; + I_AtExit(D_Endoom, false); + M_FindResponseFile (); // Undocumented "search for IWADs" parameter used by the setup diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c index 94d51851..54d51238 100644 --- a/src/heretic/d_main.c +++ b/src/heretic/d_main.c @@ -60,6 +60,8 @@ boolean advancedemo; 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 @@ void D_BindVariables(void) 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 @@ void D_BindVariables(void) } } +// +// 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 @@ void D_DoomMain(void) char file[256]; FILE *fp; boolean devMap; - //char *screen; + + I_AtExit(D_Endoom, false); M_FindResponseFile(); setbuf(stdout, NULL); diff --git a/src/i_system.c b/src/i_system.c index 7cfc23a8..034d831a 100644 --- 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 @@ void I_Init (void) // 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 @@ void I_Quit (void) 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 @@ void I_BindVariables(void) I_BindVideoVariables(); I_BindJoystickVariables(); I_BindSoundVariables(); - - M_BindVariable("show_endoom", &show_endoom); } diff --git a/src/i_system.h b/src/i_system.h index 482ee669..000c6025 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -80,5 +80,10 @@ void I_AtExit(atexit_func_t func, boolean run_if_error); void I_BindVariables(void); +// Display the Endoom screen on shutdown. Pass a pointer to the +// ENDOOM lump. + +void I_Endoom(byte *data); + #endif -- cgit v1.2.3